[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <11ce67db2349a0c18fd549be41815ccccf401e64.1734392473.git.ashish.kalra@amd.com>
Date: Mon, 16 Dec 2024 23:59:08 +0000
From: Ashish Kalra <Ashish.Kalra@....com>
To: <seanjc@...gle.com>, <pbonzini@...hat.com>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
<x86@...nel.org>, <hpa@...or.com>, <thomas.lendacky@....com>,
<john.allen@....com>, <herbert@...dor.apana.org.au>, <davem@...emloft.net>
CC: <michael.roth@....com>, <dionnaglaze@...gle.com>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-crypto@...r.kernel.org>,
<linux-coco@...ts.linux.dev>
Subject: [PATCH v2 6/9] crypto: ccp: Add new SEV/SNP platform shutdown API
From: Ashish Kalra <ashish.kalra@....com>
Add new API interface to do SEV/SNP platform shutdown when KVM module
is unloaded. This interface does a full SEV and SNP shutdown.
Signed-off-by: Ashish Kalra <ashish.kalra@....com>
---
drivers/crypto/ccp/sev-dev.c | 13 +++++++++++++
include/linux/psp-sev.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index cef0b590ca66..001e7a401a6d 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -2481,6 +2481,19 @@ void sev_platform_shutdown(void)
}
EXPORT_SYMBOL_GPL(sev_platform_shutdown);
+void sev_snp_platform_shutdown(void)
+{
+ struct sev_device *sev;
+
+ if (!psp_master || !psp_master->sev_data)
+ return;
+
+ sev = psp_master->sev_data;
+
+ sev_firmware_shutdown(sev);
+}
+EXPORT_SYMBOL_GPL(sev_snp_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 fea20fbe2a8a..335b29b31457 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -946,6 +946,7 @@ 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);
+void sev_snp_platform_shutdown(void);
#else /* !CONFIG_CRYPTO_DEV_SP_PSP */
@@ -982,6 +983,8 @@ static inline void snp_free_firmware_page(void *addr) { }
static inline void sev_platform_shutdown(void) { }
+static inline void sev_snp_platform_shutdown(void) { }
+
#endif /* CONFIG_CRYPTO_DEV_SP_PSP */
#endif /* __PSP_SEV_H__ */
--
2.34.1
Powered by blists - more mailing lists