[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 17 Nov 2026 20:15:57 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7tnln+QhO+xZpIzT0Ind+wT57cvYdAS/6n8WIGh/NKc=; b=NaBx90s3rSGmRVgEM9Kr/2T+4q67NRlgLRej5niwMINLREDWvQh2RUx30M21bfsfoENDA1VzBIkSvl0aRNwG2OyVYSmBOHmsSPhFN77xpzbezylRU4tyHspMSDSqhHL/cLAZ9TJ/iUubW+rAaaOaefpMhm6H9m9QDeuNBRI6ftnrO4YZDCsYXj0/V4k2+jaz3mHgYYhBnOAUYkka6aSNrdsK0+UxSStIamcz6W1lCvGZ1eJ3jYzu1i+YljXXiSeGHZ4AOxSpiazcbD8IZM2kR8xvp7sgcIfgjzD59Q3B9XNE1hkRkI6RrMMYIWkMUeDtibto38rkQ4iZmpoE/ks43Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NZSPWUz+8n21punZ7xx7EYmUTpehWYRUjnZYYg7cr9hCgRYugocMFKv9ISz+B67MdClj3+CvYUZ/14yv44a8W9p63cvyC//HOLjnm613KL5Fx5JsBVFoQXqNr/LMcCsxwZYpACq0dWS7D0AZlfPEyrVvabZ1OHiEycChmw24KK8n9GNKWkG3wRysGw2uLKwJavDNTYhjapENmgJvUA+Y+bBtJRlCSuMmNw5MZE0woa459RPbxFnZesvUZUVFgj7OVLNYf91f+qhcKoLStaq/YL9O59faz62DgzvGALZyRSVy8HSHgl1IIfMj1XXeP3GFHRT3jitnFVcffa5pPPRKWg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 18 Nov 2026 01:16:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-11-16 08:30, Jan Beulich wrote:
On 07.11.2026 00:15, Jason Andryuk wrote:

@@ -444,17 +445,30 @@ static int construct_secondary_tables(struct acpi_ctxt 
*ctxt,
              break;
case 2:
-            /*
-             * Check VID stored in bits 37:32 (3rd 16 bit word) of CRB
-             * identifier register.  See table 16 of TCG PC client platform
-             * TPM profile specification for TPM 2.0.
-             */
-            if ( config->crb_id[2] == 0 || config->crb_id[2] == 0xffff )
-                break;
+            if ( config->tpm_interface == ACPI_TPM_INTERFACE_TIS )

Better use switch() right away?

Well, I don't expect there to be more than these two on x86.

+            {
+                if ( config->tis_hdr[0] == 0 || config->tis_hdr[0] == 0xffff ||
+                     config->tis_hdr[1] == 0 || config->tis_hdr[1] == 0xffff )

I'm going to add a prerequisite patch that moves this probing into hvmloader.


+                memcpy(ssdt, ssdt_tpm2_tis, sizeof(ssdt_tpm2_tis));
+            }
+            else
+            {
+                /*
+                 * Check VID stored in bits 37:32 (3rd 16 bit word) of CRB
+                 * identifier register.  See table 16 of TCG PC client
+                 * platform TPM profile specification for TPM 2.0.
+                 */
+                if ( config->crb_id[2] == 0 || config->crb_id[2] == 0xffff )
+                    break;
+
+                ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2), 16);
+                if (!ssdt) return -1;

... the one you re-indent could be corrected as well. Actually, can't
we consolidate both allocation and ...

+                memcpy(ssdt, ssdt_tpm2, sizeof(ssdt_tpm2));

... copying paths by way of having another pair of local variables
(pointer and size)?

Yes, sounds good.

@@ -471,8 +485,17 @@ static int construct_secondary_tables(struct acpi_ctxt 
*ctxt,
              tpm2->header.creator_id   = ACPI_CREATOR_ID;
              tpm2->header.creator_revision = ACPI_CREATOR_REVISION;
              tpm2->platform_class = TPM2_ACPI_CLASS_CLIENT;
-            tpm2->control_area_address = TPM_CRB_CTRL_REQ;
-            tpm2->start_method = TPM2_START_METHOD_CRB;
+            if ( config->tpm_interface == ACPI_TPM_INTERFACE_TIS )
+            {
+                /* The FIFO interface has no control area. */
+                tpm2->control_area_address = 0;

There is a memset() earlier on, so only the comment looks to be needed
here.

More local variables streamlines this away.

--- /dev/null
+++ b/tools/libacpi/ssdt_tpm2_tis.asl
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/*
+ * ssdt_tpm2_tis.asl
+ */
+
+/* SSDT for TPM 2.0 TIS Interface for Xen with Qemu device model. */
+
+DefinitionBlock ("SSDT_TPM2_TIS.aml", "SSDT", 2, "Xen", "HVM", 0)
+{
+    Device (TPM)
+    {
+        Name (_HID, "MSFT0101" /* TPM 2.0 Security Device */)  // _HID: 
Hardware ID
+        Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+        {
+            Memory32Fixed (ReadWrite,
+                0xFED40000,         // Address Base
+                0x00005000,         // Address Length
+                )

I know you're only following what we do elsewhere (i.e. this isn't a
request for you to change anything), but I wonder how we could make sure
that such seemingly arbitrary address range allocations won't ever
conflict. (I assume the base address is dictated by qemu?)

Yes, it is a hardcoded address in QEMU for TPM-TIS. More generally, 0xfed4xxxx is standardized by the Trusted Computing Group for TPM TIS on x86.

ARM defines assorted GUEST_* values for ram and mmio. Something like that could be done for x86. Though using them in an .asl file isn't friendly. TPM_REGISTER_BASE is already a define. That could be placed in the comment at least?

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.