From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkaJL-0001on-If for qemu-devel@nongnu.org; Thu, 06 Jun 2013 09:33:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkaJG-0001Qq-NU for qemu-devel@nongnu.org; Thu, 06 Jun 2013 09:33:03 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:44366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkaJG-0001Q7-Il for qemu-devel@nongnu.org; Thu, 06 Jun 2013 09:32:58 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Jun 2013 09:32:55 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id EF29EC9003E for ; Thu, 6 Jun 2013 09:32:52 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r56DWres286852 for ; Thu, 6 Jun 2013 09:32:53 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r56DWrjj025614 for ; Thu, 6 Jun 2013 10:32:53 -0300 From: Corey Bryant Date: Thu, 6 Jun 2013 09:32:44 -0400 Message-Id: <1370525564-16912-3-git-send-email-coreyb@linux.vnet.ibm.com> In-Reply-To: <1370525564-16912-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1370525564-16912-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v3 2/3] nvram: Add tpm-tis drive support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanb@linux.vnet.ibm.com, Corey Bryant , mdroth@linux.vnet.ibm.com, jschopp@linux.vnet.ibm.com, stefanha@redhat.com Add a drive property to the tpm-tis device and initialize the TPM NVRAM if a drive is specified. Signed-off-by: Corey Bryant --- v2 -No changes v3 -No changes --- hw/tpm/tpm_int.h | 2 ++ hw/tpm/tpm_tis.c | 8 ++++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h index 2f582ca..05471ef 100644 --- a/hw/tpm/tpm_int.h +++ b/hw/tpm/tpm_int.h @@ -29,6 +29,8 @@ struct TPMState { char *backend; TPMBackend *be_driver; + + BlockDriverState *bdrv; }; #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index d4d8152..8648b3b 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -27,6 +27,7 @@ #include "hw/i386/pc.h" #include "hw/pci/pci_ids.h" #include "tpm_tis.h" +#include "tpm_nvram.h" #include "qemu-common.h" /*#define DEBUG_TIS */ @@ -849,6 +850,7 @@ static Property tpm_tis_properties[] = { DEFINE_PROP_UINT32("irq", TPMState, s.tis.irq_num, TPM_TIS_IRQ), DEFINE_PROP_STRING("tpmdev", TPMState, backend), + DEFINE_PROP_DRIVE("drive", TPMState, bdrv), DEFINE_PROP_END_OF_LIST(), }; @@ -864,6 +866,12 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp) return; } + if (s->bdrv && tpm_nvram_init(s->bdrv)) { + error_setg(errp, "tpm_tis: backend drive with id %s could not " + "initialize TPM NVRAM drive", s->backend); + return; + } + s->be_driver->fe_model = TPM_MODEL_TPM_TIS; if (tpm_backend_init(s->be_driver, s, tpm_tis_receive_cb)) { -- 1.7.1