Skip to contentSkip to conversation

kvm/e500: Fix the bug that mas0 update to wrong value when read TLB entry

PATCH In review Liu Yu 1 participant 2 messages Mar 16, 2009

Subsystems (2)
lore
Share & tools
lore

Liu Yu

author
#0 lore raw

PATCH 1/1 kvm/e500: Fix the bug that mas0 update to wrong value when read TLB entry

Should clear and then update the next victim area here.

Host only read TLB1 when startup kernel,
this bug result in a extra 4k TLB1 mapping in guest from 0x0 to 0x0.

As the problem has no impact to bootup a guest so far. we didn't find it before.

---
 arch/powerpc/kvm/e500_tlb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kvm/e500_tlb.c +1 -1
index 72386dd..4d6ecbd 100644
@@ -448,7 +448,7 @@ int kvmppc_e500_emul_tlbre(struct kvm_vcpu *vcpu)
 	esel = get_tlb_esel(vcpu_e500, tlbsel);
 
 	gtlbe = &vcpu_e500->guest_tlb[tlbsel][esel];
-	vcpu_e500->mas0 &= MAS0_NV(0);
+	vcpu_e500->mas0 &= ~MAS0_NV(0);
 	vcpu_e500->mas0 |= MAS0_NV(vcpu_e500->guest_tlb_nv[tlbsel]);
 	vcpu_e500->mas1 = gtlbe->mas1;
 	vcpu_e500->mas2 = gtlbe->mas2;
Signature · 1 line
1.5.4
#1 lore raw
Quoted 12 lines
---
 arch/powerpc/kvm/e500_tlb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kvm/e500_tlb.c +0 -0
index 72386dd..4d6ecbd 100644

arch/powerpc/kvm/e500_tlb.c int kvmppc_e500_emul_tlbre(struct kvm_vcpu *vcpu) · line 451

Quoted 5 lines
arch/powerpc/kvm/e500_tlb.c +1 -1
@@ -448,7 +448,7 @@ int kvmppc_e500_emul_tlbre(struct kvm_vcpu *vcpu)
 	esel = get_tlb_esel(vcpu_e500, tlbsel);
 
 	gtlbe = &vcpu_e500->guest_tlb[tlbsel][esel];
-	vcpu_e500->mas0 &= MAS0_NV(0);
+	vcpu_e500->mas0 &= ~MAS0_NV(0);

Oops...
This should be
vcpu_e500->mas0 &= ~MAS0_NV(~0);