Patchwork [23/28] KVM: PPC: e500: Mask MAS2 EPN high 32-bits in 32/64 tlbwe emulation

login
register
mail settings
Submitter Alexander Graf
Date Dec. 6, 2012, 12:41 a.m.
Message ID <1354754477-15472-24-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/204053/
State New
Headers show

Comments

Alexander Graf - Dec. 6, 2012, 12:41 a.m.
From: Mihai Caraman <mihai.caraman@freescale.com>

Mask high 32 bits of MAS2's effective page number in tlbwe emulation for guests
running in 32-bit mode.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/e500_tlb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index 7a14721..cf3f180 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -871,6 +871,8 @@  int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
 
 	gtlbe->mas1 = vcpu->arch.shared->mas1;
 	gtlbe->mas2 = vcpu->arch.shared->mas2;
+	if (!(vcpu->arch.shared->msr & MSR_CM))
+		gtlbe->mas2 &= 0xffffffffUL;
 	gtlbe->mas7_3 = vcpu->arch.shared->mas7_3;
 
 	trace_kvm_booke206_gtlb_write(vcpu->arch.shared->mas0, gtlbe->mas1,