From: "tip-bot2 for Tycho Andersen (AMD)" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Tycho Andersen (AMD)" <tycho@kernel.org>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/sev] x86/sev, crypto/ccp: Move HSAVE_PA setup to arch/x86/
Date: Mon, 30 Mar 2026 10:45:58 -0000 [thread overview]
Message-ID: <177486755805.1647592.5623868388782310620.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260324161301.1353976-6-tycho@kernel.org>
The following commit has been merged into the x86/sev branch of tip:
Commit-ID: 7b2bc5f0ab983a7aad7fa5180cede4b3e91fc164
Gitweb: https://git.kernel.org/tip/7b2bc5f0ab983a7aad7fa5180cede4b3e91fc164
Author: Tycho Andersen (AMD) <tycho@kernel.org>
AuthorDate: Tue, 24 Mar 2026 10:12:59 -06:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
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) <tycho@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
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;
}
+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);
+ /* 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);
}
-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)
snp_prepare();
- /* 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
next prev parent reply other threads:[~2026-03-30 10:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 16:12 [PATCH v4 0/7] Move SNP initialization to the CCP driver Tycho Andersen
2026-03-24 16:12 ` [PATCH v4 1/7] x86/sev: Create a function to clear/zero the RMP Tycho Andersen
2026-03-30 10:46 ` [tip: x86/sev] " tip-bot2 for Tom Lendacky
2026-03-24 16:12 ` [PATCH v4 2/7] x86/sev: Create snp_prepare() Tycho Andersen
2026-03-24 16:12 ` [PATCH v4 3/7] x86/sev: Create snp_shutdown() Tycho Andersen
2026-03-30 10:46 ` [tip: x86/sev] " tip-bot2 for Tycho Andersen (AMD)
2026-03-24 16:12 ` [PATCH v4 4/7] x86/sev, crypto/ccp: Move SNP init to ccp driver Tycho Andersen
2026-03-30 10:45 ` [tip: x86/sev] " tip-bot2 for Tycho Andersen (AMD)
2026-03-24 16:12 ` [PATCH v4 5/7] x86/sev, crypto/ccp: Move HSAVE_PA setup to arch/x86/ Tycho Andersen
2026-03-30 10:45 ` tip-bot2 for Tycho Andersen (AMD) [this message]
2026-03-24 16:13 ` [PATCH v4 6/7] crypto/ccp: Implement SNP x86 shutdown Tycho Andersen
2026-03-30 10:45 ` [tip: x86/sev] " tip-bot2 for Tycho Andersen (AMD)
2026-03-24 16:13 ` [PATCH v4 7/7] crypto/ccp: Update HV_FIXED page states to allow freeing of memory Tycho Andersen
2026-03-30 10:45 ` [tip: x86/sev] " tip-bot2 for Tom Lendacky
2026-03-25 9:07 ` [PATCH v4 0/7] Move SNP initialization to the CCP driver Borislav Petkov
2026-03-25 15:25 ` Tycho Andersen
2026-03-28 11:38 ` Borislav Petkov
2026-03-30 15:38 ` Tycho Andersen
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=177486755805.1647592.5623868388782310620.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=tycho@kernel.org \
--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®