Skip to content

Commit 05f4ee0

Browse files
x86/sev: Register tpm-svsm platform device
JIRA: https://issues.redhat.com/browse/RHEL-87276 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit e396dd8 Author: Stefano Garzarella <sgarzare@redhat.com> Date: Thu Apr 10 15:51:16 2025 +0200 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 <sgarzare@redhat.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/r/20250410135118.133240-5-sgarzare@redhat.com Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent 9d4d606 commit 05f4ee0

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
@@ -2699,6 +2699,11 @@ static struct platform_device sev_guest_device = {
26992699
.id = -1,
27002700
};
27012701

2702+
static struct platform_device tpm_svsm_device = {
2703+
.name = "tpm-svsm",
2704+
.id = -1,
2705+
};
2706+
27022707
static int __init snp_init_platform_device(void)
27032708
{
27042709
struct sev_guest_platform_data data;
@@ -2718,7 +2723,11 @@ static int __init snp_init_platform_device(void)
27182723
if (platform_device_register(&sev_guest_device))
27192724
return -ENODEV;
27202725

2721-
pr_info("SNP guest platform device initialized.\n");
2726+
if (snp_svsm_vtpm_probe() &&
2727+
platform_device_register(&tpm_svsm_device))
2728+
return -ENODEV;
2729+
2730+
pr_info("SNP guest platform devices initialized.\n");
27222731
return 0;
27232732
}
27242733
device_initcall(snp_init_platform_device);

0 commit comments

Comments
 (0)