* [PATCH 0/4] libxl TPM emulator support
@ 2026-11-06 23:15 Jason Andryuk
2026-11-06 23:15 ` [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface Jason Andryuk
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Jason Andryuk @ 2026-11-06 23:15 UTC (permalink / raw)
To: xen-devel
Cc: Jason Andryuk, Jan Beulich, Anthony PERARD, Juergen Gross,
Julien Grall, Andrew Cooper, Roger Pau Monné, Teddy Astie,
Nick Rosbrook, George Dunlap, Stefano Stabellini,
Bertrand Marquis, Michal Orzel, Volodymyr Babchuk
This patch series adds support to libxl for QEMU to emulate a TPM with
swtpm as a backend.
It reworks some ARM TPM support from Stefano to use the auto-started
swtpm.
Since ARM uses the TIS interface, I expanded x86 to use either TIS or
CRB for TPM 2.0.
On Ubuntu 22.04 (and probably others), swtpm has an AppArmor policy that
restricts access to specific paths. Those don't include /var/run/xen.
I disabled AppArmor with `sudo aa-complain swtpm`.
Jason Andryuk (3):
libacpi: Build TPM2 tables for the TIS interface
hvmloader: Support the TIS interface for TPM 2.0
tools/libxl: add emulated TPM support backed by swtpm
Stefano Stabellini (1):
libxl: Add emulated TPM support on ARM
docs/man/xl.cfg.5.pod.in | 42 +++++++
docs/misc/xenstore-paths.pandoc | 12 +-
tools/firmware/hvmloader/util.c | 12 +-
tools/golang/xenlight/gengotypes.py | 2 +-
tools/golang/xenlight/helpers.gen.go | 48 ++++++++
tools/golang/xenlight/types.gen.go | 17 +++
tools/include/libxl.h | 11 ++
tools/libacpi/Makefile | 2 +-
tools/libacpi/acpi2_0.h | 1 +
tools/libacpi/build.c | 47 +++++--
tools/libacpi/libacpi.h | 4 +
tools/libacpi/ssdt_tpm2_tis.asl | 25 ++++
tools/libs/light/libxl_arch.h | 6 +
tools/libs/light/libxl_arm.c | 47 +++++++
tools/libs/light/libxl_create.c | 46 ++++++-
tools/libs/light/libxl_dm.c | 175 ++++++++++++++++++++++++++-
tools/libs/light/libxl_domain.c | 3 +
tools/libs/light/libxl_internal.h | 4 +
tools/libs/light/libxl_types.idl | 17 +++
tools/libs/light/libxl_x86.c | 24 ++++
tools/xl/xl_parse.c | 20 +++
xen/include/public/arch-arm.h | 4 +
22 files changed, 551 insertions(+), 18 deletions(-)
create mode 100644 tools/libacpi/ssdt_tpm2_tis.asl
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface
2026-11-06 23:15 [PATCH 0/4] libxl TPM emulator support Jason Andryuk
@ 2026-11-06 23:15 ` Jason Andryuk
2026-11-16 13:30 ` Jan Beulich
2026-11-06 23:15 ` [PATCH 2/4] hvmloader: Support the TIS interface for TPM 2.0 Jason Andryuk
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Jason Andryuk @ 2026-11-06 23:15 UTC (permalink / raw)
To: xen-devel; +Cc: Jason Andryuk, Jan Beulich, Anthony PERARD
TPM 2.0 can be exposed over either the CRB or TIS (FIFO) interface.
Add TIS support to libacpii's current CRB support.
An updated SSDT is needed for the 0x5000 MMIO region. Also the start
method changes.
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
tools/libacpi/Makefile | 2 +-
tools/libacpi/acpi2_0.h | 1 +
tools/libacpi/build.c | 47 ++++++++++++++++++++++++---------
tools/libacpi/libacpi.h | 4 +++
tools/libacpi/ssdt_tpm2_tis.asl | 25 ++++++++++++++++++
5 files changed, 66 insertions(+), 13 deletions(-)
create mode 100644 tools/libacpi/ssdt_tpm2_tis.asl
diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 3b4c3d8c86..aa37d5662e 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -16,7 +16,7 @@ C_SRC-$(CONFIG_ARM_64) = dsdt_anycpu_arm.c
DSDT_FILES ?= $(C_SRC-y)
C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, $(DSDT_FILES))
H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h)
-H_SRC += $(addprefix $(ACPI_BUILD_DIR)/, ssdt_tpm.h ssdt_tpm2.h ssdt_laptop_slate.h)
+H_SRC += $(addprefix $(ACPI_BUILD_DIR)/, ssdt_tpm.h ssdt_tpm2.h ssdt_tpm2_tis.h ssdt_laptop_slate.h)
MKDSDT_CFLAGS-$(CONFIG_ARM_64) = -DCONFIG_ARM_64
MKDSDT_CFLAGS-$(CONFIG_X86) = -DCONFIG_X86
diff --git a/tools/libacpi/acpi2_0.h b/tools/libacpi/acpi2_0.h
index 51623e2a8a..759be9ba43 100644
--- a/tools/libacpi/acpi2_0.h
+++ b/tools/libacpi/acpi2_0.h
@@ -126,6 +126,7 @@ struct acpi_20_tpm2 {
uint64_t log_area_start_address;
};
#define TPM2_ACPI_CLASS_CLIENT 0
+#define TPM2_START_METHOD_MMIO 6
#define TPM2_START_METHOD_CRB 7
/*
diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index 95188e217e..14779080a7 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -11,6 +11,7 @@
#include "ssdt_s4.h"
#include "ssdt_tpm.h"
#include "ssdt_tpm2.h"
+#include "ssdt_tpm2_tis.h"
#include "ssdt_pm.h"
#include "ssdt_laptop_slate.h"
#include <xen/hvm/hvm_info_table.h>
@@ -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 )
+ {
+ if ( config->tis_hdr[0] == 0 || config->tis_hdr[0] == 0xffff ||
+ config->tis_hdr[1] == 0 || config->tis_hdr[1] == 0xffff )
+ break;
- ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2), 16);
- if (!ssdt) return -1;
- memcpy(ssdt, ssdt_tpm2, sizeof(ssdt_tpm2));
+ ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2_tis), 16);
+ if (!ssdt) return -1;
+ 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;
+ memcpy(ssdt, ssdt_tpm2, sizeof(ssdt_tpm2));
+ }
table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, ssdt);
tpm2 = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_tpm2), 16);
@@ -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;
+ tpm2->start_method = TPM2_START_METHOD_MMIO;
+ }
+ else
+ {
+ tpm2->control_area_address = TPM_CRB_CTRL_REQ;
+ tpm2->start_method = TPM2_START_METHOD_CRB;
+ }
tpm2->log_area_minimum_length = TPM_LOG_SIZE;
tpm2->log_area_start_address = TPM_LOG_AREA_ADDRESS;
diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h
index deda39e5db..0b40896127 100644
--- a/tools/libacpi/libacpi.h
+++ b/tools/libacpi/libacpi.h
@@ -28,6 +28,9 @@
#define ACPI_HAS_CMOS_RTC (1<<14)
#define ACPI_HAS_SSDT_LAPTOP_SLATE (1<<15)
+#define ACPI_TPM_INTERFACE_CRB 0
+#define ACPI_TPM_INTERFACE_TIS 1
+
struct xen_vmemrange;
struct acpi_numa {
uint32_t nr_vmemranges;
@@ -58,6 +61,7 @@ struct acpi_config {
uint32_t table_flags;
uint8_t acpi_revision;
uint8_t tpm_version;
+ uint8_t tpm_interface; /* ACPI_TPM_INTERFACE_*, only used for TPM 2.0 */
uint64_t vm_gid[2];
unsigned long vm_gid_addr; /* OUT parameter */
diff --git a/tools/libacpi/ssdt_tpm2_tis.asl b/tools/libacpi/ssdt_tpm2_tis.asl
new file mode 100644
index 0000000000..837e50f90e
--- /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
+ )
+ })
+ Method (_STA, 0, NotSerialized) // _STA: Status
+ {
+ Return (0x0F)
+ }
+ }
+}
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] hvmloader: Support the TIS interface for TPM 2.0
2026-11-06 23:15 [PATCH 0/4] libxl TPM emulator support Jason Andryuk
2026-11-06 23:15 ` [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface Jason Andryuk
@ 2026-11-06 23:15 ` Jason Andryuk
2026-11-16 13:36 ` Jan Beulich
2026-11-06 23:15 ` [PATCH 3/4] tools/libxl: add emulated TPM support backed by swtpm Jason Andryuk
2026-11-06 23:15 ` [PATCH 4/4] libxl: Add emulated TPM support on ARM Jason Andryuk
3 siblings, 1 reply; 10+ messages in thread
From: Jason Andryuk @ 2026-11-06 23:15 UTC (permalink / raw)
To: xen-devel
Cc: Jason Andryuk, Juergen Gross, Julien Grall, Jan Beulich,
Andrew Cooper, Roger Pau Monné, Teddy Astie, Anthony PERARD
Read platform/tpm-interface to determine whether a TPM 2.0 device uses
the TIS or CRB interface, and pass it to libacpi so the matching SSDT
and TPM2 table are built. The key defaults to "crb" when absent,
preserving the existing behaviour. TPM 1.2 always uses TIS.
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
tpm-interface is inconsistent with tpm_version, but it seems like "-" is
more common than "_".
docs/misc/xenstore-paths.pandoc | 12 +++++++++++-
tools/firmware/hvmloader/util.c | 12 +++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/docs/misc/xenstore-paths.pandoc b/docs/misc/xenstore-paths.pandoc
index b8b02e007a..c24ffe342e 100644
--- a/docs/misc/xenstore-paths.pandoc
+++ b/docs/misc/xenstore-paths.pandoc
@@ -280,10 +280,20 @@ circumstances where the generation ID needs to be changed.
The TPM version to be probed for.
A value of 1 indicates to probe for TPM 1.2, whereas a value of 2
-indicates that a TPM 2.0 using CRB should be probed.
+indicates that a TPM 2.0 should be probed, using the interface given by
+~/platform/tpm-interface.
A value of 0 or an invalid value will result in no TPM being probed.
If unset, a default of 1 is assumed.
+#### ~/platform/tpm-interface = ("tis"|"crb") [HVM,INTERNAL]
+
+The TPM interface to be probed for when ~/platform/tpm_version is 2.
+
+A value of "tis" indicates the TPM Interface Specification (FIFO)
+interface, whereas "crb" indicates the Command Response Buffer
+interface. If unset or set to any other value, "crb" is assumed.
+TPM 1.2 always uses the TIS interface and ignores this key.
+
### Frontend device paths
Paravirtual device frontends are generally specified by their own
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index e651342681..fe3e6ab1b9 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -922,7 +922,17 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
case 2:
config->table_flags |= ACPI_HAS_TPM;
- config->crb_id = (uint16_t *)TPM_CRB_INTF_ID;
+ if ( !strcmp(xenstore_read("platform/tpm-interface", "crb"),
+ "tis") )
+ {
+ config->tis_hdr = (uint16_t *)ACPI_TIS_HDR_ADDRESS;
+ config->tpm_interface = ACPI_TPM_INTERFACE_TIS;
+ }
+ else
+ {
+ config->crb_id = (uint16_t *)TPM_CRB_INTF_ID;
+ config->tpm_interface = ACPI_TPM_INTERFACE_CRB;
+ }
mem_hole_populate_ram(TPM_LOG_AREA_ADDRESS >> PAGE_SHIFT,
TPM_LOG_SIZE >> PAGE_SHIFT);
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] tools/libxl: add emulated TPM support backed by swtpm
2026-11-06 23:15 [PATCH 0/4] libxl TPM emulator support Jason Andryuk
2026-11-06 23:15 ` [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface Jason Andryuk
2026-11-06 23:15 ` [PATCH 2/4] hvmloader: Support the TIS interface for TPM 2.0 Jason Andryuk
@ 2026-11-06 23:15 ` Jason Andryuk
2026-11-09 19:54 ` Nick Rosbrook
2026-11-06 23:15 ` [PATCH 4/4] libxl: Add emulated TPM support on ARM Jason Andryuk
3 siblings, 1 reply; 10+ messages in thread
From: Jason Andryuk @ 2026-11-06 23:15 UTC (permalink / raw)
To: xen-devel
Cc: Jason Andryuk, Anthony PERARD, Nick Rosbrook, George Dunlap,
Juergen Gross
Add support for an emulated TPM. QEMU emulates the device and uses
swtpm for the backend. swtpm is started first and QEMU connects to it.
Add the xl.cfg options are:
tpm_version
tpm_statedir
tpm_statefile
tpm_interface
tpm_loglevel
tpm_swtpm_override
When tpm_version is absent, no TPM is configured. tpm_version must be 1
or 2, and exactly one of tpm_statedir or tpm_statefile must be
specified. tpm_statefile is only supported for swtpm 0.7 and later, so
tpm_statedir is provided for compatiblity. tpm_interface can be either
tis or crb. tpm_loglevel is passed to swtpm when non-zero, with swtpm
logging to /var/log/xen/swtpm-<domain>.log. tpm_swtpm_override specifies
the swtpm executable path; otherwise swtpm is found via PATH.
On x86, TPM 1.2 only supports TIS, while TPM 2.0 may use either and
defaults to CRB.
libxl typically tracks spawned daemons through xenstore keys - like QEMU
writing its "state" key as "running". swtpm does not write to
xenstores, so that is not used. Instead the daemon is launched first
and then QEMU launches and connects to it. If there is a failure,
the QEMU log messages will list tpm in the error message.
`interface` is a Go keyword, so the binding generator needs to specify
that.
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
docs/man/xl.cfg.5.pod.in | 36 ++++++
tools/golang/xenlight/gengotypes.py | 2 +-
tools/golang/xenlight/helpers.gen.go | 48 ++++++++
tools/golang/xenlight/types.gen.go | 17 +++
tools/include/libxl.h | 10 ++
tools/libs/light/libxl_create.c | 46 +++++++-
tools/libs/light/libxl_dm.c | 161 +++++++++++++++++++++++++++
tools/libs/light/libxl_domain.c | 3 +
tools/libs/light/libxl_internal.h | 4 +
tools/libs/light/libxl_types.idl | 17 +++
tools/libs/light/libxl_x86.c | 18 +++
tools/xl/xl_parse.c | 20 ++++
12 files changed, 380 insertions(+), 2 deletions(-)
diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index b19c25c8d1..c12d2dc4db 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -821,6 +821,42 @@ value is optional if this is a guest domain.
=back
+=item B<tpm_version=NUMBER>
+
+Provides an emulated TPM to a QEMU-based HVM guest, backed by B<swtpm(8)>.
+The TPM version to emulate is either B<1> for TPM 1.2 or B<2> for TPM 2.0.
+When this option is not specified, no TPM is provided and the other
+B<tpm_*> options are ignored.
+
+One of B<tpm_statefile> or B<tpm_statedir> is required, but not both.
+
+=item B<tpm_statefile="PATH">
+
+Path to a single file in which B<swtpm> stores the persistent TPM state.
+This uses the C<--tpmstate backend-uri=file://PATH> option added in swtpm
+version 0.7.0.
+
+=item B<tpm_statedir="PATH">
+
+Path to a directory in which B<swtpm> stores the persistent TPM state.
+
+=item B<tpm_interface="tis"|"crb">
+
+The TPM interface presented to the guest. B<tis> is the TPM Interface
+Specification (FIFO) interface and B<crb> is the Command Response Buffer
+interface. B<tpm_version=1> only supports B<tis>, while B<tpm_version=2>
+supports either and defaults to B<crb>.
+
+=item B<tpm_swtpm_override="PATH">
+
+Path to the B<swtpm> executable. By default, B<swtpm> is searched for in
+B<PATH>.
+
+=item B<tpm_loglevel=NUMBER>
+
+The B<swtpm> log level. When non-zero, B<swtpm> logs to
+F</var/log/xen/swtpm-DOMAIN.log>. Defaults to B<0> (no log).
+
=item B<p9=[ "9PFS_SPEC_STRING", "9PFS_SPEC_STRING", ...]>
Creates a Xen 9pfs connection to share a filesystem from the backend to the
diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index e4eb7ca1c1..628772d45d 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -28,7 +28,7 @@ builtin_type_names = {
}
# Some go keywords that conflict with field names in libxl structs.
-go_keywords = ['type', 'func']
+go_keywords = ['type', 'func', 'interface']
go_builtin_types = ['bool', 'string', 'int', 'byte',
'uint16', 'uint32', 'uint64']
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 6ab23a708f..58e6179374 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1076,6 +1076,48 @@ return fmt.Errorf("converting field Quota: %v", err)
return nil
}
+// NewTpm returns an instance of Tpm initialized with defaults.
+func NewTpm() (*Tpm, error) {
+var (
+x Tpm
+xc C.libxl_tpm)
+
+C.libxl_tpm_init(&xc)
+defer C.libxl_tpm_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *Tpm) fromC(xc *C.libxl_tpm) error {
+ x.Statefile = C.GoString(xc.statefile)
+x.Statedir = C.GoString(xc.statedir)
+x.SwtpmOverride = C.GoString(xc.swtpm_override)
+x.Version = int(xc.version)
+x.Loglevel = int(xc.loglevel)
+x.Interface = TpmInterface(xc._interface)
+
+ return nil}
+
+func (x *Tpm) toC(xc *C.libxl_tpm) (err error){defer func(){
+if err != nil{
+C.libxl_tpm_dispose(xc)}
+}()
+
+if x.Statefile != "" {
+xc.statefile = C.CString(x.Statefile)}
+if x.Statedir != "" {
+xc.statedir = C.CString(x.Statedir)}
+if x.SwtpmOverride != "" {
+xc.swtpm_override = C.CString(x.SwtpmOverride)}
+xc.version = C.int(x.Version)
+xc.loglevel = C.int(x.Loglevel)
+xc._interface = C.libxl_tpm_interface(x.Interface)
+
+ return nil
+ }
+
// NewDomainBuildInfo returns an instance of DomainBuildInfo initialized with defaults.
func NewDomainBuildInfo(dtype DomainType) (*DomainBuildInfo, error) {
var (
@@ -1242,6 +1284,9 @@ if err := x.DmRestrict.fromC(&xc.dm_restrict);err != nil {
return fmt.Errorf("converting field DmRestrict: %v", err)
}
x.Tee = TeeType(xc.tee)
+if err := x.Tpm.fromC(&xc.tpm);err != nil {
+return fmt.Errorf("converting field Tpm: %v", err)
+}
x.Type = DomainType(xc._type)
switch x.Type{
case DomainTypeHvm:
@@ -1626,6 +1671,9 @@ if err := x.DmRestrict.toC(&xc.dm_restrict); err != nil {
return fmt.Errorf("converting field DmRestrict: %v", err)
}
xc.tee = C.libxl_tee_type(x.Tee)
+if err := x.Tpm.toC(&xc.tpm); err != nil {
+return fmt.Errorf("converting field Tpm: %v", err)
+}
xc._type = C.libxl_domain_type(x.Type)
switch x.Type{
case DomainTypeHvm:
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 39bf9962d1..55b02ffcd7 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -553,6 +553,22 @@ type XsQuotaList struct {
Quota []XsQuotaItem
}
+type TpmInterface int
+const(
+TpmInterfaceDefault TpmInterface = 0
+TpmInterfaceTis TpmInterface = 1
+TpmInterfaceCrb TpmInterface = 2
+)
+
+type Tpm struct {
+Statefile string
+Statedir string
+SwtpmOverride string
+Version int
+Loglevel int
+Interface TpmInterface
+}
+
type DomainBuildInfo struct {
MaxVcpus int
AvailVcpus Bitmap
@@ -612,6 +628,7 @@ NestedHvm Defbool
Apic Defbool
DmRestrict Defbool
Tee TeeType
+Tpm Tpm
Type DomainType
TypeUnion DomainBuildInfoTypeUnion
ArchArm struct {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index d294fb36bd..8b431b708d 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1563,6 +1563,16 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
*/
#define LIBXL_HAVE_XENSTORE_QUOTA
+/*
+ * LIBXL_HAVE_TPM
+ *
+ * If this is defined the tpm member of struct domain_build_info is
+ * available. When its version is non-zero, libxl starts swtpm to
+ * provide an emulated TPM to a QEMU-based HVM guest. Its interface
+ * member selects the TPM interface (TIS or CRB) presented to the guest.
+ */
+#define LIBXL_HAVE_TPM
+
typedef char **libxl_string_list;
void libxl_string_list_dispose(libxl_string_list *sl);
int libxl_string_list_length(const libxl_string_list *sl);
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index a8b0c8c500..94a2a0129f 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -230,6 +230,43 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
if (!b_info->event_channels)
b_info->event_channels = 1023;
+ if (b_info->tpm.version) {
+ if (b_info->tpm.version != 1 && b_info->tpm.version != 2) {
+ LOG(ERROR, "TPM version must be 1 or 2.");
+ return ERROR_INVAL;
+ }
+
+ if (b_info->tpm.statefile && !b_info->tpm.statefile[0]) {
+ LOG(ERROR, "TPM statefile must not be empty.");
+ return ERROR_INVAL;
+ }
+
+ if (b_info->tpm.statedir && !b_info->tpm.statedir[0]) {
+ LOG(ERROR, "TPM statedir must not be empty.");
+ return ERROR_INVAL;
+ }
+
+ if (b_info->tpm.swtpm_override && !b_info->tpm.swtpm_override[0]) {
+ LOG(ERROR, "TPM swtpm_override must not be empty.");
+ return ERROR_INVAL;
+ }
+
+ if (b_info->tpm.statefile && b_info->tpm.statedir) {
+ LOG(ERROR, "Only one of TPM statefile or statedir may be specified.");
+ return ERROR_INVAL;
+ }
+
+ if (!b_info->tpm.statefile && !b_info->tpm.statedir) {
+ LOG(ERROR, "TPM statefile or statedir must be specified.");
+ return ERROR_INVAL;
+ }
+
+ if (b_info->tpm.loglevel < 0) {
+ LOG(ERROR, "TPM loglevel must not be negative.");
+ return ERROR_INVAL;
+ }
+ }
+
rc = libxl_get_physinfo(CTX, &info);
if (rc) {
LOG(ERROR, "failed to get hypervisor info");
@@ -487,7 +524,7 @@ int libxl__domain_build(libxl__gc *gc,
vments[4] = "start_time";
vments[5] = GCSPRINTF("%jd.%02d", (intmax_t)start_time.tv_sec,(int)start_time.tv_usec/10000);
- localents = libxl__calloc(gc, 13, sizeof(char *));
+ localents = libxl__calloc(gc, 17, sizeof(char *));
i = 0;
localents[i++] = "platform/acpi";
localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0";
@@ -510,6 +547,13 @@ int libxl__domain_build(libxl__gc *gc,
}
localents[i++] = "platform/device-model";
localents[i++] = (char *)libxl_device_model_version_to_string(info->device_model_version);
+ if (info->tpm.version) {
+ localents[i++] = "platform/tpm_version";
+ localents[i++] = GCSPRINTF("%d", info->tpm.version);
+ localents[i++] = "platform/tpm-interface";
+ localents[i++] = (char *)libxl_tpm_interface_to_string(
+ info->tpm.interface);
+ }
break;
case LIBXL_DOMAIN_TYPE_PV:
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 511ec76a65..843b8e29eb 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -931,6 +931,22 @@ out:
return rc;
}
+static const char *libxl__swtpm_socket_path(libxl__gc *gc, uint32_t domid)
+{
+ return GCSPRINTF("%s/swtpm-%u.sock", libxl__run_dir_path(), domid);
+}
+
+static void libxl__dm_add_tpm_args(libxl__gc *gc, flexarray_t *dm_args,
+ int guest_domid)
+{
+ const char *sock = libxl__swtpm_socket_path(gc, guest_domid);
+
+ flexarray_append_pair(dm_args, "-chardev",
+ GCSPRINTF("socket,id=chrtpm,path=%s", sock));
+ flexarray_append_pair(dm_args, "-tpmdev",
+ "emulator,id=tpm0,chardev=chrtpm");
+}
+
static int libxl__build_device_model_args_new(libxl__gc *gc,
const char *dm, int guest_domid,
const libxl_domain_config *guest_config,
@@ -1615,6 +1631,14 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
flexarray_append_pair(dm_envs, "XEN_DOMAIN_ID", GCSPRINTF("%d", guest_domid));
+ if (b_info->tpm.version) {
+ libxl__dm_add_tpm_args(gc, dm_args, guest_domid);
+ flexarray_append_pair(dm_args, "-device",
+ GCSPRINTF("%s,tpmdev=tpm0",
+ b_info->tpm.interface == LIBXL_TPM_INTERFACE_CRB ?
+ "tpm-crb" : "tpm-tis"));
+ }
+
if (b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI)
flexarray_append_pair(dm_args, "-device", "ahci,id=ahci0");
for (i = 0; i < num_disks; i++) {
@@ -1980,6 +2004,75 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
return rc;
}
+/*
+ * Build the swtpm command line. swtpm is run in --daemon mode: the
+ * process we exec forks the actual daemon and exits once the control
+ * socket is ready, so QEMU can connect to it immediately afterwards.
+ */
+static char **libxl__swtpm_argv(libxl__gc *gc, uint32_t domid,
+ const libxl_domain_config *guest_config)
+{
+ const libxl_domain_build_info *b_info = &guest_config->b_info;
+ const libxl_domain_create_info *c_info = &guest_config->c_info;
+ const char *sock = libxl__swtpm_socket_path(gc, domid);
+ const char *pidfile = GCSPRINTF("%s/swtpm-%u.pid",
+ libxl__run_dir_path(), domid);
+ flexarray_t *args = flexarray_make(gc, 16, 1);
+ const char *tpmstate;
+
+ if (b_info->tpm.statefile)
+ tpmstate = GCSPRINTF("backend-uri=file://%s", b_info->tpm.statefile);
+ else
+ tpmstate = GCSPRINTF("dir=%s", b_info->tpm.statedir);
+
+ flexarray_vappend(args,
+ b_info->tpm.swtpm_override ?: "swtpm", "socket",
+ "--tpmstate", tpmstate,
+ "--ctrl", GCSPRINTF("type=unixio,path=%s", sock),
+ NULL);
+ if (b_info->tpm.version == 2)
+ flexarray_append(args, "--tpm2");
+ if (b_info->tpm.loglevel)
+ flexarray_vappend(args, "--log",
+ GCSPRINTF("file=%s/swtpm-%s.log,level=%d",
+ XEN_LOG_DIR, c_info->name, b_info->tpm.loglevel),
+ NULL);
+ if (b_info->device_model_user)
+ flexarray_vappend(args, "--runas", b_info->device_model_user, NULL);
+ flexarray_vappend(args, "--daemon",
+ "--pid", GCSPRINTF("file=%s", pidfile), NULL);
+ flexarray_append(args, NULL);
+
+ return (char **)flexarray_contents(args);
+}
+
+int libxl__destroy_swtpm(libxl__gc *gc, uint32_t domid)
+{
+ const char *pidfile = GCSPRINTF("%s/swtpm-%u.pid",
+ libxl__run_dir_path(), domid);
+ const char *sock = libxl__swtpm_socket_path(gc, domid);
+ void *data = NULL;
+ int datalen = 0;
+ pid_t pid;
+
+ /* No pidfile means swtpm was never started for this domain. */
+ if (libxl_read_file_contents(CTX, pidfile, &data, &datalen))
+ return 0;
+
+ pid = data ? atoi(libxl__strndup(gc, data, datalen)) : 0;
+ free(data);
+
+ if (pid > 0 && kill(pid, SIGTERM) && errno != ESRCH)
+ LOGED(ERROR, domid, "failed to kill swtpm [%d]", pid);
+
+ if (unlink(pidfile) && errno != ENOENT)
+ LOGED(ERROR, domid, "failed to remove %s", pidfile);
+ if (unlink(sock) && errno != ENOENT)
+ LOGED(ERROR, domid, "failed to remove %s", sock);
+
+ return 0;
+}
+
static int libxl__store_libxl_entry(libxl__gc *gc, uint32_t domid,
const char *name, const char *value)
{
@@ -1994,6 +2087,7 @@ static void dmss_init(libxl__dm_spawn_state *dmss)
{
libxl__ev_qmp_init(&dmss->qmp);
libxl__ev_time_init(&dmss->timeout);
+ libxl__ev_child_init(&dmss->swtpm_child);
}
static void dmss_dispose(libxl__gc *gc, libxl__dm_spawn_state *dmss)
@@ -2629,6 +2723,10 @@ static void device_model_probe_spawn_outcome(libxl__egc *egc,
libxl__dm_spawn_state *dmss, int rc);
static void device_model_launch(libxl__egc *egc,
libxl__dm_spawn_state *dmss, int rc);
+static void device_model_swtpm_cb(libxl__egc *egc,
+ libxl__ev_child *child, pid_t pid, int status);
+static void device_model_spawn_qemu(libxl__egc *egc,
+ libxl__dm_spawn_state *dmss, int rc);
static void device_model_postconfig_chardev(libxl__egc *egc,
libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
static void device_model_postconfig_vnc(libxl__egc *egc,
@@ -2875,6 +2973,69 @@ static void device_model_probe_spawn_outcome(libxl__egc *egc,
static void device_model_launch(libxl__egc *egc,
libxl__dm_spawn_state *dmss, int rc)
+{
+ STATE_AO_GC(dmss->spawn.ao);
+ const libxl_domain_build_info *b_info = &dmss->guest_config->b_info;
+ const int domid = dmss->guest_domid;
+ pid_t pid;
+
+ if (rc)
+ goto out;
+
+ if (!b_info->tpm.version) {
+ device_model_spawn_qemu(egc, dmss, 0);
+ return;
+ }
+
+ /* Remove any stale pidfile so teardown can't read a previous pid. */
+ rc = libxl__remove_file(gc, GCSPRINTF("%s/swtpm-%u.pid",
+ libxl__run_dir_path(), domid));
+ if (rc)
+ goto out;
+
+ pid = libxl__ev_child_fork(gc, &dmss->swtpm_child, device_model_swtpm_cb);
+ if (pid == -1) {
+ rc = ERROR_FAIL;
+ goto out;
+ }
+ if (!pid) {
+ /* child */
+ char **argv = libxl__swtpm_argv(gc, domid, dmss->guest_config);
+ int null = open("/dev/null", O_RDWR);
+ char **arg;
+
+ LOGD(DEBUG, domid, "Spawning swtpm %s with arguments:", argv[0]);
+ for (arg = argv; *arg; arg++)
+ LOGD(DEBUG, domid, " %s", *arg);
+
+ setsid();
+ libxl__exec(gc, null, null, null, argv[0], argv, NULL);
+ /* not reached */
+ }
+ return;
+
+out:
+ device_model_spawn_qemu(egc, dmss, rc);
+}
+
+static void device_model_swtpm_cb(libxl__egc *egc,
+ libxl__ev_child *child, pid_t pid, int status)
+{
+ libxl__dm_spawn_state *dmss = CONTAINER_OF(child, *dmss, swtpm_child);
+ STATE_AO_GC(dmss->spawn.ao);
+ int rc = 0;
+
+ if (status) {
+ libxl_report_child_exitstatus(CTX, LIBXL__LOG_ERROR, "swtpm",
+ pid, status);
+ rc = ERROR_FAIL;
+ }
+
+ device_model_spawn_qemu(egc, dmss, rc);
+}
+
+static void device_model_spawn_qemu(libxl__egc *egc,
+ libxl__dm_spawn_state *dmss, int rc)
{
STATE_AO_GC(dmss->spawn.ao);
libxl_ctx *ctx = CTX;
diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index 37fcd92871..5f2ca8da7d 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -1275,6 +1275,9 @@ static void dm_destroy_cb(libxl__egc *egc,
libxl__qmp_cleanup(gc, target_domid);
}
+ /* Terminate the emulated TPM backend, if any. No-op otherwise. */
+ libxl__destroy_swtpm(gc, domid);
+
dis->drs.ao = ao;
dis->drs.domid = domid;
dis->drs.callback = devices_destroy_cb;
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index b65e0064b9..c561d3bc33 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4106,6 +4106,7 @@ struct libxl__dm_spawn_state {
libxl__spawn_state spawn;
libxl__ev_qmp qmp;
libxl__ev_time timeout;
+ libxl__ev_child swtpm_child;
libxl__dm_resume_state dmrs;
libxl__qemu_available_opts qemu_opts;
const char *dm;
@@ -4123,6 +4124,9 @@ _hidden void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state*);
*/
_hidden int libxl__local_dm_preexec_restrict(libxl__gc *gc);
+/* swtpm (emulated TPM) backend for a QEMU-based HVM guest. */
+_hidden int libxl__destroy_swtpm(libxl__gc *gc, uint32_t domid);
+
/* Stubdom device models. */
typedef struct {
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index ce697303b6..dc6790b821 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -584,6 +584,22 @@ libxl_xs_quota_list = Struct("xs_quota_list", [
("quota", Array(libxl_xs_quota_item, "num_quota"))
])
+libxl_tpm_interface = Enumeration("tpm_interface", [
+ (0, "default"),
+ (1, "tis"),
+ (2, "crb"),
+ ])
+
+# Emulated TPM backed by swtpm. A version of 0 means no TPM.
+libxl_tpm = Struct("tpm", [
+ ("statefile", string),
+ ("statedir", string),
+ ("swtpm_override", string),
+ ("version", integer, {'init_val': '0'}),
+ ("loglevel", integer, {'init_val': '0'}),
+ ("interface", libxl_tpm_interface),
+ ])
+
libxl_domain_build_info = Struct("domain_build_info",[
("max_vcpus", integer),
("avail_vcpus", libxl_bitmap),
@@ -658,6 +674,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
("apic", libxl_defbool),
("dm_restrict", libxl_defbool),
("tee", libxl_tee_type),
+ ("tpm", libxl_tpm),
("u", KeyedUnion(None, libxl_domain_type, "type",
[("hvm", Struct(None, [("firmware", string),
("bios", libxl_bios_type),
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 9e8b48372d..3182cfc9df 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -825,6 +825,24 @@ int libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
libxl_defbool_setdefault(&b_info->arch_x86.msr_relaxed, false);
libxl_defbool_setdefault(&b_info->trap_unmapped_accesses, false);
+ if (b_info->tpm.version && b_info->type == LIBXL_DOMAIN_TYPE_PVH) {
+ LOG(ERROR, "TPM is not supported for PVH guests on x86.");
+ return ERROR_INVAL;
+ }
+
+ /* TPM 1.2 only supports TIS. TPM 2.0 supports TIS or CRB. */
+ if (b_info->tpm.version) {
+ if (b_info->tpm.interface == LIBXL_TPM_INTERFACE_DEFAULT)
+ b_info->tpm.interface = b_info->tpm.version == 2 ?
+ LIBXL_TPM_INTERFACE_CRB :
+ LIBXL_TPM_INTERFACE_TIS;
+ if (b_info->tpm.version == 1 &&
+ b_info->tpm.interface != LIBXL_TPM_INTERFACE_TIS) {
+ LOG(ERROR, "TPM version 1 only supports the tis interface.");
+ return ERROR_INVAL;
+ }
+ }
+
if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
/*
* The config parameter "altp2m" replaces the parameter "altp2mhvm".
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 0ccece3e8a..1fed322380 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -3060,6 +3060,26 @@ skip_usbdev:
}
}
+ if (!xlu_cfg_get_long(config, "tpm_version", &l, 0)) {
+ b_info->tpm.version = l;
+
+ xlu_cfg_replace_string(config, "tpm_statefile",
+ &b_info->tpm.statefile, 0);
+ xlu_cfg_replace_string(config, "tpm_statedir",
+ &b_info->tpm.statedir, 0);
+ xlu_cfg_replace_string(config, "tpm_swtpm_override",
+ &b_info->tpm.swtpm_override, 0);
+ if (!xlu_cfg_get_long(config, "tpm_loglevel", &l, 0))
+ b_info->tpm.loglevel = l;
+
+ if (!xlu_cfg_get_string(config, "tpm_interface", &buf, 0) &&
+ (libxl_tpm_interface_from_string(buf, &b_info->tpm.interface) ||
+ b_info->tpm.interface == LIBXL_TPM_INTERFACE_DEFAULT)) {
+ fprintf(stderr, "xl: tpm_interface must be tis or crb\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
if (!xlu_cfg_get_string (config, "sve", &buf, 1)) {
e = libxl_sve_type_from_string(buf, &b_info->arch_arm.sve_vl);
if (e) {
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] libxl: Add emulated TPM support on ARM
2026-11-06 23:15 [PATCH 0/4] libxl TPM emulator support Jason Andryuk
` (2 preceding siblings ...)
2026-11-06 23:15 ` [PATCH 3/4] tools/libxl: add emulated TPM support backed by swtpm Jason Andryuk
@ 2026-11-06 23:15 ` Jason Andryuk
3 siblings, 0 replies; 10+ messages in thread
From: Jason Andryuk @ 2026-11-06 23:15 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Anthony PERARD, Juergen Gross,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk, Stefano Stabellini, Jason Andryuk
From: Stefano Stabellini <stefano.stabellini@amd.com>
QEMU's ARM "xenpvh" machine runs as an IOREQ server and, when given a
"tpm-base-addr" machine property, instantiates a TPM TIS sysbus device
at that address connected to the "tpm0" TPM backend. Hook the existing
tpm_* configuration up to it so ARM guests can use an swtpm-backed TPM.
Reserve GUEST_TPM_BASE/GUEST_TPM_SIZE in the ARM guest memory map and
add a "tcg,tpm-tis-mmio" node to the guest device tree when a TPM
version is configured. The xenpvh machine has no CRB device, so TIS is
the default and only interface allowed for both TPM 1.2 and 2.0.
Add libxl__arch_pv_pvh_machinearg() returning the QEMU -machine argument
for a PV/PVH guest. x86 returns plain "xenpv", while ARM uses "xenpvh"
and appends tpm-base-addr when a TPM is configured. uint64_t tpm_base
in ARM's libxl__arch_pvh_machinearg() is to allow PRIx64 to print the
value. Otherwise the ull argument mismatches PRIx64's %lx format.
libxl__arch_pv_pvh_machinearg() also handles PV guests. This keeps the
extra_pv handling identical between PV and PVH guests.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
[ Merge ARM parts with new libxl_dm implementation. ]
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
docs/man/xl.cfg.5.pod.in | 14 ++++++++---
tools/include/libxl.h | 5 ++--
tools/libs/light/libxl_arch.h | 6 +++++
tools/libs/light/libxl_arm.c | 47 +++++++++++++++++++++++++++++++++++
tools/libs/light/libxl_dm.c | 14 ++++++++++-
tools/libs/light/libxl_x86.c | 6 +++++
xen/include/public/arch-arm.h | 4 +++
7 files changed, 89 insertions(+), 7 deletions(-)
diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index c12d2dc4db..e5952d7e27 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -823,11 +823,16 @@ value is optional if this is a guest domain.
=item B<tpm_version=NUMBER>
-Provides an emulated TPM to a QEMU-based HVM guest, backed by B<swtpm(8)>.
-The TPM version to emulate is either B<1> for TPM 1.2 or B<2> for TPM 2.0.
+Provides an emulated TPM to a QEMU-based HVM guest, or to an Arm guest,
+backed by B<swtpm(8)>. The TPM version to emulate is either B<1> for
+TPM 1.2 or B<2> for TPM 2.0.
When this option is not specified, no TPM is provided and the other
B<tpm_*> options are ignored.
+On Arm, QEMU's B<xenpvh> machine is started as an IOREQ server to emulate
+a TPM TIS interface, and the guest device tree gains a
+C<tcg,tpm-tis-mmio> node describing it.
+
One of B<tpm_statefile> or B<tpm_statedir> is required, but not both.
=item B<tpm_statefile="PATH">
@@ -844,8 +849,9 @@ Path to a directory in which B<swtpm> stores the persistent TPM state.
The TPM interface presented to the guest. B<tis> is the TPM Interface
Specification (FIFO) interface and B<crb> is the Command Response Buffer
-interface. B<tpm_version=1> only supports B<tis>, while B<tpm_version=2>
-supports either and defaults to B<crb>.
+interface. On x86, B<tpm_version=1> only supports B<tis>, while
+B<tpm_version=2> supports either and defaults to B<crb>. On Arm, only
+B<tis> is supported, for both TPM versions.
=item B<tpm_swtpm_override="PATH">
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 8b431b708d..8d19cf41bc 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1568,8 +1568,9 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
*
* If this is defined the tpm member of struct domain_build_info is
* available. When its version is non-zero, libxl starts swtpm to
- * provide an emulated TPM to a QEMU-based HVM guest. Its interface
- * member selects the TPM interface (TIS or CRB) presented to the guest.
+ * provide an emulated TPM to a QEMU-based HVM guest, or to an Arm guest
+ * via QEMU's xenpvh machine. Its interface member selects the TPM
+ * interface (TIS or CRB) presented to the guest.
*/
#define LIBXL_HAVE_TPM
diff --git a/tools/libs/light/libxl_arch.h b/tools/libs/light/libxl_arch.h
index c8ef52ddbe..b3355d1e82 100644
--- a/tools/libs/light/libxl_arch.h
+++ b/tools/libs/light/libxl_arch.h
@@ -97,6 +97,12 @@ _hidden
int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
_hidden
bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc);
+
+/* QEMU -machine argument for a PVH guest. */
+_hidden
+char *libxl__arch_pv_pvh_machinearg(libxl__gc *gc,
+ const libxl_domain_build_info *b_info);
+
#if defined(__i386__) || defined(__x86_64__)
#define LAPIC_BASE_ADDRESS 0xfee00000
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 47b662ea5c..6325b19766 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -978,6 +978,29 @@ static int make_xen_iommu_node(libxl__gc *gc, void *fdt)
return 0;
}
+static int make_tpm_node(libxl__gc *gc, void *fdt)
+{
+ int res;
+ const uint64_t base = GUEST_TPM_BASE;
+ const char *name = GCSPRINTF("tpm@%"PRIx64, base);
+
+ res = fdt_begin_node(fdt, name);
+ if (res) return res;
+
+ res = fdt_property_compat(gc, fdt, 1, "tcg,tpm-tis-mmio");
+ if (res) return res;
+
+ res = fdt_property_regs(gc, fdt, GUEST_ROOT_ADDRESS_CELLS,
+ GUEST_ROOT_SIZE_CELLS, 1,
+ base, GUEST_TPM_SIZE);
+ if (res) return res;
+
+ res = fdt_end_node(fdt);
+ if (res) return res;
+
+ return 0;
+}
+
/* The caller is responsible to complete / close the fdt node */
static int make_virtio_mmio_node_common(libxl__gc *gc, void *fdt, uint64_t base,
uint32_t irq, uint32_t backend_domid,
@@ -1450,6 +1473,9 @@ next_resize:
if (iommu_needed)
FDT( make_xen_iommu_node(gc, fdt) );
+ if (info->tpm.version)
+ FDT( make_tpm_node(gc, fdt) );
+
if (pfdt)
FDT( copy_partial_fdt(gc, fdt, pfdt) );
@@ -1860,6 +1886,16 @@ int libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
return ERROR_FAIL;
}
+ /* The xenpvh machine only provides a TIS TPM interface. */
+ if (b_info->tpm.version) {
+ if (b_info->tpm.interface == LIBXL_TPM_INTERFACE_DEFAULT)
+ b_info->tpm.interface = LIBXL_TPM_INTERFACE_TIS;
+ if (b_info->tpm.interface != LIBXL_TPM_INTERFACE_TIS) {
+ LOG(ERROR, "Only the tis TPM interface is supported on Arm.");
+ return ERROR_INVAL;
+ }
+ }
+
/* Sanitise SVE parameter */
if (b_info->arch_arm.sve_vl) {
unsigned int max_sve_vl =
@@ -1949,6 +1985,17 @@ bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc)
return true;
}
+char *libxl__arch_pv_pvh_machinearg(libxl__gc *gc,
+ const libxl_domain_build_info *b_info)
+{
+ uint64_t tpm_base = GUEST_TPM_BASE;
+
+ if (b_info->tpm.version)
+ return GCSPRINTF("xenpvh,tpm-base-addr=0x%"PRIx64, tpm_base);
+
+ return libxl__strdup(gc, "xenpvh");
+}
+
/*
* Local variables:
* mode: C
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 843b8e29eb..ebdd05586e 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -18,6 +18,7 @@
#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
+#include "libxl_arch.h"
#include <xen/hvm/e820.h>
#include <sys/types.h>
@@ -1573,7 +1574,12 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
switch (b_info->type) {
case LIBXL_DOMAIN_TYPE_PVH:
case LIBXL_DOMAIN_TYPE_PV:
- flexarray_append(dm_args, "xenpv");
+ machinearg = libxl__arch_pv_pvh_machinearg(gc, b_info);
+ flexarray_append(dm_args, machinearg);
+
+ if (b_info->tpm.version)
+ libxl__dm_add_tpm_args(gc, dm_args, guest_domid);
+
for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
flexarray_append(dm_args, b_info->extra_pv[i]);
break;
@@ -3892,6 +3898,12 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config)
goto out;
}
+ /* QEMU provides the emulated TPM, e.g. via the ARM xenpvh machine. */
+ if (d_config->b_info.tpm.version) {
+ ret = 1;
+ goto out;
+ }
+
for (idx = 0;; idx++) {
dt = device_type_tbl[idx];
if (!dt)
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 3182cfc9df..a6e9ad777e 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -937,6 +937,12 @@ bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc)
return false;
}
+char *libxl__arch_pv_pvh_machinearg(libxl__gc *gc,
+ const libxl_domain_build_info *b_info)
+{
+ return libxl__strdup(gc, "xenpv");
+}
+
int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
{
int pirq = -1, gsi, r;
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 5d15f572c7..efb45eb33c 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -452,6 +452,10 @@ typedef uint64_t xen_callback_t;
#define GUEST_VPCI_ECAM_BASE xen_mk_ullong(0x10000000)
#define GUEST_VPCI_ECAM_SIZE xen_mk_ullong(0x10000000)
+/* Emulated TPM (TIS over MMIO) */
+#define GUEST_TPM_BASE xen_mk_ullong(0x0c000000)
+#define GUEST_TPM_SIZE xen_mk_ullong(0x00005000)
+
/* ACPI tables physical address */
#define GUEST_ACPI_BASE xen_mk_ullong(0x20000000)
#define GUEST_ACPI_SIZE xen_mk_ullong(0x02000000)
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] tools/libxl: add emulated TPM support backed by swtpm
2026-11-06 23:15 ` [PATCH 3/4] tools/libxl: add emulated TPM support backed by swtpm Jason Andryuk
@ 2026-11-09 19:54 ` Nick Rosbrook
0 siblings, 0 replies; 10+ messages in thread
From: Nick Rosbrook @ 2026-11-09 19:54 UTC (permalink / raw)
To: Jason Andryuk; +Cc: xen-devel, Anthony PERARD, George Dunlap, Juergen Gross
On Fri, Nov 6, 2026 at 6:15 PM Jason Andryuk <jason.andryuk@amd.com> wrote:
>
> Add support for an emulated TPM. QEMU emulates the device and uses
> swtpm for the backend. swtpm is started first and QEMU connects to it.
>
> Add the xl.cfg options are:
> tpm_version
> tpm_statedir
> tpm_statefile
> tpm_interface
> tpm_loglevel
> tpm_swtpm_override
>
> When tpm_version is absent, no TPM is configured. tpm_version must be 1
> or 2, and exactly one of tpm_statedir or tpm_statefile must be
> specified. tpm_statefile is only supported for swtpm 0.7 and later, so
> tpm_statedir is provided for compatiblity. tpm_interface can be either
> tis or crb. tpm_loglevel is passed to swtpm when non-zero, with swtpm
> logging to /var/log/xen/swtpm-<domain>.log. tpm_swtpm_override specifies
> the swtpm executable path; otherwise swtpm is found via PATH.
>
> On x86, TPM 1.2 only supports TIS, while TPM 2.0 may use either and
> defaults to CRB.
>
> libxl typically tracks spawned daemons through xenstore keys - like QEMU
> writing its "state" key as "running". swtpm does not write to
> xenstores, so that is not used. Instead the daemon is launched first
> and then QEMU launches and connects to it. If there is a failure,
> the QEMU log messages will list tpm in the error message.
>
> `interface` is a Go keyword, so the binding generator needs to specify
> that.
>
For the tools/golang changes:
Acked-by: Nick Rosbrook <enr0n@ubuntu.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface
2026-11-06 23:15 ` [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface Jason Andryuk
@ 2026-11-16 13:30 ` Jan Beulich
2026-11-18 1:15 ` Jason Andryuk
0 siblings, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2026-11-16 13:30 UTC (permalink / raw)
To: Jason Andryuk; +Cc: Anthony PERARD, xen-devel
On 07.11.2026 00:15, Jason Andryuk wrote:
> --- a/tools/libacpi/Makefile
> +++ b/tools/libacpi/Makefile
> @@ -16,7 +16,7 @@ C_SRC-$(CONFIG_ARM_64) = dsdt_anycpu_arm.c
> DSDT_FILES ?= $(C_SRC-y)
> C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, $(DSDT_FILES))
> H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h)
> -H_SRC += $(addprefix $(ACPI_BUILD_DIR)/, ssdt_tpm.h ssdt_tpm2.h ssdt_laptop_slate.h)
> +H_SRC += $(addprefix $(ACPI_BUILD_DIR)/, ssdt_tpm.h ssdt_tpm2.h ssdt_tpm2_tis.h ssdt_laptop_slate.h)
I think it's time to wrap this line.
> --- a/tools/libacpi/build.c
> +++ b/tools/libacpi/build.c
> @@ -11,6 +11,7 @@
> #include "ssdt_s4.h"
> #include "ssdt_tpm.h"
> #include "ssdt_tpm2.h"
> +#include "ssdt_tpm2_tis.h"
> #include "ssdt_pm.h"
> #include "ssdt_laptop_slate.h"
> #include <xen/hvm/hvm_info_table.h>
> @@ -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?
> + {
> + if ( config->tis_hdr[0] == 0 || config->tis_hdr[0] == 0xffff ||
> + config->tis_hdr[1] == 0 || config->tis_hdr[1] == 0xffff )
> + break;
>
> - ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2), 16);
> - if (!ssdt) return -1;
> - memcpy(ssdt, ssdt_tpm2, sizeof(ssdt_tpm2));
> + ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2_tis), 16);
> + if (!ssdt) return -1;
Please can we not gain further instances of this style-violating code? It
would be nice if ...
> + 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)?
> @@ -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.
> --- /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?)
Jan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] hvmloader: Support the TIS interface for TPM 2.0
2026-11-06 23:15 ` [PATCH 2/4] hvmloader: Support the TIS interface for TPM 2.0 Jason Andryuk
@ 2026-11-16 13:36 ` Jan Beulich
0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2026-11-16 13:36 UTC (permalink / raw)
To: Jason Andryuk
Cc: Juergen Gross, Julien Grall, Andrew Cooper, Roger Pau Monné,
Teddy Astie, Anthony PERARD, xen-devel
On 07.11.2026 00:15, Jason Andryuk wrote:
> --- a/tools/firmware/hvmloader/util.c
> +++ b/tools/firmware/hvmloader/util.c
> @@ -922,7 +922,17 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
>
> case 2:
> config->table_flags |= ACPI_HAS_TPM;
> - config->crb_id = (uint16_t *)TPM_CRB_INTF_ID;
> + if ( !strcmp(xenstore_read("platform/tpm-interface", "crb"),
> + "tis") )
If you only care about the result being (not) equal to "tis", why pass in
"crb"? Preferably with "" passed in:
Acked-by: Jan Beulich <jbeulich@suse.com> # tools/firmware/hvmloader/
Jan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface
2026-11-16 13:30 ` Jan Beulich
@ 2026-11-18 1:15 ` Jason Andryuk
2026-11-18 7:34 ` Jan Beulich
0 siblings, 1 reply; 10+ messages in thread
From: Jason Andryuk @ 2026-11-18 1:15 UTC (permalink / raw)
To: Jan Beulich; +Cc: Anthony PERARD, xen-devel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface
2026-11-18 1:15 ` Jason Andryuk
@ 2026-11-18 7:34 ` Jan Beulich
0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2026-11-18 7:34 UTC (permalink / raw)
To: Jason Andryuk; +Cc: Anthony PERARD, xen-devel
On 18.11.2026 02:15, Jason Andryuk wrote:
> 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.
I see. Something assert()-like on the else path may then be nice, except that
the way libacpi is used (and there being no abstraction of it) this may not be
possible in practice.
>>> --- /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?
Yes, this would then also serve as grep fodder.
Jan
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-18 7:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 23:15 [PATCH 0/4] libxl TPM emulator support Jason Andryuk
2026-11-06 23:15 ` [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface Jason Andryuk
2026-11-16 13:30 ` Jan Beulich
2026-11-18 1:15 ` Jason Andryuk
2026-11-18 7:34 ` Jan Beulich
2026-11-06 23:15 ` [PATCH 2/4] hvmloader: Support the TIS interface for TPM 2.0 Jason Andryuk
2026-11-16 13:36 ` Jan Beulich
2026-11-06 23:15 ` [PATCH 3/4] tools/libxl: add emulated TPM support backed by swtpm Jason Andryuk
2026-11-09 19:54 ` Nick Rosbrook
2026-11-06 23:15 ` [PATCH 4/4] libxl: Add emulated TPM support on ARM Jason Andryuk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.