All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/8] qtest and misc patches
@ 2019-05-02 16:13 ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

 Hi Peter,

the following changes since commit 8482ff2eb3bb95020eb2f370a9b3ea26511e41df:

  Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-05-02 12:04:51 +0100)

are available in the Git repository at:

  https://gitlab.com/huth/qemu.git tags/pull-request-2019-05-02

for you to fetch changes up to aff39be0ed9753c9c323f64a14f5533dd5c43525:

  hw/pci-host: Use object_initialize_child for correct reference counting (2019-05-02 16:56:33 +0200)

----------------------------------------------------------------
- Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
- Test TCG interpreter in gitlab-ci
- Small improvements to the configure script
- Use object_initialize_child in hw/pci-host
----------------------------------------------------------------

Eduardo Habkost (3):
      qtest: Move accel code to accel/qtest.c
      qtest: Don't compile qtest accel on non-POSIX systems
      accel: Remove unused AccelClass::available field

Helge Deller (1):
      configure: Relax check for libseccomp

Thomas Huth (4):
      gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
      configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
      configure: Remove old *-config-devices.mak.d files when running configure
      hw/pci-host: Use object_initialize_child for correct reference counting

 .gitlab-ci.yml            | 15 +++++++++++++
 MAINTAINERS               |  1 +
 accel/Makefile.objs       |  1 +
 accel/accel.c             |  5 -----
 accel/qtest.c             | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 configure                 | 33 +++++++----------------------
 hw/pci-host/designware.c  |  4 ++--
 hw/pci-host/gpex.c        |  5 +++--
 hw/pci-host/q35.c         |  4 ++--
 hw/pci-host/xilinx-pcie.c |  4 ++--
 include/sysemu/accel.h    |  1 -
 include/sysemu/qtest.h    |  9 --------
 qtest.c                   | 34 -----------------------------
 13 files changed, 88 insertions(+), 82 deletions(-)
 create mode 100644 accel/qtest.c

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 0/8] qtest and misc patches
@ 2019-05-02 16:13 ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

 Hi Peter,

the following changes since commit 8482ff2eb3bb95020eb2f370a9b3ea26511e41df:

  Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-05-02 12:04:51 +0100)

are available in the Git repository at:

  https://gitlab.com/huth/qemu.git tags/pull-request-2019-05-02

for you to fetch changes up to aff39be0ed9753c9c323f64a14f5533dd5c43525:

  hw/pci-host: Use object_initialize_child for correct reference counting (2019-05-02 16:56:33 +0200)

----------------------------------------------------------------
- Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
- Test TCG interpreter in gitlab-ci
- Small improvements to the configure script
- Use object_initialize_child in hw/pci-host
----------------------------------------------------------------

Eduardo Habkost (3):
      qtest: Move accel code to accel/qtest.c
      qtest: Don't compile qtest accel on non-POSIX systems
      accel: Remove unused AccelClass::available field

Helge Deller (1):
      configure: Relax check for libseccomp

Thomas Huth (4):
      gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
      configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
      configure: Remove old *-config-devices.mak.d files when running configure
      hw/pci-host: Use object_initialize_child for correct reference counting

 .gitlab-ci.yml            | 15 +++++++++++++
 MAINTAINERS               |  1 +
 accel/Makefile.objs       |  1 +
 accel/accel.c             |  5 -----
 accel/qtest.c             | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 configure                 | 33 +++++++----------------------
 hw/pci-host/designware.c  |  4 ++--
 hw/pci-host/gpex.c        |  5 +++--
 hw/pci-host/q35.c         |  4 ++--
 hw/pci-host/xilinx-pcie.c |  4 ++--
 include/sysemu/accel.h    |  1 -
 include/sysemu/qtest.h    |  9 --------
 qtest.c                   | 34 -----------------------------
 13 files changed, 88 insertions(+), 82 deletions(-)
 create mode 100644 accel/qtest.c



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 1/8] gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

So far we do not have any test coverage for TCI (the TCG interpreter) yet.
Thus let's add a CI pipeline that runs at least some basic TCG tests with
a TCI build, to make sure that there are no further regressions.

Message-Id: <20190410123550.2362-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .gitlab-ci.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 79d02cf740..c63bf2f822 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,3 +71,18 @@ build-clang:
                      ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user"
  - make -j2
  - make -j2 check
+
+build-tci:
+ script:
+ - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
+ - ./configure --enable-tcg-interpreter
+      --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
+ - make -j2
+ - make tests/boot-serial-test tests/cdrom-test tests/pxe-test
+ - for tg in $TARGETS ; do
+     export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
+     ./tests/boot-serial-test || exit 1 ;
+     ./tests/cdrom-test || exit 1 ;
+   done
+ - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/pxe-test
+ - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/pxe-test -m slow
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 1/8] gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

So far we do not have any test coverage for TCI (the TCG interpreter) yet.
Thus let's add a CI pipeline that runs at least some basic TCG tests with
a TCI build, to make sure that there are no further regressions.

Message-Id: <20190410123550.2362-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .gitlab-ci.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 79d02cf740..c63bf2f822 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,3 +71,18 @@ build-clang:
                      ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user"
  - make -j2
  - make -j2 check
+
+build-tci:
+ script:
+ - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
+ - ./configure --enable-tcg-interpreter
+      --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
+ - make -j2
+ - make tests/boot-serial-test tests/cdrom-test tests/pxe-test
+ - for tg in $TARGETS ; do
+     export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
+     ./tests/boot-serial-test || exit 1 ;
+     ./tests/cdrom-test || exit 1 ;
+   done
+ - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/pxe-test
+ - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/pxe-test -m slow
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 2/8] qtest: Move accel code to accel/qtest.c
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

From: Eduardo Habkost <ehabkost@redhat.com>

QTest has two parts: the server (-qtest) and the accelerator
(-machine accel=qtest).  The accelerator depends on CONFIG_POSIX
due to its usage of sigwait(), but the server doesn't.

Move the accel code to accel/qtest.c.  Later we will disable
compilation of accel/qtest.c on non-POSIX systems.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190422210448.2488-2-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[thuth: added fixup for MAINTAINERS file]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 MAINTAINERS         |  1 +
 accel/Makefile.objs |  1 +
 accel/qtest.c       | 55 +++++++++++++++++++++++++++++++++++++++++++++
 qtest.c             | 34 ----------------------------
 4 files changed, 57 insertions(+), 34 deletions(-)
 create mode 100644 accel/qtest.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 7dd71e0a2d..66ddbda9c9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2035,6 +2035,7 @@ M: Laurent Vivier <lvivier@redhat.com>
 R: Paolo Bonzini <pbonzini@redhat.com>
 S: Maintained
 F: qtest.c
+F: accel/qtest.c
 F: tests/libqtest.*
 F: tests/libqos/
 F: tests/*-test.c
diff --git a/accel/Makefile.objs b/accel/Makefile.objs
index c3718a10c5..2a5ed46940 100644
--- a/accel/Makefile.objs
+++ b/accel/Makefile.objs
@@ -1,4 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
+obj-$(CONFIG_SOFTMMU) += qtest.o
 obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_TCG) += tcg/
 obj-y += stubs/
diff --git a/accel/qtest.c b/accel/qtest.c
new file mode 100644
index 0000000000..a02b3c26c7
--- /dev/null
+++ b/accel/qtest.c
@@ -0,0 +1,55 @@
+/*
+ * QTest accelerator code
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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 "qapi/error.h"
+#include "qemu/module.h"
+#include "qemu/option.h"
+#include "qemu/config-file.h"
+#include "sysemu/accel.h"
+#include "sysemu/qtest.h"
+#include "sysemu/cpus.h"
+
+static int qtest_init_accel(MachineState *ms)
+{
+    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
+                                      &error_abort);
+    qemu_opt_set(opts, "shift", "0", &error_abort);
+    configure_icount(opts, &error_abort);
+    qemu_opts_del(opts);
+    return 0;
+}
+
+static void qtest_accel_class_init(ObjectClass *oc, void *data)
+{
+    AccelClass *ac = ACCEL_CLASS(oc);
+    ac->name = "QTest";
+    ac->available = qtest_available;
+    ac->init_machine = qtest_init_accel;
+    ac->allowed = &qtest_allowed;
+}
+
+#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
+
+static const TypeInfo qtest_accel_type = {
+    .name = TYPE_QTEST_ACCEL,
+    .parent = TYPE_ACCEL,
+    .class_init = qtest_accel_class_init,
+};
+
+static void qtest_type_init(void)
+{
+    type_register_static(&qtest_accel_type);
+}
+
+type_init(qtest_type_init);
diff --git a/qtest.c b/qtest.c
index 527141785f..f2e2f27778 100644
--- a/qtest.c
+++ b/qtest.c
@@ -749,16 +749,6 @@ static void qtest_event(void *opaque, int event)
     }
 }
 
-static int qtest_init_accel(MachineState *ms)
-{
-    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
-                                      &error_abort);
-    qemu_opt_set(opts, "shift", "0", &error_abort);
-    configure_icount(opts, &error_abort);
-    qemu_opts_del(opts);
-    return 0;
-}
-
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
 {
     Chardev *chr;
@@ -791,27 +781,3 @@ bool qtest_driver(void)
 {
     return qtest_chr.chr != NULL;
 }
-
-static void qtest_accel_class_init(ObjectClass *oc, void *data)
-{
-    AccelClass *ac = ACCEL_CLASS(oc);
-    ac->name = "QTest";
-    ac->available = qtest_available;
-    ac->init_machine = qtest_init_accel;
-    ac->allowed = &qtest_allowed;
-}
-
-#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
-
-static const TypeInfo qtest_accel_type = {
-    .name = TYPE_QTEST_ACCEL,
-    .parent = TYPE_ACCEL,
-    .class_init = qtest_accel_class_init,
-};
-
-static void qtest_type_init(void)
-{
-    type_register_static(&qtest_accel_type);
-}
-
-type_init(qtest_type_init);
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 2/8] qtest: Move accel code to accel/qtest.c
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

QTest has two parts: the server (-qtest) and the accelerator
(-machine accel=qtest).  The accelerator depends on CONFIG_POSIX
due to its usage of sigwait(), but the server doesn't.

Move the accel code to accel/qtest.c.  Later we will disable
compilation of accel/qtest.c on non-POSIX systems.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190422210448.2488-2-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[thuth: added fixup for MAINTAINERS file]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 MAINTAINERS         |  1 +
 accel/Makefile.objs |  1 +
 accel/qtest.c       | 55 +++++++++++++++++++++++++++++++++++++++++++++
 qtest.c             | 34 ----------------------------
 4 files changed, 57 insertions(+), 34 deletions(-)
 create mode 100644 accel/qtest.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 7dd71e0a2d..66ddbda9c9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2035,6 +2035,7 @@ M: Laurent Vivier <lvivier@redhat.com>
 R: Paolo Bonzini <pbonzini@redhat.com>
 S: Maintained
 F: qtest.c
+F: accel/qtest.c
 F: tests/libqtest.*
 F: tests/libqos/
 F: tests/*-test.c
diff --git a/accel/Makefile.objs b/accel/Makefile.objs
index c3718a10c5..2a5ed46940 100644
--- a/accel/Makefile.objs
+++ b/accel/Makefile.objs
@@ -1,4 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
+obj-$(CONFIG_SOFTMMU) += qtest.o
 obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_TCG) += tcg/
 obj-y += stubs/
diff --git a/accel/qtest.c b/accel/qtest.c
new file mode 100644
index 0000000000..a02b3c26c7
--- /dev/null
+++ b/accel/qtest.c
@@ -0,0 +1,55 @@
+/*
+ * QTest accelerator code
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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 "qapi/error.h"
+#include "qemu/module.h"
+#include "qemu/option.h"
+#include "qemu/config-file.h"
+#include "sysemu/accel.h"
+#include "sysemu/qtest.h"
+#include "sysemu/cpus.h"
+
+static int qtest_init_accel(MachineState *ms)
+{
+    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
+                                      &error_abort);
+    qemu_opt_set(opts, "shift", "0", &error_abort);
+    configure_icount(opts, &error_abort);
+    qemu_opts_del(opts);
+    return 0;
+}
+
+static void qtest_accel_class_init(ObjectClass *oc, void *data)
+{
+    AccelClass *ac = ACCEL_CLASS(oc);
+    ac->name = "QTest";
+    ac->available = qtest_available;
+    ac->init_machine = qtest_init_accel;
+    ac->allowed = &qtest_allowed;
+}
+
+#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
+
+static const TypeInfo qtest_accel_type = {
+    .name = TYPE_QTEST_ACCEL,
+    .parent = TYPE_ACCEL,
+    .class_init = qtest_accel_class_init,
+};
+
+static void qtest_type_init(void)
+{
+    type_register_static(&qtest_accel_type);
+}
+
+type_init(qtest_type_init);
diff --git a/qtest.c b/qtest.c
index 527141785f..f2e2f27778 100644
--- a/qtest.c
+++ b/qtest.c
@@ -749,16 +749,6 @@ static void qtest_event(void *opaque, int event)
     }
 }
 
-static int qtest_init_accel(MachineState *ms)
-{
-    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
-                                      &error_abort);
-    qemu_opt_set(opts, "shift", "0", &error_abort);
-    configure_icount(opts, &error_abort);
-    qemu_opts_del(opts);
-    return 0;
-}
-
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
 {
     Chardev *chr;
@@ -791,27 +781,3 @@ bool qtest_driver(void)
 {
     return qtest_chr.chr != NULL;
 }
-
-static void qtest_accel_class_init(ObjectClass *oc, void *data)
-{
-    AccelClass *ac = ACCEL_CLASS(oc);
-    ac->name = "QTest";
-    ac->available = qtest_available;
-    ac->init_machine = qtest_init_accel;
-    ac->allowed = &qtest_allowed;
-}
-
-#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
-
-static const TypeInfo qtest_accel_type = {
-    .name = TYPE_QTEST_ACCEL,
-    .parent = TYPE_ACCEL,
-    .class_init = qtest_accel_class_init,
-};
-
-static void qtest_type_init(void)
-{
-    type_register_static(&qtest_accel_type);
-}
-
-type_init(qtest_type_init);
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 3/8] qtest: Don't compile qtest accel on non-POSIX systems
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

From: Eduardo Habkost <ehabkost@redhat.com>

qtest_available() will always return 0 on non-POSIX systems.
It's simpler to just not compile the accelerator code on those
systems instead of relying on the AccelClass::available function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190422210448.2488-3-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> [on mingw64]
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 accel/Makefile.objs    | 2 +-
 accel/qtest.c          | 1 -
 include/sysemu/qtest.h | 9 ---------
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/accel/Makefile.objs b/accel/Makefile.objs
index 2a5ed46940..8b498d39d8 100644
--- a/accel/Makefile.objs
+++ b/accel/Makefile.objs
@@ -1,5 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
-obj-$(CONFIG_SOFTMMU) += qtest.o
+obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) += qtest.o
 obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_TCG) += tcg/
 obj-y += stubs/
diff --git a/accel/qtest.c b/accel/qtest.c
index a02b3c26c7..5b88f55921 100644
--- a/accel/qtest.c
+++ b/accel/qtest.c
@@ -34,7 +34,6 @@ static void qtest_accel_class_init(ObjectClass *oc, void *data)
 {
     AccelClass *ac = ACCEL_CLASS(oc);
     ac->name = "QTest";
-    ac->available = qtest_available;
     ac->init_machine = qtest_init_accel;
     ac->allowed = &qtest_allowed;
 }
diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h
index 70aa40aa72..096ddfc20c 100644
--- a/include/sysemu/qtest.h
+++ b/include/sysemu/qtest.h
@@ -27,13 +27,4 @@ bool qtest_driver(void);
 
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp);
 
-static inline int qtest_available(void)
-{
-#ifdef CONFIG_POSIX
-    return 1;
-#else
-    return 0;
-#endif
-}
-
 #endif
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 3/8] qtest: Don't compile qtest accel on non-POSIX systems
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

qtest_available() will always return 0 on non-POSIX systems.
It's simpler to just not compile the accelerator code on those
systems instead of relying on the AccelClass::available function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190422210448.2488-3-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> [on mingw64]
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 accel/Makefile.objs    | 2 +-
 accel/qtest.c          | 1 -
 include/sysemu/qtest.h | 9 ---------
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/accel/Makefile.objs b/accel/Makefile.objs
index 2a5ed46940..8b498d39d8 100644
--- a/accel/Makefile.objs
+++ b/accel/Makefile.objs
@@ -1,5 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
-obj-$(CONFIG_SOFTMMU) += qtest.o
+obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) += qtest.o
 obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_TCG) += tcg/
 obj-y += stubs/
diff --git a/accel/qtest.c b/accel/qtest.c
index a02b3c26c7..5b88f55921 100644
--- a/accel/qtest.c
+++ b/accel/qtest.c
@@ -34,7 +34,6 @@ static void qtest_accel_class_init(ObjectClass *oc, void *data)
 {
     AccelClass *ac = ACCEL_CLASS(oc);
     ac->name = "QTest";
-    ac->available = qtest_available;
     ac->init_machine = qtest_init_accel;
     ac->allowed = &qtest_allowed;
 }
diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h
index 70aa40aa72..096ddfc20c 100644
--- a/include/sysemu/qtest.h
+++ b/include/sysemu/qtest.h
@@ -27,13 +27,4 @@ bool qtest_driver(void);
 
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp);
 
-static inline int qtest_available(void)
-{
-#ifdef CONFIG_POSIX
-    return 1;
-#else
-    return 0;
-#endif
-}
-
 #endif
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 4/8] accel: Remove unused AccelClass::available field
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

From: Eduardo Habkost <ehabkost@redhat.com>

The field is not used anymore, we can remove it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190422210448.2488-4-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> [on mingw64]
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 accel/accel.c          | 5 -----
 include/sysemu/accel.h | 1 -
 2 files changed, 6 deletions(-)

diff --git a/accel/accel.c b/accel/accel.c
index 454fef9d92..5fa31717b4 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -107,11 +107,6 @@ void configure_accelerator(MachineState *ms, const char *progname)
         if (!acc) {
             continue;
         }
-        if (acc->available && !acc->available()) {
-            printf("%s not supported for this target\n",
-                   acc->name);
-            continue;
-        }
         ret = accel_init_machine(acc, ms);
         if (ret < 0) {
             init_failed = true;
diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h
index 5565e00a96..70e9e2f2a1 100644
--- a/include/sysemu/accel.h
+++ b/include/sysemu/accel.h
@@ -38,7 +38,6 @@ typedef struct AccelClass {
 
     const char *opt_name;
     const char *name;
-    int (*available)(void);
     int (*init_machine)(MachineState *ms);
     void (*setup_post)(MachineState *ms, AccelState *accel);
     bool *allowed;
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 4/8] accel: Remove unused AccelClass::available field
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

The field is not used anymore, we can remove it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190422210448.2488-4-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> [on mingw64]
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 accel/accel.c          | 5 -----
 include/sysemu/accel.h | 1 -
 2 files changed, 6 deletions(-)

diff --git a/accel/accel.c b/accel/accel.c
index 454fef9d92..5fa31717b4 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -107,11 +107,6 @@ void configure_accelerator(MachineState *ms, const char *progname)
         if (!acc) {
             continue;
         }
-        if (acc->available && !acc->available()) {
-            printf("%s not supported for this target\n",
-                   acc->name);
-            continue;
-        }
         ret = accel_init_machine(acc, ms);
         if (ret < 0) {
             init_failed = true;
diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h
index 5565e00a96..70e9e2f2a1 100644
--- a/include/sysemu/accel.h
+++ b/include/sysemu/accel.h
@@ -38,7 +38,6 @@ typedef struct AccelClass {
 
     const char *opt_name;
     const char *name;
-    int (*available)(void);
     int (*init_machine)(MachineState *ms);
     void (*setup_post)(MachineState *ms, AccelState *accel);
     bool *allowed;
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 5/8] configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

Without the -Wno-typedef-redefinition option, clang complains if a typedef
gets redefined in gnu99 mode (since this is officially a C11 feature). This
used to also happen with older versions of GCC, but since we've bumped our
minimum GCC version to 4.8, all versions of GCC that we support do not seem
to issue this warning in gnu99 mode anymore. So this has become a common
problem for people who only test their code with GCC - they do not notice
the issue until they submit their patches and suddenly patchew or a
maintainer complains.

Now that we do not urgently need to keep the code clean from typedef
redefintions anymore with recent versions of GCC, we can ease the
situation with clang, too, and simply shut these warnings off for good.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190427154539.11336-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 60719ddcc5..362bfef637 100755
--- a/configure
+++ b/configure
@@ -1908,7 +1908,7 @@ gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_
 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
-gcc_flags="-Wno-string-plus-int $gcc_flags"
+gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
 # Note that we do not add -Werror to gcc_flags here, because that would
 # enable it for all configure tests. If a configure test failed due
 # to -Werror this would just silently disable some features,
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 5/8] configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

Without the -Wno-typedef-redefinition option, clang complains if a typedef
gets redefined in gnu99 mode (since this is officially a C11 feature). This
used to also happen with older versions of GCC, but since we've bumped our
minimum GCC version to 4.8, all versions of GCC that we support do not seem
to issue this warning in gnu99 mode anymore. So this has become a common
problem for people who only test their code with GCC - they do not notice
the issue until they submit their patches and suddenly patchew or a
maintainer complains.

Now that we do not urgently need to keep the code clean from typedef
redefintions anymore with recent versions of GCC, we can ease the
situation with clang, too, and simply shut these warnings off for good.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190427154539.11336-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 60719ddcc5..362bfef637 100755
--- a/configure
+++ b/configure
@@ -1908,7 +1908,7 @@ gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_
 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
-gcc_flags="-Wno-string-plus-int $gcc_flags"
+gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
 # Note that we do not add -Werror to gcc_flags here, because that would
 # enable it for all configure tests. If a configure test failed due
 # to -Werror this would just silently disable some features,
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 6/8] configure: Remove old *-config-devices.mak.d files when running configure
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

When running "make" in a build directory from the pre-Kconfig merge time,
the build process currently fails with:

 make: *** No rule to make target `.../default-configs/pci.mak',
  needed by `aarch64-softmmu/config-devices.mak'.  Stop.

To make sure that this problem at least goes away when the user runs
"configure" (or "sh config.status") again, we have to make sure that
we re-generate the .mak.d files. Thus remove the old stale files
while running the configure script.

Message-Id: <1552300145-12526-1-git-send-email-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 362bfef637..f14b25c49c 100755
--- a/configure
+++ b/configure
@@ -1818,6 +1818,9 @@ EOF
 exit 0
 fi
 
+# Remove old dependency files to make sure that they get properly regenerated
+rm -f *-config-devices.mak.d
+
 if ! has $python; then
   error_exit "Python not found. Use --python=/path/to/python"
 fi
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 6/8] configure: Remove old *-config-devices.mak.d files when running configure
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

When running "make" in a build directory from the pre-Kconfig merge time,
the build process currently fails with:

 make: *** No rule to make target `.../default-configs/pci.mak',
  needed by `aarch64-softmmu/config-devices.mak'.  Stop.

To make sure that this problem at least goes away when the user runs
"configure" (or "sh config.status") again, we have to make sure that
we re-generate the .mak.d files. Thus remove the old stale files
while running the configure script.

Message-Id: <1552300145-12526-1-git-send-email-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 362bfef637..f14b25c49c 100755
--- a/configure
+++ b/configure
@@ -1818,6 +1818,9 @@ EOF
 exit 0
 fi
 
+# Remove old dependency files to make sure that they get properly regenerated
+rm -f *-config-devices.mak.d
+
 if ! has $python; then
   error_exit "Python not found. Use --python=/path/to/python"
 fi
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 7/8] configure: Relax check for libseccomp
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

From: Helge Deller <deller@gmx.de>

All major distributions do support libseccomp version >= 2.3.0, so there
is no need to special-case on various architectures any longer.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20190404183923.GA22347@ls3530.dellerweb.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Eduardo Otubo <otubo@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index f14b25c49c..3a9bee2621 100755
--- a/configure
+++ b/configure
@@ -2374,36 +2374,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 7/8] configure: Relax check for libseccomp
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

From: Helge Deller <deller@gmx.de>

All major distributions do support libseccomp version >= 2.3.0, so there
is no need to special-case on various architectures any longer.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20190404183923.GA22347@ls3530.dellerweb.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Eduardo Otubo <otubo@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index f14b25c49c..3a9bee2621 100755
--- a/configure
+++ b/configure
@@ -2374,36 +2374,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 8/8] hw/pci-host: Use object_initialize_child for correct reference counting
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Habkost, Helge Deller, Eduardo Otubo

Both functions, object_initialize() and object_property_add_child() increase
the reference counter of the new object, so one of the references has to be
dropped afterwards to get the reference counting right. Otherwise the child
object might not be properly cleaned up when the parent gets destroyed.
Some functions of the pci-host devices miss to drop one of the references.
Fix it by using object_initialize_child() instead, which takes care of
calling object_initialize(), object_property_add_child() and object_unref()
in the right order.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190430191552.4027-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/pci-host/designware.c  | 4 ++--
 hw/pci-host/gpex.c        | 5 +++--
 hw/pci-host/q35.c         | 4 ++--
 hw/pci-host/xilinx-pcie.c | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index 29ea313798..64ad21d295 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -721,8 +721,8 @@ static void designware_pcie_host_init(Object *obj)
     DesignwarePCIEHost *s = DESIGNWARE_PCIE_HOST(obj);
     DesignwarePCIERoot *root = &s->root;
 
-    object_initialize(root, sizeof(*root), TYPE_DESIGNWARE_PCIE_ROOT);
-    object_property_add_child(obj, "root", OBJECT(root), NULL);
+    object_initialize_child(obj, "root",  root, sizeof(*root),
+                            TYPE_DESIGNWARE_PCIE_ROOT, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index 2583b151a4..1bafffcc34 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -29,6 +29,7 @@
  * http://www.firmware.org/1275/practice/imap/imap0_9d.pdf
  */
 #include "qemu/osdep.h"
+#include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/pci-host/gpex.h"
 
@@ -120,8 +121,8 @@ static void gpex_host_initfn(Object *obj)
     GPEXHost *s = GPEX_HOST(obj);
     GPEXRootState *root = &s->gpex_root;
 
-    object_initialize(root, sizeof(*root), TYPE_GPEX_ROOT_DEVICE);
-    object_property_add_child(obj, "gpex_root", OBJECT(root), NULL);
+    object_initialize_child(obj, "gpex_root",  root, sizeof(*root),
+                            TYPE_GPEX_ROOT_DEVICE, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 7b871b5734..960939f5ed 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -216,8 +216,8 @@ static void q35_host_initfn(Object *obj)
     memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb,
                           "pci-conf-data", 4);
 
-    object_initialize(&s->mch, sizeof(s->mch), TYPE_MCH_PCI_DEVICE);
-    object_property_add_child(OBJECT(s), "mch", OBJECT(&s->mch), NULL);
+    object_initialize_child(OBJECT(s), "mch",  &s->mch, sizeof(s->mch),
+                            TYPE_MCH_PCI_DEVICE, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(&s->mch), "multifunction", false);
     /* mch's object_initialize resets the default value, set it again */
diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c
index 60309afe9e..ceb00e23e6 100644
--- a/hw/pci-host/xilinx-pcie.c
+++ b/hw/pci-host/xilinx-pcie.c
@@ -149,8 +149,8 @@ static void xilinx_pcie_host_init(Object *obj)
     XilinxPCIEHost *s = XILINX_PCIE_HOST(obj);
     XilinxPCIERoot *root = &s->root;
 
-    object_initialize(root, sizeof(*root), TYPE_XILINX_PCIE_ROOT);
-    object_property_add_child(obj, "root", OBJECT(root), NULL);
+    object_initialize_child(obj, "root",  root, sizeof(*root),
+                            TYPE_XILINX_PCIE_ROOT, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 8/8] hw/pci-host: Use object_initialize_child for correct reference counting
@ 2019-05-02 16:13   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2019-05-02 16:13 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Eduardo Otubo, Helge Deller, Eduardo Habkost

Both functions, object_initialize() and object_property_add_child() increase
the reference counter of the new object, so one of the references has to be
dropped afterwards to get the reference counting right. Otherwise the child
object might not be properly cleaned up when the parent gets destroyed.
Some functions of the pci-host devices miss to drop one of the references.
Fix it by using object_initialize_child() instead, which takes care of
calling object_initialize(), object_property_add_child() and object_unref()
in the right order.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190430191552.4027-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/pci-host/designware.c  | 4 ++--
 hw/pci-host/gpex.c        | 5 +++--
 hw/pci-host/q35.c         | 4 ++--
 hw/pci-host/xilinx-pcie.c | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index 29ea313798..64ad21d295 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -721,8 +721,8 @@ static void designware_pcie_host_init(Object *obj)
     DesignwarePCIEHost *s = DESIGNWARE_PCIE_HOST(obj);
     DesignwarePCIERoot *root = &s->root;
 
-    object_initialize(root, sizeof(*root), TYPE_DESIGNWARE_PCIE_ROOT);
-    object_property_add_child(obj, "root", OBJECT(root), NULL);
+    object_initialize_child(obj, "root",  root, sizeof(*root),
+                            TYPE_DESIGNWARE_PCIE_ROOT, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index 2583b151a4..1bafffcc34 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -29,6 +29,7 @@
  * http://www.firmware.org/1275/practice/imap/imap0_9d.pdf
  */
 #include "qemu/osdep.h"
+#include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/pci-host/gpex.h"
 
@@ -120,8 +121,8 @@ static void gpex_host_initfn(Object *obj)
     GPEXHost *s = GPEX_HOST(obj);
     GPEXRootState *root = &s->gpex_root;
 
-    object_initialize(root, sizeof(*root), TYPE_GPEX_ROOT_DEVICE);
-    object_property_add_child(obj, "gpex_root", OBJECT(root), NULL);
+    object_initialize_child(obj, "gpex_root",  root, sizeof(*root),
+                            TYPE_GPEX_ROOT_DEVICE, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 7b871b5734..960939f5ed 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -216,8 +216,8 @@ static void q35_host_initfn(Object *obj)
     memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb,
                           "pci-conf-data", 4);
 
-    object_initialize(&s->mch, sizeof(s->mch), TYPE_MCH_PCI_DEVICE);
-    object_property_add_child(OBJECT(s), "mch", OBJECT(&s->mch), NULL);
+    object_initialize_child(OBJECT(s), "mch",  &s->mch, sizeof(s->mch),
+                            TYPE_MCH_PCI_DEVICE, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(&s->mch), "multifunction", false);
     /* mch's object_initialize resets the default value, set it again */
diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c
index 60309afe9e..ceb00e23e6 100644
--- a/hw/pci-host/xilinx-pcie.c
+++ b/hw/pci-host/xilinx-pcie.c
@@ -149,8 +149,8 @@ static void xilinx_pcie_host_init(Object *obj)
     XilinxPCIEHost *s = XILINX_PCIE_HOST(obj);
     XilinxPCIERoot *root = &s->root;
 
-    object_initialize(root, sizeof(*root), TYPE_XILINX_PCIE_ROOT);
-    object_property_add_child(obj, "root", OBJECT(root), NULL);
+    object_initialize_child(obj, "root",  root, sizeof(*root),
+                            TYPE_XILINX_PCIE_ROOT, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PULL 0/8] qtest and misc patches
@ 2019-05-03  9:37   ` Peter Maydell
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2019-05-03  9:37 UTC (permalink / raw)
  To: Thomas Huth; +Cc: QEMU Developers, Eduardo Habkost, Helge Deller, Eduardo Otubo

On Thu, 2 May 2019 at 17:13, Thomas Huth <thuth@redhat.com> wrote:
>
>  Hi Peter,
>
> the following changes since commit 8482ff2eb3bb95020eb2f370a9b3ea26511e41df:
>
>   Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-05-02 12:04:51 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/huth/qemu.git tags/pull-request-2019-05-02
>
> for you to fetch changes up to aff39be0ed9753c9c323f64a14f5533dd5c43525:
>
>   hw/pci-host: Use object_initialize_child for correct reference counting (2019-05-02 16:56:33 +0200)
>
> ----------------------------------------------------------------
> - Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
> - Test TCG interpreter in gitlab-ci
> - Small improvements to the configure script
> - Use object_initialize_child in hw/pci-host
> ----------------------------------------------------------------
>
> Eduardo Habkost (3):
>       qtest: Move accel code to accel/qtest.c
>       qtest: Don't compile qtest accel on non-POSIX systems
>       accel: Remove unused AccelClass::available field
>
> Helge Deller (1):
>       configure: Relax check for libseccomp
>
> Thomas Huth (4):
>       gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
>       configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
>       configure: Remove old *-config-devices.mak.d files when running configure
>       hw/pci-host: Use object_initialize_child for correct reference counting


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PULL 0/8] qtest and misc patches
@ 2019-05-03  9:37   ` Peter Maydell
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2019-05-03  9:37 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Eduardo Otubo, Helge Deller, QEMU Developers, Eduardo Habkost

On Thu, 2 May 2019 at 17:13, Thomas Huth <thuth@redhat.com> wrote:
>
>  Hi Peter,
>
> the following changes since commit 8482ff2eb3bb95020eb2f370a9b3ea26511e41df:
>
>   Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-05-02 12:04:51 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/huth/qemu.git tags/pull-request-2019-05-02
>
> for you to fetch changes up to aff39be0ed9753c9c323f64a14f5533dd5c43525:
>
>   hw/pci-host: Use object_initialize_child for correct reference counting (2019-05-02 16:56:33 +0200)
>
> ----------------------------------------------------------------
> - Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
> - Test TCG interpreter in gitlab-ci
> - Small improvements to the configure script
> - Use object_initialize_child in hw/pci-host
> ----------------------------------------------------------------
>
> Eduardo Habkost (3):
>       qtest: Move accel code to accel/qtest.c
>       qtest: Don't compile qtest accel on non-POSIX systems
>       accel: Remove unused AccelClass::available field
>
> Helge Deller (1):
>       configure: Relax check for libseccomp
>
> Thomas Huth (4):
>       gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
>       configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
>       configure: Remove old *-config-devices.mak.d files when running configure
>       hw/pci-host: Use object_initialize_child for correct reference counting


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-05-03  9:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 16:13 [Qemu-devel] [PULL 0/8] qtest and misc patches Thomas Huth
2019-05-02 16:13 ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 1/8] gitlab-ci.yml: Test the TCG interpreter in a CI pipeline Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 2/8] qtest: Move accel code to accel/qtest.c Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 3/8] qtest: Don't compile qtest accel on non-POSIX systems Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 4/8] accel: Remove unused AccelClass::available field Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 5/8] configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang) Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 6/8] configure: Remove old *-config-devices.mak.d files when running configure Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 7/8] configure: Relax check for libseccomp Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-02 16:13 ` [Qemu-devel] [PULL 8/8] hw/pci-host: Use object_initialize_child for correct reference counting Thomas Huth
2019-05-02 16:13   ` Thomas Huth
2019-05-03  9:37 ` [Qemu-devel] [PULL 0/8] qtest and misc patches Peter Maydell
2019-05-03  9:37   ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.