[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v1 2/7] qom/cpu.c: Encapsulate cpu halting
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [RFC PATCH v1 2/7] qom/cpu.c: Encapsulate cpu halting |
Date: |
Mon, 4 Mar 2013 19:01:34 +1000 |
Set up the Device level halting API to halt cpus. This allows holders of a
pointer to the CPU to halt it from the TYPE_DEVICE abstraction. (i.e. they
can halt it even if they dont know its a CPU).
Signed-off-by: Peter Crosthwaite <address@hidden>
---
qom/cpu.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/qom/cpu.c b/qom/cpu.c
index e242dcb..00a07d9 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -43,6 +43,20 @@ static void cpu_common_reset(CPUState *cpu)
cpu->halted = 0;
}
+static void cpu_common_halt(DeviceState *dev)
+{
+ CPUState *s = CPU(dev);
+
+ s->halted = 1;
+}
+
+static void cpu_common_unhalt(DeviceState *dev)
+{
+ CPUState *s = CPU(dev);
+
+ s->halted = 0;
+}
+
ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
{
CPUClass *cc = CPU_CLASS(object_class_by_name(typename));
@@ -66,6 +80,8 @@ static void cpu_class_init(ObjectClass *klass, void *data)
k->class_by_name = cpu_common_class_by_name;
k->reset = cpu_common_reset;
+ dc->halt = cpu_common_halt;
+ dc->unhalt = cpu_common_unhalt;
dc->realize = cpu_common_realizefn;
dc->no_user = 1;
}
--
1.7.0.4
- [Qemu-devel] [RFC PATCH v1 0/7] Reset and Halting modifications + Zynq SMP, Peter Crosthwaite, 2013/03/04
- [Qemu-devel] [RFC PATCH v1 1/7] qdev: Define halting API, Peter Crosthwaite, 2013/03/04
- [Qemu-devel] [RFC PATCH v1 2/7] qom/cpu.c: Encapsulate cpu halting,
Peter Crosthwaite <=
- [Qemu-devel] [RFC PATCH v1 3/7] qom/cpu.c: Hook CPU reset up to device reset, Peter Crosthwaite, 2013/03/04
- [Qemu-devel] [RFC PATCH v1 4/7] sun4m: Use halting API to halt/unhalt CPUs, Peter Crosthwaite, 2013/03/04
- [Qemu-devel] [RFC PATCH v1 5/7] xilinx_zynq: added smp support, Peter Crosthwaite, 2013/03/04
- [Qemu-devel] [RFC PATCH v1 6/7] zynq_slcr: Add links to the CPUs, Peter Crosthwaite, 2013/03/04
- [Qemu-devel] [RFC PATCH v1 7/7] zynq_slcr: Implement CPU reset and halting, Peter Crosthwaite, 2013/03/04
- Re: [Qemu-devel] [RFC PATCH v1 0/7] Reset and Halting modifications + Zynq SMP, Andreas Färber, 2013/03/04
- Re: [Qemu-devel] [RFC PATCH v1 0/7] Reset and Halting modifications + Zynq SMP, Edgar E. Iglesias, 2013/03/30