From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796074994; b=zl4aK1R6qlbKj7Tw2vkKmSaF2J/Aotn0sGoVQFScZw51kACj57WKITCvc5dYzDSuDOhk beTYr0hIFl8iNYTfmfgmuovpHSrSMPHCUXl8QWBnMFMXo7+Sc2AUOpuSW59ARi2eqBn4J jy6XZJfk6ItY0zBMTTT5Sa/bQrfI90AF3cJXel5iIHod/xl8HYINrPqljX3Xgj7GntNda zoL1XxqFB1bHt10UbAjNQd4n0FbW/IUaQiUwwmh03KjWfclzix3F3qH5OR0ZIvsABVfMn E8PgK5pzBlnADLuHlWqy1WEI/+AzMJYcCBENENBs5QsigyarqCbOVrDEoeUkrSnNADQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074994; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=TeRMmcIcRd9QAEUQD57ydBLbgWupuu9rJKFnY9tg6eU=; b=QUnH9n4QYfpnTwuNSbNRy/UfZxGJZZbiGLIMyBtbpIRRPPw9KmH7iRzcJTThxEZy55Nr +EjyHbZDg+srZ74ls+BOgFWJcaC15COCy9nfNGhf3P9t0tFWn9HXux/lV63zyEKrMvuFp k179RcJJ1fChSYpwihAcDx31GLfgYKTHZA1xHI/fuEdy7RSDhbzCywgem5Q7F1cRDirKv 6fEbudUOneslGBKavDXR0tvHTkiyt3b4a5CQpid91h4DYRmQ+JOUyHP9PdHTQty1rNtZM fj+bJHwlP7L3bBc5cxwZqq3eXFn1yUgGPtwoObU+R1nz7I4PrVj6kJLmiBVuz6N+e6Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hr58Et41; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3575606A31A; Mon, 30 Nov 2026 21:43:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hr58Et41 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D4891F00897; Mon, 30 Nov 2026 21:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796074993; bh=TeRMmcIcRd9QAEUQD57ydBLbgWupuu9rJKFnY9tg6eU=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=hr58Et41kTUUi9b1D1pMm1AjLWtHJobCAOPIkTT3KGx3cMmn45wSVlTYKu2zBdv99 n50Rzm+iGxpK7OFv1Vw1aBBRADvdNKxVGGvkYClJHDF8EjZjIZ0C/T1puqkxqgN2xT mDe6S3qNFKNMGmKnIV4EJrsD0/3oN/zb3pLlzZw3YjjJyaZfbEoDZMlcEM2kZCwESv b1ecKtTzMRypuiQ0vEVndR91UhO8FowwyFUYA8ltLS0iAcmudzRhoE7eIYsXVgdJcO 4oD3VvZQszCkWeeHMZhhyKwhtqeK7+uUbin4e8jCrbZCZHDGE22UwOy/gcnaGQglkq ld9KbThyF73kQ== Date: Mon, 30 Nov 2026 13:43:12 -0800 From: Wei Liu To: "Pratik R. Sampat" , kameroncarr@linux.microsoft.com, decui@microsoft.com, ltykernel@gmail.com Cc: x86@kernel.org, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, haiyangz@microsoft.com, wei.liu@kernel.org, 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 Subject: Re: [Patch v5 3/3] x86/hyperv: Add guest support for Enhanced SMT Protection Message-ID: <20261130214312.GD5355@liuwe-devbox-debian-v2.local> References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > --- > 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 > >