diff mbox

[RFC,v1,3/7] qom/cpu.c: Hook CPU reset up to device reset

Message ID cc60563d3f0c4324388c1af6bea6ac13b192b5a6.1362387545.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite March 4, 2013, 9:01 a.m. UTC
Hookup the CPU::reset function up as the Device::reset function. This allows
devices that abstract away the fact that the device is a CPU to reset it.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 qom/cpu.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/qom/cpu.c b/qom/cpu.c
index 00a07d9..7084a67 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -43,6 +43,11 @@  static void cpu_common_reset(CPUState *cpu)
     cpu->halted = 0;
 }
 
+static void cpu_device_reset(DeviceState *dev)
+{
+    cpu_reset(CPU(dev));
+}
+
 static void cpu_common_halt(DeviceState *dev)
 {
     CPUState *s = CPU(dev);
@@ -80,6 +85,7 @@  static void cpu_class_init(ObjectClass *klass, void *data)
 
     k->class_by_name = cpu_common_class_by_name;
     k->reset = cpu_common_reset;
+    dc->reset = cpu_device_reset;
     dc->halt = cpu_common_halt;
     dc->unhalt = cpu_common_unhalt;
     dc->realize = cpu_common_realizefn;