linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: agraf@suse.de, benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64
Date: Mon, 30 Dec 2013 11:34:29 +0530	[thread overview]
Message-ID: <1388383469-6411-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

Although it's optional IBM POWER cpus always had DAR value set on
alignment interrupt. So don't try to compute these values.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_emulate.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 502a47ac4453..d8e2d079483d 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -599,6 +599,19 @@ unprivileged:
 
 u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst)
 {
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dsisr;
+#else
+	/*
+	 * Mac OS X has some applications - namely the Finder - that require
+	 * alignment interrupts to work properly. So we need to implement them.
+
+	 * But the spec for 970 and 750 also looks different. While 750 requires
+	 * the DSISR and DAR fields to reflect some instruction bits (DSISR) and
+	 * the fault address (DAR), the 970 declares this as an optional feature.
+	 * So we need to reconstruct DSISR and DAR manually.
+	 */
+
 	u32 dsisr = 0;
 
 	/*
@@ -637,10 +650,24 @@ u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst)
 	dsisr |= (inst >> 16) & 0x03ff; /* bits 22:31 */
 
 	return dsisr;
+#endif
 }
 
 ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
 {
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;
+#else
+	/*
+	 * Mac OS X has some applications - namely the Finder - that require
+	 * alignment interrupts to work properly. So we need to implement them.
+
+	 * But the spec for 970 and 750 also looks different. While 750 requires
+	 * the DSISR and DAR fields to reflect some instruction bits (DSISR) and
+	 * the fault address (DAR), the 970 declares this as an optional feature.
+	 * So we need to reconstruct DSISR and DAR manually.
+	 */
+
 	ulong dar = 0;
 	ulong ra = get_ra(inst);
 	ulong rb = get_rb(inst);
@@ -665,4 +692,5 @@ ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
 	}
 
 	return dar;
+#endif
 }
-- 
1.8.3.2

             reply	other threads:[~2013-12-30  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30  6:04 Aneesh Kumar K.V [this message]
2013-12-30  9:12 ` [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64 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=1388383469-6411-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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).