From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Stefan Berger" <stefanb@linux.ibm.com>
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 [thread overview]
Message-ID: <20210615152152.2496772-5-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20210615152152.2496772-1-stefanb@linux.vnet.ibm.com>
From: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210614191335.1968807-5-stefanb@linux.ibm.com>
[PMD: Remove tpm_init() / tpm_cleanup() stubs]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
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"
+#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);
}
+#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"
+#ifdef CONFIG_TPM
+
#define TYPE_TPM_BACKEND "tpm-backend"
OBJECT_DECLARE_TYPE(TPMBackend, TPMBackendClass,
TPM_BACKEND)
@@ -209,4 +211,6 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s);
TPMBackend *qemu_find_tpm_be(const char *id);
-#endif
+#endif /* CONFIG_TPM */
+
+#endif /* TPM_BACKEND_H */
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 @@
#include "qemu/osdep.h"
#include "qapi/qapi-commands-tpm.h"
-#include "sysemu/tpm.h"
#include "hw/acpi/tpm.h"
-int tpm_init(void)
-{
- return 0;
-}
-
-void tpm_cleanup(void)
-{
-}
-
TPMInfoList *qmp_query_tpm(Error **errp)
{
return NULL;
--
2.31.1
next prev parent reply other threads:[~2021-06-15 15:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 15:21 [PULL v1 0/5] Merge tpm 2021/06/15 v1 Stefan Berger
2021-06-15 15:21 ` [PULL v1 1/5] i386: Eliminate all TPM related code if CONFIG_TPM is not set Stefan Berger
2021-06-15 15:21 ` [PULL v1 2/5] arm: " Stefan Berger
2021-06-15 15:21 ` [PULL v1 3/5] acpi: " Stefan Berger
2021-06-15 15:21 ` Stefan Berger [this message]
2021-06-15 15:21 ` [PULL v1 5/5] tpm: Return QMP error when TPM is disabled in build Stefan Berger
2021-06-16 12:50 ` [PULL v1 0/5] Merge tpm 2021/06/15 v1 Peter Maydell
2021-06-16 14:38 ` Philippe Mathieu-Daudé
2021-06-16 14:48 ` Stefan Berger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210615152152.2496772-5-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).