Re: [Patch v5 3/3] x86/hyperv: Add guest support for Enhanced SMT Protection

From: Wei Liu

Date: Mon Nov 30 2026 - 16:43:23 EST


Dexuan, Tianyu and Kameron please take a look.

On Tue, Nov 17, 2026 at 05:57:00PM +0000, Pratik R. Sampat wrote:
> 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@xxxxxxx>
> ---
> v4..v5:
> * Remove comment about vCPU sibling mask configuration - Boris
>
> v3..v4: No change
> ---
> arch/x86/hyperv/ivm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
> index 2ce4dfe53472..bd57cac18181 100644
> --- a/arch/x86/hyperv/ivm.c
> +++ b/arch/x86/hyperv/ivm.c
> @@ -347,6 +347,11 @@ 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;
> + 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
>
>