SNP platform can provide a vTPM device emulated by SVSM.

The "tpm-svsm" device can be handled by the platform driver added
by the previous commit in drivers/char/tpm/tpm_svsm.c

The driver will call snp_svsm_vtpm_probe() to check if SVSM is
present and if it's support the vTPM protocol.

Signed-off-by: Stefano Garzarella <sgarz...@redhat.com>
---
 arch/x86/coco/sev/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 2166bdff88b7..a2383457889e 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -2664,6 +2664,11 @@ static struct platform_device sev_guest_device = {
        .id             = -1,
 };
 
+static struct platform_device tpm_svsm_device = {
+       .name           = "tpm-svsm",
+       .id             = -1,
+};
+
 static int __init snp_init_platform_device(void)
 {
        if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
@@ -2672,6 +2677,9 @@ static int __init snp_init_platform_device(void)
        if (platform_device_register(&sev_guest_device))
                return -ENODEV;
 
+       if (platform_device_register(&tpm_svsm_device))
+               return -ENODEV;
+
        pr_info("SNP guest platform device initialized.\n");
        return 0;
 }
-- 
2.48.1


Reply via email to