Skip to content

Commit e396dd8

Browse files
stefano-garzarellabp3tk0v
authored andcommitted
x86/sev: Register tpm-svsm platform device
SNP platform can provide a vTPM device emulated by SVSM. The "tpm-svsm" device can be handled by the platform driver registered by the x86/sev core code. Register the platform device only when SVSM is available and it supports vTPM commands as checked by snp_svsm_vtpm_probe(). [ bp: Massage commit message. ] Signed-off-by: Stefano Garzarella <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 93b7c6b commit e396dd8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

arch/x86/coco/sev/core.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2688,6 +2688,11 @@ static struct platform_device sev_guest_device = {
26882688
.id = -1,
26892689
};
26902690

2691+
static struct platform_device tpm_svsm_device = {
2692+
.name = "tpm-svsm",
2693+
.id = -1,
2694+
};
2695+
26912696
static int __init snp_init_platform_device(void)
26922697
{
26932698
if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
@@ -2696,7 +2701,11 @@ static int __init snp_init_platform_device(void)
26962701
if (platform_device_register(&sev_guest_device))
26972702
return -ENODEV;
26982703

2699-
pr_info("SNP guest platform device initialized.\n");
2704+
if (snp_svsm_vtpm_probe() &&
2705+
platform_device_register(&tpm_svsm_device))
2706+
return -ENODEV;
2707+
2708+
pr_info("SNP guest platform devices initialized.\n");
27002709
return 0;
27012710
}
27022711
device_initcall(snp_init_platform_device);

0 commit comments

Comments
 (0)