Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
[firefly-linux-kernel-4.4.55.git] / arch / powerpc / kvm / book3s_pr_papr.c
index ee02b30878ed4bec733af6cbd9aa152eefe22d0f..b24309c6c2d507d3f2c008358c3c0728d450a7cd 100644 (file)
@@ -227,6 +227,13 @@ static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu)
        return EMULATE_DONE;
 }
 
+static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
+{
+       long rc = kvmppc_xics_hcall(vcpu, cmd);
+       kvmppc_set_gpr(vcpu, 3, rc);
+       return EMULATE_DONE;
+}
+
 int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
 {
        switch (cmd) {
@@ -246,6 +253,20 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
                clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
                vcpu->stat.halt_wakeup++;
                return EMULATE_DONE;
+       case H_XIRR:
+       case H_CPPR:
+       case H_EOI:
+       case H_IPI:
+               if (kvmppc_xics_enabled(vcpu))
+                       return kvmppc_h_pr_xics_hcall(vcpu, cmd);
+               break;
+       case H_RTAS:
+               if (list_empty(&vcpu->kvm->arch.rtas_tokens))
+                       return RESUME_HOST;
+               if (kvmppc_rtas_hcall(vcpu))
+                       break;
+               kvmppc_set_gpr(vcpu, 3, 0);
+               return EMULATE_DONE;
        }
 
        return EMULATE_FAIL;