linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Vaibhav Jain <vaibhav@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org
Cc: mikey@neuling.org, sbhat@linux.ibm.com,
	amachhiw@linux.vnet.ibm.com, Jordan Niethe <jniethe5@gmail.com>,
	gautam@linux.ibm.com, Nicholas Piggin <npiggin@gmail.com>,
	David.Laight@ACULAB.COM, kconsul@linux.vnet.ibm.com,
	Vaibhav Jain <vaibhav@linux.ibm.com>,
	Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Subject: [PATCH 03/12] KVM: PPC: Book3S HV nestedv2: Do not check msr on hcalls
Date: Fri,  1 Dec 2023 18:56:08 +0530	[thread overview]
Message-ID: <20231201132618.555031-4-vaibhav@linux.ibm.com> (raw)
In-Reply-To: <20231201132618.555031-1-vaibhav@linux.ibm.com>

From: Jordan Niethe <jniethe5@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 <jniethe5@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


  parent reply	other threads:[~2023-12-01 13:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 13:26 [PATCH 00/12] KVM: PPC: Nested APIv2 : Performance improvements Vaibhav Jain
2023-12-01 13:26 ` [PATCH 01/12] KVM: PPC: Book3S HV nestedv2: Invalidate RPT before deleting a guest Vaibhav Jain
2023-12-07  9:15   ` Aneesh Kumar K.V
2023-12-08 13:45     ` Vaibhav Jain
2023-12-15 16:12       ` Aneesh Kumar K.V
2023-12-18  4:54         ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 02/12] KVM: PPC: Book3S HV nestedv2: Avoid reloading the tb offset Vaibhav Jain
2023-12-01 13:26 ` Vaibhav Jain [this message]
2023-12-01 13:26 ` [PATCH 04/12] KVM: PPC: Book3S HV nestedv2: Get the PID only if needed to copy tofrom a guest Vaibhav Jain
2023-12-01 13:26 ` [PATCH 05/12] KVM: PPC: Book3S HV nestedv2: Ensure LPCR_MER bit is passed to the L0 Vaibhav Jain
2023-12-01 13:26 ` [PATCH 06/12] KVM: PPC: Book3S HV: Handle pending exceptions on guest entry with MSR_EE Vaibhav Jain
2023-12-01 13:26 ` [PATCH 07/12] KVM: PPC: Book3S HV nestedv2: Do not inject certain interrupts Vaibhav Jain
2023-12-01 13:26 ` [PATCH 08/12] KVM: PPC: Book3S HV nestedv2: Avoid msr check in kvmppc_handle_exit_hv() Vaibhav Jain
2023-12-01 13:26 ` [PATCH 09/12] KVM: PPC: Book3S HV nestedv2: Do not call H_COPY_TOFROM_GUEST Vaibhav Jain
2023-12-08  8:15   ` Aneesh Kumar K.V
2023-12-11  3:56     ` Vaibhav Jain
2023-12-11  4:01       ` Aneesh Kumar K.V
2023-12-18  7:02         ` Vaibhav Jain
2023-12-18  7:29           ` Aneesh Kumar K.V
2023-12-01 13:26 ` [PATCH 10/12] KVM: PPC: Book3S HV nestedv2: Register the VPA with the L0 Vaibhav Jain
2023-12-01 13:26 ` [PATCH 11/12] KVM: PPC: Reduce reliance on analyse_instr() in mmio emulation Vaibhav Jain
2023-12-01 13:26 ` [PATCH 12/12] KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception Vaibhav Jain
2023-12-21 10:44 ` [PATCH 00/12] KVM: PPC: Nested APIv2 : Performance improvements Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231201132618.555031-4-vaibhav@linux.ibm.com \
    --to=vaibhav@linux.ibm.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=amachhiw@linux.vnet.ibm.com \
    --cc=gautam@linux.ibm.com \
    --cc=jniethe5@gmail.com \
    --cc=kconsul@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=npiggin@gmail.com \
    --cc=sbhat@linux.ibm.com \
    --cc=svaidy@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).