Skip to content

No TPM support for riscv64 in QEMU

Dear Sir,

Problem

I would like to mount the tpm device to my riscv64 qemu virtual machine. The command are:

swtpm socket --tpmstate dir=/tmp/mytpm1 --tpm2 \ --ctrl type=unixio,path=/tmp/mytpm1/swtpm-sock \ --log level=20 -d
qemu-system-riscv64 -nographic -machine virt -m 4G -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 -append "console=ttyS0 rw root=/dev/vda1" -device virtio-blk-device,drive=hd0 -drive file=rootfs.img,format=raw,id=hd0 -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22 \ -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0

And the response is:

qemu-system-riscv64: -tpmdev emulator,id=tpm0,chardev=chrtpm: Parameter 'type' expects a TPM backend type No TPM backend types are available

For for some version, the response is:

Failed to connect to '/tmp/mytpm1/swtpm-sock' : Connection refused

I've tested the qemu-system-x86 which can boot successfully but riscv64.

Desktop

OS: Ubuntu 20.04 in Vmware Workstation

Linux Version 5.13.0-37-generic

Versions of relevant components

swtpm: 0.7.0

QEMU: version 6.2.50 (v6.1.0-rc1-3124-g8d29feca)

PS: I've tested various version of swtpm and qemu but the problem still.

Reply from the author of swtpm

I've opened this issue in swtpm's git, and the respond is

image

Appreciate for your noticing and considering.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information