From patchwork Wed Dec 3 20:06:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 417536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C468E1400D5 for ; Thu, 4 Dec 2014 07:12:39 +1100 (AEDT) Received: from localhost ([::1]:43191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGHt-0007kP-Fy for incoming@patchwork.ozlabs.org; Wed, 03 Dec 2014 15:12:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGBy-0006mf-Tu for qemu-devel@nongnu.org; Wed, 03 Dec 2014 15:06:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwGBr-0003WU-Le for qemu-devel@nongnu.org; Wed, 03 Dec 2014 15:06:30 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:48369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGBr-0003WM-Gk for qemu-devel@nongnu.org; Wed, 03 Dec 2014 15:06:23 -0500 Received: by mail-oi0-f43.google.com with SMTP id a3so11337688oib.2 for ; Wed, 03 Dec 2014 12:06:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iFdtXnsjlMmMnYyO9mYPy2wKo9SY+xymlHa86gNIQuo=; b=PSq2VzVQINNehGyTzaWsommSogzwEfpaxsSUviIYOKnIxqVihW8wHczl+zdH/SDoa8 wFTtoYj+Q3I7ptBw8VJ2OwLsvKd20Vz0T+ZlVKCjZTokzIfO1tq0ro7P+Dk0tNHgBlA1 pSW5qTigudTr6Yh8zDLkGsODWpTGeK8pTZSGmJ7XfmeomaFK7jiWeuifQKas9XLSXIOm moQUrcBqMrRpVpMvm8SUR0UbPqOgMk7/8zPOL57GG/mtgIgTZ5gyJPBWGg47GTEXZPzd XVNOnCCVmfOBw36n+dBKaBaU6WpDsFtTV80NQDO7k4GnQWWb+y0Feiz6BPjTD36kPhUd NAeA== X-Gm-Message-State: ALoCoQmllALErpRc7x2x7Fj9GQU+HDRjobyh7M12OdKqk2bKB9mXhTgd1L2leYeFKm2rWfB7NXYh X-Received: by 10.182.20.110 with SMTP id m14mr4282200obe.25.1417637183180; Wed, 03 Dec 2014 12:06:23 -0800 (PST) Received: from gbellows-linaro.bellowshome.net (99-179-1-128.lightspeed.austtx.sbcglobal.net. [99.179.1.128]) by mx.google.com with ESMTPSA id mq4sm11787321obb.22.2014.12.03.12.06.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 12:06:22 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch, peter.maydell@linaro.org Date: Wed, 3 Dec 2014 14:06:01 -0600 Message-Id: <1417637167-20640-8-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1417637167-20640-1-git-send-email-greg.bellows@linaro.org> References: <1417637167-20640-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.218.43 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH 07/13] target-arm: Add virt class and machine types 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 Switch virt qemu machine support to use the newer object type, class, and instance model. Added virt TypeInfo with static registration along with virt specific class and machine structs. Also added virt class initialization method. Signed-off-by: Greg Bellows --- hw/arm/virt.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 314e55b..b6bb914 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -86,6 +86,23 @@ typedef struct VirtBoardInfo { uint32_t clock_phandle; } VirtBoardInfo; +typedef struct { + MachineClass parent; + VirtBoardInfo *daughterboard; +} VirtMachineClass; + +typedef struct { + MachineState parent; +} VirtMachineState; + +#define TYPE_VIRT_MACHINE "virt" +#define VIRT_MACHINE(obj) \ + OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE) +#define VIRT_MACHINE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE) +#define VIRT_MACHINE_CLASS(klass) \ + OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) + /* Addresses and sizes of our components. * 0..128MB is space for a flash device so we can run bootrom code such as UEFI. * 128MB..256MB is used for miscellaneous device I/O. @@ -615,16 +632,27 @@ static void machvirt_init(MachineState *machine) arm_load_kernel(ARM_CPU(first_cpu), &vbi->bootinfo); } -static QEMUMachine machvirt_a15_machine = { - .name = "virt", - .desc = "ARM Virtual Machine", - .init = machvirt_init, - .max_cpus = 8, +static void virt_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->name = TYPE_VIRT_MACHINE; + mc->desc = "ARM Virtual Machine", + mc->init = machvirt_init; + mc->max_cpus = 8; +} + +static const TypeInfo machvirt_info = { + .name = TYPE_VIRT_MACHINE, + .parent = TYPE_MACHINE, + .instance_size = sizeof(VirtMachineState), + .class_size = sizeof(VirtMachineClass), + .class_init = virt_class_init, }; static void machvirt_machine_init(void) { - qemu_register_machine(&machvirt_a15_machine); + type_register_static(&machvirt_info); } machine_init(machvirt_machine_init);