Support for TPM command line options
This patch adds support for TPM command line options.
The command line options supported here are
./qemu-... -tpmdev passthrough,path=<path to TPM device>,id=<id>
-device tpm-tis,tpmdev=<id>,id=<other id>
and
./qemu-... -tpmdev help
where the latter works similar to -soundhw help and shows a list of
available TPM backends (for example 'passthrough').
Using the type parameter, the backend is chosen, i.e., 'passthrough' for the
passthrough driver. The interpretation of the other parameters along
with determining whether enough parameters were provided is pushed into
the backend driver, which needs to implement the interface function
'create' and return a TPMDriverOpts structure if the VM can be started or
'NULL' if not enough or bad parameters were provided.
Monitor support for 'info tpm' has been added. It for example prints the
following:
(qemu) info tpm
TPM devices:
tpm0: model=tpm-tis
\ tpm0: type=passthrough,path=/dev/tpm0,cancel-path=/sys/devices/pnp0/00:09/cancel
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-2-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-27 21:47:49 +04:00
|
|
|
/*
|
|
|
|
* Public TPM functions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011-2013 IBM Corporation
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Stefan Berger <stefanb@us.ibm.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
#ifndef QEMU_TPM_H
|
|
|
|
#define QEMU_TPM_H
|
|
|
|
|
|
|
|
#include "qemu/option.h"
|
|
|
|
|
2013-03-28 15:26:21 +04:00
|
|
|
typedef struct TPMState TPMState;
|
|
|
|
|
Support for TPM command line options
This patch adds support for TPM command line options.
The command line options supported here are
./qemu-... -tpmdev passthrough,path=<path to TPM device>,id=<id>
-device tpm-tis,tpmdev=<id>,id=<other id>
and
./qemu-... -tpmdev help
where the latter works similar to -soundhw help and shows a list of
available TPM backends (for example 'passthrough').
Using the type parameter, the backend is chosen, i.e., 'passthrough' for the
passthrough driver. The interpretation of the other parameters along
with determining whether enough parameters were provided is pushed into
the backend driver, which needs to implement the interface function
'create' and return a TPMDriverOpts structure if the VM can be started or
'NULL' if not enough or bad parameters were provided.
Monitor support for 'info tpm' has been added. It for example prints the
following:
(qemu) info tpm
TPM devices:
tpm0: model=tpm-tis
\ tpm0: type=passthrough,path=/dev/tpm0,cancel-path=/sys/devices/pnp0/00:09/cancel
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-2-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-27 21:47:49 +04:00
|
|
|
int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
|
|
|
|
int tpm_init(void);
|
|
|
|
void tpm_cleanup(void);
|
|
|
|
|
2015-05-26 23:51:05 +03:00
|
|
|
typedef enum TPMVersion {
|
|
|
|
TPM_VERSION_UNSPEC = 0,
|
|
|
|
TPM_VERSION_1_2 = 1,
|
|
|
|
TPM_VERSION_2_0 = 2,
|
|
|
|
} TPMVersion;
|
|
|
|
|
2015-05-26 23:51:07 +03:00
|
|
|
TPMVersion tpm_tis_get_tpm_version(Object *obj);
|
|
|
|
|
2014-08-12 00:33:36 +04:00
|
|
|
#define TYPE_TPM_TIS "tpm-tis"
|
|
|
|
|
2015-05-26 23:51:07 +03:00
|
|
|
static inline TPMVersion tpm_get_version(void)
|
2014-08-12 00:33:36 +04:00
|
|
|
{
|
2015-06-02 16:47:20 +03:00
|
|
|
#ifdef CONFIG_TPM
|
2015-05-26 23:51:07 +03:00
|
|
|
Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
|
|
|
|
|
|
|
|
if (obj) {
|
|
|
|
return tpm_tis_get_tpm_version(obj);
|
|
|
|
}
|
2015-06-02 16:47:20 +03:00
|
|
|
#endif
|
2015-05-26 23:51:07 +03:00
|
|
|
return TPM_VERSION_UNSPEC;
|
2014-08-12 00:33:36 +04:00
|
|
|
}
|
|
|
|
|
Support for TPM command line options
This patch adds support for TPM command line options.
The command line options supported here are
./qemu-... -tpmdev passthrough,path=<path to TPM device>,id=<id>
-device tpm-tis,tpmdev=<id>,id=<other id>
and
./qemu-... -tpmdev help
where the latter works similar to -soundhw help and shows a list of
available TPM backends (for example 'passthrough').
Using the type parameter, the backend is chosen, i.e., 'passthrough' for the
passthrough driver. The interpretation of the other parameters along
with determining whether enough parameters were provided is pushed into
the backend driver, which needs to implement the interface function
'create' and return a TPMDriverOpts structure if the VM can be started or
'NULL' if not enough or bad parameters were provided.
Monitor support for 'info tpm' has been added. It for example prints the
following:
(qemu) info tpm
TPM devices:
tpm0: model=tpm-tis
\ tpm0: type=passthrough,path=/dev/tpm0,cancel-path=/sys/devices/pnp0/00:09/cancel
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-2-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-27 21:47:49 +04:00
|
|
|
#endif /* QEMU_TPM_H */
|