From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Piggin Date: Thu, 01 Apr 2021 15:03:19 +0000 Subject: [PATCH v5 42/48] KVM: PPC: Book3S HV: Radix guests should not have userspace hcalls reflected to the Message-Id: <20210401150325.442125-43-npiggin@gmail.com> List-Id: References: <20210401150325.442125-1-npiggin@gmail.com> In-Reply-To: <20210401150325.442125-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Nicholas Piggin The reflection of sc 1 hcalls from PR=1 userspace is required to support PR KVM. Radix guests don't support PR KVM nor do they support nested hash guests, so this sc 1 reflection can be removed from radix guests. Cause a privileged program check instead, which is less surprising. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index ae5ad93a623f..f4d6ec6c4710 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -1403,11 +1403,20 @@ static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu, int i; if (unlikely(vcpu->arch.shregs.msr & MSR_PR)) { - /* - * Guest userspace executed sc 1, reflect it back as a - * syscall as it may be a PR KVM hcall. - */ - kvmppc_core_queue_syscall(vcpu); + if (!kvmhv_vcpu_is_radix(vcpu)) { + /* + * Guest userspace executed sc 1, reflect it + * back as a syscall as it may be a PR KVM + * hcall. + */ + kvmppc_core_queue_syscall(vcpu); + } else { + /* + * radix guests can not run PR KVM so send a + * program check. + */ + kvmppc_core_queue_program(vcpu, SRR1_PROGPRIV); + } r = RESUME_GUEST; break; } -- 2.23.0