From patchwork Wed Jun 10 12:04:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 482619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CB77C14028F for ; Wed, 10 Jun 2015 22:07:12 +1000 (AEST) Received: from localhost ([::1]:39333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2emk-0000ph-T3 for incoming@patchwork.ozlabs.org; Wed, 10 Jun 2015 08:07:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2ekT-0005xM-4X for qemu-devel@nongnu.org; Wed, 10 Jun 2015 08:04:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2ekO-0007l0-T7 for qemu-devel@nongnu.org; Wed, 10 Jun 2015 08:04:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2ekO-0007ku-LH for qemu-devel@nongnu.org; Wed, 10 Jun 2015 08:04:44 -0400 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 577B32CD856 for ; Wed, 10 Jun 2015 12:04:44 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-61.ams2.redhat.com [10.36.116.61]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5AC4hKP019698; Wed, 10 Jun 2015 08:04:43 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id A3C8D80ED3; Wed, 10 Jun 2015 14:04:42 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 10 Jun 2015 14:04:30 +0200 Message-Id: <1433937870-27987-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1433937870-27987-1-git-send-email-kraxel@redhat.com> References: <1433937870-27987-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Dave Airlie , Paolo Bonzini , Gerd Hoffmann , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 3/3] virtio-vga: add '-vga virtio' support 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Some convinience fluff: Add support for '-vga virtio', also add virtio-vga to the list of vga cards so '-device virtio-vga' will turn off the default vga. Written by Dave Airlie and Gerd Hoffmann. Signed-off-by: Dave Airlie Signed-off-by: Gerd Hoffmann --- hw/isa/isa-bus.c | 3 +++ hw/pci/pci.c | 2 ++ include/sysemu/sysemu.h | 2 +- qemu-options.hx | 4 +++- vl.c | 13 +++++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index ec8e7de..43e0cd8 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -179,6 +179,9 @@ ISADevice *isa_vga_init(ISABus *bus) case VGA_VMWARE: fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__); return NULL; + case VGA_VIRTIO: + fprintf(stderr, "%s: virtio-vga: no PCI bus\n", __func__); + return NULL; case VGA_NONE: default: return NULL; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 750f3da..2158043 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1698,6 +1698,8 @@ PCIDevice *pci_vga_init(PCIBus *bus) return pci_create_simple(bus, -1, "VGA"); case VGA_VMWARE: return pci_create_simple(bus, -1, "vmware-svga"); + case VGA_VIRTIO: + return pci_create_simple(bus, -1, "virtio-vga"); case VGA_NONE: default: /* Other non-PCI types. Checking for unsupported types is already done in vl.c. */ diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 853d90a..7beb926 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -104,7 +104,7 @@ extern int autostart; typedef enum { VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, - VGA_TCX, VGA_CG3, VGA_DEVICE + VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO, } VGAInterfaceType; extern int vga_interface_type; diff --git a/qemu-options.hx b/qemu-options.hx index 4be98f7..ab617c3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1103,7 +1103,7 @@ Rotate graphical output some deg left (only PXA LCD). ETEXI DEF("vga", HAS_ARG, QEMU_OPTION_vga, - "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|none]\n" + "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n" " select video card type\n", QEMU_ARCH_ALL) STEXI @item -vga @var{type} @@ -1136,6 +1136,8 @@ fixed resolution of 1024x768. (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people wishing to run older Solaris versions. +@item virtio +Virtio VGA card. @item none Disable VGA card. @end table diff --git a/vl.c b/vl.c index d4b2d03..80ae8da 100644 --- a/vl.c +++ b/vl.c @@ -231,6 +231,7 @@ static struct { { .driver = "isa-cirrus-vga", .flag = &default_vga }, { .driver = "vmware-svga", .flag = &default_vga }, { .driver = "qxl-vga", .flag = &default_vga }, + { .driver = "virtio-vga", .flag = &default_vga }, }; static QemuOptsList qemu_rtc_opts = { @@ -1865,6 +1866,11 @@ static bool cg3_vga_available(void) return object_class_by_name("cgthree"); } +static bool virtio_vga_available(void) +{ + return object_class_by_name("virtio-vga"); +} + static void select_vgahw (const char *p) { const char *opts; @@ -1891,6 +1897,13 @@ static void select_vgahw (const char *p) fprintf(stderr, "Error: VMWare SVGA not available\n"); exit(0); } + } else if (strstart(p, "virtio", &opts)) { + if (virtio_vga_available()) { + vga_interface_type = VGA_VIRTIO; + } else { + fprintf(stderr, "Error: Virtio VGA not available\n"); + exit(0); + } } else if (strstart(p, "xenfb", &opts)) { vga_interface_type = VGA_XENFB; } else if (strstart(p, "qxl", &opts)) {