Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

2024-12-11 Thread Jason Gunthorpe
On Wed, Dec 11, 2024 at 09:19:04AM +0100, Stefano Garzarella wrote: > > After that, there is no meaningful shared code here, and maybe the > > TPM_CHIP_FLAG_IRQ hack can be avoided too. > > IIUC you are proposing the following steps: > - extend tpm_class_ops to add a new send_recv() op and use it

Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

2024-12-11 Thread Jason Gunthorpe
On Wed, Dec 11, 2024 at 04:38:29PM +0100, Stefano Garzarella wrote: > Except for the call to pops->sendrcv(buffer) the rest depends on how > the TCG TPM reference implementation [1] expects the request/response > to be formatted (we refer to this protocol with MSSIM). Make a small inline helper t

Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

2024-12-10 Thread Jason Gunthorpe
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

Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

2024-12-10 Thread Jason Gunthorpe
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_devi

Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

2025-01-14 Thread Jason Gunthorpe
On Tue, Jan 14, 2025 at 11:42:34AM +0100, Stefano Garzarella wrote: > Hi Jarkko, > > On Thu, 19 Dec 2024 at 17:07, Stefano Garzarella wrote: > > > > On Thu, Dec 19, 2024 at 05:40:58PM +0200, Jarkko Sakkinen wrote: > > >On Thu Dec 19, 2024 at 5:35 PM EET, Stefano Garzarella wrote: > > >> So to use

Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

2025-01-14 Thread Jason Gunthorpe
On Tue, Jan 14, 2025 at 05:51:33PM +0100, Stefano Garzarella wrote: > Otherwise we need an intermediate module in drivers/char/tpm. Here we > have 2 options: > 1. continue as James did by creating a platform_device. > 2. or we could avoid this by just exposing a registration API invoked by

Re: [PATCH v3 3/4] tpm: add SNP SVSM vTPM driver

2025-03-19 Thread Jason Gunthorpe
On Tue, Mar 18, 2025 at 05:18:53PM +0100, Stefano Garzarella wrote: > I see, thanks for the clarification! > I saw that with devm_get_free_pages() I can easily allocate a > resource-managed page, so I'll do that in v4. As a general note you should just use kmalloc these days, even for PAGE_SIZE.

Re: [RFC PATCH 3/3] tpm/tpm_svsm: use send_recv() op

2025-03-19 Thread Jason Gunthorpe
On Tue, Mar 11, 2025 at 11:01:30AM +0100, Stefano Garzarella wrote: > This driver does not support interrupts, and receiving the response is > synchronous with sending the command. > > Let's simplify the driver by implementing the new send_recv() op. > > Signed-off-by: Stefano Garzarella > --- >

Re: [PATCH 2/2] tpm/tpm_ftpm_tee: use send_recv() op

2025-03-26 Thread Jason Gunthorpe
On Wed, Mar 26, 2025 at 02:11:12PM +0200, Jarkko Sakkinen wrote: > Generally speaking I don't see enough value in complicating > callback interface. It's better to handle complications in > the leaves (i.e. dictatorship of majority ;-) ). That is very much not the way most driver subsystems view

Re: [PATCH][next][V4] tpm: remove kmalloc failure error message

2025-04-30 Thread Jason Gunthorpe
g space after \n > V2: remove entire message, originally just removed a trailing space > V3: replace -EFAULT with -ENOMEM > V4: send correct fix for V3, actually return -ENOMEM > --- > > drivers/char/tpm/eventlog/tpm1.c | 7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe Jason

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

2025-02-28 Thread Jason Gunthorpe
On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote: > +/* > + * tpm_svsm_remove() lives in .exit.text. For drivers registered via > + * module_platform_driver_probe() this is ok because they cannot get unbound > + * at runtime. So mark the driver struct with __refdata to prevent mod

Re: [RFC PATCH v2 0/6] Enlightened vTPM support for SVSM on SEV-SNP

2025-02-28 Thread Jason Gunthorpe
On Fri, Feb 28, 2025 at 06:07:14PM +0100, Stefano Garzarella wrote: > I put RFC back in because we haven't yet decided if this is the best > approach to support SVSM vTPM, but I really like to receive feedbacks > especially from the maintainer/reviewers of the TPM subsystem, to see if > this approa

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

2025-03-03 Thread Jason Gunthorpe
On Mon, Mar 03, 2025 at 05:19:05PM +0100, Stefano Garzarella wrote: > On Fri, Feb 28, 2025 at 08:28:19PM -0400, Jason Gunthorpe wrote: > > On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote: > > > +/* > > > + * tpm_svsm_remove() lives in .exit.text.

Re: [RFC PATCH v2 3/6] tpm: add send_recv() ops in tpm_class_ops

2025-03-05 Thread Jason Gunthorpe
On Wed, Mar 05, 2025 at 10:04:25AM +0100, Stefano Garzarella wrote: > Jason suggested the send_recv() ops [2], which I liked, but if you prefer to > avoid that, I can restore what we did in v1 and replace the > TPM_CHIP_FLAG_IRQ hack with your point 2 (or use TPM_CHIP_FLAG_IRQ if you > think it is

Re: [PATCH v4 0/5] Add support for the TPM FF-A start method

2025-03-03 Thread Jason Gunthorpe
On Sun, Mar 02, 2025 at 09:33:59PM +0200, Jarkko Sakkinen wrote: > WARNING: line length of 102 exceeds 100 columns > #764: FILE: drivers/char/tpm/tpm_crb.c:821: > + FW_BUG "TPM2 ACPI table has wrong size %u for > start method type %d\n", Just ignore that, it is an er

Re: [PATCH v4] tpm: Managed allocations for tpm_buf instances

2025-07-02 Thread Jason Gunthorpe
On Tue, Jul 01, 2025 at 05:51:35PM +0300, Jarkko Sakkinen wrote: > @@ -32,28 +32,30 @@ struct tpm_readpubek_out { > static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, > char *buf) > { > - struct tpm_buf tpm_buf; > + struct tpm_buf *tpm_buf

Re: [PATCH] tpm: Create cleanup class for tpm_buf

2025-06-26 Thread Jason Gunthorpe
On Thu, Jun 26, 2025 at 12:37:56AM +0300, Jarkko Sakkinen wrote: > @@ -323,7 +323,7 @@ unsigned long tpm1_calc_ordinal_duration(struct tpm_chip > *chip, u32 ordinal) > */ > static int tpm1_startup(struct tpm_chip *chip) > { > - struct tpm_buf buf; > + CLASS(tpm_buf, buf)(); > int