From patchwork Wed Jan 16 05:32:59 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: 212408 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 481312C007B for ; Wed, 16 Jan 2013 17:34:28 +1100 (EST) Received: from localhost ([::1]:36791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvLdu-000565-Nf for incoming@patchwork.ozlabs.org; Wed, 16 Jan 2013 00:34:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvLcx-0003iU-Hx for qemu-devel@nongnu.org; Wed, 16 Jan 2013 00:33:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvLcv-000843-Ue for qemu-devel@nongnu.org; Wed, 16 Jan 2013 00:33:31 -0500 Received: from cantor2.suse.de ([195.135.220.15]:59605 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvLcv-00083m-JP for qemu-devel@nongnu.org; Wed, 16 Jan 2013 00:33:29 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E46E2A5203; Wed, 16 Jan 2013 06:33:28 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 16 Jan 2013 06:32:59 +0100 Message-Id: <1358314380-9400-15-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358314380-9400-1-git-send-email-afaerber@suse.de> References: <1358314380-9400-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: Guan Xuetao , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [RFC qom-cpu 14/15] target-unicore32: Introduce QOM realizefn for UniCore32CPU 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 a realizefn and set realized = true in uc32_cpu_init(). Signed-off-by: Andreas Färber Acked-by: Guan Xuetao --- target-unicore32/cpu.c | 15 +++++++++++++++ target-unicore32/helper.c | 2 +- 2 Dateien geändert, 16 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c index 884c101..22330ad 100644 --- a/target-unicore32/cpu.c +++ b/target-unicore32/cpu.c @@ -61,6 +61,13 @@ static const UniCore32CPUInfo uc32_cpus[] = { { .name = "any", .instance_init = uc32_any_cpu_initfn }, }; +static void uc32_cpu_realizefn(DeviceState *dev, Error **errp) +{ + UniCore32CPU *cpu = UNICORE32_CPU(dev); + + qemu_init_vcpu(&cpu->env); +} + static void uc32_cpu_initfn(Object *obj) { UniCore32CPU *cpu = UNICORE32_CPU(obj); @@ -80,6 +87,13 @@ static void uc32_cpu_initfn(Object *obj) tlb_flush(env, 1); } +static void uc32_cpu_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + + dc->realize = uc32_cpu_realizefn; +} + static void uc32_register_cpu_type(const UniCore32CPUInfo *info) { TypeInfo type_info = { @@ -98,6 +112,7 @@ static const TypeInfo uc32_cpu_type_info = { .instance_init = uc32_cpu_initfn, .abstract = true, .class_size = sizeof(UniCore32CPUClass), + .class_init = uc32_cpu_class_init, }; static void uc32_cpu_register_types(void) diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index 5359538..347d842 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -42,7 +42,7 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model) uc32_translate_init(); } - qemu_init_vcpu(env); + object_property_set_bool(OBJECT(cpu), true, "realized", NULL); return env; }