From patchwork Thu Dec 11 23:29:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 42162 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4095126666 for ; Thu, 11 Dec 2014 23:33:04 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id x12sf4157523wgg.8 for ; Thu, 11 Dec 2014 15:33:03 -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=iFdtXnsjlMmMnYyO9mYPy2wKo9SY+xymlHa86gNIQuo=; b=LAf4wsXwPa2me7z70u1OJ7vUaWuy3DqUSVQpZXbwO8Eamxe7Ie18PwKPZDJwFxZBko 0z88QoB8eKGtzG6CQiCyuoDHbVoWg+FSO3OEbvyIsLrh3JK3WT1F3LnkrzBYyl2uYb1S 9BXXNNNMMXG0/5yy6kLYk2eW8h26M670+fSTdEVE9ZfV07OYERfRsLHPuCPI1HNUgSrY xuopb7eMZQuMLoE7me7ODUvi/l2O30lV4uRva6Lx37mwPiHryDzYhGzFvvKDWbjRx3Ll xDpwdrDeAKIl3OgdCaOPtQqCRxa4+ehApifFhLGGpZNjm4TJV+aXuiybdt/oVW/qF5k6 lAaw== X-Gm-Message-State: ALoCoQmHBozPx5mUc7XC7tCB+6STM/fzekiCxYUJBq3rv27v8QYGJuoTxV1Ci9xUReCl5otIGM9H X-Received: by 10.112.14.2 with SMTP id l2mr2066342lbc.5.1418340783473; Thu, 11 Dec 2014 15:33:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.14 with SMTP id js14ls376938lab.69.gmail; Thu, 11 Dec 2014 15:33:03 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr1444183lav.34.1418340783335; Thu, 11 Dec 2014 15:33:03 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id p9si2752400lap.51.2014.12.11.15.33.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Dec 2014 15:33:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id 10so5101989lbg.1 for ; Thu, 11 Dec 2014 15:33:03 -0800 (PST) X-Received: by 10.112.162.106 with SMTP id xz10mr12497305lbb.91.1418340783214; Thu, 11 Dec 2014 15:33:03 -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 ru5csp686417lbb; Thu, 11 Dec 2014 15:33:02 -0800 (PST) X-Received: by 10.140.92.202 with SMTP id b68mr13667673qge.10.1418340781670; Thu, 11 Dec 2014 15:33:01 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t9si641082qcn.5.2014.12.11.15.33.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Dec 2014 15:33:01 -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]:54657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzDEC-00004w-Mu for patch@linaro.org; Thu, 11 Dec 2014 18:33:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzDBF-0003ti-8F for qemu-devel@nongnu.org; Thu, 11 Dec 2014 18:30:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzDB9-0000jt-AN for qemu-devel@nongnu.org; Thu, 11 Dec 2014 18:29:57 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:35597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzDB9-0000jk-4b for qemu-devel@nongnu.org; Thu, 11 Dec 2014 18:29:51 -0500 Received: by mail-pd0-f171.google.com with SMTP id y13so5965047pdi.2 for ; Thu, 11 Dec 2014 15:29:50 -0800 (PST) X-Received: by 10.68.107.162 with SMTP id hd2mr21267988pbb.145.1418340590681; Thu, 11 Dec 2014 15:29:50 -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 ip1sm2362908pbc.0.2014.12.11.15.29.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Dec 2014 15:29:49 -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: Thu, 11 Dec 2014 17:29:20 -0600 Message-Id: <1418340569-30519-7-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1418340569-30519-1-git-send-email-greg.bellows@linaro.org> References: <1418340569-30519-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.192.171 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v2 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.170 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);