aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2013-04-22 10:41:39 -0400
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-23 10:40:40 -0500
commitbb71623811686ce3c34ce724f073f5c5dd95f51b (patch)
tree2d5dba20544e7890c1923f066d28d6c0ecdcecaa /hw
parent13daf6cad05a65970381cd8b876426d55133aadf (diff)
Move TPM passthrough specific command line options to backend structure
Move the TPM passthrough specific command line options to the passthrough backend implementation and attach them to the backend's interface structure. Add code to tpm.c for validating the TPM command line options. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Corey Bryan <coreyb@linux.vnet.ibm.com> Message-id: 1366641699-21420-1-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/tpm/tpm_int.h7
-rw-r--r--hw/tpm/tpm_passthrough.c16
2 files changed, 23 insertions, 0 deletions
diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h
index 08f87cb9a8..2f582caaee 100644
--- a/hw/tpm/tpm_int.h
+++ b/hw/tpm/tpm_int.h
@@ -33,6 +33,13 @@ struct TPMState {
#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
+#define TPM_STANDARD_CMDLINE_OPTS \
+ { \
+ .name = "type", \
+ .type = QEMU_OPT_STRING, \
+ .help = "Type of TPM backend", \
+ }
+
struct tpm_req_hdr {
uint16_t tag;
uint32_t len;
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index ce74e97043..56e9e0f8a2 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -488,8 +488,24 @@ static void tpm_passthrough_destroy(TPMBackend *tb)
g_free(tpm_pt->tpm_dev);
}
+static const QemuOptDesc tpm_passthrough_cmdline_opts[] = {
+ TPM_STANDARD_CMDLINE_OPTS,
+ {
+ .name = "cancel-path",
+ .type = QEMU_OPT_STRING,
+ .help = "Sysfs file entry for canceling TPM commands",
+ },
+ {
+ .name = "path",
+ .type = QEMU_OPT_STRING,
+ .help = "Path to TPM device on the host",
+ },
+ { /* end of list */ },
+};
+
static const TPMDriverOps tpm_passthrough_driver = {
.type = TPM_TYPE_PASSTHROUGH,
+ .opts = tpm_passthrough_cmdline_opts,
.desc = tpm_passthrough_create_desc,
.create = tpm_passthrough_create,
.destroy = tpm_passthrough_destroy,