* [PATCH-for-11.0? 1/6] MAINTAINERS: Separate QDev section from QOM one
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
@ 2026-03-25 15:17 ` Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 2/6] hw/core: Move compat_props_add() to 'hw/core/boards.h' Philippe Mathieu-Daudé
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-25 15:17 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Philippe Mathieu-Daudé, Daniel P. Berrangé,
Paolo Bonzini, Alex Bennée, kvm
QDev is about QEMU devices model API, while
QOM is about QEMU object model in plain C.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index cd8ba144506..64466cf4082 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3546,24 +3546,29 @@ M: Paolo Bonzini <pbonzini@redhat.com>
R: Daniel P. Berrange <berrange@redhat.com>
S: Supported
F: docs/devel/qom.rst
+F: include/qom/
+F: qapi/qom.json
+F: scripts/coccinelle/qom-parent-type.cocci
+F: scripts/qom-cast-macro-clean-cocci-gen.py
+F: qom/
+F: tests/unit/check-qom-interface.c
+F: tests/unit/check-qom-proplist.c
+F: tests/qtest/qom-test.c
+
+QDev
+M: Paolo Bonzini <pbonzini@redhat.com>
+R: Daniel P. Berrange <berrange@redhat.com>
+S: Supported
F: docs/qdev-device-use.txt
F: hw/core/qdev*
F: hw/core/bus.c
F: hw/core/sysbus.c
F: include/hw/qdev*
F: include/monitor/qdev.h
-F: include/qom/
-F: qapi/qom.json
F: qapi/qdev.json
-F: scripts/coccinelle/qom-parent-type.cocci
-F: scripts/qom-cast-macro-clean-cocci-gen.py
F: system/qdev-monitor.c
F: stubs/qdev.c
-F: qom/
-F: tests/unit/check-qom-interface.c
-F: tests/unit/check-qom-proplist.c
F: tests/unit/test-qdev-global-props.c
-F: tests/qtest/qom-test.c
QOM boilerplate conversion script
S: Orphan
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH-for-11.0? 2/6] hw/core: Move compat_props_add() to 'hw/core/boards.h'
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 1/6] MAINTAINERS: Separate QDev section from QOM one Philippe Mathieu-Daudé
@ 2026-03-25 15:17 ` Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 3/6] qom: Declare GlobalProperty structure in 'qom/compat-properties.h' Philippe Mathieu-Daudé
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-25 15:17 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Philippe Mathieu-Daudé, Daniel P. Berrangé,
Paolo Bonzini, Alex Bennée, kvm, Marcel Apfelbaum,
Yanan Wang, Zhao Liu
compat_props_add() is only used by board models, no need
to expose it to any device model. Restrict by defining it
only in "hw/core/boards.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/boards.h | 10 ++++++++++
include/hw/core/qdev.h | 10 ----------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
index f85f31bd90d..b7138f2715e 100644
--- a/include/hw/core/boards.h
+++ b/include/hw/core/boards.h
@@ -804,6 +804,16 @@ struct MachineState {
} \
} while (0)
+static inline void
+compat_props_add(GPtrArray *arr,
+ GlobalProperty props[], size_t nelem)
+{
+ int i;
+ for (i = 0; i < nelem; i++) {
+ g_ptr_array_add(arr, (void *)&props[i]);
+ }
+}
+
extern GlobalProperty hw_compat_10_2[];
extern const size_t hw_compat_10_2_len;
diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h
index f99a8979ccb..778617787c7 100644
--- a/include/hw/core/qdev.h
+++ b/include/hw/core/qdev.h
@@ -421,16 +421,6 @@ typedef struct GlobalProperty {
bool optional;
} GlobalProperty;
-static inline void
-compat_props_add(GPtrArray *arr,
- GlobalProperty props[], size_t nelem)
-{
- int i;
- for (i = 0; i < nelem; i++) {
- g_ptr_array_add(arr, (void *)&props[i]);
- }
-}
-
/*** Board API. This should go away once we have a machine config file. ***/
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH-for-11.0? 3/6] qom: Declare GlobalProperty structure in 'qom/compat-properties.h'
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 1/6] MAINTAINERS: Separate QDev section from QOM one Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 2/6] hw/core: Move compat_props_add() to 'hw/core/boards.h' Philippe Mathieu-Daudé
@ 2026-03-25 15:17 ` Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 4/6] qom: Declare compat properties API " Philippe Mathieu-Daudé
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-25 15:17 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Philippe Mathieu-Daudé, Daniel P. Berrangé,
Paolo Bonzini, Alex Bennée, kvm, Marcel Apfelbaum,
Yanan Wang, Zhao Liu
While GlobalProperty is expected to only be used by QDev board
layer, it is used by the lower QOM API, so define it in the
qom/ namespace. This helps to build binary which use QOM but
don't need the QDev layer.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/boards.h | 1 +
include/hw/core/qdev-properties.h | 1 +
include/hw/core/qdev.h | 17 ----------------
include/qom/compat-properties.h | 32 +++++++++++++++++++++++++++++++
qom/object.c | 2 +-
5 files changed, 35 insertions(+), 18 deletions(-)
create mode 100644 include/qom/compat-properties.h
diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
index b7138f2715e..ec8999c0e14 100644
--- a/include/hw/core/boards.h
+++ b/include/hw/core/boards.h
@@ -8,6 +8,7 @@
#include "system/blockdev.h"
#include "qapi/qapi-types-machine.h"
#include "qemu/module.h"
+#include "qom/compat-properties.h"
#include "qom/object.h"
#include "hw/core/cpu.h"
#include "hw/core/resettable.h"
diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-properties.h
index d8745d4c65f..17543957a6c 100644
--- a/include/hw/core/qdev-properties.h
+++ b/include/hw/core/qdev-properties.h
@@ -1,6 +1,7 @@
#ifndef QEMU_QDEV_PROPERTIES_H
#define QEMU_QDEV_PROPERTIES_H
+#include "qom/compat-properties.h"
#include "hw/core/qdev.h"
/**
diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h
index 778617787c7..337d69ea2c3 100644
--- a/include/hw/core/qdev.h
+++ b/include/hw/core/qdev.h
@@ -404,23 +404,6 @@ struct BusState {
ResettableState reset;
};
-/**
- * typedef GlobalProperty - a global property type
- *
- * @used: Set to true if property was used when initializing a device.
- * @optional: If set to true, GlobalProperty will be skipped without errors
- * if the property doesn't exist.
- *
- * An error is fatal for non-hotplugged devices, when the global is applied.
- */
-typedef struct GlobalProperty {
- const char *driver;
- const char *property;
- const char *value;
- bool used;
- bool optional;
-} GlobalProperty;
-
/*** Board API. This should go away once we have a machine config file. ***/
/**
diff --git a/include/qom/compat-properties.h b/include/qom/compat-properties.h
new file mode 100644
index 00000000000..6e44aabc26b
--- /dev/null
+++ b/include/qom/compat-properties.h
@@ -0,0 +1,32 @@
+/*
+ * QEMU Object Model
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_COMPAT_PROPERTIES_H
+#define QEMU_COMPAT_PROPERTIES_H
+
+/**
+ * typedef GlobalProperty - a global property type
+ *
+ * @used: Set to true if property was used when initializing a device.
+ * @optional: If set to true, GlobalProperty will be skipped without errors
+ * if the property doesn't exist.
+ *
+ * An error is fatal for non-hotplugged devices, when the global is applied.
+ */
+typedef struct GlobalProperty {
+ const char *driver;
+ const char *property;
+ const char *value;
+ bool used;
+ bool optional;
+} GlobalProperty;
+
+#endif
diff --git a/qom/object.c b/qom/object.c
index ff8ede8a328..838b1d2b225 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -11,8 +11,8 @@
*/
#include "qemu/osdep.h"
-#include "hw/core/qdev.h"
#include "qapi/error.h"
+#include "qom/compat-properties.h"
#include "qom/object.h"
#include "qom/object_interfaces.h"
#include "qemu/cutils.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH-for-11.0? 4/6] qom: Declare compat properties API in 'qom/compat-properties.h'
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2026-03-25 15:17 ` [PATCH-for-11.0? 3/6] qom: Declare GlobalProperty structure in 'qom/compat-properties.h' Philippe Mathieu-Daudé
@ 2026-03-25 15:17 ` Philippe Mathieu-Daudé
2026-03-25 15:17 ` [PATCH-for-11.0? 5/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-25 15:17 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Philippe Mathieu-Daudé, Daniel P. Berrangé,
Paolo Bonzini, Alex Bennée, kvm, David Hildenbrand,
Igor Mammedov, Marcel Apfelbaum, Yanan Wang, Zhao Liu,
Michael S. Tsirkin, Marcelo Tosatti
While most of QEMU files use the QOM concept, few of them
use the compatibility properties API (mostly use in system
emulation). Move its prototype to a new "qom/compat-properties.h"
header, keeping "qom/object.h" for generic QOM.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qom/compat-properties.h | 8 ++++++++
include/qom/object.h | 8 --------
accel/accel-system.c | 1 +
backends/hostmem.c | 1 +
hw/core/machine.c | 1 +
hw/core/qdev-properties.c | 1 +
hw/core/qdev.c | 1 +
hw/i386/pc_q35.c | 1 +
system/rtc.c | 1 +
system/vl.c | 1 +
target/i386/sev.c | 1 +
ui/vdagent.c | 1 +
12 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/include/qom/compat-properties.h b/include/qom/compat-properties.h
index 6e44aabc26b..90f8320adfd 100644
--- a/include/qom/compat-properties.h
+++ b/include/qom/compat-properties.h
@@ -29,4 +29,12 @@ typedef struct GlobalProperty {
bool optional;
} GlobalProperty;
+void object_set_machine_compat_props(GPtrArray *compat_props);
+void object_set_accelerator_compat_props(GPtrArray *compat_props);
+void object_register_sugar_prop(const char *driver, const char *prop,
+ const char *value, bool optional);
+void object_apply_compat_props(Object *obj);
+bool object_apply_global_props(Object *obj, const GPtrArray *props,
+ Error **errp);
+
#endif
diff --git a/include/qom/object.h b/include/qom/object.h
index 26df6137b91..510885218ba 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -700,14 +700,6 @@ Object *object_new_with_propv(const char *typename,
Error **errp,
va_list vargs);
-bool object_apply_global_props(Object *obj, const GPtrArray *props,
- Error **errp);
-void object_set_machine_compat_props(GPtrArray *compat_props);
-void object_set_accelerator_compat_props(GPtrArray *compat_props);
-void object_register_sugar_prop(const char *driver, const char *prop,
- const char *value, bool optional);
-void object_apply_compat_props(Object *obj);
-
/**
* object_set_props:
* @obj: the object instance to set properties on
diff --git a/accel/accel-system.c b/accel/accel-system.c
index 150af05bf5b..9176665202d 100644
--- a/accel/accel-system.c
+++ b/accel/accel-system.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/accel.h"
+#include "qom/compat-properties.h"
#include "qapi/qapi-commands-accelerator.h"
#include "monitor/monitor.h"
#include "hw/core/boards.h"
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 15d4365b697..cd2085fb3cd 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -18,6 +18,7 @@
#include "qapi/qapi-builtin-visit.h"
#include "qapi/visitor.h"
#include "qemu/config-file.h"
+#include "qom/compat-properties.h"
#include "qom/object_interfaces.h"
#include "qemu/mmap-alloc.h"
#include "qemu/madvise.h"
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 6cf0e2f404e..6290b3556ee 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -21,6 +21,7 @@
#include "qapi/qapi-visit-machine.h"
#include "qapi/qapi-commands-machine.h"
#include "qemu/madvise.h"
+#include "qom/compat-properties.h"
#include "qom/object_interfaces.h"
#include "system/cpus.h"
#include "system/system.h"
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index ba8461e9a42..73539c727b3 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -10,6 +10,7 @@
#include "qemu/units.h"
#include "qemu/cutils.h"
#include "qdev-prop-internal.h"
+#include "qom/compat-properties.h"
#include "qom/qom-qobject.h"
void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index e48616b2c6f..b36101f3a75 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -32,6 +32,7 @@
#include "qapi/visitor.h"
#include "qemu/error-report.h"
#include "qemu/option.h"
+#include "qom/compat-properties.h"
#include "hw/core/irq.h"
#include "hw/core/qdev-properties.h"
#include "hw/core/boards.h"
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index cb23322f5a4..6a0967ecd18 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -56,6 +56,7 @@
#include "hw/usb/hcd-uhci.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
+#include "qom/compat-properties.h"
#include "system/numa.h"
#include "hw/hyperv/vmbus-bridge.h"
#include "hw/mem/nvdimm.h"
diff --git a/system/rtc.c b/system/rtc.c
index 56951288c40..f13dd392a76 100644
--- a/system/rtc.c
+++ b/system/rtc.c
@@ -28,6 +28,7 @@
#include "qemu/error-report.h"
#include "qemu/option.h"
#include "qemu/timer.h"
+#include "qom/compat-properties.h"
#include "qom/object.h"
#include "system/replay.h"
#include "system/system.h"
diff --git a/system/vl.c b/system/vl.c
index 38d7b849e0a..ec31fd76c0d 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -119,6 +119,7 @@
#include "qapi/string-input-visitor.h"
#include "qapi/opts-visitor.h"
#include "qapi/clone-visitor.h"
+#include "qom/compat-properties.h"
#include "qom/object_interfaces.h"
#include "semihosting/semihost.h"
#include "crypto/init.h"
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 9dde972c118..261b6aaa37b 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -36,6 +36,7 @@
#include "system/reset.h"
#include "trace.h"
#include "migration/blocker.h"
+#include "qom/compat-properties.h"
#include "qom/object.h"
#include "monitor/monitor.h"
#include "monitor/hmp.h"
diff --git a/ui/vdagent.c b/ui/vdagent.c
index bb0c4aa14ca..bb55cbefc9c 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -5,6 +5,7 @@
#include "qemu/error-report.h"
#include "qemu/option.h"
#include "qemu/units.h"
+#include "qom/compat-properties.h"
#include "hw/core/qdev.h"
#include "hw/core/qdev-properties.h"
#include "migration/blocker.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH-for-11.0? 5/6] qom: Restrict compat properties API to system emulation
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2026-03-25 15:17 ` [PATCH-for-11.0? 4/6] qom: Declare compat properties API " Philippe Mathieu-Daudé
@ 2026-03-25 15:17 ` Philippe Mathieu-Daudé
2026-03-25 15:17 ` [NOTFORMERGE PATCH 6/6] buildsys: Allow building guest-agent on 32-bit hosts Philippe Mathieu-Daudé
2026-03-26 6:43 ` [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Michael Tokarev
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-25 15:17 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Philippe Mathieu-Daudé, Daniel P. Berrangé,
Paolo Bonzini, Alex Bennée, kvm
Move compat properties API definitions to their own file
unit, compile it only when system emulation is configured.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
qom/compat-properties.c | 116 ++++++++++++++++++++++++++++++++++++++++
qom/object.c | 100 ----------------------------------
qom/meson.build | 3 ++
3 files changed, 119 insertions(+), 100 deletions(-)
create mode 100644 qom/compat-properties.c
diff --git a/qom/compat-properties.c b/qom/compat-properties.c
new file mode 100644
index 00000000000..f8d9b0036ae
--- /dev/null
+++ b/qom/compat-properties.c
@@ -0,0 +1,116 @@
+/*
+ * QEMU Object Model
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qom/compat-properties.h"
+#include "qom/qom-qobject.h"
+#include "hw/core/qdev.h"
+
+bool object_apply_global_props(Object *obj, const GPtrArray *props,
+ Error **errp)
+{
+ int i;
+
+ if (!props) {
+ return true;
+ }
+
+ for (i = 0; i < props->len; i++) {
+ GlobalProperty *p = g_ptr_array_index(props, i);
+ Error *err = NULL;
+
+ if (object_dynamic_cast(obj, p->driver) == NULL) {
+ continue;
+ }
+ if (p->optional && !object_property_find(obj, p->property)) {
+ continue;
+ }
+ p->used = true;
+ if (!object_property_parse(obj, p->property, p->value, &err)) {
+ error_prepend(&err, "can't apply global %s.%s=%s: ",
+ p->driver, p->property, p->value);
+ /*
+ * If errp != NULL, propagate error and return.
+ * If errp == NULL, report a warning, but keep going
+ * with the remaining globals.
+ */
+ if (errp) {
+ error_propagate(errp, err);
+ return false;
+ } else {
+ warn_report_err(err);
+ }
+ }
+ }
+
+ return true;
+}
+
+/*
+ * Global property defaults
+ * Slot 0: accelerator's global property defaults
+ * Slot 1: machine's global property defaults
+ * Slot 2: global properties from legacy command line option
+ * Each is a GPtrArray of GlobalProperty.
+ * Applied in order, later entries override earlier ones.
+ */
+static GPtrArray *object_compat_props[3];
+
+/*
+ * Retrieve @GPtrArray for global property defined with options
+ * other than "-global". These are generally used for syntactic
+ * sugar and legacy command line options.
+ */
+void object_register_sugar_prop(const char *driver, const char *prop,
+ const char *value, bool optional)
+{
+ GlobalProperty *g;
+ if (!object_compat_props[2]) {
+ object_compat_props[2] = g_ptr_array_new();
+ }
+ g = g_new0(GlobalProperty, 1);
+ g->driver = g_strdup(driver);
+ g->property = g_strdup(prop);
+ g->value = g_strdup(value);
+ g->optional = optional;
+ g_ptr_array_add(object_compat_props[2], g);
+}
+
+/*
+ * Set machine's global property defaults to @compat_props.
+ * May be called at most once.
+ */
+void object_set_machine_compat_props(GPtrArray *compat_props)
+{
+ assert(!object_compat_props[1]);
+ object_compat_props[1] = compat_props;
+}
+
+/*
+ * Set accelerator's global property defaults to @compat_props.
+ * May be called at most once.
+ */
+void object_set_accelerator_compat_props(GPtrArray *compat_props)
+{
+ assert(!object_compat_props[0]);
+ object_compat_props[0] = compat_props;
+}
+
+void object_apply_compat_props(Object *obj)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
+ object_apply_global_props(obj, object_compat_props[i],
+ i == 2 ? &error_fatal : &error_abort);
+ }
+}
diff --git a/qom/object.c b/qom/object.c
index 838b1d2b225..f00d659ef0f 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -440,106 +440,6 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti)
}
}
-bool object_apply_global_props(Object *obj, const GPtrArray *props,
- Error **errp)
-{
- int i;
-
- if (!props) {
- return true;
- }
-
- for (i = 0; i < props->len; i++) {
- GlobalProperty *p = g_ptr_array_index(props, i);
- Error *err = NULL;
-
- if (object_dynamic_cast(obj, p->driver) == NULL) {
- continue;
- }
- if (p->optional && !object_property_find(obj, p->property)) {
- continue;
- }
- p->used = true;
- if (!object_property_parse(obj, p->property, p->value, &err)) {
- error_prepend(&err, "can't apply global %s.%s=%s: ",
- p->driver, p->property, p->value);
- /*
- * If errp != NULL, propagate error and return.
- * If errp == NULL, report a warning, but keep going
- * with the remaining globals.
- */
- if (errp) {
- error_propagate(errp, err);
- return false;
- } else {
- warn_report_err(err);
- }
- }
- }
-
- return true;
-}
-
-/*
- * Global property defaults
- * Slot 0: accelerator's global property defaults
- * Slot 1: machine's global property defaults
- * Slot 2: global properties from legacy command line option
- * Each is a GPtrArray of GlobalProperty.
- * Applied in order, later entries override earlier ones.
- */
-static GPtrArray *object_compat_props[3];
-
-/*
- * Retrieve @GPtrArray for global property defined with options
- * other than "-global". These are generally used for syntactic
- * sugar and legacy command line options.
- */
-void object_register_sugar_prop(const char *driver, const char *prop,
- const char *value, bool optional)
-{
- GlobalProperty *g;
- if (!object_compat_props[2]) {
- object_compat_props[2] = g_ptr_array_new();
- }
- g = g_new0(GlobalProperty, 1);
- g->driver = g_strdup(driver);
- g->property = g_strdup(prop);
- g->value = g_strdup(value);
- g->optional = optional;
- g_ptr_array_add(object_compat_props[2], g);
-}
-
-/*
- * Set machine's global property defaults to @compat_props.
- * May be called at most once.
- */
-void object_set_machine_compat_props(GPtrArray *compat_props)
-{
- assert(!object_compat_props[1]);
- object_compat_props[1] = compat_props;
-}
-
-/*
- * Set accelerator's global property defaults to @compat_props.
- * May be called at most once.
- */
-void object_set_accelerator_compat_props(GPtrArray *compat_props)
-{
- assert(!object_compat_props[0]);
- object_compat_props[0] = compat_props;
-}
-
-void object_apply_compat_props(Object *obj)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
- object_apply_global_props(obj, object_compat_props[i],
- i == 2 ? &error_fatal : &error_abort);
- }
-}
-
static void object_class_property_init_all(Object *obj)
{
ObjectPropertyIterator iter;
diff --git a/qom/meson.build b/qom/meson.build
index 81922434309..bd6f4aadd78 100644
--- a/qom/meson.build
+++ b/qom/meson.build
@@ -5,6 +5,9 @@ qom_ss.add(files(
'object_interfaces.c',
'qom-qobject.c',
))
+if have_system
+ qom_ss.add(files('compat-properties.c'))
+endif
qmp_ss.add(files('qom-qmp-cmds.c'))
system_ss.add(files('qom-hmp-cmds.c'))
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [NOTFORMERGE PATCH 6/6] buildsys: Allow building guest-agent on 32-bit hosts
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2026-03-25 15:17 ` [PATCH-for-11.0? 5/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
@ 2026-03-25 15:17 ` Philippe Mathieu-Daudé
2026-03-26 6:43 ` [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Michael Tokarev
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-25 15:17 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Philippe Mathieu-Daudé, Daniel P. Berrangé,
Paolo Bonzini, Alex Bennée, kvm
Partially revert commit range 5053e0a65db...90e2e8ada7c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
configure | 64 +++++++++++++++++++++++++++++++++++++++++++----------
meson.build | 2 +-
2 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/configure b/configure
index eea90306728..e984ec2bd3c 100755
--- a/configure
+++ b/configure
@@ -381,6 +381,8 @@ fi
if test ! -z "$cpu" ; then
# command line argument
:
+elif check_define __i386__ ; then
+ cpu="i386"
elif check_define __x86_64__ ; then
if check_define __ILP32__ ; then
cpu="x32"
@@ -399,22 +401,30 @@ elif check_define _ARCH_PPC64 ; then
else
cpu="ppc64"
fi
-elif check_define __mips64 ; then
- cpu="mips64"
+elif check_define __mips__ ; then
+ if check_define __mips64 ; then
+ cpu="mips64"
+ fi
elif check_define __s390__ ; then
if check_define __s390x__ ; then
cpu="s390x"
else
cpu="s390"
fi
-elif check_define __riscv && check_define _LP64 ; then
- cpu="riscv64"
+elif check_define __riscv ; then
+ if check_define _LP64 ; then
+ cpu="riscv64"
+ else
+ cpu="riscv32"
+ fi
+elif check_define __arm__ ; then
+ cpu="arm"
elif check_define __aarch64__ ; then
cpu="aarch64"
elif check_define __loongarch64 ; then
cpu="loongarch64"
elif check_define EMSCRIPTEN ; then
- error_exit "wasm64 must be specified to the cpu flag"
+ error_exit "wasm32 or wasm64 must be specified to the cpu flag"
else
# Using uname is really broken, but it is just a fallback for architectures
# that are going to use TCI anyway
@@ -440,6 +450,18 @@ case "$cpu" in
linux_arch=arm64
;;
+ armv*b|armv*l|arm)
+ cpu=arm
+ host_arch=arm
+ ;;
+
+ i386|i486|i586|i686)
+ cpu="i386"
+ host_arch=i386
+ linux_arch=x86
+ CPU_CFLAGS="-m32"
+ ;;
+
loongarch*)
cpu=loongarch64
host_arch=loongarch64
@@ -448,7 +470,7 @@ case "$cpu" in
mips64*|mipsisa64*)
cpu=mips64
- host_arch=mips64
+ host_arch=mips
linux_arch=mips
;;
@@ -464,8 +486,8 @@ case "$cpu" in
CPU_CFLAGS="-m64 -mlittle-endian"
;;
- riscv64)
- host_arch=riscv64
+ riscv32 | riscv64)
+ host_arch=riscv
linux_arch=riscv
;;
@@ -500,6 +522,9 @@ case "$cpu" in
linux_arch=x86
CPU_CFLAGS="-m64"
;;
+ wasm32)
+ CPU_CFLAGS="-m32"
+ ;;
wasm64)
CPU_CFLAGS="-m64 -sMEMORY64=$wasm64_memory64"
;;
@@ -1287,7 +1312,7 @@ EOF
test "$bigendian" = no && rust_arch=${rust_arch}el
;;
- riscv64)
+ riscv32|riscv64)
# e.g. riscv64gc-unknown-linux-gnu, but riscv64-linux-android
test "$android" = no && rust_arch=${rust_arch}gc
;;
@@ -1449,18 +1474,26 @@ probe_target_compiler() {
container_image=debian-all-test-cross
container_cross_prefix=aarch64-linux-gnu-
;;
- alpha|hppa|m68k|mips|riscv64|sh4|sparc64)
+ hppa|m68k|mips|riscv64|sparc64)
container_image=debian-all-test-cross
;;
mips64)
container_image=debian-all-test-cross
container_cross_prefix=mips64-linux-gnuabi64-
;;
- ppc|ppc64|ppc64le)
+ ppc64|ppc64le)
container_image=debian-all-test-cross
container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu-
;;
+ # debian-legacy-test-cross architectures (need Debian 11)
+ # - libc6.1-dev-alpha-cross: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054412
+ # - sh4-linux-user: binaries don't run with bookworm compiler
+
+ alpha|sh4)
+ container_image=debian-legacy-test-cross
+ ;;
+
# architectures with individual containers
aarch64)
@@ -1930,7 +1963,14 @@ if test "$skip_meson" = no; then
if test "$cross_compile" = "yes"; then
echo "[host_machine]" >> $cross
echo "system = '$host_os'" >> $cross
- echo "cpu_family = '$cpu'" >> $cross
+ case "$cpu" in
+ i386)
+ echo "cpu_family = 'x86'" >> $cross
+ ;;
+ *)
+ echo "cpu_family = '$cpu'" >> $cross
+ ;;
+ esac
echo "cpu = '$cpu'" >> $cross
if test "$bigendian" = "yes" ; then
echo "endian = 'big'" >> $cross
diff --git a/meson.build b/meson.build
index d7c4095b395..ae412263ec7 100644
--- a/meson.build
+++ b/meson.build
@@ -323,7 +323,7 @@ endif
# Compiler flags #
##################
-if cc.sizeof('void *') < 8
+if not have_ga and cc.sizeof('void *') < 8
error('QEMU requires a 64-bit CPU host architecture')
endif
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation
2026-03-25 15:17 [PATCH-for-11.0? 0/6] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2026-03-25 15:17 ` [NOTFORMERGE PATCH 6/6] buildsys: Allow building guest-agent on 32-bit hosts Philippe Mathieu-Daudé
@ 2026-03-26 6:43 ` Michael Tokarev
6 siblings, 0 replies; 8+ messages in thread
From: Michael Tokarev @ 2026-03-26 6:43 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Marc-André Lureau, Richard Henderson,
Daniel P. Berrangé, Paolo Bonzini, Alex Bennée, kvm
25.03.2026 18:17, Philippe Mathieu-Daudé wrote:
> Remove QDev uses from QOM to help build the guest-agent
> binary without pulling in QDev methods.
>
> After that only util/qsp.c is left (cond/mutex atomics),
> see this thread:
> https://lore.kernel.org/qemu-devel/a547c29b-3ab7-42fe-889a-19668bc9d090@tls.msk.ru/
>
> Philippe Mathieu-Daudé (6):
> MAINTAINERS: Separate QDev section from QOM one
> hw/core: Move compat_props_add() to 'hw/core/boards.h'
> qom: Declare GlobalProperty structure in 'qom/compat-properties.h'
> qom: Declare compat properties API in 'qom/compat-properties.h'
> qom: Restrict compat properties API to system emulation
> buildsys: Allow building guest-agent on 32-bit hosts
Series:
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
This definitely helps with qemu-ga issue (a few steps closer to it,
anyway), makes things better separated and cleaner, and might even
be simple enough for 11.0. Though I'm not sure for the latter.
Thank you Philippe for this!
/mjt
> MAINTAINERS | 21 +++---
> configure | 64 +++++++++++++----
> meson.build | 2 +-
> include/hw/core/boards.h | 11 +++
> include/hw/core/qdev-properties.h | 1 +
> include/hw/core/qdev.h | 27 -------
> include/qom/compat-properties.h | 40 +++++++++++
> include/qom/object.h | 8 ---
> accel/accel-system.c | 1 +
> backends/hostmem.c | 1 +
> hw/core/machine.c | 1 +
> hw/core/qdev-properties.c | 1 +
> hw/core/qdev.c | 1 +
> hw/i386/pc_q35.c | 1 +
> qom/compat-properties.c | 116 ++++++++++++++++++++++++++++++
> qom/object.c | 102 +-------------------------
> system/rtc.c | 1 +
> system/vl.c | 1 +
> target/i386/sev.c | 1 +
> ui/vdagent.c | 1 +
> qom/meson.build | 3 +
> 21 files changed, 248 insertions(+), 157 deletions(-)
> create mode 100644 include/qom/compat-properties.h
> create mode 100644 qom/compat-properties.c
>
^ permalink raw reply [flat|nested] 8+ messages in thread