Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Yeoreum Yun <yeoreum.yun@arm.com>, Jiri Pirko <jiri@resnulli.us>,
	linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org,
	linux-doc@vger.kernel.org, david.quigley@intel.com,
	lukas@wunner.de, ksinyuk@kernel.org, rodrigo.vivi@intel.com,
	cedric.xing@intel.com, sameo@meta.com, drdeeglaze@gmail.com,
	James.Bottomley@hansenpartnership.com, aik@amd.com,
	jpiotrowski@nvidia.com, qinkun@google.com, pgonda@google.com,
	jic23@kernel.org, alistair.francis@wdc.com, ankita@nvidia.com,
	suzuki.poulose@arm.com, kas@kernel.org,
	rick.p.edgecombe@intel.com, elena.reshetova@intel.com,
	dave.hansen@linux.intel.com,
	sathyanarayanan.kuppuswamy@linux.intel.com, peter.fang@intel.com,
	zohar@linux.ibm.com, aneesh.kumar@kernel.org,
	dave.jiang@intel.com, nik.borisov@suse.com,
	sergii.dmytruk@3mdeb.com
Subject: Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Date: Mon, 23 Nov 2026 17:24:15 +0200	[thread overview]
Message-ID: <awRan8ZELzpTwduV@kernel.org> (raw)
In-Reply-To: <awRYr7yB8IWj7S3G@kernel.org>

On Mon, Nov 23, 2026 at 05:16:05PM +0200, Jarkko Sakkinen wrote:
> 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.

Location, I don't know. I was thinking something like "lib/tcg.c" with
routines that are plain calculations based on TCG/TPM data. And perhaps
for tpm_buf (both stack/heap allocatable), if Trenchboot ever moves
forward.

Br, Jarkko

  reply	other threads:[~2026-11-23 15:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:08 [PATCH RFC v2 0/9] attestation: Add a common subsystem and TDX support Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 2/9] Documentation: attestation: Add userspace ABI Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 3/9] attestation: Prepare provider and instance core Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 4/9] attestation: Prepare measurement registers Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 5/9] attestation: Add CTLV operation handling Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 6/9] Documentation: attestation: Describe how to write a provider Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 7/9] tdx-guest: Expose the native attestation service API Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 8/9] attestation: Add the TDX family specification and generated files Jiri Pirko
2026-11-13 16:08 ` [PATCH RFC v2 9/9] attestation: Add the TDX family implementation Jiri Pirko
2026-11-23  9:09   ` Yeoreum Yun
2026-11-23 12:38     ` Jarkko Sakkinen
2026-11-23 15:11       ` Jason Gunthorpe
2026-11-23 15:15         ` Jarkko Sakkinen
2026-11-23 15:24           ` Jarkko Sakkinen [this message]
2026-11-23 15:40             ` Jason Gunthorpe
2026-11-23 15:42               ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awRan8ZELzpTwduV@kernel.org \
    --to=jarkko@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=aik@amd.com \
    --cc=alistair.francis@wdc.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=ankita@nvidia.com \
    --cc=cedric.xing@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david.quigley@intel.com \
    --cc=drdeeglaze@gmail.com \
    --cc=elena.reshetova@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jic23@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=jpiotrowski@nvidia.com \
    --cc=kas@kernel.org \
    --cc=ksinyuk@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=nik.borisov@suse.com \
    --cc=peter.fang@intel.com \
    --cc=pgonda@google.com \
    --cc=qinkun@google.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sameo@meta.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sergii.dmytruk@3mdeb.com \
    --cc=suzuki.poulose@arm.com \
    --cc=x86@kernel.org \
    --cc=yeoreum.yun@arm.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox