Comments

From Andreas Niederl's original posting with adaptations where necessary:
This patch is based of off version 9 of Stefan Berger's patch series
"QEMU Trusted Platform Module (TPM) integration"
and adds a new backend driver for it.
This patch adds a passthrough backend driver for passing commands sent to the
emulated TPM device directly to a TPM device opened on the host machine.
Thus it is possible to use a hardware TPM device in a system running on QEMU,
providing the ability to access a TPM in a special state (e.g. after a Trusted
Boot).
This functionality is being used in the acTvSM Trusted Virtualization Platform
which is available on [1].
Usage example:
qemu-system-x86_64 -tpmdev passthrough,id=tpm0,path=/dev/tpm0 \
-device tpm-tis,tpmdev=tpm0 \
-cdrom test.iso -boot d
Some notes about the host TPM:
The TPM needs to be enabled and activated. If that's not the case one
has to go through the BIOS/UEFI and enable and activate that TPM for TPM
commands to work as expected.
It may be necessary to boot the kernel using tpm_tis.force=1 in the boot
command line or 'modprobe tpm_tis force=1' in case of using it as a module.
Regards,
Andreas Niederl, Stefan Berger
[1] http://trustedjava.sourceforge.net/
Signed-off-by: Andreas Niederl <andreas.niederl@iaik.tugraz.at>Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
---
include/qemu/sockets.h | 1 +
qemu-char.c | 24 +++
qemu-options.hx | 36 ++++-
tpm/Makefile.objs | 4 +-
tpm/tpm.c | 14 ++
tpm/tpm_backend.c | 58 ++++++++
tpm/tpm_backend.h | 45 ++++++
tpm/tpm_int.h | 33 +++++
tpm/tpm_passthrough.c | 386 +++++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 599 insertions(+), 2 deletions(-)
create mode 100644 tpm/tpm_backend.c
create mode 100644 tpm/tpm_backend.h
create mode 100644 tpm/tpm_passthrough.c