KVM: PPC: BOOKE : Emulate rfdi instruction
authorBharat Bhushan <Bharat.Bhushan@freescale.com>
Wed, 6 Aug 2014 06:38:52 +0000 (12:08 +0530)
committerAlexander Graf <agraf@suse.de>
Mon, 22 Sep 2014 08:11:29 +0000 (10:11 +0200)
This patch adds "rfdi" instruction emulation which is required for
guest debug hander on BOOKE-HV

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/booke_emulate.c

index 6040008823522f1bfe7d93b92dcea4626685322c..8a8da0acfd282f0e85878d5902eee30a6a7f8a8a 100644 (file)
@@ -139,6 +139,7 @@ enum kvm_exit_types {
        EMULATED_TLBWE_EXITS,
        EMULATED_RFI_EXITS,
        EMULATED_RFCI_EXITS,
+       EMULATED_RFDI_EXITS,
        DEC_EXITS,
        EXT_INTR_EXITS,
        HALT_WAKEUP,
index 28c158881d23f7f87daf87e7c2ce8731775d5630..4b9a079927539ed1940334ba2b3a46ee8a2c226d 100644 (file)
@@ -25,6 +25,7 @@
 
 #define OP_19_XOP_RFI     50
 #define OP_19_XOP_RFCI    51
+#define OP_19_XOP_RFDI    39
 
 #define OP_31_XOP_MFMSR   83
 #define OP_31_XOP_WRTEE   131
@@ -37,6 +38,12 @@ static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu)
        kvmppc_set_msr(vcpu, vcpu->arch.shared->srr1);
 }
 
+static void kvmppc_emul_rfdi(struct kvm_vcpu *vcpu)
+{
+       vcpu->arch.pc = vcpu->arch.dsrr0;
+       kvmppc_set_msr(vcpu, vcpu->arch.dsrr1);
+}
+
 static void kvmppc_emul_rfci(struct kvm_vcpu *vcpu)
 {
        vcpu->arch.pc = vcpu->arch.csrr0;
@@ -65,6 +72,12 @@ int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
                        *advance = 0;
                        break;
 
+               case OP_19_XOP_RFDI:
+                       kvmppc_emul_rfdi(vcpu);
+                       kvmppc_set_exit_type(vcpu, EMULATED_RFDI_EXITS);
+                       *advance = 0;
+                       break;
+
                default:
                        emulated = EMULATE_FAIL;
                        break;