Skip to contentSkip to conversation

tpm: add stubs to fix compiling with --disable-tpm

PATCH Superseded Philippe Mathieu-Daudé 3 participants 8 messages Oct 23, 2017 – Oct 24, 2017 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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 build fix instead of via trivial.

Regards,

Phil.

Philippe Mathieu-Daudé (3):
tpm: add missing include
tpm: add stubs
vl: remove unnecessary #ifdef CONFIG_TPM

 Makefile.objs        |  2 +-
 include/sysemu/tpm.h |  1 +
 stubs/tpm.c          | 33 +++++++++++++++++++++++++++++++++
 vl.c                 |  2 --
 MAINTAINERS          |  1 +
 stubs/Makefile.objs  |  1 +
 6 files changed, 37 insertions(+), 3 deletions(-)
 create mode 100644 stubs/tpm.c
Signature · 1 line
2.15.0.rc1
#1 lore raw

PATCH 1/3 tpm: add missing include

else files including "sysemu/tpm.h" fail 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
index c8afa179e5..d7a2bd8556 100644
@@ -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
#2 lore raw

PATCH 2/3 tpm: add stubs

In reply to Philippe Mathieu-Daudé

this fixes compile with --disable-tpm

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
index d4f973a8fc..285c6f3c15 100644
@@ -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
new file mode 100644
index 0000000000..6b90557e42
@@ -0,0 +1,33 @@
+/*
+ * TPM configuration
+ *
+ * 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
index 12175425a7..2650063242 100644
@@ -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
index c7594796c3..8cfe34328a 100644
@@ -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
#3 lore raw

PATCH 3/3 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
index 0723835bbf..ec299099ff 100644
@@ -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
#4 lore raw

Re: [Qemu-devel] [PATCH 3/3] vl: remove unnecessary #ifdef CONFIG_TPM

The series fixes the build for me, thanks :-)

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/
#7 lore raw

Re: [Qemu-devel] [PATCH 3/3] vl: remove unnecessary #ifdef CONFIG_TPM

In reply to Philippe Mathieu-Daudé
Quoted 13 lines · Philippe Mathieu-Daudé

a stub is now provided.

---
  vl.c | 2 --
  1 file changed, 2 deletions(-)
vl.c +0 -0
index 0723835bbf..ec299099ff 100644
@@ -4624,11 +4624,9 @@ int main(int argc, char **argv, char **envp)
          exit(1);

vl.c int main(int argc, char **argv, char **envp) · line 4632

Quoted 10 lines
vl.c +0 -2
      }
 
-#ifdef CONFIG_TPM
      if (tpm_init() < 0) {
          exit(1);
      }
-#endif
 
      /* init the bluetooth world */
      if (foreach_device_config(DEV_BT, bt_parse))

Now you should be able to also remove the #ifdef CONFIG_TPM from ./tpm.c.

Stefan

#5 lore raw

Re: [Qemu-devel] [PATCH 3/3] vl: remove unnecessary #ifdef CONFIG_TPM

In reply to Richard W.M. Jones

Hi Richard,

Quoted 1 line · Richard W.M. Jones

The series fixes the build for me, thanks :-)

Good, does this mean I can add your Tested-by: tag?

Regards,

Phil.

#6 lore raw

Re: [Qemu-devel] [PATCH 3/3] vl: remove unnecessary #ifdef CONFIG_TPM

Quoted 6 lines · Philippe Mathieu-Daudé

Hi Richard,

Quoted 1 line · Richard W.M. Jones

The series fixes the build for me, thanks :-)

Good, does this mean I can add your Tested-by: tag?

Sure,

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/