From nobody Mon Feb 9 11:33:00 2026 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=1623701403; cv=none; d=zohomail.com; s=zohoarc; b=g4O4JEinzDQ05yreWtRGXkdOKwhHUaBKXedV43lcmpSYKJMOGTUoGhawBxUPl3oic8PqtSOrcgVX0TzxWRfVq1h2fiy47QwB5sfQvWVnwewPeFhgnhxlmmILh5CmTncUvJmPRUIPOVKEZhfaUzl+WkoQ0Lpj5hznYpbQQ2SFUBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623701403; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=3hIM4nZ+edtMSEGqYdtBltxWEdrhiKauaGSD/ANl7HE=; b=HYBSVM7d6fdZ6zSQXP+q51i14mzCuAQlNl09VZYEk48fnOXqYr/dWqK8wo6FOjc3usAW3yRi/IG1DPPwzS6jM9UkLxrZdp2CG/1CnyA9vjiClm821CyzeOvcYbLRmkSSaihfaSgk3tvzC1GtMpdqM1Rbfb0miQkDKQFZOH3Lq+o= 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 1623701403700611.8853423914654; Mon, 14 Jun 2021 13:10:03 -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-582-AHm66AUBNOKfNtf6Vyo-_Q-1; Mon, 14 Jun 2021 16:10:01 -0400 Received: by mail-wm1-f70.google.com with SMTP id u17-20020a05600c19d1b02901af4c4deac5so437004wmq.7 for ; Mon, 14 Jun 2021 13:10:01 -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 l10sm16558905wrs.11.2021.06.14.13.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 13:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623701402; 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=iME3OMRtFPbpEyXHFD+D12MbqHnsbwsach/DvWXAIMmYlgCJS58URYCpLRRqZkEzuDINAL YPCiwnbiVy2tfPgXEKOCvcxOOeO8YmZX2grrwdjYhXIPC0oY9L9i/np54WPNaURj9hpwrT Zu2TKjzlFM/XPheRvyfr4XOdzdsDTM8= X-MC-Unique: AHm66AUBNOKfNtf6Vyo-_Q-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=XSRLmWTdQY+JGDxYU/T0AmWyB9QUJVQrE+6OBaebN7gM5mZURGB9aoob7AbpKS1PL8 IcVaaH7A63t08BaNfJtySb75jrHGe8IACwCOiPvlgx6bpTuri159g8XLr3QMHpi0J84d 5oYcaJFPFXm2KbYxsWDDaN1IevB0tb9+JpXL7Iev88oysWoHxFlpYZWu2NGo3utdJDkH Bu/63SvSr73VI+t8g+NTOexmJHJzv9HOOB+XhrEaT02PPxkPc5T+2qrn5N1VTjEzy5no aHo2pGxaxWNjQYJ7AdApHzLj4KAol5PglTi13V0kB8Xa0hfmdDPMcfDdfXBluDbKj97q Q6Kg== X-Gm-Message-State: AOAM530wmmE3Gxsj7Nr3q/15UeaLEHZyrlbe8DZYlDeIoi9v9hCOaWvy V55ksCFmrYHfnvl/sfIjmlIOy8AcAO3YAb68uUSaLFN/IsqfZ63NZYDj5lwssRIWc8M6Q/P36wG gyGzOup5NfRi6rg== X-Received: by 2002:a7b:c20b:: with SMTP id x11mr908274wmi.9.1623701400291; Mon, 14 Jun 2021 13:10:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaznMWFe5kkp1meQldQFacYfdH9YXNqNYunC1G3Aov7zVvcIVEXU8ceZduYpB9ckQkbChHjg== X-Received: by 2002:a7b:c20b:: with SMTP id x11mr908261wmi.9.1623701400118; Mon, 14 Jun 2021 13:10:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , qemu-arm@nongnu.org, "Michael S. Tsirkin" , Igor Mammedov , Markus Armbruster , Eric Blake , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 4/5] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined Date: Mon, 14 Jun 2021 22:09:39 +0200 Message-Id: <20210614200940.2056770-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210614200940.2056770-1-philmd@redhat.com> References: <20210614200940.2056770-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