Hi, This patch series introduces TPM device emulation in QEMU.
The emulation is divided into a device frontend implementing the TPM TIS 1.2 interface (specification available at [1]) and a framework for implementation specific backend drivers which are used by the frontend. A backend driver for direct passthrough of a TPM device using the host driver on a Linux system is provided and is enabled by passing '-tpm type=host,path=...,id=...' to QEMU. Since the Linux TPM driver requires blocking I/O to the TPM device, a custom thread or a threadlet (using the threadlet patch series on this list, see last patch) is needed for handling I/O operations in the host backend. The frontend is integrated into the qdev device framework and can be enabled using the '-device' argument specifying a valid backend driver, e.g.: qemu ... -tpm type=host,path=/dev/tpm0,id=tpm0 -device tpm,backend=tpm0 When the frontend is enabled, a SSDT ACPI table containing the device description for hotplugging is loaded using the fw_cfg runtime configuration interface to SeaBIOS. This device emulation can be tested by loading an image and installing the jTPMTools and the jTSS stack which ships a set of unit tests itself and is available on [2]. Testing can also be done using the character device provided by the TPM emulator [3] with the tpmd_dev kernel module. This patch series is used in the acTvSM trusted virtualization platform which also is available on [2]. Regards, Andreas Niederl [1] https://www.trustedcomputinggroup.org/ [2] http://trustedjava.sourceforge.net/ [3] http://tpm-emulator.berlios.de/ Andreas Niederl (5): Add TPM 1.2 device interface Provide SSDT for enabled TPM device Add TPM host passthrough device backend. Add configure script and command line options for TPM interface. Adapt TPM host backend to use threadlets Makefile.objs | 3 + Makefile.target | 3 + configure | 9 + hw/acpi.c | 28 ++ hw/pc.h | 1 + hw/tpm.h | 24 ++ hw/tpm_acpi.c | 40 +++ hw/tpm_backend.c | 78 ++++++ hw/tpm_host_backend.c | 235 ++++++++++++++++ hw/tpm_int.h | 56 ++++ hw/tpm_ssdt.dsl | 55 ++++ hw/tpm_ssdt.hex | 41 +++ hw/tpm_tis.c | 706 +++++++++++++++++++++++++++++++++++++++++++++++++ qemu-config.c | 16 ++ qemu-config.h | 1 + qemu-options.hx | 6 + rules.mak | 7 +- vl.c | 45 +++ 18 files changed, 1353 insertions(+), 1 deletions(-) create mode 100644 hw/tpm.h create mode 100644 hw/tpm_acpi.c create mode 100644 hw/tpm_backend.c create mode 100644 hw/tpm_host_backend.c create mode 100644 hw/tpm_int.h create mode 100644 hw/tpm_ssdt.dsl create mode 100644 hw/tpm_ssdt.hex create mode 100644 hw/tpm_tis.c -- 1.7.4.1