From patchwork Wed Mar 16 17:18:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 8603031 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7EAACC0553 for ; Wed, 16 Mar 2016 17:26:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1585202A1 for ; Wed, 16 Mar 2016 17:26:16 +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 1890920166 for ; Wed, 16 Mar 2016 17:26:16 +0000 (UTC) Received: from localhost ([::1]:57718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agFD5-0002gJ-DX for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 13:26:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agF5t-0002F5-Bu for qemu-devel@nongnu.org; Wed, 16 Mar 2016 13:18:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agF5r-0001J6-Oo for qemu-devel@nongnu.org; Wed, 16 Mar 2016 13:18:49 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:56205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agF5r-0001Hs-3N for qemu-devel@nongnu.org; Wed, 16 Mar 2016 13:18:47 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1agF5i-0000ut-SA for qemu-devel@nongnu.org; Wed, 16 Mar 2016 17:18:38 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 17:18:18 +0000 Message-Id: <1458148715-16864-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458148715-16864-1-git-send-email-peter.maydell@linaro.org> References: <1458148715-16864-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 04/21] 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 From: Wei Huang 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.6", whose naming scheme is similar to other architectures. For the purpose of backward compatibility, "virt" is converted to an alias, pointing to "virt-2.6". With this patch, "qemu -M ?" lists the following virtual machine types along with others: virt QEMU 2.6 ARM Virtual Machine (alias of virt-2.6) virt-2.6 QEMU 2.6 ARM Virtual Machine Signed-off-by: Wei Huang Message-id: 1457717778-17727-2-git-send-email-wei@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/virt.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8c6c996..be9bbfb 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1345,6 +1345,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); @@ -1382,7 +1395,8 @@ static void virt_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - mc->desc = "ARM Virtual Machine", + mc->desc = "QEMU 2.6 ARM Virtual Machine"; + mc->alias = "virt"; 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 @@ -1396,16 +1410,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.6"), + .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); }