All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, aliguori@us.ibm.com,
	stefanb@linux.vnet.ibm.com,
	Corey Bryant <coreyb@linux.vnet.ibm.com>,
	mdroth@linux.vnet.ibm.com, jschopp@linux.vnet.ibm.com,
	stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/3] nvram: Add tpm-tis drive support
Date: Wed,  5 Jun 2013 16:48:00 -0400	[thread overview]
Message-ID: <1370465280-31072-3-git-send-email-coreyb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1370465280-31072-1-git-send-email-coreyb@linux.vnet.ibm.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 <coreyb@linux.vnet.ibm.com>
---
v2
  -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

      parent reply	other threads:[~2013-06-05 20:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 20:47 [Qemu-devel] [PATCH v2 0/3] TPM NVRAM persistent storage Corey Bryant
2013-06-05 20:47 ` [Qemu-devel] [PATCH v2 1/3] nvram: Add TPM NVRAM implementation Corey Bryant
2013-06-06  9:22   ` Stefan Hajnoczi
2013-06-06 13:32     ` Corey Bryant
2013-06-05 20:48 ` Corey Bryant [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370465280-31072-3-git-send-email-coreyb@linux.vnet.ibm.com \
    --to=coreyb@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=jschopp@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.