diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2015-05-26 16:51:05 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-05-31 20:29:02 +0200 |
commit | 116694c34aa794a994051fce55bfee418fe1521d (patch) | |
tree | a39a2b1c07f50854b990705b347b8e2f2f73a6d9 /include | |
parent | 38d40ff10f71657ea913a63d1f8477be368b92c1 (diff) |
Extend TPM TIS interface to support TPM 2
Following the recent upgrade to version 1.3, extend the TPM TIS
interface with capabilities introduced for support of a TPM 2.
TPM TIS for TPM 2 introduced the following extensions beyond the
TPM TIS 1.3 (used for TPM 1.2):
- A new 32bit interface Id register was introduced.
- New flags for the status (STS) register were defined.
- New flags for the capability flags were defined.
Support the above if a TPM TIS 1.3 for TPM 2 is used with a TPM 2
on the backend side. Support the old TPM TIS 1.3 configuration if a
TPM 1.2 is being used. A subsequent patch will then determine which
TPM version is being used in the backend.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sysemu/tpm.h | 6 | ||||
-rw-r--r-- | include/sysemu/tpm_backend.h | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index 9b81ce9189..848df412db 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -20,6 +20,12 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg); int tpm_init(void); void tpm_cleanup(void); +typedef enum TPMVersion { + TPM_VERSION_UNSPEC = 0, + TPM_VERSION_1_2 = 1, + TPM_VERSION_2_0 = 2, +} TPMVersion; + #define TYPE_TPM_TIS "tpm-tis" static inline bool tpm_find(void) diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index 540ee25477..0a366be0f2 100644 --- a/include/sysemu/tpm_backend.h +++ b/include/sysemu/tpm_backend.h @@ -88,6 +88,10 @@ struct TPMDriverOps { void (*cancel_cmd)(TPMBackend *t); bool (*get_tpm_established_flag)(TPMBackend *t); + + int (*reset_tpm_established_flag)(TPMBackend *t, uint8_t locty); + + TPMVersion (*get_tpm_version)(TPMBackend *t); }; @@ -192,6 +196,15 @@ void tpm_backend_cancel_cmd(TPMBackend *s); bool tpm_backend_get_tpm_established_flag(TPMBackend *s); /** + * tpm_backend_reset_tpm_established_flag: + * @s: the backend + * @locty: the locality number + * + * Reset the TPM establishment flag. + */ +int tpm_backend_reset_tpm_established_flag(TPMBackend *s, uint8_t locty); + +/** * tpm_backend_open: * @s: the backend to open * @errp: a pointer to return the #Error object if an error occurs. @@ -201,6 +214,16 @@ bool tpm_backend_get_tpm_established_flag(TPMBackend *s); */ void tpm_backend_open(TPMBackend *s, Error **errp); +/** + * tpm_backend_get_tpm_version: + * @s: the backend to call into + * + * Get the TPM Version that is emulated at the backend. + * + * Returns TPMVersion. + */ +TPMVersion tpm_backend_get_tpm_version(TPMBackend *s); + TPMBackend *qemu_find_tpm(const char *id); const TPMDriverOps *tpm_get_backend_driver(const char *type); |