* [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64
@ 2013-12-30 6:04 Aneesh Kumar K.V
2013-12-30 9:12 ` Alexander Graf
0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2013-12-30 6:04 UTC (permalink / raw)
To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc, Aneesh Kumar K.V
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64
2013-12-30 6:04 [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64 Aneesh Kumar K.V
@ 2013-12-30 9:12 ` Alexander Graf
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2013-12-30 9:12 UTC (permalink / raw)
To: Aneesh Kumar K.V
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, paulus@samba.org,
Aneesh Kumar K.V, linuxppc-dev@lists.ozlabs.org
> Am 30.12.2013 um 07:04 schrieb "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet=
.ibm.com>:
>=20
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>=20
> Although it's optional IBM POWER cpus always had DAR value set on
> alignment interrupt. So don't try to compute these values.
>=20
> 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(+)
>=20
> diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_e=
mulate.c
> index 502a47ac4453..d8e2d079483d 100644
> --- a/arch/powerpc/kvm/book3s_emulate.c
> +++ b/arch/powerpc/kvm/book3s_emulate.c
> @@ -599,6 +599,19 @@ unprivileged:
>=20
> u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst)
> {
> +#ifdef CONFIG_PPC_BOOK3S_64
> + return vcpu->arch.fault_dsisr;
This is still wrong when you virtualize a 750 on a 970 for example.
Alex
> +#else
> + /*
> + * Mac OS X has some applications - namely the Finder - that require
> + * alignment interrupts to work properly. So we need to implement the=
m.
> +
> + * But the spec for 970 and 750 also looks different. While 750 requi=
res
> + * the DSISR and DAR fields to reflect some instruction bits (DSISR) a=
nd
> + * the fault address (DAR), the 970 declares this as an optional feat=
ure.
> + * So we need to reconstruct DSISR and DAR manually.
> + */
> +
> u32 dsisr =3D 0;
>=20
> /*
> @@ -637,10 +650,24 @@ u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, un=
signed int inst)
> dsisr |=3D (inst >> 16) & 0x03ff; /* bits 22:31 */
>=20
> return dsisr;
> +#endif
> }
>=20
> 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 the=
m.
> +
> + * But the spec for 970 and 750 also looks different. While 750 requi=
res
> + * the DSISR and DAR fields to reflect some instruction bits (DSISR) a=
nd
> + * the fault address (DAR), the 970 declares this as an optional feat=
ure.
> + * So we need to reconstruct DSISR and DAR manually.
> + */
> +
> ulong dar =3D 0;
> ulong ra =3D get_ra(inst);
> ulong rb =3D get_rb(inst);
> @@ -665,4 +692,5 @@ ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsi=
gned int inst)
> }
>=20
> return dar;
> +#endif
> }
> --=20
> 1.8.3.2
>=20
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-30 9:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-30 6:04 [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64 Aneesh Kumar K.V
2013-12-30 9:12 ` Alexander Graf
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).