aboutsummaryrefslogtreecommitdiff
path: root/hw/arm
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2020-09-14 14:56:17 +0100
committerEduardo Habkost <ehabkost@redhat.com>2020-09-22 16:45:16 -0400
commitefba15959cdb1ca7beeed8d6188ab0905b468f90 (patch)
tree5af4ba146184a2bcdc3100bd37388a04b11d3e43 /hw/arm
parent834b9273d5cdab68180dc8c84d641aaa4344b057 (diff)
qom: simplify object_find_property / object_class_find_property
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>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/armv7m.c10
-rw-r--r--hw/arm/exynos4210.c2
-rw-r--r--hw/arm/highbank.c2
-rw-r--r--hw/arm/integratorcp.c2
-rw-r--r--hw/arm/realview.c2
-rw-r--r--hw/arm/sbsa-ref.c2
-rw-r--r--hw/arm/versatilepb.c2
-rw-r--r--hw/arm/vexpress.c4
-rw-r--r--hw/arm/virt.c10
-rw-r--r--hw/arm/xilinx_zynq.c2
10 files changed, 19 insertions, 19 deletions
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index aa831d6653..0e5997d333 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 081bbff317..ced2769b10 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 7da984171b..da0510d7ce 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 de670b08a9..16e8985953 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 5f1f36b15c..0831159d15 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 bcb2cb4761..257ada9425 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 84d4677abb..1ea5534626 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 94ff094ab3..531f3a122a 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 acf9bfbece..1231a197c8 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 2c0bff4fa6..b72772bc82 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);
}