* [RFC PATCH] target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize()
@ 2025-01-14 23:13 Philippe Mathieu-Daudé
2025-01-15 18:38 ` Richard Henderson
2025-03-06 14:05 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-14 23:13 UTC (permalink / raw)
To: qemu-devel
Cc: Stafford Horne, Jia Liu, Philippe Mathieu-Daudé,
Paolo Bonzini
OpenRISC timer is architecturally tied to the CPU.
It doesn't belong to the machine init() code to
instanciate it: move its creation when a vCPU is
realized (after being created).
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/openrisc/openrisc_sim.c | 2 --
hw/openrisc/virt.c | 2 --
target/openrisc/cpu.c | 2 ++
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index e0da4067ba3..d7f97d19913 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -306,8 +306,6 @@ static void openrisc_sim_init(MachineState *machine)
exit(1);
}
- cpu_openrisc_clock_init(cpus[n]);
-
qemu_register_reset(main_cpu_reset, cpus[n]);
}
diff --git a/hw/openrisc/virt.c b/hw/openrisc/virt.c
index 7b60bf85094..676cf8d692d 100644
--- a/hw/openrisc/virt.c
+++ b/hw/openrisc/virt.c
@@ -487,8 +487,6 @@ static void openrisc_virt_init(MachineState *machine)
exit(1);
}
- cpu_openrisc_clock_init(cpus[n]);
-
qemu_register_reset(main_cpu_reset, cpus[n]);
}
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
index b7bab0d7abf..291fec04fda 100644
--- a/target/openrisc/cpu.c
+++ b/target/openrisc/cpu.c
@@ -165,6 +165,8 @@ static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp)
qemu_init_vcpu(cs);
cpu_reset(cs);
+ cpu_openrisc_clock_init(OPENRISC_CPU(dev));
+
occ->parent_realize(dev, errp);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize()
2025-01-14 23:13 [RFC PATCH] target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize() Philippe Mathieu-Daudé
@ 2025-01-15 18:38 ` Richard Henderson
2025-03-06 14:05 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2025-01-15 18:38 UTC (permalink / raw)
To: qemu-devel
On 1/14/25 15:13, Philippe Mathieu-Daudé wrote:
> OpenRISC timer is architecturally tied to the CPU.
>
> It doesn't belong to the machine init() code to
> instanciate it: move its creation when a vCPU is
> realized (after being created).
>
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/openrisc/openrisc_sim.c | 2 --
> hw/openrisc/virt.c | 2 --
> target/openrisc/cpu.c | 2 ++
> 3 files changed, 2 insertions(+), 4 deletions(-)
Acked-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index e0da4067ba3..d7f97d19913 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -306,8 +306,6 @@ static void openrisc_sim_init(MachineState *machine)
> exit(1);
> }
>
> - cpu_openrisc_clock_init(cpus[n]);
> -
> qemu_register_reset(main_cpu_reset, cpus[n]);
> }
>
> diff --git a/hw/openrisc/virt.c b/hw/openrisc/virt.c
> index 7b60bf85094..676cf8d692d 100644
> --- a/hw/openrisc/virt.c
> +++ b/hw/openrisc/virt.c
> @@ -487,8 +487,6 @@ static void openrisc_virt_init(MachineState *machine)
> exit(1);
> }
>
> - cpu_openrisc_clock_init(cpus[n]);
> -
> qemu_register_reset(main_cpu_reset, cpus[n]);
> }
>
> diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
> index b7bab0d7abf..291fec04fda 100644
> --- a/target/openrisc/cpu.c
> +++ b/target/openrisc/cpu.c
> @@ -165,6 +165,8 @@ static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp)
> qemu_init_vcpu(cs);
> cpu_reset(cs);
>
> + cpu_openrisc_clock_init(OPENRISC_CPU(dev));
> +
> occ->parent_realize(dev, errp);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize()
2025-01-14 23:13 [RFC PATCH] target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize() Philippe Mathieu-Daudé
2025-01-15 18:38 ` Richard Henderson
@ 2025-03-06 14:05 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-06 14:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Stafford Horne, Jia Liu, Paolo Bonzini
On 15/1/25 00:13, Philippe Mathieu-Daudé wrote:
> OpenRISC timer is architecturally tied to the CPU.
>
> It doesn't belong to the machine init() code to
> instanciate it: move its creation when a vCPU is
> realized (after being created).
>
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/openrisc/openrisc_sim.c | 2 --
> hw/openrisc/virt.c | 2 --
> target/openrisc/cpu.c | 2 ++
> 3 files changed, 2 insertions(+), 4 deletions(-)
Patch queued, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-06 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 23:13 [RFC PATCH] target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize() Philippe Mathieu-Daudé
2025-01-15 18:38 ` Richard Henderson
2025-03-06 14:05 ` Philippe Mathieu-Daudé
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).