From patchwork Mon Feb 22 21:06:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 8383411 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EE2339F1D4 for ; Mon, 22 Feb 2016 21:07:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AB9C20483 for ; Mon, 22 Feb 2016 21:07:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CBB220461 for ; Mon, 22 Feb 2016 21:07:04 +0000 (UTC) Received: from localhost ([::1]:51973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXxh9-0006p5-Tj for patchwork-qemu-devel@patchwork.kernel.org; Mon, 22 Feb 2016 16:07:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXxgs-0006hL-SJ for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXxgr-0004SH-WB for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:06:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXxgn-0004QX-Ry; Mon, 22 Feb 2016 16:06:41 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 8DD0313A523; Mon, 22 Feb 2016 21:06:41 +0000 (UTC) Received: from apm-mustang-ev3-33.khw.lab.eng.bos.redhat.com (apm-mustang-ev3-33.khw.lab.eng.bos.redhat.com [10.16.184.127]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1ML6dUU015881; Mon, 22 Feb 2016 16:06:40 -0500 From: Wei Huang To: qemu-devel@nongnu.org Date: Mon, 22 Feb 2016 16:06:37 -0500 Message-Id: <1456175198-25210-2-git-send-email-wei@redhat.com> In-Reply-To: <1456175198-25210-1-git-send-email-wei@redhat.com> References: <1456175198-25210-1-git-send-email-wei@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 22 Feb 2016 21:06:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: wei@redhat.com, peter.maydell@linaro.org, drjones@redhat.com, qemu-arm@nongnu.org, abologna@redhat.com Subject: [Qemu-devel] [PATCH RFC 1/2] arm: virt: Add an abstract ARM virt machine type 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for future ARM virt machine types, this patch creates an abstract type for all ARM machines. The current machine type in QEMU (i.e. "virt") is renamed to "virt-2.5", which is similar to other architectures. For the purpose of backward compatibility, "virt" is converted to an alias, pointing to "virt-2.5". With this patch, "qemu -M ?" lists the following virtual machine types: virt QEMU 2.5 ARM Virtual Machine (alias of virt-2.5) virt-2.5 QEMU 2.5 ARM Virtual Machine Signed-off-by: Wei Huang --- hw/arm/virt.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 44bbbea..ee15301 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1251,6 +1251,19 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp) } } +static void virt_machine_class_init(ObjectClass *oc, void *data) +{ +} + +static const TypeInfo virt_machine_info = { + .name = TYPE_VIRT_MACHINE, + .parent = TYPE_MACHINE, + .abstract = true, + .instance_size = sizeof(VirtMachineState), + .class_size = sizeof(VirtMachineClass), + .class_init = virt_machine_class_init, +}; + static void virt_instance_init(Object *obj) { VirtMachineState *vms = VIRT_MACHINE(obj); @@ -1288,7 +1301,9 @@ static void virt_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - mc->desc = "ARM Virtual Machine", + mc->desc = "QEMU 2.5 ARM Virtual Machine"; + mc->alias = "virt"; + mc->is_default = 1; mc->init = machvirt_init; /* Start max_cpus at the maximum QEMU supports. We'll further restrict * it later in machvirt_init, where we have more information about the @@ -1302,16 +1317,15 @@ static void virt_class_init(ObjectClass *oc, void *data) } static const TypeInfo machvirt_info = { - .name = TYPE_VIRT_MACHINE, - .parent = TYPE_MACHINE, - .instance_size = sizeof(VirtMachineState), + .name = MACHINE_TYPE_NAME("virt-2.5"), + .parent = TYPE_VIRT_MACHINE, .instance_init = virt_instance_init, - .class_size = sizeof(VirtMachineClass), .class_init = virt_class_init, }; static void machvirt_machine_init(void) { + type_register_static(&virt_machine_info); type_register_static(&machvirt_info); }