From: "Pratik R. Sampat" <prsampat@amd.com>
To: <kvm@vger.kernel.org>, <x86@kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <tglx@kernel.org>, <mingo@redhat.com>, <bp@alien8.de>,
<dave.hansen@linux.intel.com>, <seanjc@google.com>,
<pbonzini@redhat.com>, <thomas.lendacky@amd.com>,
<kim.phillips@amd.com>, <nikunj@amd.com>, <michael.roth@amd.com>,
<ashish.kalra@amd.com>, <prsampat@amd.com>
Subject: [Patch v3 4/4] x86/hyperv: Add guest support for Enhanced SMT Protection
Date: Fri, 16 Oct 2026 21:54:07 +0000 [thread overview]
Message-ID: <32abec5508bb39420b713e3960233979a520e4e9.1792184487.git.prsampat@amd.com> (raw)
In-Reply-To: <cover.1792184487.git.prsampat@amd.com>
Add corresponding hyperv support for Enhanced SMT protection. A fully
enlightened SEV-SNP guest on Hyper-V builds the VMSA itself when
bringing up an AP, so populate both fields there, before the page is
turned into a VMSA and while it is still writable.
Similar to KVM, fully set the sibling mask so that all threads of the
same guest trust each other.
Signed-off-by: Pratik R. Sampat <prsampat@amd.com>
---
v2..v3: No changes
v1..v2: New patch
---
arch/x86/hyperv/ivm.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
index 2ce4dfe53472..40dd252f333a 100644
--- a/arch/x86/hyperv/ivm.c
+++ b/arch/x86/hyperv/ivm.c
@@ -347,6 +347,17 @@ int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu)
vmsa->vmpl = 0;
vmsa->sev_features = sev_status >> 2;
+ if (sev_status & MSR_AMD64_SNP_ESMT_PROT) {
+ vmsa->vcpu_id = apic_id;
+ /*
+ * The mask fully set puts every vCPU in one group, so any two
+ * of them may be co-resident. A legal ESMTP sibling must
+ * also match on ASID, so the sibling of a vCPU in guest mode is
+ * always either another vCPU of this same guest or idle.
+ */
+ vmsa->vcpu_sibling_mask = U32_MAX;
+ }
+
ret = snp_set_vmsa(vmsa, true);
if (ret) {
pr_err("RMPADJUST(%llx) failed: %llx\n", (u64)vmsa, ret);
--
2.43.0
prev parent reply other threads:[~2026-10-16 21:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 21:54 [Patch v3 0/4] Introduce Enhanced SMT Protection for SEV-SNP Pratik R. Sampat
2026-10-16 21:54 ` [Patch v3 1/4] KVM: SVM: Re-queue events that were never injected Pratik R. Sampat
2026-10-16 21:54 ` [Patch v3 2/4] KVM: SVM: Add host support for Enhanced SMT Protection Pratik R. Sampat
2026-10-16 21:54 ` [Patch v3 3/4] x86/sev: Add guest " Pratik R. Sampat
2026-10-16 21:54 ` Pratik R. Sampat [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=32abec5508bb39420b713e3960233979a520e4e9.1792184487.git.prsampat@amd.com \
--to=prsampat@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=kim.phillips@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--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
all inboxes | Powered by JetHome®