Re: [RFC PATCH v2 5/6] tpm: add SNP SVSM vTPM driver

Jarkko Sakkinen
2025-03-04T17:27:34Z

On Mon, Mar 03, 2025 at 05:46:16PM +0100, Stefano Garzarella wrote:
> On Sat, Mar 01, 2025 at 03:51:46AM +0200, Jarkko Sakkinen wrote:
> > On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote:
> > > Add driver for the vTPM defined by the AMD SVSM spec [1].
> > >
> > > The specification defines a protocol that a SEV-SNP guest OS can use to
> > > discover and talk to a vTPM emulated by the Secure VM Service Module (SVSM)
> > > in the guest context, but at a more privileged level (VMPL0).
> > >
> > > The new tpm-svsm platform driver uses two functions exposed by x86/sev
> > > to verify that the device is actually emulated by the platform and to
> > > send commands and receive responses.
> > >
> > > The vTPM is emulated through the TCG reference implementation, so this
> > > driver leverages tpm_tcgsim.h to fill commands and parse responses.
> >
> > Why? Please don't.
>
> You mean it's better not to have the external header and have all the
> functions here to prepare commands and parse responses?
>
> As I mentioned, I did this because there may be other future drivers that
> could use it to talk to emulated devices in the same way, that is, through
> the TCG TPM reference implementation,

Sorry about harsh comment. I think we discussed this (MS simulator
caused confusion). Anchor this to SVSM spec and we're fine.

BR, Jarkko