[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its ch
From: |
Liu Ping Fan |
Subject: |
[Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child |
Date: |
Tue, 10 Jul 2012 14:16:06 +0800 |
This will give the embeded logic module, such as apic has the
opportunity to reset.
Signed-off-by: Liu Ping Fan <address@hidden>
---
qom/cpu.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/qom/cpu.c b/qom/cpu.c
index 5b36046..6aea8e6 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -20,10 +20,26 @@
#include "qemu/cpu.h"
#include "qemu-common.h"
+#include "hw/qdev.h"
+
+static int cpu_reset_kid(Object *child, void *opaque)
+{
+ if (object_is_type_str(child, TYPE_DEVICE)) {
+ device_reset(DEVICE(child));
+ } else if (object_is_type_str(child, TYPE_BUS)) {
+ bus_reset(BUS(child));
+ } else {
+ printf("cpu's child must be DEVICE or BUS");
+ abort();
+ }
+ return 0;
+}
void cpu_reset(CPUState *cpu)
{
CPUClass *klass = CPU_GET_CLASS(cpu);
+ Object *obj = OBJECT(cpu);
+ object_child_foreach(obj, cpu_reset_kid, NULL);
if (klass->reset != NULL) {
(*klass->reset)(cpu);
--
1.7.4.4
- [Qemu-devel] [PATCH 1/5] qdev: introduce qdev_create_kid(Object *parent, const char *type), (continued)
- [Qemu-devel] [PATCH 2/5] qom: introduce object_is_type_str(), so we can judge its type., Liu Ping Fan, 2012/07/10
- [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface, Liu Ping Fan, 2012/07/10
- [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child,
Liu Ping Fan <=
- Re: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child, liu ping fan, 2012/07/10
- Re: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child, Paolo Bonzini, 2012/07/11
[Qemu-devel] [PATCH 5/5] apic: create apic as a child of cpu, not system_bus any longer, Liu Ping Fan, 2012/07/10