Skip to contentSkip to conversation

KVM: PPC: Assorted 440 fixes

PATCH New Alexander Graf 1 participant 3 messages Aug 13, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover KVM: PPC: Assorted 440 fixes

With these patches, I get at least shortly into a KVM guest on 440. It fails for me later on, but I'm quite sure that's an orthogonal issue.

Alexander Graf (2):
KVM: PPC: 44x: Initialize PVR
KVM: PPC: BookE: Add MCSR SPR support

 arch/powerpc/kvm/44x.c           |    1 +
 arch/powerpc/kvm/booke_emulate.c |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
#1 lore raw

PATCH 1/2 KVM: PPC: 44x: Initialize PVR

We need to make sure that vcpu->arch.pvr is initialized to a sane value, so let's just take the host PVR.

---
 arch/powerpc/kvm/44x.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/kvm/44x.c +1 -0
index 50e7dbc..3d7fd21 100644
@@ -83,6 +83,7 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
 		vcpu_44x->shadow_refs[i].gtlb_index = -1;
 
 	vcpu->arch.cpu_type = KVM_CPU_440;
+	vcpu->arch.pvr = mfspr(SPRN_PVR);
 
 	return 0;
 }
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 2/2 KVM: PPC: BookE: Add MCSR SPR support

In reply to Alexander Graf

Add support for the MCSR SPR. This only implements the SPR storage bits, not actual machine checks.

---
 arch/powerpc/kvm/booke_emulate.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/powerpc/kvm/booke_emulate.c +6 -0
index cc99a0b..514790f 100644
@@ -237,6 +237,9 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
 	case SPRN_IVOR15:
 		vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG] = spr_val;
 		break;
+	case SPRN_MCSR:
+		vcpu->arch.mcsr &= ~spr_val;
+		break;
 
 	default:
 		emulated = EMULATE_FAIL;
@@ -329,6 +332,9 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
 	case SPRN_IVOR15:
 		*spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG];
 		break;
+	case SPRN_MCSR:
+		*spr_val = vcpu->arch.mcsr;
+		break;
 
 	default:
 		emulated = EMULATE_FAIL;
Signature · 1 line
1.6.0.2