|
@@ -503,10 +503,18 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
|
|
|
break;
|
|
|
unprivileged:
|
|
|
default:
|
|
|
- printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn);
|
|
|
-#ifndef DEBUG_SPR
|
|
|
- emulated = EMULATE_FAIL;
|
|
|
-#endif
|
|
|
+ pr_info_ratelimited("KVM: invalid SPR write: %d\n", sprn);
|
|
|
+ if (sprn & 0x10) {
|
|
|
+ if (kvmppc_get_msr(vcpu) & MSR_PR) {
|
|
|
+ kvmppc_core_queue_program(vcpu, SRR1_PROGPRIV);
|
|
|
+ emulated = EMULATE_AGAIN;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ((kvmppc_get_msr(vcpu) & MSR_PR) || sprn == 0) {
|
|
|
+ kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
|
|
|
+ emulated = EMULATE_AGAIN;
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -648,10 +656,20 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
|
|
|
break;
|
|
|
default:
|
|
|
unprivileged:
|
|
|
- printk(KERN_INFO "KVM: invalid SPR read: %d\n", sprn);
|
|
|
-#ifndef DEBUG_SPR
|
|
|
- emulated = EMULATE_FAIL;
|
|
|
-#endif
|
|
|
+ pr_info_ratelimited("KVM: invalid SPR read: %d\n", sprn);
|
|
|
+ if (sprn & 0x10) {
|
|
|
+ if (kvmppc_get_msr(vcpu) & MSR_PR) {
|
|
|
+ kvmppc_core_queue_program(vcpu, SRR1_PROGPRIV);
|
|
|
+ emulated = EMULATE_AGAIN;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ((kvmppc_get_msr(vcpu) & MSR_PR) || sprn == 0 ||
|
|
|
+ sprn == 4 || sprn == 5 || sprn == 6) {
|
|
|
+ kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
|
|
|
+ emulated = EMULATE_AGAIN;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
|