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: 41872 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7266025E88 for ; Wed, 3 Dec 2014 20:12:57 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf10192235eek.1 for ; Wed, 03 Dec 2014 12:12:56 -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=mebgpoiQdjspHKHnnn2VXpTvfMcYaQF+T+dookVXr61XSfQqJ7KqkEMZSfbsPFrc+j xNlKwS28C/bu8evnBvHDkTUItCtO2I8o7uyC9vfUD1JSLlOuAGjzIDeeL2l2p4FY68Wx coT5jpjbx/mbzpYJ3qypP7qa9Cg1xZC5uRpe6091pDyBDLn12g0nINom0hUCTr2lXJqT PBLhXrBGwSGSvWLVepdSg0qkc1vKtaQxosixNI0gLoHBI8YXqGqbzBeK39IamxlU+xHi 8o1IYb0TW28/H1I16ZOVZ8Z/M6TG5XgYs96znkiTI0h83xKiNsIENfq8xzU8IIBuHVG4 tCug== X-Gm-Message-State: ALoCoQk5htLopzvoGKOBGcMih5Dkm9UWs56fAWsRYlibWh1IY0HacPQdy8q8QAsvPqvJHKxkWnNE X-Received: by 10.194.173.97 with SMTP id bj1mr734020wjc.2.1417637576724; Wed, 03 Dec 2014 12:12:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.134 with SMTP id ay6ls209632lab.107.gmail; Wed, 03 Dec 2014 12:12:56 -0800 (PST) X-Received: by 10.112.145.37 with SMTP id sr5mr6191633lbb.76.1417637576566; Wed, 03 Dec 2014 12:12:56 -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 e2si6977574laa.32.2014.12.03.12.12.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 12:12:56 -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 hs14so12933140lab.22 for ; Wed, 03 Dec 2014 12:12:56 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr5812493lbc.23.1417637576236; Wed, 03 Dec 2014 12:12:56 -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.184.201 with SMTP id ew9csp731510lbc; Wed, 3 Dec 2014 12:12:55 -0800 (PST) X-Received: by 10.180.103.229 with SMTP id fz5mr30320765wib.31.1417637575535; Wed, 03 Dec 2014 12:12:55 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id du6si42638510wib.28.2014.12.03.12.12.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 12:12:55 -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]:43191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGIA-0007kP-AN for patch@linaro.org; Wed, 03 Dec 2014 15:12:54 -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-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+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 --- 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);