From: Yosry Ahmed <yosry@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Venkatesh Srinivas <venkateshs@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Yosry Ahmed <yosry@kernel.org>
Subject: [PATCH v2 2/3] KVM: x86: Use kvm_cpu_cap_has() for EFER bits enablement checks
Date: Sat, 7 Mar 2026 01:16:18 +0000 [thread overview]
Message-ID: <20260307011619.2324234-3-yosry@kernel.org> (raw)
In-Reply-To: <20260307011619.2324234-1-yosry@kernel.org>
Instead of checking that the hardware supports underlying features for
EFER bits, check if KVM supports them. It is practically the same, but
this removes a subtle dependency on kvm_set_cpu_caps() enabling the
relevant CPUID features.
No functional change intended.
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Yosry Ahmed <yosry@kernel.org>
---
arch/x86/kvm/x86.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1aae2bc380d1b..0b5d48e75b657 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10027,13 +10027,13 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_setup_xss_caps);
static void kvm_setup_efer_caps(void)
{
- if (boot_cpu_has(X86_FEATURE_NX))
+ if (kvm_cpu_cap_has(X86_FEATURE_NX))
kvm_enable_efer_bits(EFER_NX);
- if (boot_cpu_has(X86_FEATURE_FXSR_OPT))
+ if (kvm_cpu_cap_has(X86_FEATURE_FXSR_OPT))
kvm_enable_efer_bits(EFER_FFXSR);
- if (boot_cpu_has(X86_FEATURE_AUTOIBRS))
+ if (kvm_cpu_cap_has(X86_FEATURE_AUTOIBRS))
kvm_enable_efer_bits(EFER_AUTOIBRS);
}
--
2.53.0.473.g4a7958ca14-goog
next prev parent reply other threads:[~2026-03-07 1:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 1:16 [PATCH v2 0/3] KVM: SVM: Advertise TCE to userspace Yosry Ahmed
2026-03-07 1:16 ` [PATCH v2 1/3] KVM: x86: Move some EFER bits enablement to common code Yosry Ahmed
2026-03-07 1:16 ` Yosry Ahmed [this message]
2026-03-07 1:16 ` [PATCH v2 3/3] KVM: SVM: Advertise Translation Cache Extensions to userspace Yosry Ahmed
2026-03-07 1:54 ` Andrew Cooper
2026-03-09 13:53 ` Yosry Ahmed
2026-03-09 15:06 ` Sean Christopherson
2026-03-09 15:10 ` Yosry Ahmed
2026-03-09 22:53 ` Venkatesh Srinivas
2026-04-03 15:13 ` [PATCH v2 0/3] KVM: SVM: Advertise TCE " Sean Christopherson
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=20260307011619.2324234-3-yosry@kernel.org \
--to=yosry@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=venkateshs@google.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