Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
From: Jarkko Sakkinen
Date: Mon Nov 23 2026 - 10:16:12 EST
On Mon, Nov 23, 2026 at 11:11:28AM -0400, Jason Gunthorpe wrote:
> On Mon, Nov 23, 2026 at 02:38:44PM +0200, Jarkko Sakkinen wrote:
> > On Mon, Nov 23, 2026 at 09:09:02AM +0000, Yeoreum Yun wrote:
> > > Hi Jiri,
> > >
> > > [...]
> > >
> > > > +static void __iomem *tdx_attestation_log_map(size_t *length)
> > > > +{
> > > > + struct acpi_table_header *header;
> > > > + struct acpi_table_ccel *ccel;
> > > > + void __iomem *log = NULL;
> > > > +
> > > > + if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_CCEL, 0, &header)))
> > > > + return NULL;
> > > > + ccel = container_of(header, struct acpi_table_ccel, header);
> > > > + if (header->length >= sizeof(*ccel) && ccel->log_area_start_address &&
> > > > + ccel->log_area_minimum_length &&
> > > > + ccel->log_area_minimum_length <= UINT_MAX)
> > > > + log = acpi_os_map_iomem(ccel->log_area_start_address,
> > > > + ccel->log_area_minimum_length);
> > > > + if (log)
> > > > + *length = ccel->log_area_minimum_length;
> > > > + acpi_put_table(header);
> > > > + return log;
> > > > +}
> > > > +
> > >
> > > I think we don't need to dump log area with the log_area_minimum_length
> > > since the area would include none-event otherwise, pre-exist tool (i.e.
> > > tpm2_eventlog) reports error for them like:
> > >
> > > ...
> > > - EventNum: 21
> > > PCRIndex: 2
> > > EventType: EV_EFI_ACTION
> > > DigestCount: 1
> > > Digests:
> > > - AlgorithmId: sha256
> > > Digest: "b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"
> > > EventSize: 40
> > > Event: |-
> > > Exit Boot Services Returned with Success
> > > ERROR: corrupted log, insufficient size for event header: 3
> > > ERROR: failed to parse tpm2 eventlog
> > > ERROR: Unable to run tpm2_eventlog
> > >
> > >
> > > So, what about export *real size* of eventlog like
> > > tpm2_calc_event_log_size()?
> >
> > Nothing in the patch (neither commit message nor any comment in code)
> > says that TDX attestion registers share the same format as TPM2 even
> > log.
>
> It comes from the UEFI spec's definition of CCEL:
>
> 38.1 Virtual Platform CC Event Log
>
> If a virtual firmware with confidential computing (CC) capability
> supports measurement and an event is created, virtual firmware should
> report the event log with the same data structure in TCG Platform
> Firmware Profile (PFP) specification with
> EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 format. The index created by the
> virtual firmware in the event log should be the index for the
> confidential computing (CC) measurement register. It is CC vendor
> specific.
>
> It makes sense that the kernel would size it correctly.
>
> > As per the function, perhaps tpm2_calc_event_log_size() should be
> > relocated to lib and have non-TPM name like firmware_event_log_size()
> > or something.
>
> Probably under drivers/attestation since that is where all the TCG
> formatted logs should end up. It should be 'tcg_event_log_size()' or
> something. Maybe a tiny module for it like we would have done in lib/
+1 for the name, as it is obviously more accurate prefix.
>
> Jason
Br, Jarkko