diff mbox series

cpus: Restrict 'start-powered-off' property to system emulation

Message ID 20240111161817.43150-1-philmd@linaro.org
State Superseded
Headers show
Series cpus: Restrict 'start-powered-off' property to system emulation | expand

Commit Message

Philippe Mathieu-Daudé Jan. 11, 2024, 4:18 p.m. UTC
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>
---
 cpu-target.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Richard Henderson Jan. 11, 2024, 9:48 p.m. UTC | #1
On 1/12/24 03:18, Philippe Mathieu-Daudé wrote:
> 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>
> ---
>   cpu-target.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Philippe Mathieu-Daudé Jan. 17, 2024, 8:20 a.m. UTC | #2
On 11/1/24 22:48, Richard Henderson wrote:
> On 1/12/24 03:18, Philippe Mathieu-Daudé wrote:
>> 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>
>> ---
>>   cpu-target.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Thanks, patch queued.
diff mbox series

Patch

diff --git a/cpu-target.c b/cpu-target.c
index c4ea795bdd..7e4241c33d 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -206,6 +206,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);
@@ -217,12 +218,13 @@  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.
@@ -230,6 +232,9 @@  void cpu_class_init_props(DeviceClass *dc)
     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)