mirror of https://github.com/xemu-project/xemu.git
hw: Simplify accesses to the CPUState::'start-powered-off' property
The 'start-powered-off' property has been added to ARM CPUs in commit5de164304a
("arm: Allow secondary KVM CPUs to be booted via PSCI"), then eventually got generalized to all CPUs in commitc1b701587e
("target/arm: Move start-powered-off property to generic CPUState"). Since all CPUs have it, no need to check whether it is available. Updating this property can't fail, so use &error_abort. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20231123143813.42632-5-philmd@linaro.org>
This commit is contained in:
parent
eab4f398f4
commit
287fa32324
|
@ -1022,10 +1022,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
|
||||||
* later if necessary.
|
* later if necessary.
|
||||||
*/
|
*/
|
||||||
if (extract32(info->cpuwait_rst, i, 1)) {
|
if (extract32(info->cpuwait_rst, i, 1)) {
|
||||||
if (!object_property_set_bool(cpuobj, "start-powered-off", true,
|
object_property_set_bool(cpuobj, "start-powered-off", true,
|
||||||
errp)) {
|
&error_abort);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!s->cpu_fpu[i]) {
|
if (!s->cpu_fpu[i]) {
|
||||||
if (!object_property_set_bool(cpuobj, "vfp", false, errp)) {
|
if (!object_property_set_bool(cpuobj, "vfp", false, errp)) {
|
||||||
|
|
|
@ -318,12 +318,6 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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")) {
|
if (object_property_find(OBJECT(s->cpu), "vfp")) {
|
||||||
if (!object_property_set_bool(OBJECT(s->cpu), "vfp", s->vfp, errp)) {
|
if (!object_property_set_bool(OBJECT(s->cpu), "vfp", s->vfp, errp)) {
|
||||||
return;
|
return;
|
||||||
|
@ -334,6 +328,8 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
object_property_set_bool(OBJECT(s->cpu), "start-powered-off",
|
||||||
|
s->start_powered_off, &error_abort);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Real M-profile hardware can be configured with a different number of
|
* Real M-profile hardware can be configured with a different number of
|
||||||
|
|
|
@ -135,12 +135,8 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
|
||||||
bc->peri_base, &error_abort);
|
bc->peri_base, &error_abort);
|
||||||
|
|
||||||
/* start powered off if not enabled */
|
/* start powered off if not enabled */
|
||||||
if (!object_property_set_bool(OBJECT(&s->cpu[n].core),
|
object_property_set_bool(OBJECT(&s->cpu[n].core), "start-powered-off",
|
||||||
"start-powered-off",
|
n >= s->enabled_cpus, &error_abort);
|
||||||
n >= s->enabled_cpus,
|
|
||||||
errp)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!qdev_realize(DEVICE(&s->cpu[n].core), NULL, errp)) {
|
if (!qdev_realize(DEVICE(&s->cpu[n].core), NULL, errp)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -78,10 +78,9 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
|
||||||
CPUMIPSState *env = &cpu->env;
|
CPUMIPSState *env = &cpu->env;
|
||||||
|
|
||||||
/* All VPs are halted on reset. Leave powering up to CPC. */
|
/* All VPs are halted on reset. Leave powering up to CPC. */
|
||||||
if (!object_property_set_bool(OBJECT(cpu), "start-powered-off", true,
|
object_property_set_bool(OBJECT(cpu), "start-powered-off", true,
|
||||||
errp)) {
|
&error_abort);
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* All cores use the same clock tree */
|
/* All cores use the same clock tree */
|
||||||
qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
|
qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
|
||||||
|
|
||||||
|
|
|
@ -955,7 +955,7 @@ void ppce500_init(MachineState *machine)
|
||||||
* when implementing non-kernel boot.
|
* when implementing non-kernel boot.
|
||||||
*/
|
*/
|
||||||
object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
|
object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
|
||||||
&error_fatal);
|
&error_abort);
|
||||||
qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
|
qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
|
||||||
|
|
||||||
if (!firstenv) {
|
if (!firstenv) {
|
||||||
|
|
|
@ -804,7 +804,7 @@ static void cpu_devinit(const char *cpu_type, unsigned int id,
|
||||||
|
|
||||||
qemu_register_reset(sun4m_cpu_reset, cpu);
|
qemu_register_reset(sun4m_cpu_reset, cpu);
|
||||||
object_property_set_bool(OBJECT(cpu), "start-powered-off", id != 0,
|
object_property_set_bool(OBJECT(cpu), "start-powered-off", id != 0,
|
||||||
&error_fatal);
|
&error_abort);
|
||||||
qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
|
qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
|
||||||
cpu_sparc_set_id(env, id);
|
cpu_sparc_set_id(env, id);
|
||||||
*cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS);
|
*cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS);
|
||||||
|
|
Loading…
Reference in New Issue