From: Jordan Niethe <jniet...@gmail.com>

The check for a hcall coming from userspace is done for KVM-PR. This is
not supported for nestedv2 and the L0 will directly inject the necessary
exception to the L2 if userspace performs a hcall. Avoid checking the
MSR and thus avoid a H_GUEST_GET_STATE hcall in the L1.

Signed-off-by: Jordan Niethe <jniet...@gmail.com>
---
 arch/powerpc/kvm/book3s_hv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 5543e8490cd9..069c336b6f3c 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1688,7 +1688,7 @@ static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu,
        {
                int i;
 
-               if (unlikely(__kvmppc_get_msr_hv(vcpu) & MSR_PR)) {
+               if (!kvmhv_is_nestedv2() && unlikely(__kvmppc_get_msr_hv(vcpu) 
& MSR_PR)) {
                        /*
                         * Guest userspace executed sc 1. This can only be
                         * reached by the P9 path because the old path
@@ -4949,7 +4949,7 @@ static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu)
                if (run->exit_reason == KVM_EXIT_PAPR_HCALL) {
                        accumulate_time(vcpu, &vcpu->arch.hcall);
 
-                       if (WARN_ON_ONCE(__kvmppc_get_msr_hv(vcpu) & MSR_PR)) {
+                       if (!kvmhv_is_nestedv2() && 
WARN_ON_ONCE(__kvmppc_get_msr_hv(vcpu) & MSR_PR)) {
                                /*
                                 * These should have been caught reflected
                                 * into the guest by now. Final sanity check:
-- 
2.42.0

Reply via email to