aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-11-06 19:39:21 +0100
committerStefan Berger <stefanb@linux.vnet.ibm.com>2017-12-14 23:39:15 -0500
commit51a837e908d6f4bbe94469a4a0edcb76348fe964 (patch)
tree62bccf154b1174485ecc8542fbd31437fbde0a21
parentc87b35fa71833ec4c34fb4a85f03c47028c44d0e (diff)
downloadqemu-51a837e908d6f4bbe94469a4a0edcb76348fe964.zip
qemu-51a837e908d6f4bbe94469a4a0edcb76348fe964.tar.gz
qemu-51a837e908d6f4bbe94469a4a0edcb76348fe964.tar.bz2
tpm-tis: check that at most one TPM device exists
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
-rw-r--r--hw/tpm/tpm_tis.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 0a23203..db101b6 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -1061,6 +1061,11 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
{
TPMState *s = TPM(dev);
+ if (!tpm_find()) {
+ error_setg(errp, "at most one TPM device is permitted");
+ return;
+ }
+
s->be_driver = qemu_find_tpm_be(s->backend);
if (!s->be_driver) {
error_setg(errp, "backend driver with id %s could not be found",