Skip to content

Commit

Permalink
cpus: Restrict 'start-powered-off' property to system emulation
Browse files Browse the repository at this point in the history
Since the CPUState::start-powered-off property is irrelevant
to user emulation, restrict it to system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240111161817.43150-1-philmd@linaro.org>
  • Loading branch information
philmd committed Jan 19, 2024
1 parent 1c3d42c commit 0f9237f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cpu-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ static Property cpu_common_props[] = {
DEFINE_PROP_END_OF_LIST(),
};

#ifndef CONFIG_USER_ONLY
static bool cpu_get_start_powered_off(Object *obj, Error **errp)
{
CPUState *cpu = CPU(obj);
Expand All @@ -215,19 +216,23 @@ static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp)
CPUState *cpu = CPU(obj);
cpu->start_powered_off = value;
}
#endif

void cpu_class_init_props(DeviceClass *dc)
{
#ifndef CONFIG_USER_ONLY
ObjectClass *oc = OBJECT_CLASS(dc);

device_class_set_props(dc, cpu_common_props);
/*
* We can't use DEFINE_PROP_BOOL in the Property array for this
* property, because we want this to be settable after realize.
*/
object_class_property_add_bool(oc, "start-powered-off",
cpu_get_start_powered_off,
cpu_set_start_powered_off);
#endif

device_class_set_props(dc, cpu_common_props);
}

void cpu_exec_initfn(CPUState *cpu)
Expand Down

0 comments on commit 0f9237f

Please sign in to comment.