From nobody Sat May 4 23:58:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623770756910245.36100038482311; Tue, 15 Jun 2021 08:25:56 -0700 (PDT) Received: from localhost ([::1]:36416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltAwt-00076H-Qx for importer2@patchew.org; Tue, 15 Jun 2021 11:25:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtT-0001FI-EH for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:16034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtR-0006OM-Ae for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:23 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15FF5QQZ123555; Tue, 15 Jun 2021 11:22:20 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 396xbyh3rw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:19 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15FF5SaI123832; Tue, 15 Jun 2021 11:22:19 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 396xbyh3rg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:19 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15FFBrvA021102; Tue, 15 Jun 2021 15:22:18 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01dal.us.ibm.com with ESMTP id 394mja74gg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 15:22:18 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15FFMGYb11731218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jun 2021 15:22:17 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE5B378064; Tue, 15 Jun 2021 15:22:16 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C0487805E; Tue, 15 Jun 2021 15:22:11 +0000 (GMT) Received: from sbct-3.pok.ibm.com?044watson.ibm.com (unknown [9.47.158.153]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 15 Jun 2021 15:22:11 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=1oNHrl934cpjAyZR9sOh8+kRN3xyCGRqJUlqfaWwNb4=; b=UkOyQqpKCkHJD3xv5nRDHcVdcRVPcjPAmex+s7wvuklrIi/AAdQjjQnENn0gYEYljJHa BNjyeXn91CZEeaw+QW84Q45inJQcobOJZQ4g9GS99Jl6XpZ01gboqGQ3IKy1Px59PP4E zQu568vHji+fzfbgUNTQDEtlSm8BAP7WHNcrDA1ZIqFTYsxI4Utvm/MUfPexh1rYGyiB DkeE/U63/YK3TffXBLP9CWhlUXXjrTqSYA+GvlXMUq3pKmL/yWrRBsrl17BqWL4uEgId 11PaaorXZFiesdgh/auyl5WYSj86gmLBnIBItqe1T6HoC9yEbkIWVpOBmo+8qTbcglSe kg== From: Stefan Berger To: qemu-devel@nongnu.org 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 Message-Id: <20210615152152.2496772-2-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> References: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: m0qfX8vMPDdquZpokzHgKDLAfflk2jVJ X-Proofpoint-ORIG-GUID: RYBH8uQXh1WPBSr2aQaEDkFje5rpGw1G X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-15_07:2021-06-14, 2021-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106150095 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=148.163.158.5; envelope-from=stefanb@linux.vnet.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Igor Mammedov , "Michael S . Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 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) } =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 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) -{ -} --=20 2.31.1 From nobody Sat May 4 23:58:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623770640468581.7467486799675; Tue, 15 Jun 2021 08:24:00 -0700 (PDT) Received: from localhost ([::1]:59452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltAv1-0003UW-AY for importer2@patchew.org; Tue, 15 Jun 2021 11:23:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtW-0001M6-Kg for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtS-0006Og-3C for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:26 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15FF3qrV045955; Tue, 15 Jun 2021 11:22:20 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 396x7w1k28-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:19 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15FF4GOG048004; Tue, 15 Jun 2021 11:22:19 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 396x7w1k1k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:19 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15FFDPHl012481; Tue, 15 Jun 2021 15:22:18 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma01wdc.us.ibm.com with ESMTP id 394mj9902t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 15:22:18 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15FFMHsP29295000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jun 2021 15:22:17 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 593CC7805C; Tue, 15 Jun 2021 15:22:17 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D41B78064; Tue, 15 Jun 2021 15:22:16 +0000 (GMT) Received: from sbct-3.pok.ibm.com?044watson.ibm.com (unknown [9.47.158.153]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 15 Jun 2021 15:22:16 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=cDW+v0140pijcT53TpR/bxVhKV0wpHipd5e2UonGcIE=; b=MC6Mm4VEfFk+i+TJPOz0l4pSo2INcj/qg7sIqP12SVwmAxN6OSIaB/3g0H1l/cKmRIgW 04/EZB3pfk4tk2XuKVODmckROwCXYf2OdmHpRzGeXC2imhBJ98QZdHamcJVkQPhk5KQ6 cmpZyV10oVOQoFF+thLBgRYqdFCtie+4wXdMtMNeLYSKLx9GK6NRZpZrKUwC692ul/Bo RZ8lJ1TBwxZfkPOcnIJaV4nnbLAeMIVJt/PUxi3xlYHgk5LMKKrwl2q6XpgE5QM4o2bN 7eYzHEjFxHp6q3DEHzhrZXdV5uYVX6L/BDZ9CriiYq6wQ6IRN6UXyMTJa6B3NGcy9pWZ Uw== From: Stefan Berger To: qemu-devel@nongnu.org Subject: [PULL v1 2/5] arm: Eliminate all TPM related code if CONFIG_TPM is not set Date: Tue, 15 Jun 2021 11:21:49 -0400 Message-Id: <20210615152152.2496772-3-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> References: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: oKyrigJx1SdfRAlG0xJw067x1PtAHI3z X-Proofpoint-ORIG-GUID: RjDbrlh0cEx-d-fL32J-dNhpDsDufG7a X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-15_07:2021-06-14, 2021-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106150095 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=148.163.156.1; envelope-from=stefanb@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 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, =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 60fe2e65a7..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 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 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 =3D IF_VIRTIO; mc->no_cdrom =3D 1; mc->pci_allow_0_address =3D true; --=20 2.31.1 From nobody Sat May 4 23:58:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623771015930121.46432884762714; Tue, 15 Jun 2021 08:30:15 -0700 (PDT) Received: from localhost ([::1]:45730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltB14-0005P2-Qu for importer2@patchew.org; Tue, 15 Jun 2021 11:30:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAyT-0002RW-HN for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:27:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50064 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAyP-0000XN-LX for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:27:33 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15FF4KTM028243; Tue, 15 Jun 2021 11:27:27 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 396wyujafn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:27:27 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15FF4dux030217; Tue, 15 Jun 2021 11:27:27 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 396wyujafe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:27:27 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15FFCCE7013488; Tue, 15 Jun 2021 15:22:19 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma04dal.us.ibm.com with ESMTP id 3965ytmfpm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 15:22:19 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15FFMHw735520888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jun 2021 15:22:18 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D159C78066; Tue, 15 Jun 2021 15:22:17 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 702507805E; Tue, 15 Jun 2021 15:22:17 +0000 (GMT) Received: from sbct-3.pok.ibm.com?044watson.ibm.com (unknown [9.47.158.153]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 15 Jun 2021 15:22:17 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=pm2GZHPTSetfhkrn/yYYCDVVMDeA502sznfYJXZrur8=; b=fwCHS4bH8mN/PKqL6+BTN8Sk9Hyu8yfizC8AssFy2PFy4URTvYhu8Gd7cWL+xZIuOr37 k/3J5HqiZXincnjG/BcHzL2rfEIjvjNZ9G/LoaCH+ik+gg+gRbRxPMQ2XVI0VLgXH1VN 52QIpL0i3ULF3bU7g1Jshnvj9e6YLLLPEVeLSi1oQSZMwrW9xtD70fbkW4K6jGQzuIoM /ax6JZXi7Iuy13MrrP7oCG3XocCVevgf5XaO2Vg0QhrgiAkOmoxN+c+loP2baO32v7gZ B2ta6OW4fDBfTb/ouioMaGxpSaQS7yNWlmrT4Ez47Be77Zdu7G6FDu2+F0vsUios7E9t 2w== From: Stefan Berger To: qemu-devel@nongnu.org Subject: [PULL v1 3/5] acpi: Eliminate all TPM related code if CONFIG_TPM is not set Date: Tue, 15 Jun 2021 11:21:50 -0400 Message-Id: <20210615152152.2496772-4-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> References: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 1N21GD9GJl18NaSg3ZEAh77KAiUYmfsP X-Proofpoint-GUID: 6AkQXHIdFngS9jMRsjYftWRgbm3u2i2p X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-15_07:2021-06-14, 2021-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106150095 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=148.163.158.5; envelope-from=stefanb@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Igor Mammedov , "M : Michael S . Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 --- hw/acpi/aml-build.c | 2 ++ include/hw/acpi/tpm.h | 4 ++++ 2 files changed, 6 insertions(+) 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); } =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, 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" =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 */ --=20 2.31.1 From nobody Sat May 4 23:58:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623770785760489.80026185487645; Tue, 15 Jun 2021 08:26:25 -0700 (PDT) Received: from localhost ([::1]:37536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltAxM-00082v-PD for importer2@patchew.org; Tue, 15 Jun 2021 11:26:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtX-0001Nh-Ap for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:27746 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtS-0006Or-Ez for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:27 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15FFGBVk150610; Tue, 15 Jun 2021 11:22:21 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 396xpt07cd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:21 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15FFGred155139; Tue, 15 Jun 2021 11:22:20 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com with ESMTP id 396xpt07bx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:20 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15FFBuCn021445; Tue, 15 Jun 2021 15:22:19 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01dal.us.ibm.com with ESMTP id 394mja74gs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 15:22:19 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15FFMIcQ21955032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jun 2021 15:22:18 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FF207805F; Tue, 15 Jun 2021 15:22:18 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E80337805C; Tue, 15 Jun 2021 15:22:17 +0000 (GMT) Received: from sbct-3.pok.ibm.com?044watson.ibm.com (unknown [9.47.158.153]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 15 Jun 2021 15:22:17 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=yH7sQEpCce6PEXVnnqxniCtIBkmYvVTL8LVn5IZJV90=; b=aj23rl0wjMbCp8pxNzvDPuS+U+pvX4fMU3mQJ69rvhe3eirTkeRFnQvrIRWbSx64XZW3 Ivp0+ewYCRfnL3MpyLj0nW/l9OS+h3j+z9EYN1BmG0ADSFM2lJpWa1hsEabgDgJPmfA9 V7Ulf0nbM73kyZTbI6lXliTP9xL/H25Yn58ndyZ7TH7MXh9E9HUF3uKoqo0WjC2KTF6v kGG0oL7jzywUycXNVFp8vaWf7zUmZKxacmVgLjVgghoE1PDYc1DFfMQ3HfZQadeIRkZb OLNm5RJroqPt8vxnjBZ4/PLWknu+HXhVrBB1HmntGelPsY9YPWdtCQbqYBFEIscaZ9o0 ZA== From: Stefan Berger To: qemu-devel@nongnu.org Subject: [PULL v1 4/5] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Date: Tue, 15 Jun 2021 11:21:51 -0400 Message-Id: <20210615152152.2496772-5-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> References: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: IMMGUHQxhP2X0BxR2pkyCH8WhePOVb3T X-Proofpoint-GUID: C4XY7S0TVaQwGmC-QAtn18i3v3NOguDg X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-15_07:2021-06-14, 2021-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106150095 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=148.163.158.5; envelope-from=stefanb@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 1a85564e47..68b2206463 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 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" =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 22014595a0..e79bd2a6c2 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 Sat May 4 23:58:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623770868576618.3171927382164; Tue, 15 Jun 2021 08:27:48 -0700 (PDT) Received: from localhost ([::1]:40734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltAyh-00020w-G4 for importer2@patchew.org; Tue, 15 Jun 2021 11:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtW-0001LJ-7q for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40386 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltAtT-0006PY-Qr for qemu-devel@nongnu.org; Tue, 15 Jun 2021 11:22:25 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15FF4JRR028203; Tue, 15 Jun 2021 11:22:21 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 396wyuj5dr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:20 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15FF4duh030217; Tue, 15 Jun 2021 11:22:20 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0b-001b2d01.pphosted.com with ESMTP id 396wyuj5d9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 11:22:20 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15FFDPJ2012476; Tue, 15 Jun 2021 15:22:19 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01wdc.us.ibm.com with ESMTP id 394mj99032-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 15:22:19 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15FFMIPp19464526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jun 2021 15:22:18 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B90C57805F; Tue, 15 Jun 2021 15:22:18 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5747978064; Tue, 15 Jun 2021 15:22:18 +0000 (GMT) Received: from sbct-3.pok.ibm.com?044watson.ibm.com (unknown [9.47.158.153]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 15 Jun 2021 15:22:18 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=jK4vgPBy8Rt4KGUiquvdchOVaPLjYl+plWmJXvf3WlE=; b=BCCrgJ7chaU21tUPiyNVJR0lBbR0YkqcPvoD+B+g1I+grvoySEAzbsCjb99uCET0U6kL Yt8kOsgsaUlyDvMb7KPr6fscqe1na6m514dd16BzmMiyUqveIJiPFTtyYOxSiPSwFnfs us3oV6ol+UC8t+Fq8vylLKe/61UWXXMCx1vr8CFYlXdqVT4ylayPSvcV2bGguzXFPmaT UYP+THxZ4G43SLMzJ6dCkP+Og/uJPsYu7NyM4rXSkogKqr04vpL8HHn658QlMemyFeDA hSuX39233YEzILdV8AIdWYPbzDivXKZMN7m3K32VnxvPEQTHacYkg0S1la6JmESutiEK 0A== From: Stefan Berger To: qemu-devel@nongnu.org Subject: [PULL v1 5/5] tpm: Return QMP error when TPM is disabled in build Date: Tue, 15 Jun 2021 11:21:52 -0400 Message-Id: <20210615152152.2496772-6-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> References: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hzf1Dj-HkGzvbB2k75vVUHzhJ3WiD1tq X-Proofpoint-GUID: wRkG7wlljSGLf6O5uXJHiutNv6B4yBMw X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-15_07:2021-06-14, 2021-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106150095 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=148.163.158.5; envelope-from=stefanb@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 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 Signed-off-by: Stefan Berger --- MAINTAINERS | 1 - monitor/hmp-cmds.c | 4 ++++ qapi/tpm.json | 28 +++++++++++++++++++--------- stubs/meson.build | 1 - stubs/tpm.c | 25 ------------------------- 5 files changed, 23 insertions(+), 36 deletions(-) delete mode 100644 stubs/tpm.c diff --git a/MAINTAINERS b/MAINTAINERS index 7d9cd29042..636bf2f536 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/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d10ee14110..0942027208 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/qapi/tpm.json b/qapi/tpm.json index 6a10c9ed8d..75590979fd 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/stubs/meson.build b/stubs/meson.build index 65c22c0568..d4e9549dc9 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -38,7 +38,6 @@ stub_ss.add(files('runstate-check.c')) 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')) diff --git a/stubs/tpm.c b/stubs/tpm.c deleted file mode 100644 index e79bd2a6c2..0000000000 --- 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; -} --=20 2.31.1