]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: ccp: Skip SEV and SNP INIT for kdump boot
authorAshish Kalra <ashish.kalra@amd.com>
Mon, 25 Aug 2025 21:46:38 +0000 (21:46 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 5 Sep 2025 12:45:16 +0000 (14:45 +0200)
Since SEV or SNP may already be initialized in the previous kernel,
attempting to initialize them again in the kdump kernel can result
in SNP initialization failures, which in turn lead to IOMMU
initialization failures. Moreover, SNP/SEV guests are not run under a
kdump kernel, so there is no need to initialize SEV or SNP during
kdump boot.

Skip SNP and SEV INIT if doing kdump boot.

Tested-by: Sairaj Kodilkar <sarunkod@amd.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Link: https://lore.kernel.org/r/d884eff5f6180d8b8c6698a6168988118cf9cba1.1756157913.git.ashish.kalra@amd.com
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/crypto/ccp/sev-dev.c

index e058ba0277929620c14618e43ba7e89e05f981d2..24e27f7c1377802919a0ede188a4ded0d7defa75 100644 (file)
@@ -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,15 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
        if (!psp_master || !psp_master->sev_data)
                return -ENODEV;
 
+       /*
+        * Skip SNP/SEV initialization under a kdump kernel as SEV/SNP
+        * may already be initialized in the previous kernel. Since no
+        * SNP/SEV guests are run under a kdump kernel, there is no
+        * need to initialize SNP or SEV during kdump boot.
+        */
+       if (is_kdump_kernel())
+               return 0;
+
        sev = psp_master->sev_data;
 
        if (sev->state == SEV_STATE_INIT)