target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize()
RFC PATCH 1/1 target/openrisc: Call cpu_openrisc_clock_init() in cpu_realize()
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 <[email protected]>
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- hw/openrisc/openrisc_sim.c | 2 -- hw/openrisc/virt.c | 2 -- target/openrisc/cpu.c | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-)
hw/openrisc/openrisc_sim.c +0 -2
@@ -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]); }
hw/openrisc/virt.c +0 -2
@@ -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]); }
target/openrisc/cpu.c +2 -0
@@ -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); }
Signature · 1 line
2.47.1
Quoted 6 lines · Philippe Mathieu-Daudé
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).
Quoted 7 lines
Reported-by Paolo Bonzini <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/openrisc/openrisc_sim.c | 2 -- hw/openrisc/virt.c | 2 -- target/openrisc/cpu.c | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-)
r~
Quoted 40 lines
hw/openrisc/openrisc_sim.c +0
-2@@ -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]); }hw/openrisc/virt.c +0
-2@@ -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]); }target/openrisc/cpu.c +2
-0@@ -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); }
Quoted 6 lines · Philippe Mathieu-Daudé
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).
Quoted 7 lines
Reported-by Paolo Bonzini <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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.