tpm: add stubs to fix compiling with --disable-tpm
v2 cover tpm: add stubs to fix compiling with --disable-tpm
This fixes building with --disable-tpm as reported by Zoltan:
http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg05369.html
Cc'ing Peter in case this enters as a build fix instead of via trivial.
v2:
- added Richard W.M. Jones Tested-by tag
- remove #ifdef CONFIG_TPM in tpm.c (Stefan Berger)
Regards,
Phil.
PD: I missed Amarnath Valluri in my first series, you might want to add yourself
a R: tag in MAINTAINTERS.
Philippe Mathieu-Daudé (4):
tpm: add missing include
tpm: add stubs
tpm: remove unnecessary #ifdef CONFIG_TPM
vl: remove unnecessary #ifdef CONFIG_TPM
Makefile.objs | 2 +- include/sysemu/tpm.h | 1 + stubs/tpm.c | 33 +++++++++++++++++++++++++++++++++ tpm.c | 4 ---- vl.c | 2 -- MAINTAINERS | 1 + stubs/Makefile.objs | 1 + 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 stubs/tpm.c
Signature · 1 line
2.15.0.rc1
PATCH v2 1/4 tpm: add missing include
else file including "sysemu/tpm.h" fails to compile:
In file included from qemu/stubs/tpm.c:2:0:
qemu/include/sysemu/tpm.h:36:19: error: implicit declaration of function ‘object_resolve_path_type’ [-Werror=implicit-function-declaration]
Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~--- include/sysemu/tpm.h | 1 + 1 file changed, 1 insertion(+)
include/sysemu/tpm.h +1 -0
@@ -13,6 +13,7 @@#define QEMU_TPM_H #include "qemu/option.h" +#include "qom/object.h" typedef struct TPMState TPMState ;
Signature · 1 line
2.15.0.rc1
PATCH v2 3/4 tpm: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-DaudéMakefile.objs now checks for $(CONFIG_TPM).
--- tpm.c | 4 ---- 1 file changed, 4 deletions(-)
tpm.c +0 -4
@@ -30,8 +30,6 @@ void tpm_register_model(enum TpmModel model) tpm_models[model] = true; } -#ifdef CONFIG_TPM -static const TPMBackendClass *tpm_be_find_by_type (enum TpmType type) {
@@ -192,8 +190,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)return 0 ; } -#endif /* CONFIG_TPM */ -/* * Walk the list of active TPM backends and collect information about them * following the schema description in qapi-schema.json.
Signature · 1 line
2.15.0.rc1
PATCH v2 2/4 tpm: add stubs
In reply to Philippe Mathieu-DaudéCommit c37cacabf22 moved tpm_cleanup() in the main loop exit, however this function is not available when compiling with --disable-tpm.
Provides necessary stubs to keep code clean of #ifdef'fery.
Message-Id: <[email protected]>
--- Makefile.objs | 2 +- stubs/tpm.c | 33 +++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + stubs/Makefile.objs | 1 + 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 stubs/tpm.c
Makefile.objs +1 -1
@@ -62,7 +62,7 @@ bt-host.o-cflags := $(BLUEZ_CFLAGS) common-obj-y += dma-helpers.o common-obj-y += vl.o vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) -common-obj-y += tpm.o +common-obj-$(CONFIG_TPM) += tpm.o common-obj-$(CONFIG_SLIRP) += slirp/
stubs/tpm.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* TPM stubs +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#include "qemu/osdep.h" +#include "sysemu/tpm.h" +#include "qmp-commands.h" + +int tpm_init (void ) +{ +return 0 ; +} + +void tpm_cleanup (void ) +{ +} + +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 ; +}
MAINTAINERS +1 -0
@@ -1544,6 +1544,7 @@ TPM M: Stefan Berger <[email protected]> S: Maintained F: tpm.c +F: stubs/tpm.c F: hw/tpm/* F: include/hw/acpi/tpm.h F: include/sysemu/tpm*
stubs/Makefile.objs +1 -0
@@ -28,6 +28,7 @@ stub-obj-y += runstate-check.o stub-obj-y += set-fd-handler.o stub-obj-y += slirp.o stub-obj-y += sysbus.o +stub-obj-y += tpm.o stub-obj-y += trace-control.o stub-obj-y += uuid.o stub-obj-y += vm-stop.o
Signature · 1 line
2.15.0.rc1
PATCH v2 4/4 vl: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-Daudéa stub is now provided.
--- vl.c | 2 -- 1 file changed, 2 deletions(-)
vl.c +0 -2
@@ -4624,11 +4624,9 @@ int main(int argc, char **argv, char **envp)exit (1 ); } -#ifdef CONFIG_TPM if (tpm_init () <0 ) {exit (1 ); } -#endif /* init the bluetooth world */ if (foreach_device_config (DEV_BT , bt_parse))
Signature · 1 line
2.15.0.rc1
Quoted 8 lines · Philippe Mathieu-Daudé
This fixes building with --disable-tpm as reported by Zoltan:
http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg05369.htmlCc'ing Peter in case this enters as a build fix instead of via trivial.
v2:
- added Richard W.M. Jones Tested-by tag
- remove #ifdefCONFIG_TPMintpm.c(Stefan Berger)
Can confirm v2 works as well.
Rich.
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Quoted 5 lines
Quoted 3 lines
v2:
- added Richard W.M. Jones Tested-by tag
- remove #ifdefCONFIG_TPMintpm.c(Stefan Berger)Can confirm v2 works as well.
Thanks for testing!
Re: [Qemu-devel] [PATCH v2 3/4] tpm: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
Makefile.objs now checks for $(CONFIG_TPM).
Suggested-by Stefan Berger <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 26 lines
--- tpm.c | 4 ---- 1 file changed, 4 deletions(-)tpm.c +0
-4@@ -30,8 +30,6 @@ void tpm_register_model(enum TpmModel model) tpm_models[model] = true; } -#ifdef CONFIG_TPM -static const TPMBackendClass *tpm_be_find_by_type (enum TpmType type) {@@ -192,8 +190,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)return 0 ; } -#endif /* CONFIG_TPM */ -/* * Walk the list of active TPM backends and collect information about them * following the schema description in qapi-schema.json.
Quoted 22 lines · Philippe Mathieu-Daudé
This fixes building with --disable-tpm as reported by Zoltan:
http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg05369.htmlCc'ing Peter in case this enters as a build fix instead of via trivial.
v2:
- added Richard W.M. Jones Tested-by tag
- remove #ifdefCONFIG_TPMintpm.c(Stefan Berger)Regards,
Phil.
PD: I missed Amarnath Valluri in my first series, you might want to add yourself
a R: tag in MAINTAINTERS.Philippe Mathieu-Daudé (4):
tpm: add missing include
tpm: add stubs
tpm: remove unnecessary #ifdefCONFIG_TPM
vl: remove unnecessary #ifdefCONFIG_TPM
Quoted 10 lines
Makefile.objs | 2 +- include/sysemu/tpm.h | 1 + stubs/tpm.c | 33 +++++++++++++++++++++++++++++++++ tpm.c | 4 ---- vl.c | 2 -- MAINTAINERS | 1 + stubs/Makefile.objs | 1 + 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 stubs/tpm.c
+1, Nice cleanup in my opinion, now it looks much cleaner.
- Amarnath
Re: [Qemu-devel] [PATCH v2 2/4] tpm: add stubs
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
Commit
c37cacabf22movedtpm_cleanup()in the main loop exit, however this function is not available when compiling with --disable-tpm.Provides necessary stubs to keep code clean of #ifdef'fery.
Reported-by BALATON Zoltan <[email protected]>Message-Id: <[email protected]>
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Richard W.M. Jones <[email protected]>
Re: [Qemu-devel] [PATCH v2 3/4] tpm: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
Makefile.objs now checks for $(CONFIG_TPM).
Suggested-by Stefan Berger <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Re: [Qemu-devel] [PATCH v2 4/4] vl: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
a stub is now provided.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Richard W.M. Jones <[email protected]>
Hi Amarnath,
Quoted 3 lines · Amarnath Valluri
Quoted 2 lines · Philippe Mathieu-Daudé
This fixes building with --disable-tpm as reported by Zoltan:
http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg05369.html
[...]
Quoted 1 line
+1, Nice cleanup in my opinion, now it looks much cleaner.
Thanks, however I'm not sure what a +1 means, is it equivalent to an Acked-by or a Reviewed-by tag? If so it would be better to write them explicitly.
Regards,
Phil.
Re: [Qemu-devel] [PATCH v2 4/4] vl: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
a stub is now provided.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Richard W.M. Jones <[email protected]>
Quoted 20 lines
---
vl.c | 2 --1 file changed, 2 deletions(-)Reviewed-by:
vl.c +0
-0@@ -4624,11 +4624,9 @@ int main(int argc, char **argv, char **envp) exit(1); }
-#ifdefCONFIG_TPM
if (tpm_init()< 0) {
exit(1);
}
-#endif
/* init the bluetooth world */
if (foreach_device_config(DEV_BT, bt_parse))
Re: [Qemu-devel] [PATCH v2 3/4] tpm: remove unnecessary #ifdef CONFIG_TPM
In reply to Philippe Mathieu-DaudéQuoted 5 lines · Philippe Mathieu-Daudé
Makefile.objs now checks for $(CONFIG_TPM).
Suggested-by Stefan Berger <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 27 lines
tpm.c | 4 ----
1 file changed, 4 deletions(-)tpm.c +0
-0@@ -30,8 +30,6 @@ void tpm_register_model(enum TpmModel model) tpm_models[model] = true; }tpm.c +0
-2-#ifdef CONFIG_TPM -static const TPMBackendClass *
tpm_be_find_by_type(enum TpmType type)
{tpm.c +0
-0@@ -192,8 +190,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg) return 0; }tpm.c +0
-2-#endif /* CONFIG_TPM */ -/*
* Walk the list of active TPM backends and collect information about them
* following the schema description in qapi-schema.json.
Re: [Qemu-devel] [PATCH v2 2/4] tpm: add stubs
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
Commit
c37cacabf22movedtpm_cleanup()in the main loop exit, however this
function is not available when compiling with --disable-tpm.Provides necessary stubs to keep code clean of #ifdef'fery.
Reported-by BALATON Zoltan <[email protected]>Message-Id: <[email protected]>
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Richard W.M. Jones <[email protected]>---