From 92dcc234ec1f266fb5d59bed77d66320c2c75965 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Wed, 27 Feb 2013 12:47:54 -0500 Subject: Add support for cancelling of a TPM command This patch adds support for cancelling an executing TPM command. In Linux for example a user can cancel a command through the TPM's sysfs 'cancel' entry using echo "1" > /sysfs/class/misc/tpm0/device/cancel This patch propagates the cancellation of a command inside a VM to the host TPM's sysfs entry. It also uses the possibility to cancel the command before QEMU VM shutdown or reboot, which helps in preventing QEMU from hanging while waiting for the completion of the command. To relieve higher layers or users from having to determine the TPM's cancel sysfs entry, the driver searches for the entry in well known locations. Signed-off-by: Stefan Berger Reviewed-by: Corey Bryant Reviewed-by: Joel Schopp Message-id: 1361987275-26289-7-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori --- qemu-options.hx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'qemu-options.hx') diff --git a/qemu-options.hx b/qemu-options.hx index 0be16b4d76..30fb85d619 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2221,8 +2221,10 @@ DEFHEADING() DEFHEADING(TPM device options:) DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \ - "-tpmdev passthrough,id=id[,path=path]\n" - " use path to provide path to a character device; default is /dev/tpm0\n", + "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n" + " use path to provide path to a character device; default is /dev/tpm0\n" + " use cancel-path to provide path to TPM's cancel sysfs entry; if\n" + " not provided it will be searched for in /sys/class/misc/tpm?/device\n", QEMU_ARCH_ALL) STEXI @@ -2244,7 +2246,7 @@ Use 'help' to print all available TPM backend types. qemu -tpmdev help @end example -@item -tpmdev passthrough, id=@var{id}, path=@var{path} +@item -tpmdev passthrough, id=@var{id}, path=@var{path}, cancel-path=@var{cancel-path} (Linux-host only) Enable access to the host's TPM using the passthrough driver. @@ -2253,6 +2255,11 @@ driver. a Linux host this would be @code{/dev/tpm0}. @option{path} is optional and by default @code{/dev/tpm0} is used. +@option{cancel-path} specifies the path to the host TPM device's sysfs +entry allowing for cancellation of an ongoing TPM command. +@option{cancel-path} is optional and by default QEMU will search for the +sysfs entry to use. + Some notes about using the host's TPM with the passthrough driver: The TPM device accessed by the passthrough driver must not be -- cgit v1.2.1