[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241210150413.GI1888283@ziepe.ca>
Date: Tue, 10 Dec 2024 11:04:13 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: James Bottomley <James.Bottomley@...senpartnership.com>
Cc: Stefano Garzarella <sgarzare@...hat.com>, linux-coco@...ts.linux.dev,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Huewe <peterhuewe@....de>, "H. Peter Anvin" <hpa@...or.com>,
linux-integrity@...r.kernel.org, x86@...nel.org,
Joerg Roedel <jroedel@...e.de>, Jarkko Sakkinen <jarkko@...nel.org>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Claudio Carvalho <cclaudio@...ux.ibm.com>,
Dov Murik <dovmurik@...ux.ibm.com>,
Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device
On Tue, Dec 10, 2024 at 09:55:41AM -0500, James Bottomley wrote:
> 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).
Sure, that's what TPM drivers are for, give those platforms TPM drivers
too.
Why put a mini driver hidden under an already mini driver?
> 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).
That makes sense, but that isn't really what I see in this series?
Patch one just has tpm_class_ops send() invoke pops sendrcv() after
re-arranging the arguments?
It looks to me like there would be mert in adding a new op to
tpm_class_ops for the send/recv type operating mode and have the core
code manage the buffer singleton (is a global static even *correct*??)
After that, there is no meaningful shared code here, and maybe the
TPM_CHIP_FLAG_IRQ hack can be avoided too.
Simply call tpm_chip_alloc/register from the sev code directly and
provide an op that does the send/recv. Let the tpm core code deal with
everything else. It is much cleaner than platform devices and driver
data..
Jason
Powered by blists - more mailing lists