* [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set @ 2021-06-12 1:20 Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 1/3] acpi: Eliminate all " Stefan Berger ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Stefan Berger @ 2021-06-12 1:20 UTC (permalink / raw) To: armbru, qemu-devel; +Cc: philmd, Stefan Berger The following patches entirely elimiante TPM related code if CONFIG_TPM is not set. Stefan Stefan Berger (3): acpi: Eliminate all TPM related code if CONFIG_TPM is not set arm: Eliminate all TPM related code if CONFIG_TPM is not set sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined hw/acpi/aml-build.c | 2 ++ hw/arm/sysbus-fdt.c | 4 ++++ hw/arm/virt-acpi-build.c | 6 ++++++ hw/arm/virt.c | 2 ++ hw/i386/acpi-build.c | 20 ++++++++++++++++++++ include/hw/acpi/tpm.h | 4 ++++ include/sysemu/tpm.h | 6 +++++- include/sysemu/tpm_backend.h | 6 +++++- stubs/tpm.c | 4 ---- 9 files changed, 48 insertions(+), 6 deletions(-) -- 2.31.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC PATCH V1 1/3] acpi: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-12 1:20 [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Stefan Berger @ 2021-06-12 1:21 ` Stefan Berger 2021-06-14 8:09 ` Markus Armbruster 2021-06-14 9:53 ` Philippe Mathieu-Daudé 2021-06-12 1:21 ` [RFC PATCH V1 2/3] arm: " Stefan Berger ` (2 subsequent siblings) 3 siblings, 2 replies; 10+ messages in thread From: Stefan Berger @ 2021-06-12 1:21 UTC (permalink / raw) To: armbru, qemu-devel Cc: Igor Mammedov, M : Michael S . Tsirkin, philmd, Stefan Berger Cc: M: Michael S. Tsirkin <mst@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> --- hw/acpi/aml-build.c | 2 ++ hw/arm/virt-acpi-build.c | 2 ++ hw/i386/acpi-build.c | 20 ++++++++++++++++++++ include/hw/acpi/tpm.h | 4 ++++ stubs/tpm.c | 4 ---- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index f0035d2b4a..d5103e6d7b 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -2044,6 +2044,7 @@ build_hdr: "FACP", tbl->len - fadt_start, f->rev, oem_id, oem_table_id); } +#ifdef CONFIG_TPM /* * build_tpm2 - Build the TPM2 table as specified in * table 7: TCG Hardware Interface Description Table Format for TPM 2.0 @@ -2101,6 +2102,7 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, (void *)(table_data->data + tpm2_start), "TPM2", table_data->len - tpm2_start, 4, oem_id, oem_table_id); } +#endif Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset, uint32_t mmio32_offset, uint64_t mmio64_offset, diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 60fe2e65a7..6b3c1fdb0a 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -745,11 +745,13 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) build_iort(tables_blob, tables->linker, vms); } +#ifdef CONFIG_TPM if (tpm_get_version(tpm_find()) == TPM_VERSION_2_0) { acpi_add_table(table_offsets, tables_blob); build_tpm2(tables_blob, tables->linker, tables->tcpalog, vms->oem_id, vms->oem_table_id); } +#endif /* XSDT is pointed to by RSDP */ xsdt = tables_blob->len; 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/include/hw/acpi/tpm.h b/include/hw/acpi/tpm.h index 1a2a57a21f..559ba6906c 100644 --- a/include/hw/acpi/tpm.h +++ b/include/hw/acpi/tpm.h @@ -21,6 +21,8 @@ #include "hw/acpi/aml-build.h" #include "sysemu/tpm.h" +#ifdef CONFIG_TPM + #define TPM_TIS_ADDR_BASE 0xFED40000 #define TPM_TIS_ADDR_SIZE 0x5000 @@ -209,4 +211,6 @@ REG32(CRB_DATA_BUFFER, 0x80) void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev); +#endif /* CONFIG_TPM */ + #endif /* HW_ACPI_TPM_H */ diff --git a/stubs/tpm.c b/stubs/tpm.c index b1dc6370a5..524e534cb1 100644 --- a/stubs/tpm.c +++ b/stubs/tpm.c @@ -17,7 +17,3 @@ int tpm_init(void) void tpm_cleanup(void) { } - -void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev) -{ -} -- 2.31.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [RFC PATCH V1 1/3] acpi: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-12 1:21 ` [RFC PATCH V1 1/3] acpi: Eliminate all " Stefan Berger @ 2021-06-14 8:09 ` Markus Armbruster 2021-06-14 9:53 ` Philippe Mathieu-Daudé 1 sibling, 0 replies; 10+ messages in thread From: Markus Armbruster @ 2021-06-14 8:09 UTC (permalink / raw) To: Stefan Berger; +Cc: Igor Mammedov, philmd, qemu-devel, M : Michael S . Tsirkin Stefan Berger <stefanb@linux.ibm.com> writes: > Cc: M: Michael S. Tsirkin <mst@redhat.com> Pasto; drop the "M: ". > Cc: Igor Mammedov <imammedo@redhat.com> > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH V1 1/3] acpi: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-12 1:21 ` [RFC PATCH V1 1/3] acpi: Eliminate all " Stefan Berger 2021-06-14 8:09 ` Markus Armbruster @ 2021-06-14 9:53 ` Philippe Mathieu-Daudé 2021-06-14 18:12 ` Stefan Berger 1 sibling, 1 reply; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2021-06-14 9:53 UTC (permalink / raw) To: Stefan Berger, armbru, qemu-devel, qemu-arm Cc: Igor Mammedov, M : Michael S . Tsirkin On 6/12/21 3:21 AM, Stefan Berger wrote: > Cc: M: Michael S. Tsirkin <mst@redhat.com> > Cc: Igor Mammedov <imammedo@redhat.com> > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> > --- > hw/acpi/aml-build.c | 2 ++ > hw/arm/virt-acpi-build.c | 2 ++ > hw/i386/acpi-build.c | 20 ++++++++++++++++++++ > include/hw/acpi/tpm.h | 4 ++++ > stubs/tpm.c | 4 ---- > 5 files changed, 28 insertions(+), 4 deletions(-) > > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c > index f0035d2b4a..d5103e6d7b 100644 > --- a/hw/acpi/aml-build.c > +++ b/hw/acpi/aml-build.c > @@ -2044,6 +2044,7 @@ build_hdr: > "FACP", tbl->len - fadt_start, f->rev, oem_id, oem_table_id); > } > > +#ifdef CONFIG_TPM > /* > * build_tpm2 - Build the TPM2 table as specified in > * table 7: TCG Hardware Interface Description Table Format for TPM 2.0 > @@ -2101,6 +2102,7 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, > (void *)(table_data->data + tpm2_start), > "TPM2", table_data->len - tpm2_start, 4, oem_id, oem_table_id); > } > +#endif This makes the ARM virt machine build to fail for missing the build_tpm2() symbol. You probably need to split the patch in 2 and rearrange the series: 1/ hw/i386 (current 1) 2/ hw/arm (current 2) 3/ hw/acpi (current 1) 4/ sysemu/tpm (current 3) > diff --git a/include/hw/acpi/tpm.h b/include/hw/acpi/tpm.h > index 1a2a57a21f..559ba6906c 100644 > --- a/include/hw/acpi/tpm.h > +++ b/include/hw/acpi/tpm.h > @@ -21,6 +21,8 @@ > #include "hw/acpi/aml-build.h" > #include "sysemu/tpm.h" > > +#ifdef CONFIG_TPM > + > #define TPM_TIS_ADDR_BASE 0xFED40000 > #define TPM_TIS_ADDR_SIZE 0x5000 > > @@ -209,4 +211,6 @@ REG32(CRB_DATA_BUFFER, 0x80) > > void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev); > > +#endif /* CONFIG_TPM */ > + > #endif /* HW_ACPI_TPM_H */ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH V1 1/3] acpi: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-14 9:53 ` Philippe Mathieu-Daudé @ 2021-06-14 18:12 ` Stefan Berger 0 siblings, 0 replies; 10+ messages in thread From: Stefan Berger @ 2021-06-14 18:12 UTC (permalink / raw) To: Philippe Mathieu-Daudé, armbru, qemu-devel, qemu-arm Cc: Igor Mammedov, M : Michael S . Tsirkin On 6/14/21 5:53 AM, Philippe Mathieu-Daudé wrote: > On 6/12/21 3:21 AM, Stefan Berger wrote: >> Cc: M: Michael S. Tsirkin <mst@redhat.com> >> Cc: Igor Mammedov <imammedo@redhat.com> >> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> >> --- >> hw/acpi/aml-build.c | 2 ++ >> hw/arm/virt-acpi-build.c | 2 ++ >> hw/i386/acpi-build.c | 20 ++++++++++++++++++++ >> include/hw/acpi/tpm.h | 4 ++++ >> stubs/tpm.c | 4 ---- >> 5 files changed, 28 insertions(+), 4 deletions(-) >> >> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c >> index f0035d2b4a..d5103e6d7b 100644 >> --- a/hw/acpi/aml-build.c >> +++ b/hw/acpi/aml-build.c >> @@ -2044,6 +2044,7 @@ build_hdr: >> "FACP", tbl->len - fadt_start, f->rev, oem_id, oem_table_id); >> } >> >> +#ifdef CONFIG_TPM >> /* >> * build_tpm2 - Build the TPM2 table as specified in >> * table 7: TCG Hardware Interface Description Table Format for TPM 2.0 >> @@ -2101,6 +2102,7 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, >> (void *)(table_data->data + tpm2_start), >> "TPM2", table_data->len - tpm2_start, 4, oem_id, oem_table_id); >> } >> +#endif > This makes the ARM virt machine build to fail for missing > the build_tpm2() symbol. > > You probably need to split the patch in 2 and rearrange the > series: > > 1/ hw/i386 (current 1) > 2/ hw/arm (current 2) > 3/ hw/acpi (current 1) > 4/ sysemu/tpm (current 3) I took a bottom-up approach where I also eliminated all callers. So from what I can see build_tpm2() symbol has been eliminated by both i386 and aarch64, but ok, I will change it to a top-down approach. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC PATCH V1 2/3] arm: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-12 1:20 [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 1/3] acpi: Eliminate all " Stefan Berger @ 2021-06-12 1:21 ` Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Stefan Berger 2021-06-14 8:34 ` [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Markus Armbruster 3 siblings, 0 replies; 10+ messages in thread From: Stefan Berger @ 2021-06-12 1:21 UTC (permalink / raw) To: armbru, qemu-devel; +Cc: Peter Maydell, philmd, Stefan Berger Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> --- hw/arm/sysbus-fdt.c | 4 ++++ hw/arm/virt-acpi-build.c | 4 ++++ hw/arm/virt.c | 2 ++ 3 files changed, 10 insertions(+) diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index 6b6906f4cf..48c5fe9bf1 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -437,6 +437,7 @@ static bool vfio_platform_match(SysBusDevice *sbdev, #endif /* CONFIG_LINUX */ +#ifdef CONFIG_TPM /* * add_tpm_tis_fdt_node: Create a DT node for TPM TIS * @@ -467,6 +468,7 @@ static int add_tpm_tis_fdt_node(SysBusDevice *sbdev, void *opaque) g_free(nodename); return 0; } +#endif static int no_fdt_node(SysBusDevice *sbdev, void *opaque) { @@ -488,7 +490,9 @@ static const BindingEntry bindings[] = { TYPE_BINDING(TYPE_VFIO_AMD_XGBE, add_amd_xgbe_fdt_node), VFIO_PLATFORM_BINDING("amd,xgbe-seattle-v1a", add_amd_xgbe_fdt_node), #endif +#ifdef CONFIG_TPM TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node), +#endif TYPE_BINDING(TYPE_RAMFB_DEVICE, no_fdt_node), TYPE_BINDING("", NULL), /* last element */ }; diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 6b3c1fdb0a..f1024843dd 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -205,6 +205,7 @@ static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap, aml_append(scope, dev); } +#ifdef CONFIG_TPM static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms) { PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev); @@ -236,6 +237,7 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms) aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); } +#endif static void build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) @@ -642,7 +644,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } acpi_dsdt_add_power_button(scope); +#ifdef CONFIG_TPM acpi_dsdt_add_tpm(scope, vms); +#endif aml_append(dsdt, scope); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 840758666d..9122e22ee0 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2599,7 +2599,9 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); +#ifdef CONFIG_TPM machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); +#endif mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; mc->pci_allow_0_address = true; -- 2.31.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [RFC PATCH V1 3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined 2021-06-12 1:20 [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 1/3] acpi: Eliminate all " Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 2/3] arm: " Stefan Berger @ 2021-06-12 1:21 ` Stefan Berger 2021-06-14 9:46 ` Philippe Mathieu-Daudé 2021-06-14 8:34 ` [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Markus Armbruster 3 siblings, 1 reply; 10+ messages in thread From: Stefan Berger @ 2021-06-12 1:21 UTC (permalink / raw) To: armbru, qemu-devel; +Cc: philmd, Stefan Berger Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> --- include/sysemu/tpm.h | 6 +++++- include/sysemu/tpm_backend.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index 1a85564e47..2ca3fa32ee 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -15,10 +15,12 @@ #include "qapi/qapi-types-tpm.h" #include "qom/object.h" -int tpm_config_parse(QemuOptsList *opts_list, const char *optarg); int tpm_init(void); void tpm_cleanup(void); +#ifdef CONFIG_TPM +int tpm_config_parse(QemuOptsList *opts_list, const char *optarg); + typedef enum TPMVersion { TPM_VERSION_UNSPEC = 0, TPM_VERSION_1_2 = 1, @@ -73,4 +75,6 @@ static inline TPMVersion tpm_get_version(TPMIf *ti) return TPM_IF_GET_CLASS(ti)->get_version(ti); } +#endif /* CONFIG_TPM */ + #endif /* QEMU_TPM_H */ diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index 6f078f5f48..8fd3269c11 100644 --- a/include/sysemu/tpm_backend.h +++ b/include/sysemu/tpm_backend.h @@ -18,6 +18,8 @@ #include "sysemu/tpm.h" #include "qapi/error.h" +#ifdef CONFIG_TPM + #define TYPE_TPM_BACKEND "tpm-backend" OBJECT_DECLARE_TYPE(TPMBackend, TPMBackendClass, TPM_BACKEND) @@ -209,4 +211,6 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s); TPMBackend *qemu_find_tpm_be(const char *id); -#endif +#endif /* CONFIG_TPM */ + +#endif /* TPM_BACKEND_H */ -- 2.31.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [RFC PATCH V1 3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined 2021-06-12 1:21 ` [RFC PATCH V1 3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Stefan Berger @ 2021-06-14 9:46 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2021-06-14 9:46 UTC (permalink / raw) To: Stefan Berger, armbru, qemu-devel On 6/12/21 3:21 AM, Stefan Berger wrote: > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> > --- > include/sysemu/tpm.h | 6 +++++- > include/sysemu/tpm_backend.h | 6 +++++- > 2 files changed, 10 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set 2021-06-12 1:20 [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Stefan Berger ` (2 preceding siblings ...) 2021-06-12 1:21 ` [RFC PATCH V1 3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Stefan Berger @ 2021-06-14 8:34 ` Markus Armbruster 2021-06-14 19:12 ` Stefan Berger 3 siblings, 1 reply; 10+ messages in thread From: Markus Armbruster @ 2021-06-14 8:34 UTC (permalink / raw) To: Stefan Berger; +Cc: philmd, qemu-devel Stefan Berger <stefanb@linux.ibm.com> writes: > The following patches entirely elimiante TPM related code if CONFIG_TPM > is not set. > > Stefan I believe this is on top of Philippe's "[PATCH v2 2/2] tpm: Return QMP error when TPM is disabled in build" Based-on: <20210609184955.1193081-3-philmd@redhat.com> However, it should probably go *first*, so the additional 'if' to suppress warnings about unused qmp_marshal_output_TpmFOO() can be squashed into Philippe's patch. Apart from that, this looks good to me! Additional 'if': diff --git a/qapi/tpm.json b/qapi/tpm.json index 09332e6f99..e74c881ea6 100644 --- a/qapi/tpm.json +++ b/qapi/tpm.json @@ -17,7 +17,9 @@ # # Since: 1.5 ## -{ 'enum': 'TpmModel', 'data': [ 'tpm-tis', 'tpm-crb', 'tpm-spapr' ] } +{ 'enum': 'TpmModel', 'data': [ 'tpm-tis', 'tpm-crb', 'tpm-spapr' ], + 'if': 'defined(CONFIG_TPM)' } + ## # @query-tpm-models: # @@ -47,7 +49,8 @@ # # Since: 1.5 ## -{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ] } +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ], + 'if': 'defined(CONFIG_TPM)' } ## # @query-tpm-types: @@ -124,7 +127,8 @@ { 'struct': 'TPMInfo', 'data': {'id': 'str', 'model': 'TpmModel', - 'options': 'TpmTypeOptions' } } + 'options': 'TpmTypeOptions' }, + 'if': 'defined(CONFIG_TPM)' } ## # @query-tpm: ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set 2021-06-14 8:34 ` [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Markus Armbruster @ 2021-06-14 19:12 ` Stefan Berger 0 siblings, 0 replies; 10+ messages in thread From: Stefan Berger @ 2021-06-14 19:12 UTC (permalink / raw) To: Markus Armbruster; +Cc: philmd, qemu-devel On 6/14/21 4:34 AM, Markus Armbruster wrote: > Stefan Berger <stefanb@linux.ibm.com> writes: > >> The following patches entirely elimiante TPM related code if CONFIG_TPM >> is not set. >> >> Stefan > I believe this is on top of Philippe's "[PATCH v2 2/2] tpm: Return QMP > error when TPM is disabled in build" No, my series is stand-alone. Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-06-14 19:13 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-06-12 1:20 [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 1/3] acpi: Eliminate all " Stefan Berger 2021-06-14 8:09 ` Markus Armbruster 2021-06-14 9:53 ` Philippe Mathieu-Daudé 2021-06-14 18:12 ` Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 2/3] arm: " Stefan Berger 2021-06-12 1:21 ` [RFC PATCH V1 3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Stefan Berger 2021-06-14 9:46 ` Philippe Mathieu-Daudé 2021-06-14 8:34 ` [RFC PATCH V1 0/3] tpm: Eliminate TPM related code if CONFIG_TPM is not set Markus Armbruster 2021-06-14 19:12 ` Stefan Berger
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).