From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org, mst@redhat.com
Cc: imammedo@redhat.com, kevin@koconnor.net, stefanb@us.ibm.com,
quan.xu@intel.com, Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v2 2/6] Introduce RAM location in vendor specific area in TIS
Date: Fri, 8 May 2015 12:15:16 -0400 [thread overview]
Message-ID: <1431101720-701152-3-git-send-email-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1431101720-701152-1-git-send-email-stefanb@linux.vnet.ibm.com>
Introduce RAM locations in the vendor specific area in the TIS. These
locations will survive a reset and will be part of the state written
during a suspend. Their purpose is to support the physical presence
interface where the OS (ACPI) and the firmware (SeaBIOS) use these RAM
locations to exchange data.
Only locality 0 is used, leaving localities 1-4 available for other extensions.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
hw/tpm/tpm_tis.c | 27 +++++++++++++++++++++++++++
hw/tpm/tpm_tis.h | 2 ++
2 files changed, 29 insertions(+)
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index daf2ac9..1fb4e17 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -61,6 +61,7 @@
/* vendor-specific registers */
#define TPM_TIS_REG_DEBUG 0xf90
+#define TPM_TIS_REG_RAM 0xfa0
#define TPM_TIS_STS_TPM_FAMILY_MASK (0x3 << 26)/* TPM 2.0 */
#define TPM_TIS_STS_TPM_FAMILY1_2 (0 << 26) /* TPM 2.0 */
@@ -503,6 +504,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
uint8_t locty = tpm_tis_locality_from_addr(addr);
uint32_t avail;
uint8_t v;
+ int c;
if (tpm_backend_had_startup_error(s->be_driver)) {
return val;
@@ -599,6 +601,18 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
tpm_tis_dump_state(opaque, addr);
break;
#endif
+ case TPM_TIS_REG_RAM ... 0xfff:
+ if (locty == 0) {
+ /* RAM only in locality 0 -- allow unaligned accesses */
+ offset = addr & 0xfff;
+ shift = 0;
+
+ for (c = size - 1; c >= 0; c--) {
+ val <<= 8;
+ val |= tis->locty0_ram[offset - TPM_TIS_REG_RAM + c];
+ }
+ }
+ break;
}
if (shift) {
@@ -938,6 +952,19 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
}
}
break;
+
+ case TPM_TIS_REG_RAM ... 0xfff:
+ if (locty == 0) {
+ /* RAM only in locality 0 -- allow unaligned accesses */
+ off = addr & 0xfff;
+ val >>= shift;
+ /* only support locality 0 */
+ for (c = 0; c <= size - 1; c++) {
+ tis->locty0_ram[off - TPM_TIS_REG_RAM + c] = val;
+ val >>= 8;
+ }
+ }
+ break;
}
}
diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
index a1df41f..0e98cb0 100644
--- a/hw/tpm/tpm_tis.h
+++ b/hw/tpm/tpm_tis.h
@@ -65,6 +65,8 @@ typedef struct TPMTISEmuState {
qemu_irq irq;
uint32_t irq_num;
+
+ uint8_t locty0_ram[0x60]; /* a vendor spec. extension at 0xfa0-0xfff in locality 0 */
} TPMTISEmuState;
#endif /* TPM_TPM_TIS_H */
--
1.9.3
next prev parent reply other threads:[~2015-05-08 16:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 16:15 [Qemu-devel] [PATCH v2 0/6] Extend TPM support with a QEMU-external TPM Stefan Berger
2015-05-08 16:15 ` [Qemu-devel] [PATCH v2 1/6] Provide support for the CUSE TPM Stefan Berger
2015-05-08 16:15 ` Stefan Berger [this message]
2015-05-08 16:15 ` [Qemu-devel] [PATCH v2 3/6] Support Physical Presence Interface Spec Stefan Berger
2015-05-08 18:02 ` Stefan Berger
2015-05-15 15:13 ` Igor Mammedov
2015-05-15 18:24 ` Stefan Berger
2015-05-22 0:20 ` Stefan Berger
2015-05-08 16:15 ` [Qemu-devel] [PATCH v2 4/6] Introduce condition to notifiy waiters of completed command Stefan Berger
2015-05-08 16:15 ` [Qemu-devel] [PATCH v2 5/6] Introduce condition in TPM backend for notification Stefan Berger
2015-05-08 16:15 ` [Qemu-devel] [PATCH v2 6/6] Add support for VM suspend/resume for TPM TIS Stefan Berger
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=1431101720-701152-3-git-send-email-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=imammedo@redhat.com \
--cc=kevin@koconnor.net \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quan.xu@intel.com \
--cc=stefanb@us.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).