[PATCH v4 3/4] crypto: ccp: Skip SEV and SNP INIT for kdump boot

Ashish Kalra posted 4 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH v4 3/4] crypto: ccp: Skip SEV and SNP INIT for kdump boot
Posted by Ashish Kalra 2 months, 2 weeks ago
From: Ashish Kalra <ashish.kalra@amd.com>

If SNP is enabled and initialized in the previous kernel then SNP is
already initialized for kdump boot and attempting SNP INIT again
during kdump boot causes SNP INIT failure and eventually leads to
IOMMU failures.

For SEV avoid SEV INIT failure warnings during kdump boot if SEV
is enabled and initialized in the previous kernel.

Skip SNP and SEV INIT if doing kdump boot.

Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
---
 drivers/crypto/ccp/sev-dev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index e058ba027792..c204831ca4a6 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -28,6 +28,7 @@
 #include <linux/fs_struct.h>
 #include <linux/psp.h>
 #include <linux/amd-iommu.h>
+#include <linux/crash_dump.h>
 
 #include <asm/smp.h>
 #include <asm/cacheflush.h>
@@ -1345,6 +1346,13 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
 	if (!psp_master || !psp_master->sev_data)
 		return -ENODEV;
 
+	/*
+	 * Skip SNP/SEV INIT for kdump boot as SEV/SNP is already initialized
+	 * in previous kernel if SEV/SNP is enabled.
+	 */
+	if (is_kdump_kernel())
+		return 0;
+
 	sev = psp_master->sev_data;
 
 	if (sev->state == SEV_STATE_INIT)
-- 
2.34.1
Re: [PATCH v4 3/4] crypto: ccp: Skip SEV and SNP INIT for kdump boot
Posted by Sairaj Kodilkar 2 months, 1 week ago

On 7/22/2025 3:23 AM, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.com>
> 
> If SNP is enabled and initialized in the previous kernel then SNP is
> already initialized for kdump boot and attempting SNP INIT again
> during kdump boot causes SNP INIT failure and eventually leads to
> IOMMU failures.
> 
> For SEV avoid SEV INIT failure warnings during kdump boot if SEV
> is enabled and initialized in the previous kernel.
> 
> Skip SNP and SEV INIT if doing kdump boot.
> 
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Tested-by: Sairaj Kodilkar <sarunkod@amd.com>