diff options
author | Ninad Palsule <ninad@linux.ibm.com> | 2023-04-14 17:07:54 -0500 |
---|---|---|
committer | Stefan Berger <stefanb@linux.ibm.com> | 2023-04-20 08:17:15 -0400 |
commit | 139fdb3ed8f593b03f78ec9984467562331ef98c (patch) | |
tree | 39aab76b42f9a3532f4990c1ee785f6a65db53f0 /hw/tpm/Kconfig | |
parent | bbadfb2e0af238576646e0fc8e0b5e4f4fe29648 (diff) | |
download | qemu-139fdb3ed8f593b03f78ec9984467562331ef98c.zip qemu-139fdb3ed8f593b03f78ec9984467562331ef98c.tar.gz qemu-139fdb3ed8f593b03f78ec9984467562331ef98c.tar.bz2 |
tpm: Add support for TPM device over I2C bus
Qemu already supports devices attached to ISA and sysbus. This drop adds
support for the I2C bus attached TPM devices. I2C model only supports
TPM2 protocol.
This commit includes changes for the common code.
- Added I2C emulation model. Logic was added in the model to temporarily
cache the data as I2C interface works per byte basis.
- New tpm type "tpm-tis-i2c" added for I2C support. The user has to
provide this string on command line.
Testing:
TPM I2C device module is tested using SWTPM (software based TPM
package). Qemu uses the rainier machine and is connected to swtpm over
the socket interface.
The command to start swtpm is as follows:
$ swtpm socket --tpmstate dir=/tmp/mytpm1 \
--ctrl type=unixio,path=/tmp/mytpm1/swtpm-sock \
--tpm2 --log level=100
The command to start qemu is as follows:
$ qemu-system-arm -M rainier-bmc -nographic \
-kernel ${IMAGEPATH}/fitImage-linux.bin \
-dtb ${IMAGEPATH}/aspeed-bmc-ibm-rainier.dtb \
-initrd ${IMAGEPATH}/obmc-phosphor-initramfs.rootfs.cpio.xz \
-drive file=${IMAGEPATH}/obmc-phosphor-image.rootfs.wic.qcow2,if=sd,index=2 \
-net nic -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443 \
-chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm \
-device tpm-tis-i2c,tpmdev=tpm0,bus=aspeed.i2c.bus.12,address=0x2e
Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Tested-by: Joel Stanley <joel@jms.id.au>
Message-id: 20230414220754.1191476-4-ninadpalsule@us.ibm.com
Diffstat (limited to 'hw/tpm/Kconfig')
-rw-r--r-- | hw/tpm/Kconfig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/tpm/Kconfig b/hw/tpm/Kconfig index 29e82f3..a466632 100644 --- a/hw/tpm/Kconfig +++ b/hw/tpm/Kconfig @@ -1,3 +1,10 @@ +config TPM_TIS_I2C + bool + depends on TPM + select TPM_BACKEND + select I2C + select TPM_TIS + config TPM_TIS_ISA bool depends on TPM && ISA_BUS |