]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tpm_tis: Return TPM_VERSION_UNSPEC in case of BE failure
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Sat, 11 Nov 2017 03:07:35 +0000 (22:07 -0500)
committerStefan Berger <Stefan Berger stefanb@linux.vnet.ibm.com>
Wed, 15 Nov 2017 11:47:35 +0000 (06:47 -0500)
In case the backend has a failure, such as the tpm_emulator's CMD_INIT
failing, the TIS goes into failure mode and does not respond to reads
or writes to MMIO registers. In this case we need to prevent the ACPI
table from being added and the straight-forward way is to indicate that
there's no known TPM version being used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
hw/tpm/tpm_tis.c

index 7402528b256ce69d6125fa8082f985b351c7a734..fec2fc617a39c380f49f8b766c60fd6df9867b70 100644 (file)
@@ -1008,6 +1008,10 @@ TPMVersion tpm_tis_get_tpm_version(Object *obj)
 {
     TPMState *s = TPM(obj);
 
+    if (tpm_backend_had_startup_error(s->be_driver)) {
+        return TPM_VERSION_UNSPEC;
+    }
+
     return tpm_backend_get_tpm_version(s->be_driver);
 }