Skip to content

Commit 681562c

Browse files
paulusmackagraf
authored andcommitted
KVM: PPC: Book3S PR: Invalidate SLB entries properly
At present, if the guest creates a valid SLB (segment lookaside buffer) entry with the slbmte instruction, then invalidates it with the slbie instruction, then reads the entry with the slbmfee/slbmfev instructions, the result of the slbmfee will have the valid bit set, even though the entry is not actually considered valid by the host. This is confusing, if not worse. This fixes it by zeroing out the orige and origv fields of the SLB entry structure when the entry is invalidated. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
1 parent 0f29682 commit 681562c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎arch/powerpc/kvm/book3s_64_mmu.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ static void kvmppc_mmu_book3s_64_slbie(struct kvm_vcpu *vcpu, u64 ea)
397397
dprintk("KVM MMU: slbie(0x%llx, 0x%llx)\n", ea, slbe->esid);
398398

399399
slbe->valid = false;
400+
slbe->orige = 0;
401+
slbe->origv = 0;
400402

401403
seg_size = 1ull << kvmppc_slb_sid_shift(slbe);
402404
kvmppc_mmu_flush_segment(vcpu, ea & ~(seg_size - 1), seg_size);
@@ -408,8 +410,11 @@ static void kvmppc_mmu_book3s_64_slbia(struct kvm_vcpu *vcpu)
408410

409411
dprintk("KVM MMU: slbia()\n");
410412

411-
for (i = 1; i < vcpu->arch.slb_nr; i++)
413+
for (i = 1; i < vcpu->arch.slb_nr; i++) {
412414
vcpu->arch.slb[i].valid = false;
415+
vcpu->arch.slb[i].orige = 0;
416+
vcpu->arch.slb[i].origv = 0;
417+
}
413418

414419
if (vcpu->arch.shared->msr & MSR_IR) {
415420
kvmppc_mmu_flush_segments(vcpu);

0 commit comments

Comments
 (0)