mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
Add a TPM Passthrough backend driver implementation
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> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Message-id: 1361987275-26289-6-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
ab214c2960
commit
4549a8b7ee
9 changed files with 599 additions and 1 deletions
24
qemu-char.c
24
qemu-char.c
|
@ -533,6 +533,30 @@ int send_all(int fd, const void *_buf, int len1)
|
|||
}
|
||||
return len1 - len;
|
||||
}
|
||||
|
||||
int recv_all(int fd, void *_buf, int len1, bool single_read)
|
||||
{
|
||||
int ret, len;
|
||||
uint8_t *buf = _buf;
|
||||
|
||||
len = len1;
|
||||
while ((len > 0) && (ret = read(fd, buf, len)) != 0) {
|
||||
if (ret < 0) {
|
||||
if (errno != EINTR && errno != EAGAIN) {
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
if (single_read) {
|
||||
return ret;
|
||||
}
|
||||
buf += ret;
|
||||
len -= ret;
|
||||
}
|
||||
}
|
||||
return len1 - len;
|
||||
}
|
||||
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
typedef struct IOWatchPoll
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue