[PATCH 1/4] crypto: ccp: Enumerate SNP support in output of sev_platform_init()
From: Sean Christopherson
Date: Fri Feb 28 2025 - 13:01:37 EST
Add an output param to sev_platform_init() to communicate whether or not
SNP was (or already was) successfully initialized. The return code from
sev_platform_init() is completely disconnected from SNP initialization,
e.g. will return errors if SNP setup succeeded, and will return success if
SNP setup failed.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
drivers/crypto/ccp/sev-dev.c | 1 +
include/linux/psp-sev.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index cde6ebab589d..5164c5f3bd3f 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -1357,6 +1357,7 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
*/
dev_err(sev->dev, "SEV-SNP: failed to INIT, continue SEV INIT\n");
}
+ args->snp_initialized = sev->snp_initialized;
/* Defer legacy SEV/SEV-ES support if allowed by caller/module. */
if (args->probe && !psp_init_on_probe)
diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
index 0b3a36bdaa90..726535e302be 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -797,10 +797,12 @@ struct sev_data_snp_shutdown_ex {
* @probe: True if this is being called as part of CCP module probe, which
* will defer SEV_INIT/SEV_INIT_EX firmware initialization until needed
* unless psp_init_on_probe module param is set
+ * @snp_initialized: Output param that is true if SNP was initialized.
*/
struct sev_platform_init_args {
int error;
bool probe;
+ bool snp_initialized;
};
/**
base-commit: ac2ba191f3b6b41c9403b142223dfcc3dfe8903b
--
2.48.1.711.g2feabab25a-goog
--ZxKkPI+e2NE34Qwk
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="0002-KVM-SVM-Reject-SNP-VM-creation-if-SNP-platform-initi.patch"