From: Eric Auger <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, eric.auger@redhat.com,
stefanb@linux.ibm.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com,
imammedo@redhat.com
Cc: thuth@redhat.com, lersek@redhat.com, drjones@redhat.com,
shannon.zhaosl@gmail.com, marcandre.lureau@redhat.com,
philmd@redhat.com, ardb@kernel.org
Subject: [PATCH v6 2/3] arm/acpi: Add the TPM2.0 device under the DSDT
Date: Fri, 19 Jun 2020 16:18:50 +0200 [thread overview]
Message-ID: <20200619141851.16272-3-eric.auger@redhat.com> (raw)
In-Reply-To: <20200619141851.16272-1-eric.auger@redhat.com>
In case it is dynamically instantiated, add the TPM 2.0 device object
under the DSDT table in the ACPI namespace. Its HID is MSFT0101
while its current resource settings (CRS) property is initialized
with the guest physical address and MMIO size of the device.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
---
v3 -> v4:
- check the presence of the tpm in acpi_dsdt_add_tpm
as it was done in v2
v2 -> v3:
- use SYS_BUS_DEVICE() instead of
(SysBusDevice *)object_dynamic_cast(OBJECT())
v1 -> v2:
- use memory_region_size
- fix mingw compilation issue by casting to uint32_t
- added Stefan's R-b
---
hw/arm/virt-acpi-build.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index ca31f70f7f..1384a2cf2a 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -46,6 +46,7 @@
#include "hw/pci/pci.h"
#include "hw/arm/virt.h"
#include "hw/mem/nvdimm.h"
+#include "hw/platform-bus.h"
#include "sysemu/numa.h"
#include "sysemu/reset.h"
#include "sysemu/tpm.h"
@@ -364,6 +365,38 @@ static void acpi_dsdt_add_power_button(Aml *scope)
aml_append(scope, dev);
}
+static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
+{
+ PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
+ hwaddr pbus_base = vms->memmap[VIRT_PLATFORM_BUS].base;
+ SysBusDevice *sbdev = SYS_BUS_DEVICE(tpm_find());
+ MemoryRegion *sbdev_mr;
+ hwaddr tpm_base;
+
+ if (!sbdev) {
+ return;
+ }
+
+ tpm_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
+ assert(tpm_base != -1);
+
+ tpm_base += pbus_base;
+
+ sbdev_mr = sysbus_mmio_get_region(sbdev, 0);
+
+ Aml *dev = aml_device("TPM0");
+ aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
+ aml_append(dev, aml_name_decl("_UID", aml_int(0)));
+
+ Aml *crs = aml_resource_template();
+ aml_append(crs,
+ aml_memory32_fixed(tpm_base,
+ (uint32_t)memory_region_size(sbdev_mr),
+ AML_READ_WRITE));
+ aml_append(dev, aml_name_decl("_CRS", crs));
+ aml_append(scope, dev);
+}
+
static void
build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
@@ -762,6 +795,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
}
acpi_dsdt_add_power_button(scope);
+ acpi_dsdt_add_tpm(scope, vms);
aml_append(dsdt, scope);
--
2.20.1
next prev parent reply other threads:[~2020-06-19 14:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 14:18 [PATCH v6 0/3] vTPM/aarch64 ACPI support Eric Auger
2020-06-19 14:18 ` [PATCH v6 1/3] acpi: Some build_tpm2() code reshape Eric Auger
2020-06-19 15:07 ` Stefan Berger
2020-06-19 15:34 ` Auger Eric
2020-06-19 16:09 ` Stefan Berger
2020-06-19 16:14 ` Auger Eric
2020-06-22 12:51 ` Igor Mammedov
2020-06-19 14:18 ` Eric Auger [this message]
2020-06-22 12:48 ` [PATCH v6 2/3] arm/acpi: Add the TPM2.0 device under the DSDT Igor Mammedov
2020-06-19 14:18 ` [PATCH v6 3/3] docs/specs/tpm: ACPI boot now supported for TPM/ARM Eric Auger
2020-06-19 16:10 ` Stefan Berger
2020-06-22 12:47 ` Igor Mammedov
2020-06-19 15:13 ` [PATCH v6 0/3] vTPM/aarch64 ACPI support no-reply
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=20200619141851.16272-3-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=ardb@kernel.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=imammedo@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhaosl@gmail.com \
--cc=stefanb@linux.ibm.com \
--cc=thuth@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 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).