Thread (75 messages) 75 messages, 6 authors, 2012-10-08

Re: [Qemu-ppc] [RFC PATCH 04/17] KVM: PPC64: booke: Add guest computation mode for irq delivery

flat view

From: Alexander Graf <hidden>
Date: 2012-07-04 13:40:41
Also in: kvm

On 25.06.2012, at 14:26, Mihai Caraman wrote:
When delivering guest IRQs, update MSR computaion
computation
quoted hunk ↗ jump to hunk
mode according to guest
interrupt computation mode found in EPCR.
=20
Signed-off-by: Mihai Caraman <redacted>
---
arch/powerpc/kvm/booke.c |    8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
=20
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d15c4b5..93b48e0 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -287,6 +287,7 @@ static int kvmppc_booke_irqprio_deliver(struct =
kvm_vcpu *vcpu,
quoted hunk ↗ jump to hunk
	bool crit;
	bool keep_irq =3D false;
	enum int_class int_class;
+	ulong msr_cm =3D 0;
=20
	/* Truncate crit indicators in 32 bit mode */
	if (!(vcpu->arch.shared->msr & MSR_SF)) {
@@ -299,6 +300,10 @@ static int kvmppc_booke_irqprio_deliver(struct =
kvm_vcpu *vcpu,
	/* ... and we're in supervisor mode */
	crit =3D crit && !(vcpu->arch.shared->msr & MSR_PR);
=20
+#ifdef CONFIG_64BIT
+	msr_cm =3D vcpu->arch.epcr & SPRN_EPCR_ICM ? MSR_CM : 0;
+#endif
No need for the ifdef, no?. Just mask EPCR_ICM out in the 32-bit host =
case, then this check is always false on 32-bit hosts.
quoted hunk ↗ jump to hunk
+
	if (priority =3D=3D BOOKE_IRQPRIO_EXTERNAL_LEVEL) {
		priority =3D BOOKE_IRQPRIO_EXTERNAL;
		keep_irq =3D true;
@@ -381,7 +386,8 @@ static int kvmppc_booke_irqprio_deliver(struct =
kvm_vcpu *vcpu,
			set_guest_esr(vcpu, vcpu->arch.queued_esr);
		if (update_dear =3D=3D true)
			set_guest_dear(vcpu, vcpu->arch.queued_dear);
-		kvmppc_set_msr(vcpu, vcpu->arch.shared->msr & msr_mask);
+		kvmppc_set_msr(vcpu, (vcpu->arch.shared->msr & msr_mask)
+				| msr_cm);
Please split this computation out into its own variable and apply the =
masking regardless. Something like

ulong new_msr =3D vcpu->arch.shared->msr;
if (vcpu->arch.epcr & SPRN_EPCR_ICM)
    new_msr |=3D MSR_CM;
new_msr &=3D msr_mask;
kvmppc_set_msr(vcpu, new_msr);

Alex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help