Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Jack Wang <jinpu.wang@ionos.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org, stable@vger.kernel.org
Cc: dmitrii.omelchenko@cloud.ionos.com,
	Ashish Kalra <ashish.kalra@amd.com>,
	Dionna Glaze <dionnaglaze@google.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Jack Wang <jinpu.wang@cloud.ionos.com>
Subject: [stable-6.12 1/4] crypto: ccp - Add new SEV/SNP platform shutdown API
Date: Fri, 14 Aug 2026 12:02:54 +0200	[thread overview]
Message-ID: <20260814100652.225499-2-jinpu.wang@ionos.com> (raw)
In-Reply-To: <20260814100652.225499-1-jinpu.wang@ionos.com>

From: Ashish Kalra <ashish.kalra@amd.com>

commit f7b86e0e75bc234751cb7a82d888083a57ef28b2 upstream.

Add new API interface to do SEV/SNP platform shutdown when KVM module
is unloaded.

Reviewed-by: Dionna Glaze <dionnaglaze@google.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
---
 drivers/crypto/ccp/sev-dev.c | 9 +++++++++
 include/linux/psp-sev.h      | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index d668f9318c28..7c05cae7e577 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -2444,6 +2444,15 @@ static void sev_firmware_shutdown(struct sev_device *sev)
 	mutex_unlock(&sev_cmd_mutex);
 }
 
+void sev_platform_shutdown(void)
+{
+	if (!psp_master || !psp_master->sev_data)
+		return;
+
+	sev_firmware_shutdown(psp_master->sev_data);
+}
+EXPORT_SYMBOL_GPL(sev_platform_shutdown);
+
 void sev_dev_destroy(struct psp_device *psp)
 {
 	struct sev_device *sev = psp->sev_data;
diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
index 613a8209bed2..6a4435cfa977 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -947,6 +947,7 @@ int sev_do_cmd(int cmd, void *data, int *psp_ret);
 void *psp_copy_user_blob(u64 uaddr, u32 len);
 void *snp_alloc_firmware_page(gfp_t mask);
 void snp_free_firmware_page(void *addr);
+void sev_platform_shutdown(void);
 
 #else	/* !CONFIG_CRYPTO_DEV_SP_PSP */
 
@@ -981,6 +982,8 @@ static inline void *snp_alloc_firmware_page(gfp_t mask)
 
 static inline void snp_free_firmware_page(void *addr) { }
 
+static inline void sev_platform_shutdown(void) { }
+
 #endif	/* CONFIG_CRYPTO_DEV_SP_PSP */
 
 #endif	/* __PSP_SEV_H__ */
-- 
2.43.0


  reply	other threads:[~2026-08-14 10:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 10:02 [PATCH 6.12.y 0/4] crypto: ccp, KVM: SVM - missing SEV/SNP platform-init dependency + 2 bugfixes Jack Wang
2026-08-14 10:02 ` Jack Wang [this message]
2026-08-14 10:02 ` [stable-6.12 2/4] KVM: SVM: Add support to initialize SEV/SNP functionality in KVM Jack Wang
2026-08-14 14:40   ` Sean Christopherson
2026-08-14 10:02 ` [stable-6.12 3/4] crypto: ccp - Fix checks for SNP_VLEK_LOAD input buffer length Jack Wang
2026-08-14 10:02 ` [stable-6.12 4/4] crypto: ccp - Abort doing SEV INIT if SNP INIT fails Jack Wang
2026-08-15  2:33 ` [PATCH 6.12.y 0/4] crypto: ccp, KVM: SVM - missing SEV/SNP platform-init dependency + 2 bugfixes Sasha Levin
2026-08-17  4:51   ` Jinpu Wang
2026-08-17  5:00     ` Greg KH
2026-08-17  5:22       ` Jinpu Wang
2026-08-17  5:34         ` Greg KH

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=20260814100652.225499-2-jinpu.wang@ionos.com \
    --to=jinpu.wang@ionos.com \
    --cc=ashish.kalra@amd.com \
    --cc=dionnaglaze@google.com \
    --cc=dmitrii.omelchenko@cloud.ionos.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    /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