linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Mihai Caraman <mihai.caraman@freescale.com>
To: <kvm-ppc@vger.kernel.org>
Cc: Mihai Caraman <mihai.caraman@freescale.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org
Subject: [PATCH 06/12] KVM: PPC: Mask ea's high 32-bits in 32/64 instr emulation
Date: Thu, 11 Oct 2012 19:13:23 +0300	[thread overview]
Message-ID: <1349972009-23027-7-git-send-email-mihai.caraman@freescale.com> (raw)
In-Reply-To: <1349972009-23027-1-git-send-email-mihai.caraman@freescale.com>

Mask high 32 bits of effective address in emulation layer for guests running
in 32-bit mode.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
v1: added BOOK3S implementation.

 arch/powerpc/include/asm/kvm_ppc.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index a08e756..4a3fdbd 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -296,11 +296,21 @@ static inline void kvmppc_lazy_ee_enable(void)
 static inline ulong kvmppc_get_ea_indexed(struct kvm_vcpu *vcpu, int ra, int rb)
 {
 	ulong ea;
+	ulong msr_64bit = 0;
 
 	ea = kvmppc_get_gpr(vcpu, rb);
 	if (ra)
 		ea += kvmppc_get_gpr(vcpu, ra);
 
+#if defined(CONFIG_PPC_BOOK3E_64)
+	msr_64bit = MSR_CM;
+#elif defined(CONFIG_PPC_BOOK3S_64)
+	msr_64bit = MSR_SF;
+#endif
+
+	if (!(vcpu->arch.shared->msr & msr_64bit))
+	    ea = (uint32_t)ea;
+
 	return ea;
 }
 
-- 
1.7.4.1

  parent reply	other threads:[~2012-10-11 16:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 16:13 [PATCH 00/12] KVM: PPC: 64-bit Book3E arch support Mihai Caraman
2012-10-11 16:13 ` [PATCH 01/12] KVM: PPC: e500: Silence bogus GCC warning in tlb code Mihai Caraman
2012-10-11 16:13 ` [PATCH 02/12] KVM: PPC: booke: Fix get_tb() compile error on 64-bit Mihai Caraman
2012-10-11 16:13 ` [PATCH 03/12] KVM: PPC: bookehv: Remove GET_VCPU macro from exception handler Mihai Caraman
2012-10-11 16:13 ` [PATCH 04/12] KVM: PPC64: bookehv: Add support for interrupt handling Mihai Caraman
2012-10-11 16:13 ` [PATCH 05/12] KVM: PPC: e500: Add emulation helper for getting instruction ea Mihai Caraman
2012-12-01 13:28   ` Alexander Graf
2012-12-01 13:32     ` Alexander Graf
2012-10-11 16:13 ` Mihai Caraman [this message]
2012-10-11 16:13 ` [PATCH 07/12] KVM: PPC: e500: Mask MAS2 EPN high 32-bits in 32/64 tlbwe emulation Mihai Caraman
2012-10-11 16:13 ` [PATCH 08/12] KVM: PPC: booke: Extend MAS2 EPN mask for 64-bit Mihai Caraman
2012-10-11 16:13 ` [PATCH 09/12] KVM: PPC: bookehv: Add guest computation mode for irq delivery Mihai Caraman
2012-12-01 13:42   ` Alexander Graf
2012-10-11 16:13 ` [PATCH 10/12] KVM: PPC: bookehv: Add EPCR support in mtspr/mfspr emulation Mihai Caraman
2012-12-01 13:59   ` Alexander Graf
2012-10-11 16:13 ` [PATCH 11/12] KVM: PPC: booke: Add EPCR support in sregs Mihai Caraman
2012-12-01 14:02   ` Alexander Graf
2012-10-11 16:13 ` [PATCH 12/12] KVM: PPC: booke: Get/set guest EPCR register using ONE_REG interface Mihai Caraman
2012-12-01 14:15   ` Alexander Graf
2012-12-01 15:06 ` [PATCH 00/12] KVM: PPC: 64-bit Book3E arch support Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349972009-23027-7-git-send-email-mihai.caraman@freescale.com \
    --to=mihai.caraman@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).