From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Igor Mammedov" <imammedo@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Stefan Berger" <stefanb@linux.ibm.com>
Subject: [PULL v1 1/5] i386: Eliminate all TPM related code if CONFIG_TPM is not set
Date: Tue, 15 Jun 2021 11:21:48 -0400 [thread overview]
Message-ID: <20210615152152.2496772-2-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com>
From: Stefan Berger <stefanb@linux.ibm.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210614191335.1968807-2-stefanb@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/i386/acpi-build.c | 20 ++++++++++++++++++++
stubs/tpm.c | 4 ----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 80bee00da6..796ffc6f5c 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -107,7 +107,9 @@ typedef struct AcpiPmInfo {
typedef struct AcpiMiscInfo {
bool is_piix4;
bool has_hpet;
+#ifdef CONFIG_TPM
TPMVersion tpm_version;
+#endif
const unsigned char *dsdt_code;
unsigned dsdt_size;
uint16_t pvpanic_port;
@@ -286,7 +288,9 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
}
info->has_hpet = hpet_find();
+#ifdef CONFIG_TPM
info->tpm_version = tpm_get_version(tpm_find());
+#endif
info->pvpanic_port = pvpanic_port();
info->applesmc_io_base = applesmc_port();
}
@@ -1371,7 +1375,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
uint32_t nr_mem = machine->ram_slots;
int root_bus_limit = 0xFF;
PCIBus *bus = NULL;
+#ifdef CONFIG_TPM
TPMIf *tpm = tpm_find();
+#endif
int i;
VMBusBridge *vmbus_bridge = vmbus_bridge_find();
@@ -1604,10 +1610,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
}
}
+#ifdef CONFIG_TPM
if (TPM_IS_TIS_ISA(tpm_find())) {
aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
}
+#endif
aml_append(scope, aml_name_decl("_CRS", crs));
/* reserve GPE0 block resources */
@@ -1753,6 +1761,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
/* Scan all PCI buses. Generate tables to support hotplug. */
build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
+#ifdef CONFIG_TPM
if (TPM_IS_TIS_ISA(tpm)) {
if (misc->tpm_version == TPM_VERSION_2_0) {
dev = aml_device("TPM");
@@ -1780,11 +1789,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
aml_append(scope, dev);
}
+#endif
aml_append(sb_scope, scope);
}
}
+#ifdef CONFIG_TPM
if (TPM_IS_CRB(tpm)) {
dev = aml_device("TPM");
aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
@@ -1799,6 +1810,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
aml_append(sb_scope, dev);
}
+#endif
aml_append(dsdt, sb_scope);
@@ -1828,6 +1840,7 @@ build_hpet(GArray *table_data, BIOSLinker *linker, const char *oem_id,
"HPET", sizeof(*hpet), 1, oem_id, oem_table_id);
}
+#ifdef CONFIG_TPM
static void
build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
const char *oem_id, const char *oem_table_id)
@@ -1854,6 +1867,7 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
(void *)(table_data->data + tcpa_start),
"TCPA", sizeof(*tcpa), 2, oem_id, oem_table_id);
}
+#endif
#define HOLE_640K_START (640 * KiB)
#define HOLE_640K_END (1 * MiB)
@@ -2403,6 +2417,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
build_hpet(tables_blob, tables->linker, x86ms->oem_id,
x86ms->oem_table_id);
}
+#ifdef CONFIG_TPM
if (misc.tpm_version != TPM_VERSION_UNSPEC) {
if (misc.tpm_version == TPM_VERSION_1_2) {
acpi_add_table(table_offsets, tables_blob);
@@ -2414,6 +2429,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
x86ms->oem_id, x86ms->oem_table_id);
}
}
+#endif
if (pcms->numa_nodes) {
acpi_add_table(table_offsets, tables_blob);
build_srat(tables_blob, tables->linker, machine);
@@ -2605,8 +2621,10 @@ void acpi_setup(void)
AcpiBuildTables tables;
AcpiBuildState *build_state;
Object *vmgenid_dev;
+#ifdef CONFIG_TPM
TPMIf *tpm;
static FwCfgTPMConfig tpm_config;
+#endif
if (!x86ms->fw_cfg) {
ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n");
@@ -2638,6 +2656,7 @@ void acpi_setup(void)
acpi_add_rom_blob(acpi_build_update, build_state,
tables.linker->cmd_blob, ACPI_BUILD_LOADER_FILE);
+#ifdef CONFIG_TPM
fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
@@ -2651,6 +2670,7 @@ void acpi_setup(void)
fw_cfg_add_file(x86ms->fw_cfg, "etc/tpm/config",
&tpm_config, sizeof tpm_config);
}
+#endif
vmgenid_dev = find_vmgenid_dev();
if (vmgenid_dev) {
diff --git a/stubs/tpm.c b/stubs/tpm.c
index 9bded191d9..22014595a0 100644
--- a/stubs/tpm.c
+++ b/stubs/tpm.c
@@ -33,7 +33,3 @@ TpmModelList *qmp_query_tpm_models(Error **errp)
{
return NULL;
}
-
-void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
-{
-}
--
2.31.1
next prev parent reply other threads:[~2021-06-15 15:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 15:21 [PULL v1 0/5] Merge tpm 2021/06/15 v1 Stefan Berger
2021-06-15 15:21 ` Stefan Berger [this message]
2021-06-15 15:21 ` [PULL v1 2/5] arm: Eliminate all TPM related code if CONFIG_TPM is not set Stefan Berger
2021-06-15 15:21 ` [PULL v1 3/5] acpi: " Stefan Berger
2021-06-15 15:21 ` [PULL v1 4/5] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Stefan Berger
2021-06-15 15:21 ` [PULL v1 5/5] tpm: Return QMP error when TPM is disabled in build Stefan Berger
2021-06-16 12:50 ` [PULL v1 0/5] Merge tpm 2021/06/15 v1 Peter Maydell
2021-06-16 14:38 ` Philippe Mathieu-Daudé
2021-06-16 14:48 ` 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=20210615152152.2496772-2-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.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 read-only IMAP folder(s) and NNTP newsgroup(s).