From: Amit Shah <amit@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
x86@kernel.org, linux-doc@vger.kernel.org, amit.shah@amd.com,
thomas.lendacky@amd.com, bp@alien8.de, tglx@linutronix.de,
peterz@infradead.org, jpoimboe@kernel.org,
pawan.kumar.gupta@linux.intel.com, corbet@lwn.net,
mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com,
pbonzini@redhat.com, daniel.sneddon@linux.intel.com,
kai.huang@intel.com, sandipan.das@amd.com,
boris.ostrovsky@oracle.com, Babu.Moger@amd.com,
david.kaplan@amd.com, dwmw@amazon.co.uk,
andrew.cooper3@citrix.com
Subject: Re: [PATCH v5 1/1] x86: kvm: svm: set up ERAPS support for guests
Date: Thu, 28 Aug 2025 11:40:51 +0200 [thread overview]
Message-ID: <aLAkI1PosfK0wDKZ@mun-amitshah-l> (raw)
In-Reply-To: <aKYBeIokyVC8AKHe@google.com>
On (Wed) 20 Aug 2025 [10:10:16], Sean Christopherson wrote:
[...]
> > + if (tdp_enabled)
> > + kvm_cpu_cap_check_and_set(X86_FEATURE_ERAPS);
>
> _If_ ERAPS is conditionally enabled, then it probably makes sense to do this in
> svm_set_cpu_caps(). But I think we can just support ERAPS unconditionally.
[...]
> @@ -2560,6 +2563,8 @@ static int cr_interception(struct kvm_vcpu *vcpu)
> break;
> case 3:
> err = kvm_set_cr3(vcpu, val);
> + if (!err && nested && kvm_cpu_cap_has(X86_FEATURE_ERAPS))
> + svm->vmcb->control.erap_ctl |= ERAP_CONTROL_FLUSH_RAP;
I missed this part in my reply earlier.
Enabling ERAPS for a guest is trickier in the no-NPT case: *if* the guest is
enlightened, notices the CPUID for ERAPS, and drops the mitigations, KVM needs
to ensure the FLUSH_RAP bit is set in the VMCB on guest CR3 changes all the
time. Your change adds it - but only for the nested case. It needs to do it
for the non-nested case as well.
I steered away from enabling it in the !npt case in the first place because it
was such a niche configuration that wasn't worth bothering and getting right
-- but since you've added it here, I'll go with it and drop the '&& nested'
part of the hunk above.
Amit
prev parent reply other threads:[~2025-08-28 9:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 15:26 [PATCH v5 0/1] KVM: Add support for the ERAPS feature Amit Shah
2025-05-15 15:26 ` [PATCH v5 1/1] x86: kvm: svm: set up ERAPS support for guests Amit Shah
2025-05-19 21:22 ` Tom Lendacky
2025-05-28 12:49 ` Amit Shah
2025-08-20 16:18 ` Sean Christopherson
2025-08-21 9:05 ` Amit Shah
2025-08-20 17:10 ` Sean Christopherson
2025-08-27 9:17 ` Amit Shah
2025-08-28 9:40 ` Amit Shah [this message]
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=aLAkI1PosfK0wDKZ@mun-amitshah-l \
--to=amit@kernel.org \
--cc=Babu.Moger@amd.com \
--cc=amit.shah@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=david.kaplan@amd.com \
--cc=dwmw@amazon.co.uk \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=sandipan.das@amd.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/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