From patchwork Sat Feb 16 15:45:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 220986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CCFEB2C0080 for ; Sun, 17 Feb 2013 04:10:38 +1100 (EST) Received: from localhost ([::1]:51879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6k2K-0005pl-ER for incoming@patchwork.ozlabs.org; Sat, 16 Feb 2013 10:50:48 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6k0q-0004aO-9D for qemu-devel@nongnu.org; Sat, 16 Feb 2013 10:49:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6k0o-0002MG-CD for qemu-devel@nongnu.org; Sat, 16 Feb 2013 10:49:16 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40373 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6k0o-0002M4-32 for qemu-devel@nongnu.org; Sat, 16 Feb 2013 10:49:14 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8BE08A4E0C; Sat, 16 Feb 2013 16:49:13 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sat, 16 Feb 2013 16:45:11 +0100 Message-Id: <1361029542-8412-17-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361029542-8412-1-git-send-email-afaerber@suse.de> References: <1361029542-8412-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Max Filippov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 16/47] target-xtensa: Introduce QOM realizefn for XtensaCPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Introduce realizefn and set realized = true in cpu_xtensa_init(). Signed-off-by: Andreas Färber --- target-xtensa/cpu-qom.h | 2 ++ target-xtensa/cpu.c | 13 +++++++++++++ target-xtensa/helper.c | 4 +++- 3 Dateien geändert, 18 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h index e344a9a..270de16 100644 --- a/target-xtensa/cpu-qom.h +++ b/target-xtensa/cpu-qom.h @@ -43,6 +43,7 @@ /** * XtensaCPUClass: + * @parent_realize: The parent class' realize handler. * @parent_reset: The parent class' reset handler. * * An Xtensa CPU model. @@ -52,6 +53,7 @@ typedef struct XtensaCPUClass { CPUClass parent_class; /*< public >*/ + DeviceRealize parent_realize; void (*parent_reset)(CPUState *cpu); } XtensaCPUClass; diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c index ebc7e99..d3706a3 100644 --- a/target-xtensa/cpu.c +++ b/target-xtensa/cpu.c @@ -57,6 +57,16 @@ static void xtensa_cpu_reset(CPUState *s) reset_mmu(env); } +static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp) +{ + XtensaCPU *cpu = XTENSA_CPU(dev); + XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev); + + qemu_init_vcpu(&cpu->env); + + xcc->parent_realize(dev, errp); +} + static void xtensa_cpu_initfn(Object *obj) { XtensaCPU *cpu = XTENSA_CPU(obj); @@ -76,6 +86,9 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) CPUClass *cc = CPU_CLASS(oc); XtensaCPUClass *xcc = XTENSA_CPU_CLASS(cc); + xcc->parent_realize = dc->realize; + dc->realize = xtensa_cpu_realizefn; + xcc->parent_reset = cc->reset; cc->reset = xtensa_cpu_reset; diff --git a/target-xtensa/helper.c b/target-xtensa/helper.c index 94c03a1..14bcc7e 100644 --- a/target-xtensa/helper.c +++ b/target-xtensa/helper.c @@ -104,7 +104,9 @@ XtensaCPU *cpu_xtensa_init(const char *cpu_model) } xtensa_irq_init(env); - qemu_init_vcpu(env); + + object_property_set_bool(OBJECT(cpu), true, "realized", NULL); + return cpu; }