From patchwork Tue Jun 4 18:18:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Bryant X-Patchwork-Id: 248796 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 698492C009C for ; Wed, 5 Jun 2013 04:21:49 +1000 (EST) Received: from localhost ([::1]:56259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujvrf-00025S-GR for incoming@patchwork.ozlabs.org; Tue, 04 Jun 2013 14:21:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujvq3-0000Gi-BK for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:20:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ujvq0-0004m5-5g for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:20:07 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:58084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujvpz-0004lK-6I for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:20:04 -0400 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Jun 2013 12:20:01 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 4 Jun 2013 12:19:07 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 2EE6D3E40087 for ; Tue, 4 Jun 2013 12:18:48 -0600 (MDT) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r54IJ9oh102694 for ; Tue, 4 Jun 2013 12:19:09 -0600 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r54IJ4FI010493 for ; Tue, 4 Jun 2013 12:19:04 -0600 Received: from localhost ([9.80.98.244]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r54IJ32p010435; Tue, 4 Jun 2013 12:19:03 -0600 From: Corey Bryant To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2013 14:18:41 -0400 Message-Id: <1370369921-14925-3-git-send-email-coreyb@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370369921-14925-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1370369921-14925-1-git-send-email-coreyb@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13060418-5518-0000-0000-00000F555D19 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.110.159 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 Subject: [Qemu-devel] [PATCH 2/2] nvram: Add tpm-tis drive support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a drive property to the tpm-tis device and initialize the TPM NVRAM if a drive is specified. Signed-off-by: Corey Bryant --- 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)) {