From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoTkm-00080y-7w for qemu-devel@nongnu.org; Tue, 10 Jul 2012 02:16:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoTkk-0001O0-CG for qemu-devel@nongnu.org; Tue, 10 Jul 2012 02:16:55 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:52368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoTkk-0001Lt-5o for qemu-devel@nongnu.org; Tue, 10 Jul 2012 02:16:54 -0400 Received: by mail-gh0-f173.google.com with SMTP id r14so11759246ghr.4 for ; Mon, 09 Jul 2012 23:16:53 -0700 (PDT) From: Liu Ping Fan Date: Tue, 10 Jul 2012 14:16:06 +0800 Message-Id: <1341900967-4344-5-git-send-email-qemulist@gmail.com> In-Reply-To: <1341900967-4344-1-git-send-email-qemulist@gmail.com> References: <1341900967-4344-1-git-send-email-qemulist@gmail.com> Subject: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori This will give the embeded logic module, such as apic has the opportunity to reset. Signed-off-by: Liu Ping Fan --- 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