Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device
From: James Bottomley
Date: Tue Dec 10 2024 - 09:56:04 EST
On Tue, 2024-12-10 at 10:40 -0400, Jason Gunthorpe wrote:
> On Tue, Dec 10, 2024 at 03:34:23PM +0100, Stefano Garzarella wrote:
>
> > + if (platform_device_add_data(&tpm_device, &pops,
> > sizeof(pops)))
> > + return -ENODEV;
> > + if (platform_device_register(&tpm_device))
> > + return -ENODEV;
>
> This seems like an old fashioned way to instantiate a device. Why do
> this? Just put the TPM driver here and forget about pops? Simple tpm
> drivers are not very complex.
This driver may be for the AMD SEV SVSM vTPM module, but there are
other platforms where there's an internal vTPM which might be contacted
via a platform specific enlightenment (Intel SNP and Microsoft
OpenHCL). This separation of the platform device from the contact
mechanism is designed to eliminate the duplication of having a platform
device within each implementation and to make any bugs in the mssim
protocol centrally fixable (every vTPM currently speaks this).
Regards,
James