From patchwork Mon Dec 15 18:51:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 42286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 778C72456A for ; Mon, 15 Dec 2014 19:00:05 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf7958763eek.4 for ; Mon, 15 Dec 2014 11:00:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=G3amjp67ntas+ZeLeHNbSkbxOuCBaCzo+/zWjMA3CQo=; b=WeEFDs0qN6TTI3LLedKnWdS0E32djXMtSK93X8HKhtwzCkbmpDJmMdqdiBZk74EB+3 Z12cI54YXm+XK1tZd8NXGw1Y3Q7dUkFyc5nZ6CMkCWpRzdekrek/LolL7G50JAiQItvr Uo51eKAnsccbXFemxFHVvKqboG8+ceo0J8ih8mieSTkS8fY/tCH7B9ArqoJxqnPpFP7R kcBcvpXQGtu7m7JMIVvO2vnARgFECNeYzjoN/IyRsL3bN14tdLK2oDw3iZI35SvXoNBg OIVl2SrYPkJ+ffywM7ThM5UXf4j8UYgeMJIVBPn6gMLN3zb0nZ9tRqafFtkZ0TDyU2PY rc0Q== X-Gm-Message-State: ALoCoQl0nSFWXgumf3YtNuII7MCgxwAW+RD1cCQirH5laWBRwnqEp0rLNNdzTXL3Y/FtDmGN53TT X-Received: by 10.112.16.36 with SMTP id c4mr551769lbd.15.1418670004650; Mon, 15 Dec 2014 11:00:04 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.227 with SMTP id ap3ls775399lac.60.gmail; Mon, 15 Dec 2014 11:00:04 -0800 (PST) X-Received: by 10.153.5.1 with SMTP id ci1mr16030948lad.67.1418670004369; Mon, 15 Dec 2014 11:00:04 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id q13si11353883laa.27.2014.12.15.11.00.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 11:00:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id hs14so9796159lab.22 for ; Mon, 15 Dec 2014 11:00:04 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr31956544lal.29.1418670004247; Mon, 15 Dec 2014 11:00:04 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp810432lbb; Mon, 15 Dec 2014 11:00:03 -0800 (PST) X-Received: by 10.224.115.75 with SMTP id h11mr15041517qaq.58.1418670002554; Mon, 15 Dec 2014 11:00:02 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a8si2319387qga.3.2014.12.15.11.00.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 11:00:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:41518 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0asD-0005pm-FM for patch@linaro.org; Mon, 15 Dec 2014 14:00:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0akD-0000VG-E7 for qemu-devel@nongnu.org; Mon, 15 Dec 2014 13:51:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0ak7-0005uC-CT for qemu-devel@nongnu.org; Mon, 15 Dec 2014 13:51:45 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:41538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0ak7-0005u3-7O for qemu-devel@nongnu.org; Mon, 15 Dec 2014 13:51:39 -0500 Received: by mail-pa0-f44.google.com with SMTP id et14so12459214pad.3 for ; Mon, 15 Dec 2014 10:51:38 -0800 (PST) X-Received: by 10.70.15.195 with SMTP id z3mr53673497pdc.89.1418669498635; Mon, 15 Dec 2014 10:51:38 -0800 (PST) Received: from gbellows-linaro.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com. [67.52.129.61]) by mx.google.com with ESMTPSA id bq7sm9972513pdb.50.2014.12.15.10.51.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 10:51:38 -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: Mon, 15 Dec 2014 12:51:10 -0600 Message-Id: <1418669479-23908-7-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1418669479-23908-1-git-send-email-greg.bellows@linaro.org> References: <1418669479-23908-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.220.44 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v3 06/15] 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: greg.bellows@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Reviewed-by: Peter Maydell --- 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);