From nobody Tue May 21 23:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623766890; cv=none; d=zohomail.com; s=zohoarc; b=fEs8gmdnWCyEpZ0ReF7lbB9p85pumbqSzrPiRkzJKWQVS6Fhd8VmWClMf4GASBIQPiAIRMudG71Ic4ClF7HgGjKFDlcb1CDaGT/R4VFXAxvSbtbJ8DGBnDbeYY4DX/vsZsLz8xgiNcvMa1M3Fn3qlOh97WHL2OhC36NAXexA3N8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623766890; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=40vzgrQVAoTrypUvftjd8gyH06NkxRrNl5FBl3A4XCw=; b=QfWJHnPoJ/EyPtXicKcPM+5/Ww+ek33pAK0UZRLocST8jo7EquHmhmC+zv0eOZmJ4m14MvwuvgiOyIDBSgFgcPohpmUoSKbaMRi+eeG+VcqKfgxVF9r6MdvsQ0IzwJ/ToHbDupgqVNoSyVp8alKAUK41Csr8jbb5zuCNdtG9KnE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623766890869116.63768366405975; Tue, 15 Jun 2021 07:21:30 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-536-xClJ7ey9ND6vzGAsiQxwbA-1; Tue, 15 Jun 2021 10:21:28 -0400 Received: by mail-wm1-f69.google.com with SMTP id u17-20020a05600c19d1b02901af4c4deac5so1570294wmq.7 for ; Tue, 15 Jun 2021 07:21:28 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id z5sm421569wrp.92.2021.06.15.07.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 07:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623766889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=40vzgrQVAoTrypUvftjd8gyH06NkxRrNl5FBl3A4XCw=; b=iPUh4ChgR1CArRBVSOdhA2tegOJNda8gbdPK1BFkhfC7D5fmm1r0ULdT9gEkXhNeKGPCoU 31n53V/V5EC6e/a3nAuYIpD828VRDxDYAhcbpVxJ60ygvNcFSh5I05JkIqln5oQdpNkRO4 kH5+xNFTiSubqok9IAhg+PVz5LbZdi4= X-MC-Unique: xClJ7ey9ND6vzGAsiQxwbA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=40vzgrQVAoTrypUvftjd8gyH06NkxRrNl5FBl3A4XCw=; b=CGdniBq5+Wwts1lAJcaw2NWWkW6HWC1rZH2zV1Jp8/hl3XIPeAoqwGkj5IXQEnhKuQ SY3qggPd6RJrkITI2j6tk/B56F7ey3pWW3vF86hI6490fKvRN8baKcu2TSI3uvuEcbiC MCRAZ+LrmWhFNIYFj8Ix/fQdLRTGNr6ApVMbPH82IXfV+MlbSnRJzlwz2bVpdwWiD2Cr jH35khb/Mi84TaCnETMkCGO4oiILsxB1HLwnexC+2F/nhyy1o1FTgcak//CK2eLnPg6F 7vvAZwSu7whRCKVjE5HGWs9oUI2Gvuean5MNdGA1VG46SkQjY1XJilQtQpTAO8NlPo7n ha7A== X-Gm-Message-State: AOAM531QSal6DZ8Ub3SHeabaRqwtVA/giTuSPeBqtvijOJF5jlXKFs/y YLh98yUTzqEA6JmR3zE7f2Bsd5Um4JdZL8l1dVX/TmAf8jx/TmYy1xOdbaXxZnCTCqeffv6Ghjb x2zmf5Tq8GJRIww== X-Received: by 2002:a7b:c210:: with SMTP id x16mr22223597wmi.105.1623766887465; Tue, 15 Jun 2021 07:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3JH8bwEo+9yLd2/37Pviq3Q3IZoqtKwr12kkGh4W4RQFCsWrnkzBgZfZIONHpT/s6iNWIUg== X-Received: by 2002:a7b:c210:: with SMTP id x16mr22223578wmi.105.1623766887322; Tue, 15 Jun 2021 07:21:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , Stefan Berger , "Michael S . Tsirkin" , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/5] i386: Eliminate all TPM related code if CONFIG_TPM is not set Date: Tue, 15 Jun 2021 16:21:17 +0200 Message-Id: <20210615142121.2127692-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615142121.2127692-1-philmd@redhat.com> References: <20210615142121.2127692-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Stefan Berger Cc: Michael S. Tsirkin Cc: Igor Mammedov Signed-off-by: Stefan Berger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210614191335.1968807-2-stefanb@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 80bee00da66..796ffc6f5c4 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) } =20 info->has_hpet =3D hpet_find(); +#ifdef CONFIG_TPM info->tpm_version =3D tpm_get_version(tpm_find()); +#endif info->pvpanic_port =3D pvpanic_port(); info->applesmc_io_base =3D applesmc_port(); } @@ -1371,7 +1375,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, uint32_t nr_mem =3D machine->ram_slots; int root_bus_limit =3D 0xFF; PCIBus *bus =3D NULL; +#ifdef CONFIG_TPM TPMIf *tpm =3D tpm_find(); +#endif int i; VMBusBridge *vmbus_bridge =3D vmbus_bridge_find(); =20 @@ -1604,10 +1610,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, } } =20 +#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)); =20 /* 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); =20 +#ifdef CONFIG_TPM if (TPM_IS_TIS_ISA(tpm)) { if (misc->tpm_version =3D=3D TPM_VERSION_2_0) { dev =3D aml_device("TPM"); @@ -1780,11 +1789,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 aml_append(scope, dev); } +#endif =20 aml_append(sb_scope, scope); } } =20 +#ifdef CONFIG_TPM if (TPM_IS_CRB(tpm)) { dev =3D aml_device("TPM"); aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101"))); @@ -1799,6 +1810,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 aml_append(sb_scope, dev); } +#endif =20 aml_append(dsdt, sb_scope); =20 @@ -1828,6 +1840,7 @@ build_hpet(GArray *table_data, BIOSLinker *linker, co= nst char *oem_id, "HPET", sizeof(*hpet), 1, oem_id, oem_table_id); } =20 +#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 =20 #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 !=3D TPM_VERSION_UNSPEC) { if (misc.tpm_version =3D=3D 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 =20 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); =20 +#ifdef CONFIG_TPM fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); =20 @@ -2651,6 +2670,7 @@ void acpi_setup(void) fw_cfg_add_file(x86ms->fw_cfg, "etc/tpm/config", &tpm_config, sizeof tpm_config); } +#endif =20 vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { diff --git a/stubs/tpm.c b/stubs/tpm.c index 9bded191d9d..22014595a06 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) -{ -} --=20 2.31.1 From nobody Tue May 21 23:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623766895; cv=none; d=zohomail.com; s=zohoarc; b=hx1veHShGsbpQFd0elFqUov7zkKKWPcFKMvGLxskdjWIznMFWTXQovFJYeO4hMmV779Bbjjve48+LE16djWqwlbfjoYJ5YyH5EP2B+4G1G9rhA9k7QBrC0w7MNDSf74L/9yGLdAPZS6XAJtbNHAp/+lzEeXZ1Y3cu6Oa38RGHHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623766895; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=1/ujT/H+jsCDhMHDnxsFjIbcqBjOv5SGrl9Ow17b7os=; b=TfKyeh5tAS/PTwCwxCp3r7Yy66uLC9wpBqWpl5ss4B7SqLQ8u57RiKnoP6UBCXhyD0r5ZHkkleOatqn4MPpnyb4uq/UQbCOrv32dbHn4q5JXVhon8KqrHRnzExsBTTm1EfTTVK6i1OFopePnFYNtC93nLP/5NpQCPeCwu4FkpR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623766895260157.4880793117718; Tue, 15 Jun 2021 07:21:35 -0700 (PDT) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-g58b0d-wPZiLMZdzUjH0rA-1; Tue, 15 Jun 2021 10:21:33 -0400 Received: by mail-wr1-f69.google.com with SMTP id n4-20020a5d42040000b0290119fef97609so8662603wrq.18 for ; Tue, 15 Jun 2021 07:21:32 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id r3sm15286035wmq.8.2021.06.15.07.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 07:21:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623766894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1/ujT/H+jsCDhMHDnxsFjIbcqBjOv5SGrl9Ow17b7os=; b=RE9OU+6wp9rn680lhib3hIQXNZV6HXlqS2i/rZHigP/f5Gb61TIPNvDgmFKkeO2R6pkDd+ vwGw9/wkAwtK+gQrp6uUIh65rOMh99mp9xWecLNSdUpTcI5a9fpM7gDFI09mp3TBEedi+V pYNHE5eCp+TrMZsqAgGS6T/102P6BLk= X-MC-Unique: g58b0d-wPZiLMZdzUjH0rA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1/ujT/H+jsCDhMHDnxsFjIbcqBjOv5SGrl9Ow17b7os=; b=l+mLSETZvKDz87+xNnHsHuC0uQ5eT3E3jD8qz48ILrjOpoGHst/cbocRLHqYd/jTzM ydZXD6CAHUSHDqpfqgCb6J0F6uda0eeW6PuwytwIS0+AehzWCFuyYgVkx/ANXC9jzA9N LNHjNWYi8jJTkd1EPwxPmA243Xhgqyed5z9J4C2oxYD67bvsO6tUmU6A2JK+0CSgn7CY nzrmZR1KvD+dsAXOl0KiXL4+S9vN+fG9lIwfz3DfyW3FZ/r1vHmeULyVNS37xWhAbwX/ n1FyYw10wQ7J9i/wYBHQ4EWuIJhaE4u0EkvY5gOrhdz5xmzyIZiD/3b9Vjrg2tzAg/+9 ioUg== X-Gm-Message-State: AOAM530qUkdEc5zDa6MySX+AfGrh81hH81D1czQKsoFJLpIamI2UszkX dSz9F7IEqWoDJdavBpoq7ENMqQg7Z+nbARmgXA3RU22sXR5AFJK7hVb1aZpsQDGNPZMXGNRf8YN 6cB3kK0QErngpUQ== X-Received: by 2002:adf:8b91:: with SMTP id o17mr25268018wra.385.1623766891932; Tue, 15 Jun 2021 07:21:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9Nr+byIDbGXXdj+92CbAwO/GPEkHWzAmI5vYjPCXokzFTyVAP92qU2pwXx8DN3AmlwcGs7A== X-Received: by 2002:adf:8b91:: with SMTP id o17mr25267997wra.385.1623766891807; Tue, 15 Jun 2021 07:21:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 2/5] arm: Eliminate all TPM related code if CONFIG_TPM is not set Date: Tue, 15 Jun 2021 16:21:18 +0200 Message-Id: <20210615142121.2127692-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615142121.2127692-1-philmd@redhat.com> References: <20210615142121.2127692-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Stefan Berger Peter Maydell Signed-off-by: Stefan Berger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210614191335.1968807-3-stefanb@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/sysbus-fdt.c | 4 ++++ hw/arm/virt-acpi-build.c | 6 ++++++ hw/arm/virt.c | 2 ++ 3 files changed, 12 insertions(+) diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index 6b6906f4cfc..48c5fe9bf18 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -437,6 +437,7 @@ static bool vfio_platform_match(SysBusDevice *sbdev, =20 #endif /* CONFIG_LINUX */ =20 +#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, vo= id *opaque) g_free(nodename); return 0; } +#endif =20 static int no_fdt_node(SysBusDevice *sbdev, void *opaque) { @@ -488,7 +490,9 @@ static const BindingEntry bindings[] =3D { 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 60fe2e65a76..f1024843ddb 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 MemMap= Entry *gpio_memmap, aml_append(scope, dev); } =20 +#ifdef CONFIG_TPM static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms) { PlatformBusDevice *pbus =3D PLATFORM_BUS_DEVICE(vms->platform_bus_dev); @@ -236,6 +237,7 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineSt= ate *vms) aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); } +#endif =20 static void build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) @@ -642,7 +644,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) } =20 acpi_dsdt_add_power_button(scope); +#ifdef CONFIG_TPM acpi_dsdt_add_tpm(scope, vms); +#endif =20 aml_append(dsdt, scope); =20 @@ -745,11 +749,13 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuild= Tables *tables) build_iort(tables_blob, tables->linker, vms); } =20 +#ifdef CONFIG_TPM if (tpm_get_version(tpm_find()) =3D=3D 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 =20 /* XSDT is pointed to by RSDP */ xsdt =3D tables_blob->len; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 840758666d4..9122e22ee0c 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 =3D IF_VIRTIO; mc->no_cdrom =3D 1; mc->pci_allow_0_address =3D true; --=20 2.31.1 From nobody Tue May 21 23:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623766899; cv=none; d=zohomail.com; s=zohoarc; b=ZkMKl8RzviV9GVPDCHSR0ouEZYOaQBNaaX3+2ZKcoVPwbTIZHPXvS/PZntsZsSKJjdwk679TEmjD4iIkjehLxDv0Wt1HCcMQ5qEwOIiTfSTadVMbPVJU2bhk6GLzAWb6juxWYG2C9NGoMXmHNa57Z/DI0gETrNGllki+f/7P63I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623766899; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=EPKTfv2HqhrWVRWhfR1Uo1UNdb0VcpdNpjLI/wWrdVo=; b=GABg5q55IQ3g/+tXOnUSG62asNinZiZJhthXdwOpQt+4vdsFH7Wyi1f6bBBraCyT0/sqU6zzbkAXaoK5VfI2IpBfzkB4kPK3YaA4Ohdy9sFPmyBmTv83X4X4jFVl6PpGJmIJMArweorpkpdkQ1DM8IsQgcmlcVhEKOfEZovTt0Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623766899586590.3512751182778; Tue, 15 Jun 2021 07:21:39 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492--fEBzxbuOA6TnYFkrOa6_g-1; Tue, 15 Jun 2021 10:21:37 -0400 Received: by mail-wr1-f72.google.com with SMTP id k25-20020a5d52590000b0290114dee5b660so8707731wrc.16 for ; Tue, 15 Jun 2021 07:21:37 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id j131sm2401069wma.40.2021.06.15.07.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 07:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623766898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EPKTfv2HqhrWVRWhfR1Uo1UNdb0VcpdNpjLI/wWrdVo=; b=dY09S/jZjvDEFUyrLe6UB6JQMjgoUwyKWyRDx1ndr9e8yLg6jgwtT6duldkmnLRjad1dae h5by4QU0hxII8VXdY4R811gOEC3TAW/Vk4zRnOWWxPLrN+LTW9pCpt91ORkNPMbx2FKCP1 YSXYgKXBJNJzJISMBRseCrSDEt3di2k= X-MC-Unique: -fEBzxbuOA6TnYFkrOa6_g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EPKTfv2HqhrWVRWhfR1Uo1UNdb0VcpdNpjLI/wWrdVo=; b=QnHh5Bbr6AnUcUH0bsFOhirTBevFpzamGtB68c5MEDMXLaYM6X5vEGBEW6Gyysb+eq fRqQFoB1KUjoCh2al5tQQsWEAHBM6sPNm+itIPuD/ZoCSo5uOx+VDv9daVtCoZD5wwG9 nOdU+7qJx1NMusLOnRpcnfaXL3cWuu2FiAMQw7hSvym6wf1+6zVt+brprOI4V4j74Rnz TH2BiR0l76KQriOA4i11fDuOX2uwx/NU4hXRcZUupZhPr7GnvZnfj5imIISqr12kJ1Sm 1EFQ94KvoFMz/H7x1a09AOfDXUa3H3ixuPox1mFDvIf1T7FY0ZZoPAKe6ySu+IW/wx+O sxuQ== X-Gm-Message-State: AOAM533Z93LVqZC2BOMZ5CPc5Af+k5cj7FupcT9hTTZ1PmaTQbVzT6Zo vQNP0Y1Z+cl9PfRPaTr/vA15/X4RF1JkdfFqNX6AMFo7SMFDxFJxOiX/v1dllZWqbtK/5i6c+Ju wG6c+IRXwjmTArQ== X-Received: by 2002:adf:f907:: with SMTP id b7mr25374114wrr.357.1623766896400; Tue, 15 Jun 2021 07:21:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3GlcNBRqRb+XpNwnxIFJAzmIc+HaJR0ycHvDIYPwpyaKDcDxKqBGwGXVMqKBFx2sbwXjUtA== X-Received: by 2002:adf:f907:: with SMTP id b7mr25374099wrr.357.1623766896278; Tue, 15 Jun 2021 07:21:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , Stefan Berger , "M : Michael S . Tsirkin" , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 3/5] acpi: Eliminate all TPM related code if CONFIG_TPM is not set Date: Tue, 15 Jun 2021 16:21:19 +0200 Message-Id: <20210615142121.2127692-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615142121.2127692-1-philmd@redhat.com> References: <20210615142121.2127692-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Stefan Berger Cc: M: Michael S. Tsirkin Cc: Igor Mammedov Signed-off-by: Stefan Berger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210614191335.1968807-4-stefanb@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/acpi/tpm.h | 4 ++++ hw/acpi/aml-build.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/hw/acpi/tpm.h b/include/hw/acpi/tpm.h index 1a2a57a21f0..559ba6906c8 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" =20 +#ifdef CONFIG_TPM + #define TPM_TIS_ADDR_BASE 0xFED40000 #define TPM_TIS_ADDR_SIZE 0x5000 =20 @@ -209,4 +211,6 @@ REG32(CRB_DATA_BUFFER, 0x80) =20 void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev); =20 +#endif /* CONFIG_TPM */ + #endif /* HW_ACPI_TPM_H */ diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index f0035d2b4a1..d5103e6d7b0 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); } =20 +#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 *linke= r, GArray *tcpalog, (void *)(table_data->data + tpm2_start), "TPM2", table_data->len - tpm2_start, 4, oem_id, oem_tabl= e_id); } +#endif =20 Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_off= set, uint32_t mmio32_offset, uint64_t mmio64_offset, --=20 2.31.1 From nobody Tue May 21 23:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623766904; cv=none; d=zohomail.com; s=zohoarc; b=hsXshZ1GjQTdGH2uvo7ievvlEUWZV4GU9LEwT0M9+vdJ2E5hJDdVBxtJqDfdeRL6QPzAPICIU8SZo//o1cD4FLzr5XsuyuoQkx25olUclcVNTLpvRmqCfKDDTkZVZ6AZli7mH7R0AeMiHmDOi4Af0x5u1puUFW/WPz9fufeE3Vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623766904; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=3hIM4nZ+edtMSEGqYdtBltxWEdrhiKauaGSD/ANl7HE=; b=D3y072o8y2r5VkegwDbgT+/pVxJEgzgV8wAHTyiO3ksv+CEIYu0yWD1F25MN0iT2vQrtKH9cVoQWn1HAO4Tz9LFY6RF0DBsBLn3n5KntkVKocaBlH+wL1Otd/kbezg42yGNJE1ImCWBnIXRjhOj+e6JsHY4WMbEhh9VpdRdbN1g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623766904593394.4446727678587; Tue, 15 Jun 2021 07:21:44 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-594-uqqfFWc-M_GYXYtU0miMoQ-1; Tue, 15 Jun 2021 10:21:42 -0400 Received: by mail-wm1-f70.google.com with SMTP id n8-20020a05600c3b88b02901b6e5bcd841so2844734wms.9 for ; Tue, 15 Jun 2021 07:21:42 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id t1sm18620831wrx.28.2021.06.15.07.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 07:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623766903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3hIM4nZ+edtMSEGqYdtBltxWEdrhiKauaGSD/ANl7HE=; b=iR7q52YRZsRPHr9IaNSfLDlD/ImXqlS3GnS0/UMmD6+3J09Dl2nHjax58jl8KOSKbiHXzq MXnB3pCAQP3/eBQjh/TwEZJ/638NrYNtLHxE/QeV9n/6GEJ5ddljDqY/7+Kc4QBr9cvjbw M6OztAdyljdVWAhFpy4XHjwNy/itiog= X-MC-Unique: uqqfFWc-M_GYXYtU0miMoQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3hIM4nZ+edtMSEGqYdtBltxWEdrhiKauaGSD/ANl7HE=; b=dsCXlEuj4oK5scGvM9eCZ+qKkWBjhXTwfEiKb+SlEJgrUZGxvNPEorpqYuMBeOm93J +RUyU9VWgm4sfb6ALhl+Hv0ZNglFFIR6Ky/WKjoW9TPzUG1iWjAYh9ju6dszD1znyabS OQeQXgNvBY/csQDSWCxwKxN1i0cS7784HUcvZaxF74hZW13kaPqZrjTiXINaVdcu1tKn +Tk4BAw3WdJoLxlevNhoSnSRm0VbGZLel8aZ7EcshRfbw7bwT/u49ORylRpPwHgcVWz1 wpWpn6mPwx0zWVrpXwskVoteWfQ2cLJPTxh9OoqGcZHMUgsmeobdctGbAHm9hPM4nBS8 IVkg== X-Gm-Message-State: AOAM5334Qnksw40DvOhBRra8ZpzMgNou7vt032vjdhFkLARAPFlDI9yA 6hA7LaN2k5/B2SKdDLAFUBPFEk7lThWtCLuJyqOrbiSQHMJEA4JzSEs+BfrrXdP3DG68lDVgJXk PPMMtvWg2GuQv7Q== X-Received: by 2002:a05:600c:4e8e:: with SMTP id f14mr5473878wmq.172.1623766901483; Tue, 15 Jun 2021 07:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ac6UxeiY2dO0jq/DtQflEHm9UTpF6R/VHeyAVvmD2jdUs//SV3xreYd+mdAfdlwDOz90Hg== X-Received: by 2002:a05:600c:4e8e:: with SMTP id f14mr5473863wmq.172.1623766901357; Tue, 15 Jun 2021 07:21:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 4/5] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Date: Tue, 15 Jun 2021 16:21:20 +0200 Message-Id: <20210615142121.2127692-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615142121.2127692-1-philmd@redhat.com> References: <20210615142121.2127692-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Stefan Berger Signed-off-by: Stefan Berger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210614191335.1968807-5-stefanb@linux.ibm.com> [PMD: Remove tpm_init() / tpm_cleanup() stubs] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/tpm.h | 9 +++++++++ include/sysemu/tpm_backend.h | 6 +++++- stubs/tpm.c | 10 ---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index 1a85564e479..68b2206463c 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -15,6 +15,8 @@ #include "qapi/qapi-types-tpm.h" #include "qom/object.h" =20 +#ifdef CONFIG_TPM + int tpm_config_parse(QemuOptsList *opts_list, const char *optarg); int tpm_init(void); void tpm_cleanup(void); @@ -73,4 +75,11 @@ static inline TPMVersion tpm_get_version(TPMIf *ti) return TPM_IF_GET_CLASS(ti)->get_version(ti); } =20 +#else /* CONFIG_TPM */ + +#define tpm_init() (0) +#define tpm_cleanup() + +#endif /* CONFIG_TPM */ + #endif /* QEMU_TPM_H */ diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index 6f078f5f482..8fd3269c117 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" =20 +#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); =20 TPMBackend *qemu_find_tpm_be(const char *id); =20 -#endif +#endif /* CONFIG_TPM */ + +#endif /* TPM_BACKEND_H */ diff --git a/stubs/tpm.c b/stubs/tpm.c index 22014595a06..e79bd2a6c2d 100644 --- a/stubs/tpm.c +++ b/stubs/tpm.c @@ -7,18 +7,8 @@ =20 #include "qemu/osdep.h" #include "qapi/qapi-commands-tpm.h" -#include "sysemu/tpm.h" #include "hw/acpi/tpm.h" =20 -int tpm_init(void) -{ - return 0; -} - -void tpm_cleanup(void) -{ -} - TPMInfoList *qmp_query_tpm(Error **errp) { return NULL; --=20 2.31.1 From nobody Tue May 21 23:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623766909; cv=none; d=zohomail.com; s=zohoarc; b=j4W9lMIzZfUhpiaZ0g3eqYILBYoo31w0lzu/PLh9X2mPsksfBDikva//hWCXOAbUF3jMksX73w4fawsi4NdgyAedlF4WJ2TdRDbWcwZx6HScbH6tAvXeDNNMPd8eTJyPdna0piZ9dA8c1BG3Uq70jfKjLEOr2YNRN4fL0b4M9Dw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623766909; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=VQGtLvI+0Hnax5suxA4HAJUzAwKZqsUpVwnL5qBALDg=; b=apTdx6edpATYEdsnMxUzILynJvYxz/akCAjCI6Z/1Y5Iq40f4OCtO8ZPy5nWT2+SZ2iX42OOdxLaL6yNZDYBuarQ9AWzD4wBvdtryD4NdqfJB+jaJNTfqp2sYnAQGIfjAn/9lH49ibiD7ErsfCW2p/fI8eyJLs1TR3qh3zvmpns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1623766909580319.66728144746; Tue, 15 Jun 2021 07:21:49 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-SCQOCQHqPFur09D0EJc4IA-1; Tue, 15 Jun 2021 10:21:47 -0400 Received: by mail-wm1-f69.google.com with SMTP id 18-20020a05600c0252b029019a0ce35d36so566108wmj.4 for ; Tue, 15 Jun 2021 07:21:47 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id u20sm15450940wmq.24.2021.06.15.07.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 07:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623766908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VQGtLvI+0Hnax5suxA4HAJUzAwKZqsUpVwnL5qBALDg=; b=Yv1pi2OvKMgtFajNrYGwLsDmEBgT4l6XS6Kkx+oDJg0ZTD086RJBV+5wud7D1Q9tS7wOWn o1h7hR5egu3uEcpieriQS04IGkSOb3FCVjj4cpUPzCKUHGkNGyx/Z49kj8Q1c0mIFNnqpB UzJyJpfQ7SwpQ7oZQPPNEoOCjAyv3Bk= X-MC-Unique: SCQOCQHqPFur09D0EJc4IA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VQGtLvI+0Hnax5suxA4HAJUzAwKZqsUpVwnL5qBALDg=; b=oycE9YMFtX7Ala2Yc67dfLz65Oafftt4j6u3CgJP4uErZw+qLHCuV7lTaOp9Nw+93t MtVdldTQqVADt2frpi0VzHxGKbnzf+MGR2xOmZ6LeA/KH7fI0UvwyBickym6GPEi+F81 +36KrNtZWIVnXiSYiFyi0An7678Pn4m8dfgr3ujUFL+M26O/0pW1q0lPUgBLHgkTvoF6 9tCsq9XgaGrocTdbc9J1CdThhJ7PfD3gDk0Hj20qfAU0pVC655vW68L4IXB4xzTiDFS5 iJyQ5zb3Ec3XrR3RhG55WUoeZHPQCHva+vA2ZqyEwCt3G12YaN+qREPhs/tVs7hhpfR1 G5Zg== X-Gm-Message-State: AOAM5317sKf3/J3lLAYdyhMUrwcJNp08gK4brxhdQKiHNJ30It9SVEd9 uSMxsOmmDs71CjP853/0NceDfFLFxRdJgJEaOfhY7kIdG0IoUc67Uxk7qBTiVGYX2qjwLgVgyji e2G3fuir54LdoVg== X-Received: by 2002:a05:600c:4f8f:: with SMTP id n15mr23188125wmq.116.1623766905902; Tue, 15 Jun 2021 07:21:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNhGEha8xgctO3+fKlRQVn88RPsOtJ88fcI1N4nt93DWZpzly4dk4qLiO4l716gTgTEehdjg== X-Received: by 2002:a05:600c:4f8f:: with SMTP id n15mr23188102wmq.116.1623766905730; Tue, 15 Jun 2021 07:21:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Subject: [PATCH v4 5/5] tpm: Return QMP error when TPM is disabled in build Date: Tue, 15 Jun 2021 16:21:21 +0200 Message-Id: <20210615142121.2127692-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615142121.2127692-1-philmd@redhat.com> References: <20210615142121.2127692-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) When the management layer queries a binary built using --disable-tpm for TPM devices, it gets confused by getting empty responses: { "execute": "query-tpm" } { "return": [ ] } { "execute": "query-tpm-types" } { "return": [ ] } { "execute": "query-tpm-models" } { "return": [ ] } To make it clearer by returning an error: - Make the TPM QAPI schema conditional All of tpm.json is now 'if': 'defined(CONFIG_TPM)'. - Adapt the HMP command - Remove stubs which became unnecessary The management layer now gets a 'CommandNotFound' error: { "execute": "query-tpm" } { "error": { "class": "CommandNotFound", "desc": "The command query-tpm has not been found" } } Suggested-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- qapi/tpm.json | 28 +++++++++++++++++++--------- monitor/hmp-cmds.c | 4 ++++ stubs/tpm.c | 25 ------------------------- MAINTAINERS | 1 - stubs/meson.build | 1 - 5 files changed, 23 insertions(+), 36 deletions(-) delete mode 100644 stubs/tpm.c diff --git a/qapi/tpm.json b/qapi/tpm.json index 6a10c9ed8d2..75590979fde 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: # @@ -33,7 +35,8 @@ # <- { "return": [ "tpm-tis", "tpm-crb", "tpm-spapr" ] } # ## -{ 'command': 'query-tpm-models', 'returns': ['TpmModel'] } +{ 'command': 'query-tpm-models', 'returns': ['TpmModel'], + 'if': 'defined(CONFIG_TPM)' } =20 ## # @TpmType: @@ -46,7 +49,8 @@ # # Since: 1.5 ## -{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ] } +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ], + 'if': 'defined(CONFIG_TPM)' } =20 ## # @query-tpm-types: @@ -63,7 +67,8 @@ # <- { "return": [ "passthrough", "emulator" ] } # ## -{ 'command': 'query-tpm-types', 'returns': ['TpmType'] } +{ 'command': 'query-tpm-types', 'returns': ['TpmType'], + 'if': 'defined(CONFIG_TPM)' } =20 ## # @TPMPassthroughOptions: @@ -79,7 +84,8 @@ ## { 'struct': 'TPMPassthroughOptions', 'data': { '*path': 'str', - '*cancel-path': 'str' } } + '*cancel-path': 'str' }, + 'if': 'defined(CONFIG_TPM)' } =20 ## # @TPMEmulatorOptions: @@ -90,7 +96,8 @@ # # Since: 2.11 ## -{ 'struct': 'TPMEmulatorOptions', 'data': { 'chardev' : 'str' } } +{ 'struct': 'TPMEmulatorOptions', 'data': { 'chardev' : 'str' }, + 'if': 'defined(CONFIG_TPM)' } =20 ## # @TpmTypeOptions: @@ -104,7 +111,8 @@ ## { 'union': 'TpmTypeOptions', 'data': { 'passthrough' : 'TPMPassthroughOptions', - 'emulator': 'TPMEmulatorOptions' } } + 'emulator': 'TPMEmulatorOptions' }, + 'if': 'defined(CONFIG_TPM)' } =20 ## # @TPMInfo: @@ -122,7 +130,8 @@ { 'struct': 'TPMInfo', 'data': {'id': 'str', 'model': 'TpmModel', - 'options': 'TpmTypeOptions' } } + 'options': 'TpmTypeOptions' }, + 'if': 'defined(CONFIG_TPM)' } =20 ## # @query-tpm: @@ -152,4 +161,5 @@ # } # ## -{ 'command': 'query-tpm', 'returns': ['TPMInfo'] } +{ 'command': 'query-tpm', 'returns': ['TPMInfo'], + 'if': 'defined(CONFIG_TPM)' } diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d10ee141109..0942027208d 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -901,6 +901,7 @@ void hmp_info_pci(Monitor *mon, const QDict *qdict) =20 void hmp_info_tpm(Monitor *mon, const QDict *qdict) { +#ifdef CONFIG_TPM TPMInfoList *info_list, *info; Error *err =3D NULL; unsigned int c =3D 0; @@ -946,6 +947,9 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) c++; } qapi_free_TPMInfoList(info_list); +#else + monitor_printf(mon, "TPM device not supported\n"); +#endif /* CONFIG_TPM */ } =20 void hmp_quit(Monitor *mon, const QDict *qdict) diff --git a/stubs/tpm.c b/stubs/tpm.c deleted file mode 100644 index e79bd2a6c2d..00000000000 --- a/stubs/tpm.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * TPM stubs - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * See the COPYING file in the top-level directory. - */ - -#include "qemu/osdep.h" -#include "qapi/qapi-commands-tpm.h" -#include "hw/acpi/tpm.h" - -TPMInfoList *qmp_query_tpm(Error **errp) -{ - return NULL; -} - -TpmTypeList *qmp_query_tpm_types(Error **errp) -{ - return NULL; -} - -TpmModelList *qmp_query_tpm_models(Error **errp) -{ - return NULL; -} diff --git a/MAINTAINERS b/MAINTAINERS index 7d9cd290426..636bf2f5365 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2707,7 +2707,6 @@ TPM M: Stefan Berger S: Maintained F: tpm.c -F: stubs/tpm.c F: hw/tpm/* F: include/hw/acpi/tpm.h F: include/sysemu/tpm* diff --git a/stubs/meson.build b/stubs/meson.build index 65c22c0568c..d4e9549dc99 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -38,7 +38,6 @@ stub_ss.add(files('sysbus.c')) stub_ss.add(files('target-get-monitor-def.c')) stub_ss.add(files('target-monitor-defs.c')) -stub_ss.add(files('tpm.c')) stub_ss.add(files('trace-control.c')) stub_ss.add(files('uuid.c')) stub_ss.add(files('vmgenid.c')) --=20 2.31.1