Implement a TPM 2.0 emulation backend to connect to a running swtpm instance using a UNIX domain socket.
For this to work, swtpm needs to be running and listening to a socket already. For testing, it can be started like this:
# swtpm socket --tpmstate backend-uri=file:///path/to/tpm.state --tpm2 --server type=unixio,path=/path/to/tpm.socket --log file=/path/to/tpm.log --flags not-need-init --daemon # bhyve [...] [...] -l tpm,swtpm,/path/to/tpm.socket [...]
The swtpm backend doesn't do much error handling at this point. If the connection to the swtpm process is lost while bhyve attempts to use it, it will simply stop the VM.