Skip to content

Commit 8c57101

Browse files
ashkalrajoergroedel
authored andcommitted
crypto: ccp: Skip SEV and SNP INIT for kdump boot
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 <[email protected]> Signed-off-by: Ashish Kalra <[email protected]> Link: https://lore.kernel.org/r/d884eff5f6180d8b8c6698a6168988118cf9cba1.1756157913.git.ashish.kalra@amd.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent 38e5f33 commit 8c57101

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/crypto/ccp/sev-dev.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/fs_struct.h>
2929
#include <linux/psp.h>
3030
#include <linux/amd-iommu.h>
31+
#include <linux/crash_dump.h>
3132

3233
#include <asm/smp.h>
3334
#include <asm/cacheflush.h>
@@ -1345,6 +1346,15 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
13451346
if (!psp_master || !psp_master->sev_data)
13461347
return -ENODEV;
13471348

1349+
/*
1350+
* Skip SNP/SEV initialization under a kdump kernel as SEV/SNP
1351+
* may already be initialized in the previous kernel. Since no
1352+
* SNP/SEV guests are run under a kdump kernel, there is no
1353+
* need to initialize SNP or SEV during kdump boot.
1354+
*/
1355+
if (is_kdump_kernel())
1356+
return 0;
1357+
13481358
sev = psp_master->sev_data;
13491359

13501360
if (sev->state == SEV_STATE_INIT)

0 commit comments

Comments
 (0)