* [PULL 00/11] machine + QOM queue, 2020-09-22
@ 2020-09-22 22:25 Eduardo Habkost
2020-09-22 22:25 ` [PULL 01/11] qom: simplify object_find_property / object_class_find_property Eduardo Habkost
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell; +Cc: Paolo Bonzini, Daniel P. Berrangé
The following changes since commit 834b9273d5cdab68180dc8c84d641aaa4344b057:
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-5.2-pull-request' into staging (2020-09-22 15:42:23 +0100)
are available in the Git repository at:
git://github.com/ehabkost/qemu.git tags/machine-next-pull-request
for you to fetch changes up to 418b473e8f586247475e8adc5d048598e5721361:
sifive_u: Register "start-in-flash" as class property (2020-09-22 16:48:29 -0400)
----------------------------------------------------------------
machine + QOM queue, 2020-09-22
QOM cleanups:
* Convert instance properties to class properties
(Eduardo Habkost)
* simplify object_find_property / object_class_find_property
(Daniel P. Berrangé)
Deprecated feature removal:
* Drop support for invalid topologies (Igor Mammedov)
----------------------------------------------------------------
Daniel P. Berrangé (1):
qom: simplify object_find_property / object_class_find_property
Eduardo Habkost (9):
cryptodev-vhost-user: Register "chardev" as class property
cryptodev-backend: Register "chardev" as class property
s390x: Register all CPU properties as class properties
cpu/core: Register core-id and nr-threads as class properties
xlnx-zcu102: Register properties as class properties
machine: Register "memory-backend" as class property
i440fx: Register i440FX-pcihost properties as class properties
sifive_e: Register "revb" as class property
sifive_u: Register "start-in-flash" as class property
Igor Mammedov (1):
smp: drop support for deprecated (invalid topologies)
docs/system/deprecated.rst | 26 +++++++-------
include/qom/object.h | 48 ++++++++++++++++++++++---
target/s390x/internal.h | 1 -
backends/cryptodev-vhost-user.c | 13 +++----
backends/cryptodev.c | 8 ++---
hw/arm/armv7m.c | 10 +++---
hw/arm/exynos4210.c | 2 +-
hw/arm/highbank.c | 2 +-
hw/arm/integratorcp.c | 2 +-
hw/arm/realview.c | 2 +-
hw/arm/sbsa-ref.c | 2 +-
hw/arm/versatilepb.c | 2 +-
hw/arm/vexpress.c | 4 +--
hw/arm/virt.c | 10 +++---
hw/arm/xilinx_zynq.c | 2 +-
hw/arm/xlnx-zcu102.c | 25 ++++++-------
hw/core/machine.c | 28 ++++++---------
hw/core/qdev-properties-system.c | 2 +-
hw/core/sysbus.c | 2 +-
hw/cpu/a15mpcore.c | 4 +--
hw/cpu/a9mpcore.c | 2 +-
hw/cpu/core.c | 8 ++---
hw/i386/pc.c | 16 +++------
hw/misc/iotkit-sysctl.c | 2 +-
hw/pci-host/i440fx.c | 32 ++++++++---------
hw/pci/pci.c | 2 +-
hw/riscv/sifive_e.c | 11 +++---
hw/riscv/sifive_u.c | 16 ++++-----
hw/scsi/scsi-bus.c | 4 +--
qom/object.c | 60 +++++++++++++++++++-------------
target/arm/monitor.c | 2 +-
target/i386/cpu.c | 2 +-
target/s390x/cpu.c | 1 -
target/s390x/cpu_models.c | 35 +++++++++----------
target/ppc/translate_init.c.inc | 2 +-
35 files changed, 208 insertions(+), 182 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PULL 01/11] qom: simplify object_find_property / object_class_find_property
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 02/11] smp: drop support for deprecated (invalid topologies) Eduardo Habkost
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Daniel P. Berrangé,
Philippe Mathieu-Daudé
From: Daniel P. Berrangé <berrange@redhat.com>
When debugging QEMU it is often useful to put a breakpoint on the
error_setg_internal method impl.
Unfortunately the object_property_add / object_class_property_add
methods call object_property_find / object_class_property_find methods
to check if a property exists already before adding the new property.
As a result there are a huge number of calls to error_setg_internal
on startup of most QEMU commands, making it very painful to set a
breakpoint on this method.
Most callers of object_find_property and object_class_find_property,
however, pass in a NULL for the Error parameter. This simplifies the
methods to remove the Error parameter entirely, and then adds some
new wrapper methods that are able to raise an Error when needed.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200914135617.1493072-1-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/qom/object.h | 48 ++++++++++++++++++++++---
hw/arm/armv7m.c | 10 +++---
hw/arm/exynos4210.c | 2 +-
hw/arm/highbank.c | 2 +-
hw/arm/integratorcp.c | 2 +-
hw/arm/realview.c | 2 +-
hw/arm/sbsa-ref.c | 2 +-
hw/arm/versatilepb.c | 2 +-
hw/arm/vexpress.c | 4 +--
hw/arm/virt.c | 10 +++---
hw/arm/xilinx_zynq.c | 2 +-
hw/core/qdev-properties-system.c | 2 +-
hw/core/sysbus.c | 2 +-
hw/cpu/a15mpcore.c | 4 +--
hw/cpu/a9mpcore.c | 2 +-
hw/misc/iotkit-sysctl.c | 2 +-
hw/pci/pci.c | 2 +-
hw/scsi/scsi-bus.c | 4 +--
qom/object.c | 60 +++++++++++++++++++-------------
target/arm/monitor.c | 2 +-
target/i386/cpu.c | 2 +-
target/ppc/translate_init.c.inc | 2 +-
22 files changed, 109 insertions(+), 61 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 19cccd3f5f7..9b018887266 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1463,14 +1463,52 @@ void object_property_set_default_uint(ObjectProperty *prop, uint64_t value);
* object_property_find:
* @obj: the object
* @name: the name of the property
+ *
+ * Look up a property for an object.
+ *
+ * Return its #ObjectProperty if found, or NULL.
+ */
+ObjectProperty *object_property_find(Object *obj, const char *name);
+
+/**
+ * object_property_find_err:
+ * @obj: the object
+ * @name: the name of the property
* @errp: returns an error if this function fails
*
- * Look up a property for an object and return its #ObjectProperty if found.
+ * Look up a property for an object.
+ *
+ * Return its #ObjectProperty if found, or NULL.
*/
-ObjectProperty *object_property_find(Object *obj, const char *name,
- Error **errp);
-ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,
- Error **errp);
+ObjectProperty *object_property_find_err(Object *obj,
+ const char *name,
+ Error **errp);
+
+/**
+ * object_class_property_find:
+ * @klass: the object class
+ * @name: the name of the property
+ *
+ * Look up a property for an object class.
+ *
+ * Return its #ObjectProperty if found, or NULL.
+ */
+ObjectProperty *object_class_property_find(ObjectClass *klass,
+ const char *name);
+
+/**
+ * object_class_property_find_err:
+ * @klass: the object class
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Look up a property for an object class.
+ *
+ * Return its #ObjectProperty if found, or NULL.
+ */
+ObjectProperty *object_class_property_find_err(ObjectClass *klass,
+ const char *name,
+ Error **errp);
typedef struct ObjectPropertyIterator {
ObjectClass *nextclass;
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index aa831d6653c..0e5997d333a 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -169,28 +169,28 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
object_property_set_link(OBJECT(s->cpu), "memory", OBJECT(&s->container),
&error_abort);
- if (object_property_find(OBJECT(s->cpu), "idau", NULL)) {
+ if (object_property_find(OBJECT(s->cpu), "idau")) {
object_property_set_link(OBJECT(s->cpu), "idau", s->idau,
&error_abort);
}
- if (object_property_find(OBJECT(s->cpu), "init-svtor", NULL)) {
+ if (object_property_find(OBJECT(s->cpu), "init-svtor")) {
if (!object_property_set_uint(OBJECT(s->cpu), "init-svtor",
s->init_svtor, errp)) {
return;
}
}
- if (object_property_find(OBJECT(s->cpu), "start-powered-off", NULL)) {
+ if (object_property_find(OBJECT(s->cpu), "start-powered-off")) {
if (!object_property_set_bool(OBJECT(s->cpu), "start-powered-off",
s->start_powered_off, errp)) {
return;
}
}
- if (object_property_find(OBJECT(s->cpu), "vfp", NULL)) {
+ if (object_property_find(OBJECT(s->cpu), "vfp")) {
if (!object_property_set_bool(OBJECT(s->cpu), "vfp", s->vfp, errp)) {
return;
}
}
- if (object_property_find(OBJECT(s->cpu), "dsp", NULL)) {
+ if (object_property_find(OBJECT(s->cpu), "dsp")) {
if (!object_property_set_bool(OBJECT(s->cpu), "dsp", s->dsp, errp)) {
return;
}
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index 081bbff3170..ced2769b102 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -214,7 +214,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
/* By default A9 CPUs have EL3 enabled. This board does not currently
* support EL3 so the CPU EL3 property is disabled before realization.
*/
- if (object_property_find(cpuobj, "has_el3", NULL)) {
+ if (object_property_find(cpuobj, "has_el3")) {
object_property_set_bool(cpuobj, "has_el3", false, &error_fatal);
}
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index 7da984171bb..da0510d7cef 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -276,7 +276,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
&error_abort);
}
- if (object_property_find(cpuobj, "reset-cbar", NULL)) {
+ if (object_property_find(cpuobj, "reset-cbar")) {
object_property_set_int(cpuobj, "reset-cbar", MPCORE_PERIPHBASE,
&error_abort);
}
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index de670b08a90..16e89859539 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -603,7 +603,7 @@ static void integratorcp_init(MachineState *machine)
* currently support EL3 so the CPU EL3 property is disabled before
* realization.
*/
- if (object_property_find(cpuobj, "has_el3", NULL)) {
+ if (object_property_find(cpuobj, "has_el3")) {
object_property_set_bool(cpuobj, "has_el3", false, &error_fatal);
}
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 5f1f36b15cd..0831159d158 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -108,7 +108,7 @@ static void realview_init(MachineState *machine,
* does not currently support EL3 so the CPU EL3 property is disabled
* before realization.
*/
- if (object_property_find(cpuobj, "has_el3", NULL)) {
+ if (object_property_find(cpuobj, "has_el3")) {
object_property_set_bool(cpuobj, "has_el3", false, &error_fatal);
}
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index bcb2cb47619..257ada94255 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -703,7 +703,7 @@ static void sbsa_ref_init(MachineState *machine)
numa_cpu_pre_plug(&possible_cpus->cpus[cs->cpu_index], DEVICE(cpuobj),
&error_fatal);
- if (object_property_find(cpuobj, "reset-cbar", NULL)) {
+ if (object_property_find(cpuobj, "reset-cbar")) {
object_property_set_int(cpuobj, "reset-cbar",
sbsa_ref_memmap[SBSA_CPUPERIPHS].base,
&error_abort);
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 84d4677abb7..1ea55346264 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -213,7 +213,7 @@ static void versatile_init(MachineState *machine, int board_id)
* currently support EL3 so the CPU EL3 property is disabled before
* realization.
*/
- if (object_property_find(cpuobj, "has_el3", NULL)) {
+ if (object_property_find(cpuobj, "has_el3")) {
object_property_set_bool(cpuobj, "has_el3", false, &error_fatal);
}
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 94ff094ab3e..531f3a122ad 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -218,12 +218,12 @@ static void init_cpus(MachineState *ms, const char *cpu_type,
object_property_set_bool(cpuobj, "has_el3", false, NULL);
}
if (!virt) {
- if (object_property_find(cpuobj, "has_el2", NULL)) {
+ if (object_property_find(cpuobj, "has_el2")) {
object_property_set_bool(cpuobj, "has_el2", false, NULL);
}
}
- if (object_property_find(cpuobj, "reset-cbar", NULL)) {
+ if (object_property_find(cpuobj, "reset-cbar")) {
object_property_set_int(cpuobj, "reset-cbar", periphbase,
&error_abort);
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index acf9bfbecea..1231a197c85 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1806,7 +1806,7 @@ static void machvirt_init(MachineState *machine)
object_property_set_bool(cpuobj, "has_el3", false, NULL);
}
- if (!vms->virt && object_property_find(cpuobj, "has_el2", NULL)) {
+ if (!vms->virt && object_property_find(cpuobj, "has_el2")) {
object_property_set_bool(cpuobj, "has_el2", false, NULL);
}
@@ -1822,15 +1822,15 @@ static void machvirt_init(MachineState *machine)
}
if (vmc->kvm_no_adjvtime &&
- object_property_find(cpuobj, "kvm-no-adjvtime", NULL)) {
+ object_property_find(cpuobj, "kvm-no-adjvtime")) {
object_property_set_bool(cpuobj, "kvm-no-adjvtime", true, NULL);
}
- if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) {
+ if (vmc->no_pmu && object_property_find(cpuobj, "pmu")) {
object_property_set_bool(cpuobj, "pmu", false, NULL);
}
- if (object_property_find(cpuobj, "reset-cbar", NULL)) {
+ if (object_property_find(cpuobj, "reset-cbar")) {
object_property_set_int(cpuobj, "reset-cbar",
vms->memmap[VIRT_CPUPERIPHS].base,
&error_abort);
@@ -1850,7 +1850,7 @@ static void machvirt_init(MachineState *machine)
* The property exists only if MemTag is supported.
* If it is, we must allocate the ram to back that up.
*/
- if (!object_property_find(cpuobj, "tag-memory", NULL)) {
+ if (!object_property_find(cpuobj, "tag-memory")) {
error_report("MTE requested, but not supported "
"by the guest CPU");
exit(1);
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 2c0bff4fa6c..b72772bc824 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -196,7 +196,7 @@ static void zynq_init(MachineState *machine)
* currently support EL3 so the CPU EL3 property is disabled before
* realization.
*/
- if (object_property_find(OBJECT(cpu), "has_el3", NULL)) {
+ if (object_property_find(OBJECT(cpu), "has_el3")) {
object_property_set_bool(OBJECT(cpu), "has_el3", false, &error_fatal);
}
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 3e4f16fc218..b29daf4fb51 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -460,7 +460,7 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
qdev_prop_set_netdev(dev, "netdev", nd->netdev);
}
if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&
- object_property_find(OBJECT(dev), "vectors", NULL)) {
+ object_property_find(OBJECT(dev), "vectors")) {
qdev_prop_set_uint32(dev, "vectors", nd->nvectors);
}
nd->instantiated = 1;
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 294f90b7dee..68e8dc88c5c 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -93,7 +93,7 @@ bool sysbus_has_irq(SysBusDevice *dev, int n)
char *prop = g_strdup_printf("%s[%d]", SYSBUS_DEVICE_GPIO_IRQ, n);
ObjectProperty *r;
- r = object_property_find(OBJECT(dev), prop, NULL);
+ r = object_property_find(OBJECT(dev), prop);
g_free(prop);
return (r != NULL);
diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c
index c377be398d1..774ca9987a1 100644
--- a/hw/cpu/a15mpcore.c
+++ b/hw/cpu/a15mpcore.c
@@ -66,11 +66,11 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)
* either all the CPUs have TZ, or none do.
*/
cpuobj = OBJECT(qemu_get_cpu(0));
- has_el3 = object_property_find(cpuobj, "has_el3", NULL) &&
+ has_el3 = object_property_find(cpuobj, "has_el3") &&
object_property_get_bool(cpuobj, "has_el3", &error_abort);
qdev_prop_set_bit(gicdev, "has-security-extensions", has_el3);
/* Similarly for virtualization support */
- has_el2 = object_property_find(cpuobj, "has_el2", NULL) &&
+ has_el2 = object_property_find(cpuobj, "has_el2") &&
object_property_get_bool(cpuobj, "has_el2", &error_abort);
qdev_prop_set_bit(gicdev, "has-virtualization-extensions", has_el2);
}
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
index ec186d49abd..d03f57e579b 100644
--- a/hw/cpu/a9mpcore.c
+++ b/hw/cpu/a9mpcore.c
@@ -81,7 +81,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)
/* Make the GIC's TZ support match the CPUs. We assume that
* either all the CPUs have TZ, or none do.
*/
- has_el3 = object_property_find(cpuobj, "has_el3", NULL) &&
+ has_el3 = object_property_find(cpuobj, "has_el3") &&
object_property_get_bool(cpuobj, "has_el3", &error_abort);
qdev_prop_set_bit(gicdev, "has-security-extensions", has_el3);
diff --git a/hw/misc/iotkit-sysctl.c b/hw/misc/iotkit-sysctl.c
index 269783366d1..964b48c74d9 100644
--- a/hw/misc/iotkit-sysctl.c
+++ b/hw/misc/iotkit-sysctl.c
@@ -83,7 +83,7 @@ static void set_init_vtor(uint64_t cpuid, uint32_t vtor)
Object *cpuobj = OBJECT(arm_get_cpu_by_id(cpuid));
if (cpuobj) {
- if (object_property_find(cpuobj, "init-svtor", NULL)) {
+ if (object_property_find(cpuobj, "init-svtor")) {
object_property_set_uint(cpuobj, "init-svtor", vtor, &error_abort);
}
}
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index de0fae10ab9..fce725474b9 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1900,7 +1900,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
* a temporary instance here to be able to check it.
*/
Object *obj = object_new_with_class(OBJECT_CLASS(dc));
- if (object_property_find(obj, "netdev", NULL)) {
+ if (object_property_find(obj, "netdev")) {
g_ptr_array_add(pci_nic_models, (gpointer)name);
}
object_unref(obj);
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index df65cc22239..3284a5d1fb6 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -270,10 +270,10 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
object_property_set_int(OBJECT(dev), "bootindex", bootindex,
&error_abort);
}
- if (object_property_find(OBJECT(dev), "removable", NULL)) {
+ if (object_property_find(OBJECT(dev), "removable")) {
qdev_prop_set_bit(dev, "removable", removable);
}
- if (serial && object_property_find(OBJECT(dev), "serial", NULL)) {
+ if (serial && object_property_find(OBJECT(dev), "serial")) {
qdev_prop_set_string(dev, "serial", serial);
}
if (!qdev_prop_set_drive_err(dev, "drive", blk, errp)) {
diff --git a/qom/object.c b/qom/object.c
index a91a6a515af..a1ab9a78011 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -403,7 +403,7 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
if (object_dynamic_cast(obj, p->driver) == NULL) {
continue;
}
- if (p->optional && !object_property_find(obj, p->property, NULL)) {
+ if (p->optional && !object_property_find(obj, p->property)) {
continue;
}
p->used = true;
@@ -1214,7 +1214,7 @@ object_property_try_add(Object *obj, const char *name, const char *type,
return ret;
}
- if (object_property_find(obj, name, NULL) != NULL) {
+ if (object_property_find(obj, name) != NULL) {
error_setg(errp, "attempt to add duplicate property '%s' to object (type '%s')",
name, object_get_typename(obj));
return NULL;
@@ -1256,7 +1256,7 @@ object_class_property_add(ObjectClass *klass,
{
ObjectProperty *prop;
- assert(!object_class_property_find(klass, name, NULL));
+ assert(!object_class_property_find(klass, name));
prop = g_malloc0(sizeof(*prop));
@@ -1273,24 +1273,27 @@ object_class_property_add(ObjectClass *klass,
return prop;
}
-ObjectProperty *object_property_find(Object *obj, const char *name,
- Error **errp)
+ObjectProperty *object_property_find(Object *obj, const char *name)
{
ObjectProperty *prop;
ObjectClass *klass = object_get_class(obj);
- prop = object_class_property_find(klass, name, NULL);
+ prop = object_class_property_find(klass, name);
if (prop) {
return prop;
}
- prop = g_hash_table_lookup(obj->properties, name);
- if (prop) {
- return prop;
- }
+ return g_hash_table_lookup(obj->properties, name);
+}
- error_setg(errp, "Property '.%s' not found", name);
- return NULL;
+ObjectProperty *object_property_find_err(Object *obj, const char *name,
+ Error **errp)
+{
+ ObjectProperty *prop = object_property_find(obj, name);
+ if (!prop) {
+ error_setg(errp, "Property '.%s' not found", name);
+ }
+ return prop;
}
void object_property_iter_init(ObjectPropertyIterator *iter,
@@ -1320,27 +1323,34 @@ void object_class_property_iter_init(ObjectPropertyIterator *iter,
iter->nextclass = object_class_get_parent(klass);
}
-ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,
- Error **errp)
+ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name)
{
- ObjectProperty *prop;
ObjectClass *parent_klass;
parent_klass = object_class_get_parent(klass);
if (parent_klass) {
- prop = object_class_property_find(parent_klass, name, NULL);
+ ObjectProperty *prop =
+ object_class_property_find(parent_klass, name);
if (prop) {
return prop;
}
}
- prop = g_hash_table_lookup(klass->properties, name);
+ return g_hash_table_lookup(klass->properties, name);
+}
+
+ObjectProperty *object_class_property_find_err(ObjectClass *klass,
+ const char *name,
+ Error **errp)
+{
+ ObjectProperty *prop = object_class_property_find(klass, name);
if (!prop) {
error_setg(errp, "Property '.%s' not found", name);
}
return prop;
}
+
void object_property_del(Object *obj, const char *name)
{
ObjectProperty *prop = g_hash_table_lookup(obj->properties, name);
@@ -1355,7 +1365,7 @@ bool object_property_get(Object *obj, const char *name, Visitor *v,
Error **errp)
{
Error *err = NULL;
- ObjectProperty *prop = object_property_find(obj, name, errp);
+ ObjectProperty *prop = object_property_find_err(obj, name, errp);
if (prop == NULL) {
return false;
@@ -1374,7 +1384,7 @@ bool object_property_set(Object *obj, const char *name, Visitor *v,
Error **errp)
{
Error *err = NULL;
- ObjectProperty *prop = object_property_find(obj, name, errp);
+ ObjectProperty *prop = object_property_find_err(obj, name, errp);
if (prop == NULL) {
return false;
@@ -1590,7 +1600,7 @@ int object_property_get_enum(Object *obj, const char *name,
{
char *str;
int ret;
- ObjectProperty *prop = object_property_find(obj, name, errp);
+ ObjectProperty *prop = object_property_find_err(obj, name, errp);
EnumProperty *enumprop;
if (prop == NULL) {
@@ -1647,7 +1657,7 @@ out:
const char *object_property_get_type(Object *obj, const char *name, Error **errp)
{
- ObjectProperty *prop = object_property_find(obj, name, errp);
+ ObjectProperty *prop = object_property_find_err(obj, name, errp);
if (prop == NULL) {
return NULL;
}
@@ -2025,7 +2035,7 @@ char *object_get_canonical_path(const Object *obj)
Object *object_resolve_path_component(Object *parent, const char *part)
{
- ObjectProperty *prop = object_property_find(parent, part, NULL);
+ ObjectProperty *prop = object_property_find(parent, part);
if (prop == NULL) {
return NULL;
}
@@ -2724,8 +2734,8 @@ object_property_add_alias(Object *obj, const char *name,
ObjectProperty *target_prop;
g_autofree char *prop_type = NULL;
- target_prop = object_property_find(target_obj, target_name,
- &error_abort);
+ target_prop = object_property_find_err(target_obj, target_name,
+ &error_abort);
if (object_property_is_child(target_prop)) {
prop_type = g_strdup_printf("link%s",
@@ -2758,7 +2768,7 @@ void object_property_set_description(Object *obj, const char *name,
{
ObjectProperty *op;
- op = object_property_find(obj, name, &error_abort);
+ op = object_property_find_err(obj, name, &error_abort);
g_free(op->description);
op->description = g_strdup(description);
}
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index ba6e01abd03..375f34bfaa7 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -214,7 +214,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
i = 0;
while ((name = cpu_model_advertised_features[i++]) != NULL) {
- ObjectProperty *prop = object_property_find(obj, name, NULL);
+ ObjectProperty *prop = object_property_find(obj, name);
if (prop) {
QObject *value;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1c58f764dcb..3ffd877dd51 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6828,7 +6828,7 @@ static void x86_cpu_register_bit_prop(X86CPU *cpu,
ObjectProperty *op;
uint64_t mask = (1ULL << bitnr);
- op = object_property_find(OBJECT(cpu), prop_name, NULL);
+ op = object_property_find(OBJECT(cpu), prop_name);
if (op) {
fp = op->opaque;
assert(fp->w == w);
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
index accb4f2faea..bb66526280e 100644
--- a/target/ppc/translate_init.c.inc
+++ b/target/ppc/translate_init.c.inc
@@ -10478,7 +10478,7 @@ static void ppc_cpu_parse_featurestr(const char *type, char *features,
return;
}
- if (object_property_find(machine, "max-cpu-compat", NULL)) {
+ if (object_property_find(machine, "max-cpu-compat")) {
int i;
char **inpieces;
char *s = features;
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 02/11] smp: drop support for deprecated (invalid topologies)
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
2020-09-22 22:25 ` [PULL 01/11] qom: simplify object_find_property / object_class_find_property Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 03/11] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Daniel P. Berrangé, Igor Mammedov
From: Igor Mammedov <imammedo@redhat.com>
it's was deprecated since 3.1
Support for invalid topologies is removed, the user must ensure
that topologies described with -smp include all possible cpus,
i.e. (sockets * cores * threads) == maxcpus or QEMU will
exit with error.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200911133202.938754-1-imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
docs/system/deprecated.rst | 26 +++++++++++++-------------
hw/core/machine.c | 16 ++++------------
hw/i386/pc.c | 16 ++++------------
3 files changed, 21 insertions(+), 37 deletions(-)
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 808c334fe74..fb95d2ecc4f 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -47,19 +47,6 @@ The 'file' driver for drives is no longer appropriate for character or host
devices and will only accept regular files (S_IFREG). The correct driver
for these file types is 'host_cdrom' or 'host_device' as appropriate.
-``-smp`` (invalid topologies) (since 3.1)
-'''''''''''''''''''''''''''''''''''''''''
-
-CPU topology properties should describe whole machine topology including
-possible CPUs.
-
-However, historically it was possible to start QEMU with an incorrect topology
-where *n* <= *sockets* * *cores* * *threads* < *maxcpus*,
-which could lead to an incorrect topology enumeration by the guest.
-Support for invalid topologies will be removed, the user must ensure
-topologies described with -smp include all possible cpus, i.e.
-*sockets* * *cores* * *threads* = *maxcpus*.
-
``-vnc acl`` (since 4.0.0)
''''''''''''''''''''''''''
@@ -642,6 +629,19 @@ New machine versions (since 5.1) will not accept the option but it will still
work with old machine types. User can check the QAPI schema to see if the legacy
option is supported by looking at MachineInfo::numa-mem-supported property.
+``-smp`` (invalid topologies) (removed 5.2)
+'''''''''''''''''''''''''''''''''''''''''''
+
+CPU topology properties should describe whole machine topology including
+possible CPUs.
+
+However, historically it was possible to start QEMU with an incorrect topology
+where *n* <= *sockets* * *cores* * *threads* < *maxcpus*,
+which could lead to an incorrect topology enumeration by the guest.
+Support for invalid topologies is removed, the user must ensure
+topologies described with -smp include all possible cpus, i.e.
+*sockets* * *cores* * *threads* = *maxcpus*.
+
Block devices
-------------
diff --git a/hw/core/machine.c b/hw/core/machine.c
index ea26d612374..09aee4ea52b 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -754,23 +754,15 @@ static void smp_parse(MachineState *ms, QemuOpts *opts)
exit(1);
}
- if (sockets * cores * threads > ms->smp.max_cpus) {
- error_report("cpu topology: "
- "sockets (%u) * cores (%u) * threads (%u) > "
- "maxcpus (%u)",
+ if (sockets * cores * threads != ms->smp.max_cpus) {
+ error_report("Invalid CPU topology: "
+ "sockets (%u) * cores (%u) * threads (%u) "
+ "!= maxcpus (%u)",
sockets, cores, threads,
ms->smp.max_cpus);
exit(1);
}
- if (sockets * cores * threads != ms->smp.max_cpus) {
- warn_report("Invalid CPU topology deprecated: "
- "sockets (%u) * cores (%u) * threads (%u) "
- "!= maxcpus (%u)",
- sockets, cores, threads,
- ms->smp.max_cpus);
- }
-
ms->smp.cpus = cpus;
ms->smp.cores = cores;
ms->smp.threads = threads;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b55369357e5..1e2ab5ebe79 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -746,23 +746,15 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
exit(1);
}
- if (sockets * dies * cores * threads > ms->smp.max_cpus) {
- error_report("cpu topology: "
- "sockets (%u) * dies (%u) * cores (%u) * threads (%u) > "
- "maxcpus (%u)",
+ if (sockets * dies * cores * threads != ms->smp.max_cpus) {
+ error_report("Invalid CPU topology deprecated: "
+ "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
+ "!= maxcpus (%u)",
sockets, dies, cores, threads,
ms->smp.max_cpus);
exit(1);
}
- if (sockets * dies * cores * threads != ms->smp.max_cpus) {
- warn_report("Invalid CPU topology deprecated: "
- "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
- "!= maxcpus (%u)",
- sockets, dies, cores, threads,
- ms->smp.max_cpus);
- }
-
ms->smp.cpus = cpus;
ms->smp.cores = cores;
ms->smp.threads = threads;
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 03/11] cryptodev-vhost-user: Register "chardev" as class property
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
2020-09-22 22:25 ` [PULL 01/11] qom: simplify object_find_property / object_class_find_property Eduardo Habkost
2020-09-22 22:25 ` [PULL 02/11] smp: drop support for deprecated (invalid topologies) Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 04/11] cryptodev-backend: " Eduardo Habkost
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell; +Cc: Paolo Bonzini, Gonglei, Daniel P. Berrangé
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <20200921221045.699690-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
backends/cryptodev-vhost-user.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 60ec4908aa1..e1df073de2d 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -334,13 +334,6 @@ cryptodev_vhost_user_get_chardev(Object *obj, Error **errp)
return NULL;
}
-static void cryptodev_vhost_user_instance_int(Object *obj)
-{
- object_property_add_str(obj, "chardev",
- cryptodev_vhost_user_get_chardev,
- cryptodev_vhost_user_set_chardev);
-}
-
static void cryptodev_vhost_user_finalize(Object *obj)
{
CryptoDevBackendVhostUser *s =
@@ -361,13 +354,17 @@ cryptodev_vhost_user_class_init(ObjectClass *oc, void *data)
bc->create_session = cryptodev_vhost_user_sym_create_session;
bc->close_session = cryptodev_vhost_user_sym_close_session;
bc->do_sym_op = NULL;
+
+ object_class_property_add_str(oc, "chardev",
+ cryptodev_vhost_user_get_chardev,
+ cryptodev_vhost_user_set_chardev);
+
}
static const TypeInfo cryptodev_vhost_user_info = {
.name = TYPE_CRYPTODEV_BACKEND_VHOST_USER,
.parent = TYPE_CRYPTODEV_BACKEND,
.class_init = cryptodev_vhost_user_class_init,
- .instance_init = cryptodev_vhost_user_instance_int,
.instance_finalize = cryptodev_vhost_user_finalize,
.instance_size = sizeof(CryptoDevBackendVhostUser),
};
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 04/11] cryptodev-backend: Register "chardev" as class property
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (2 preceding siblings ...)
2020-09-22 22:25 ` [PULL 03/11] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 05/11] s390x: Register all CPU properties as class properties Eduardo Habkost
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell; +Cc: Paolo Bonzini, Gonglei, Daniel P. Berrangé
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <20200921221045.699690-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
backends/cryptodev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/backends/cryptodev.c b/backends/cryptodev.c
index ada4ebe78b1..3f141f61ed6 100644
--- a/backends/cryptodev.c
+++ b/backends/cryptodev.c
@@ -206,10 +206,6 @@ cryptodev_backend_can_be_deleted(UserCreatable *uc)
static void cryptodev_backend_instance_init(Object *obj)
{
- object_property_add(obj, "queues", "uint32",
- cryptodev_backend_get_queues,
- cryptodev_backend_set_queues,
- NULL, NULL);
/* Initialize devices' queues property to 1 */
object_property_set_int(obj, "queues", 1, NULL);
}
@@ -230,6 +226,10 @@ cryptodev_backend_class_init(ObjectClass *oc, void *data)
ucc->can_be_deleted = cryptodev_backend_can_be_deleted;
QTAILQ_INIT(&crypto_clients);
+ object_class_property_add(oc, "queues", "uint32",
+ cryptodev_backend_get_queues,
+ cryptodev_backend_set_queues,
+ NULL, NULL);
}
static const TypeInfo cryptodev_backend_info = {
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 05/11] s390x: Register all CPU properties as class properties
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (3 preceding siblings ...)
2020-09-22 22:25 ` [PULL 04/11] cryptodev-backend: " Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 06/11] cpu/core: Register core-id and nr-threads " Eduardo Habkost
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Cornelia Huck, Daniel P. Berrangé,
David Hildenbrand
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200921221045.699690-13-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/s390x/internal.h | 1 -
target/s390x/cpu.c | 1 -
target/s390x/cpu_models.c | 35 ++++++++++++++++-------------------
3 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index b1e0ebf67f8..bac0d3c67b2 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -260,7 +260,6 @@ static inline void s390_cpu_unhalt(S390CPU *cpu)
/* cpu_models.c */
-void s390_cpu_model_register_props(Object *obj);
void s390_cpu_model_class_register_props(ObjectClass *oc);
void s390_realize_cpu_model(CPUState *cs, Error **errp);
ObjectClass *s390_cpu_class_by_name(const char *name);
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index e350edc9f53..9cbd937ba2c 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -302,7 +302,6 @@ static void s390_cpu_initfn(Object *obj)
timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu);
s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
#endif
- s390_cpu_model_register_props(obj);
}
static void s390_cpu_finalize(Object *obj)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index c2af2261743..b97e9596ab0 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -1089,25 +1089,6 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name,
}
}
-void s390_cpu_model_register_props(Object *obj)
-{
- S390FeatGroup group;
- S390Feat feat;
-
- for (feat = 0; feat < S390_FEAT_MAX; feat++) {
- const S390FeatDef *def = s390_feat_def(feat);
- object_property_add(obj, def->name, "bool", get_feature,
- set_feature, NULL, (void *) feat);
- object_property_set_description(obj, def->name, def->desc);
- }
- for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
- const S390FeatGroupDef *def = s390_feat_group_def(group);
- object_property_add(obj, def->name, "bool", get_feature_group,
- set_feature_group, NULL, (void *) group);
- object_property_set_description(obj, def->name, def->desc);
- }
-}
-
static void s390_cpu_model_initfn(Object *obj)
{
S390CPU *cpu = S390_CPU(obj);
@@ -1215,11 +1196,27 @@ static char *get_description(Object *obj, Error **errp)
void s390_cpu_model_class_register_props(ObjectClass *oc)
{
+ S390FeatGroup group;
+ S390Feat feat;
+
object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe,
NULL);
object_class_property_add_bool(oc, "static", get_is_static,
NULL);
object_class_property_add_str(oc, "description", get_description, NULL);
+
+ for (feat = 0; feat < S390_FEAT_MAX; feat++) {
+ const S390FeatDef *def = s390_feat_def(feat);
+ object_class_property_add(oc, def->name, "bool", get_feature,
+ set_feature, NULL, (void *) feat);
+ object_class_property_set_description(oc, def->name, def->desc);
+ }
+ for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
+ const S390FeatGroupDef *def = s390_feat_group_def(group);
+ object_class_property_add(oc, def->name, "bool", get_feature_group,
+ set_feature_group, NULL, (void *) group);
+ object_class_property_set_description(oc, def->name, def->desc);
+ }
}
#ifdef CONFIG_KVM
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 06/11] cpu/core: Register core-id and nr-threads as class properties
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (4 preceding siblings ...)
2020-09-22 22:25 ` [PULL 05/11] s390x: Register all CPU properties as class properties Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 07/11] xlnx-zcu102: Register properties " Eduardo Habkost
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Daniel P. Berrangé, Igor Mammedov
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200921221045.699690-18-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/cpu/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/cpu/core.c b/hw/cpu/core.c
index 3a659291eae..92d3b2fbad6 100644
--- a/hw/cpu/core.c
+++ b/hw/cpu/core.c
@@ -69,10 +69,6 @@ static void cpu_core_instance_init(Object *obj)
MachineState *ms = MACHINE(qdev_get_machine());
CPUCore *core = CPU_CORE(obj);
- object_property_add(obj, "core-id", "int", core_prop_get_core_id,
- core_prop_set_core_id, NULL, NULL);
- object_property_add(obj, "nr-threads", "int", core_prop_get_nr_threads,
- core_prop_set_nr_threads, NULL, NULL);
core->nr_threads = ms->smp.threads;
}
@@ -81,6 +77,10 @@ static void cpu_core_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
+ object_class_property_add(oc, "core-id", "int", core_prop_get_core_id,
+ core_prop_set_core_id, NULL, NULL);
+ object_class_property_add(oc, "nr-threads", "int", core_prop_get_nr_threads,
+ core_prop_set_nr_threads, NULL, NULL);
}
static const TypeInfo cpu_core_type_info = {
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 07/11] xlnx-zcu102: Register properties as class properties
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (5 preceding siblings ...)
2020-09-22 22:25 ` [PULL 06/11] cpu/core: Register core-id and nr-threads " Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 08/11] machine: Register "memory-backend" as class property Eduardo Habkost
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Alistair Francis, Daniel P. Berrangé
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200921221045.699690-20-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/arm/xlnx-zcu102.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
index 066571a9723..ad7fff9697b 100644
--- a/hw/arm/xlnx-zcu102.c
+++ b/hw/arm/xlnx-zcu102.c
@@ -206,20 +206,8 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)
/* Default to secure mode being disabled */
s->secure = false;
- object_property_add_bool(obj, "secure", zcu102_get_secure,
- zcu102_set_secure);
- object_property_set_description(obj, "secure",
- "Set on/off to enable/disable the ARM "
- "Security Extensions (TrustZone)");
-
/* Default to virt (EL2) being disabled */
s->virt = false;
- object_property_add_bool(obj, "virtualization", zcu102_get_virt,
- zcu102_set_virt);
- object_property_set_description(obj, "virtualization",
- "Set on/off to enable/disable emulating a "
- "guest CPU which implements the ARM "
- "Virtualization Extensions");
}
static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
@@ -235,6 +223,19 @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS;
mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS;
mc->default_ram_id = "ddr-ram";
+
+ object_class_property_add_bool(oc, "secure", zcu102_get_secure,
+ zcu102_set_secure);
+ object_class_property_set_description(oc, "secure",
+ "Set on/off to enable/disable the ARM "
+ "Security Extensions (TrustZone)");
+
+ object_class_property_add_bool(oc, "virtualization", zcu102_get_virt,
+ zcu102_set_virt);
+ object_class_property_set_description(oc, "virtualization",
+ "Set on/off to enable/disable emulating a "
+ "guest CPU which implements the ARM "
+ "Virtualization Extensions");
}
static const TypeInfo xlnx_zcu102_machine_init_typeinfo = {
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 08/11] machine: Register "memory-backend" as class property
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (6 preceding siblings ...)
2020-09-22 22:25 ` [PULL 07/11] xlnx-zcu102: Register properties " Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 09/11] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Daniel P. Berrangé, Igor Mammedov
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200921221045.699690-21-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/core/machine.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 09aee4ea52b..9b02fb2f5ed 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -866,6 +866,12 @@ static void machine_class_init(ObjectClass *oc, void *data)
machine_get_memory_encryption, machine_set_memory_encryption);
object_class_property_set_description(oc, "memory-encryption",
"Set memory encryption object to use");
+
+ object_class_property_add_str(oc, "memory-backend",
+ machine_get_memdev, machine_set_memdev);
+ object_class_property_set_description(oc, "memory-backend",
+ "Set RAM backend"
+ "Valid value is ID of hostmem based backend");
}
static void machine_class_base_init(ObjectClass *oc, void *data)
@@ -917,12 +923,6 @@ static void machine_initfn(Object *obj)
"Table (HMAT)");
}
- object_property_add_str(obj, "memory-backend",
- machine_get_memdev, machine_set_memdev);
- object_property_set_description(obj, "memory-backend",
- "Set RAM backend"
- "Valid value is ID of hostmem based backend");
-
/* Register notifier when init is done for sysbus sanity checks */
ms->sysbus_notifier.notify = machine_init_notify;
qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 09/11] i440fx: Register i440FX-pcihost properties as class properties
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (7 preceding siblings ...)
2020-09-22 22:25 ` [PULL 08/11] machine: Register "memory-backend" as class property Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 10/11] sifive_e: Register "revb" as class property Eduardo Habkost
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Daniel P. Berrangé, Igor Mammedov
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200921221045.699690-23-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/pci-host/i440fx.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index aecbcc2446e..28c9bae8994 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -210,22 +210,6 @@ static void i440fx_pcihost_initfn(Object *obj)
"pci-conf-idx", 4);
memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
"pci-conf-data", 4);
-
- object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
- i440fx_pcihost_get_pci_hole_start,
- NULL, NULL, NULL);
-
- object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
- i440fx_pcihost_get_pci_hole_end,
- NULL, NULL, NULL);
-
- object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
- i440fx_pcihost_get_pci_hole64_start,
- NULL, NULL, NULL);
-
- object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
- i440fx_pcihost_get_pci_hole64_end,
- NULL, NULL, NULL);
}
static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
@@ -401,6 +385,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
device_class_set_props(dc, i440fx_props);
/* Reason: needs to be wired up by pc_init1 */
dc->user_creatable = false;
+
+ object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
+ i440fx_pcihost_get_pci_hole_start,
+ NULL, NULL, NULL);
+
+ object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
+ i440fx_pcihost_get_pci_hole_end,
+ NULL, NULL, NULL);
+
+ object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
+ i440fx_pcihost_get_pci_hole64_start,
+ NULL, NULL, NULL);
+
+ object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
+ i440fx_pcihost_get_pci_hole64_end,
+ NULL, NULL, NULL);
}
static const TypeInfo i440fx_pcihost_info = {
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 10/11] sifive_e: Register "revb" as class property
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (8 preceding siblings ...)
2020-09-22 22:25 ` [PULL 09/11] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-22 22:25 ` [PULL 11/11] sifive_u: Register "start-in-flash" " Eduardo Habkost
2020-09-24 16:22 ` [PULL 00/11] machine + QOM queue, 2020-09-22 Peter Maydell
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Alistair Francis, Daniel P. Berrangé
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200921221045.699690-24-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/riscv/sifive_e.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 759059cd7bf..fcfac168161 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -137,11 +137,6 @@ static void sifive_e_machine_instance_init(Object *obj)
SiFiveEState *s = RISCV_E_MACHINE(obj);
s->revb = false;
- object_property_add_bool(obj, "revb", sifive_e_machine_get_revb,
- sifive_e_machine_set_revb);
- object_property_set_description(obj, "revb",
- "Set on to tell QEMU that it should model "
- "the revB HiFive1 board");
}
static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
@@ -152,6 +147,12 @@ static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
mc->init = sifive_e_machine_init;
mc->max_cpus = 1;
mc->default_cpu_type = SIFIVE_E_CPU;
+
+ object_class_property_add_bool(oc, "revb", sifive_e_machine_get_revb,
+ sifive_e_machine_set_revb);
+ object_class_property_set_description(oc, "revb",
+ "Set on to tell QEMU that it should model "
+ "the revB HiFive1 board");
}
static const TypeInfo sifive_e_machine_typeinfo = {
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 11/11] sifive_u: Register "start-in-flash" as class property
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (9 preceding siblings ...)
2020-09-22 22:25 ` [PULL 10/11] sifive_e: Register "revb" as class property Eduardo Habkost
@ 2020-09-22 22:25 ` Eduardo Habkost
2020-09-24 16:22 ` [PULL 00/11] machine + QOM queue, 2020-09-22 Peter Maydell
11 siblings, 0 replies; 13+ messages in thread
From: Eduardo Habkost @ 2020-09-22 22:25 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Paolo Bonzini, Alistair Francis, Daniel P. Berrangé
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200921221045.699690-25-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/riscv/sifive_u.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index a97637fb333..6ad975d6923 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -568,14 +568,6 @@ static void sifive_u_machine_instance_init(Object *obj)
SiFiveUState *s = RISCV_U_MACHINE(obj);
s->start_in_flash = false;
- object_property_add_bool(obj, "start-in-flash",
- sifive_u_machine_get_start_in_flash,
- sifive_u_machine_set_start_in_flash);
- object_property_set_description(obj, "start-in-flash",
- "Set on to tell QEMU's ROM to jump to "
- "flash. Otherwise QEMU will jump to DRAM "
- "or L2LIM depending on the msel value");
-
s->msel = 0;
object_property_add(obj, "msel", "uint32",
sifive_u_machine_get_uint32_prop,
@@ -599,6 +591,14 @@ static void sifive_u_machine_class_init(ObjectClass *oc, void *data)
mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
mc->default_cpus = mc->min_cpus;
+
+ object_class_property_add_bool(oc, "start-in-flash",
+ sifive_u_machine_get_start_in_flash,
+ sifive_u_machine_set_start_in_flash);
+ object_class_property_set_description(oc, "start-in-flash",
+ "Set on to tell QEMU's ROM to jump to "
+ "flash. Otherwise QEMU will jump to DRAM "
+ "or L2LIM depending on the msel value");
}
static const TypeInfo sifive_u_machine_typeinfo = {
--
2.26.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PULL 00/11] machine + QOM queue, 2020-09-22
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
` (10 preceding siblings ...)
2020-09-22 22:25 ` [PULL 11/11] sifive_u: Register "start-in-flash" " Eduardo Habkost
@ 2020-09-24 16:22 ` Peter Maydell
11 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2020-09-24 16:22 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: Paolo Bonzini, Daniel P. Berrangé, QEMU Developers
On Tue, 22 Sep 2020 at 23:25, Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> The following changes since commit 834b9273d5cdab68180dc8c84d641aaa4344b057:
>
> Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-5.2-pull-request' into staging (2020-09-22 15:42:23 +0100)
>
> are available in the Git repository at:
>
> git://github.com/ehabkost/qemu.git tags/machine-next-pull-request
>
> for you to fetch changes up to 418b473e8f586247475e8adc5d048598e5721361:
>
> sifive_u: Register "start-in-flash" as class property (2020-09-22 16:48:29 -0400)
>
> ----------------------------------------------------------------
> machine + QOM queue, 2020-09-22
>
> QOM cleanups:
> * Convert instance properties to class properties
> (Eduardo Habkost)
> * simplify object_find_property / object_class_find_property
> (Daniel P. Berrangé)
>
> Deprecated feature removal:
> * Drop support for invalid topologies (Igor Mammedov)
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-09-24 16:45 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-22 22:25 [PULL 00/11] machine + QOM queue, 2020-09-22 Eduardo Habkost
2020-09-22 22:25 ` [PULL 01/11] qom: simplify object_find_property / object_class_find_property Eduardo Habkost
2020-09-22 22:25 ` [PULL 02/11] smp: drop support for deprecated (invalid topologies) Eduardo Habkost
2020-09-22 22:25 ` [PULL 03/11] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
2020-09-22 22:25 ` [PULL 04/11] cryptodev-backend: " Eduardo Habkost
2020-09-22 22:25 ` [PULL 05/11] s390x: Register all CPU properties as class properties Eduardo Habkost
2020-09-22 22:25 ` [PULL 06/11] cpu/core: Register core-id and nr-threads " Eduardo Habkost
2020-09-22 22:25 ` [PULL 07/11] xlnx-zcu102: Register properties " Eduardo Habkost
2020-09-22 22:25 ` [PULL 08/11] machine: Register "memory-backend" as class property Eduardo Habkost
2020-09-22 22:25 ` [PULL 09/11] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
2020-09-22 22:25 ` [PULL 10/11] sifive_e: Register "revb" as class property Eduardo Habkost
2020-09-22 22:25 ` [PULL 11/11] sifive_u: Register "start-in-flash" " Eduardo Habkost
2020-09-24 16:22 ` [PULL 00/11] machine + QOM queue, 2020-09-22 Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).