From nobody Thu Apr 2 04:37:28 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCFFC3BFE50; Mon, 30 Mar 2026 10:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774867562; cv=none; b=KyMHwwgHXTCG2FtqzB065w2k1zRR1B7Ei7tEdPPrYIg+sG4oDfsLGygao2cmUnLWkzuF6+J8CutLKggdpto5jKoQ0ve7RAIHzQFRGkCLEzadHssOv/YdwBzgcvpxpcc3Yz/EsXpInq2WIWDtBFSBhmSW0TbSgaXyPtn/JNfGwPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774867562; c=relaxed/simple; bh=P/aykGCsgb01qbewNV/HqqIF24FzNY0Z/vjf4TiTZJg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=gKlj4Ji2bKej0lYIbvTAjCBUPMNGgpjPvKyRFMO7GrigtXfF8EhK9udV+9rgJ1X+7DmyIPJSXWXwlzq3GVpTY0tdRnVNPnj9olADT0fkmr1R+heCnjSdkORI5qIlLmCPTpa3ctxXRq2AS7hj00rEmSfLsUdAnNOv4aumZrU+5xI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=r9rFTg7L; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2S3wxSaD; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="r9rFTg7L"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2S3wxSaD" Date: Mon, 30 Mar 2026 10:45:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774867559; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fo3Vjb9jw8bRcP1dWMAktum/9tYHRcsL/ETKqiGvJ00=; b=r9rFTg7LjqPD6Tlvnlr9Dx/Am8Zu1j3eYUht7o8MuHTaUTOPQi1TBC6mJkjpi3btQ1koRu BVJIf8uqNHE7yZse8y33Kf/3mJaVHEGBwn4W2JZ5Cyuw9MLRYkesP0Uke0/t7QyjVA8Bhe K9QZ+C4yLkPQceQDDuHfYmEzWi/5FDX+CMY9gmrQ/0HjmD+5FCObj+SRNeSX+vUuR47+hw 8OdOyNweICK5rrGmh+lpMvnV59t8Tx0o5che6Bf6KkSONWmeKB47SFhsORFeagFzOxamml DfInfNpBrfFYsV9PR67P1f7glfBB7yxeupHbTyqGUU1GFqJUni7uC0Nbc/NBwQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774867559; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fo3Vjb9jw8bRcP1dWMAktum/9tYHRcsL/ETKqiGvJ00=; b=2S3wxSaDhcwzuA9ouvbj5VhKrBnoH+CA1vNb9C0a10f8E39cVH9pYG6QAamDIX4jmDyuil aidE+mORkJHszfCw== From: "tip-bot2 for Tycho Andersen (AMD)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] x86/sev, crypto/ccp: Move HSAVE_PA setup to arch/x86/ Cc: "Tycho Andersen (AMD)" , "Borislav Petkov (AMD)" , Tom Lendacky , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260324161301.1353976-6-tycho@kernel.org> References: <20260324161301.1353976-6-tycho@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177486755805.1647592.5623868388782310620.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/sev branch of tip: Commit-ID: 7b2bc5f0ab983a7aad7fa5180cede4b3e91fc164 Gitweb: https://git.kernel.org/tip/7b2bc5f0ab983a7aad7fa5180cede4b3e= 91fc164 Author: Tycho Andersen (AMD) AuthorDate: Tue, 24 Mar 2026 10:12:59 -06:00 Committer: Borislav Petkov (AMD) CommitterDate: Sun, 29 Mar 2026 19:59:58 +02:00 x86/sev, crypto/ccp: Move HSAVE_PA setup to arch/x86/ Now that there is snp_prepare() that indicates when the CCP driver wants to prepare the architecture for SNP_INIT(_EX), move this architecture-specific bit of code to a more sensible place. Signed-off-by: Tycho Andersen (AMD) Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Tom Lendacky Link: https://patch.msgid.link/20260324161301.1353976-6-tycho@kernel.org --- arch/x86/virt/svm/sev.c | 8 ++++++++ drivers/crypto/ccp/sev-dev.c | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c index 423fe77..41f76f1 100644 --- a/arch/x86/virt/svm/sev.c +++ b/arch/x86/virt/svm/sev.c @@ -506,6 +506,11 @@ static bool __init setup_rmptable(void) return true; } =20 +static void clear_hsave_pa(void *arg) +{ + wrmsrq(MSR_VM_HSAVE_PA, 0); +} + void snp_prepare(void) { u64 val; @@ -529,6 +534,9 @@ void snp_prepare(void) on_each_cpu(mfd_reconfigure, (void *)1, 1); on_each_cpu(snp_enable, NULL, 1); =20 + /* SNP_INIT requires MSR_VM_HSAVE_PA to be cleared on all CPUs. */ + on_each_cpu(clear_hsave_pa, NULL, 1); + cpus_read_unlock(); } EXPORT_SYMBOL_FOR_MODULES(snp_prepare, "ccp"); diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 024eab2..0d0c09a 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -1076,11 +1076,6 @@ static inline int __sev_do_init_locked(int *psp_ret) return __sev_init_locked(psp_ret); } =20 -static void snp_set_hsave_pa(void *arg) -{ - wrmsrq(MSR_VM_HSAVE_PA, 0); -} - /* Hypervisor Fixed pages API interface */ static void snp_hv_fixed_pages_state_update(struct sev_device *sev, enum snp_hv_fixed_pages_state page_state) @@ -1375,9 +1370,6 @@ static int __sev_snp_init_locked(int *error, unsigned= int max_snp_asid) =20 snp_prepare(); =20 - /* SNP_INIT requires MSR_VM_HSAVE_PA to be cleared on all CPUs. */ - on_each_cpu(snp_set_hsave_pa, NULL, 1); - /* * Starting in SNP firmware v1.52, the SNP_INIT_EX command takes a list * of system physical address ranges to convert into HV-fixed page