From patchwork Mon Dec 15 23:09:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 42300 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB58D26C6C for ; Mon, 15 Dec 2014 23:14:21 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf8015760lbj.11 for ; Mon, 15 Dec 2014 15:14:20 -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=TnlkQxAID0DeWgmoSWgie98emItvlEW1omRh6vEvGxmVbAWbKNox13TBejzEjmkFUe Z6CQo0e3EVQhkdeffv8WBL+GZxIwHAAvzi7C5jdJbKSmilh7CTA3TvDA4BKflbXUGkRn ziuhZczfKi6sfmuhhTIgdWBruJ9XDVnJEHJt1VKd6NXEYKR94ouUEPu814mtsQj3iuka 9M1gSNqh6EetpD8X5ebd26LyFY/xvhD+COIxUApTyUxiWnWIMVN7ybG2679Hfvm4AvTe AVDRUCdCMAkFUenuXbqC51Us4PMEa3LClRgOpMQUqkXXk6yVrGLHbzcrT43FAWG1y477 gOgQ== X-Gm-Message-State: ALoCoQm22k2risiEAozIOwzCvPZTg8S6NfEBFsMppvgH0MD3WITl2MMk4jsHn10AVmyPN8I5YZXj X-Received: by 10.112.188.199 with SMTP id gc7mr1359345lbc.6.1418685260807; Mon, 15 Dec 2014 15:14:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.5 with SMTP id m5ls636012laj.71.gmail; Mon, 15 Dec 2014 15:14:20 -0800 (PST) X-Received: by 10.152.203.137 with SMTP id kq9mr32683137lac.51.1418685260476; Mon, 15 Dec 2014 15:14:20 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ui10si11829969lbb.62.2014.12.15.15.14.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 15:14:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so9971336lbv.14 for ; Mon, 15 Dec 2014 15:14:20 -0800 (PST) X-Received: by 10.112.135.229 with SMTP id pv5mr32745324lbb.52.1418685260386; Mon, 15 Dec 2014 15:14:20 -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 ru5csp866690lbb; Mon, 15 Dec 2014 15:14:19 -0800 (PST) X-Received: by 10.140.43.52 with SMTP id d49mr58067509qga.94.1418685258681; Mon, 15 Dec 2014 15:14:18 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z5si12482314qab.9.2014.12.15.15.14.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 15:14:18 -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]:42340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0eqH-0000iD-HP for patch@linaro.org; Mon, 15 Dec 2014 18:14:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0emR-0003aS-41 for qemu-devel@nongnu.org; Mon, 15 Dec 2014 18:10:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0emL-0000fn-0x for qemu-devel@nongnu.org; Mon, 15 Dec 2014 18:10:19 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:55528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0emK-0000fj-S2 for qemu-devel@nongnu.org; Mon, 15 Dec 2014 18:10:12 -0500 Received: by mail-pa0-f45.google.com with SMTP id lf10so12158492pab.4 for ; Mon, 15 Dec 2014 15:10:12 -0800 (PST) X-Received: by 10.68.220.196 with SMTP id py4mr33739196pbc.33.1418685012457; Mon, 15 Dec 2014 15:10:12 -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 uq15sm10402467pab.8.2014.12.15.15.10.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 15:10:11 -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 17:09:43 -0600 Message-Id: <1418684992-8996-7-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1418684992-8996-1-git-send-email-greg.bellows@linaro.org> References: <1418684992-8996-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.45 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v4 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.217.169 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);