Skip to contentSkip to conversation

Rework PCI video card initialization

PATCH Superseded Aurelien Jarno 6 participants 25 messages Sep 8, 2012 – Sep 10, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#4 lore raw

PATCH 2/12 vl.c: check for qxl availability

In reply to Aurelien Jarno

Check for qxl availability in vl.c. This will allow to remove #ifdef CONFIG_SPICE .. #endif later in this series

Cc Anthony Liguori <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
 vl.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
vl.c +11 -1
index 7c577fa..6363915 100644
@@ -1703,6 +1703,11 @@ static bool vmware_vga_available(void)
     return qdev_exists("vmware-svga");
 }
 
+static bool qxl_vga_available(void)
+{
+    return qdev_exists("qxl-vga");
+}
+
 static void select_vgahw (const char *p)
 {
     const char *opts;
@@ -1732,7 +1737,12 @@ static void select_vgahw (const char *p)
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
     } else if (strstart(p, "qxl", &opts)) {
-        vga_interface_type = VGA_QXL;
+        if (qxl_vga_available()) {
+            vga_interface_type = VGA_QXL;
+        } else {
+            fprintf(stderr, "Error: QXL VGA not available\n");
+            exit(0);
+        }
     } else if (!strstart(p, "none", &opts)) {
     invalid_vga:
         fprintf(stderr, "Unknown vga type: %s\n", p);
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 3/12 pci: add a pci_vga_init() function

In reply to Aurelien Jarno

This function create a PCI VGA device according to the value of vga_interface_type. It returns a PCIDevice (and not a DeviceState).

---
 hw/pci.c |   18 ++++++++++++++++++
 hw/pci.h |    3 +++
 2 files changed, 21 insertions(+)
hw/pci.c +18 -0
index 4d95984..1b775b6 100644
@@ -1474,6 +1474,24 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
     return res;
 }
 
+PCIDevice *pci_vga_init(PCIBus *bus)
+{
+    switch (vga_interface_type) {
+    case VGA_CIRRUS:
+        return pci_create_simple(bus, -1, "cirrus-vga");
+    case VGA_QXL:
+        return pci_create_simple(bus, -1, "qxl-vga");
+    case VGA_STD:
+        return pci_create_simple(bus, -1, "VGA");
+    case VGA_VMWARE:
+        return pci_create_simple(bus, -1, "vmware-svga");
+    case VGA_NONE:
+    default: /* Other non-PCI types. Checking for unsupported types is already
+                done in vl.c. */
+        return NULL;
+    }
+}
+
 /* Whether a given bus number is in range of the secondary
  * bus of the given bridge device. */
 static bool pci_secondary_bus_in_range(PCIDevice *dev, int bus_num)
hw/pci.h +3 -0
index 4b6ab3d..84b43b2 100644
@@ -334,6 +334,9 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
                         const char *default_devaddr);
 PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
                                const char *default_devaddr);
+
+PCIDevice *pci_vga_init(PCIBus *bus);
+
 int pci_bus_num(PCIBus *s);
 void pci_for_each_device(PCIBus *bus, int bus_num,
                          void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque),
Signature · 1 line
1.7.10.4
#16 lore raw

PATCH 8/12 ppc/prep: use the new pci_vga_init() function

In reply to Aurelien Jarno

As a bonus it allows new vga card types (including none).

---
 hw/ppc_prep.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ppc_prep.c +1 -2
index 1fa7609..1544430 100644
@@ -39,7 +39,6 @@
 #include "blockdev.h"
 #include "arch_init.h"
 #include "exec-memory.h"
-#include "vga-pci.h"
 
 //#define HARD_DEBUG_PPC_IO
 //#define DEBUG_PPC_IO
@@ -611,7 +610,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
     memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory);
 
     /* init basic PC hardware */
-    pci_std_vga_init(pci_bus);
+    pci_vga_init(pci_bus);
 
     if (serial_hds[0])
         serial_isa_init(isa_bus, 0, serial_hds[0]);
Signature · 1 line
1.7.10.4
#18 lore raw

PATCH 9/12 ppc/pSeries: use the new pci_vga_init() function

In reply to Aurelien Jarno

Keep the case to prevent some vga card to be selected.

Cc Alexander Graf <[email protected]>
Cc David Gibson <[email protected]>
---
 hw/spapr.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/spapr.c +2 -5
index 80735d6..8b0c390 100644
@@ -46,7 +46,6 @@
 #include "kvm.h"
 #include "kvm_ppc.h"
 #include "pci.h"
-#include "vga-pci.h"
 
 #include "exec-memory.h"
 #include "hw/usb.h"
@@ -589,11 +588,9 @@ static void spapr_cpu_reset(void *opaque)
 static int spapr_vga_init(PCIBus *pci_bus)
 {
     switch (vga_interface_type) {
-    case VGA_STD:
-        pci_std_vga_init(pci_bus);
-        return 1;
     case VGA_NONE:
-        return 0;
+    case VGA_STD:
+        return pci_vga_init(pci_bus) != NULL;
     default:
         fprintf(stderr, "This vga model is not supported,"
                 "currently it only supports -vga std\n");
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/12 vga: rename pci_vga_init() into pci_std_vga_init()

In reply to Aurelien Jarno

This better explains what is this function about. Adjust all callers.

Cc Richard Henderson <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Andreas Färber <[email protected]>
Cc David Gibson <[email protected]>
Cc Blue Swirl <[email protected]>
Cc Anthony Liguori <[email protected]>
---
 hw/alpha_pci.c    |    2 +-
 hw/mips_malta.c   |    2 +-
 hw/pc.c           |    2 +-
 hw/ppc_newworld.c |    2 +-
 hw/ppc_oldworld.c |    2 +-
 hw/ppc_prep.c     |    2 +-
 hw/spapr.c        |    2 +-
 hw/sun4u.c        |    2 +-
 hw/vga-pci.c      |    6 +++---
 hw/vga-pci.h      |    2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)
hw/alpha_pci.c +1 -1
index ea546f8..0352e72 100644
@@ -128,6 +128,6 @@ void alpha_pci_vga_setup(PCIBus *pci_bus)
     /* If VGA is enabled at all, and one of the above didn't work, then
        fallback to Standard VGA.  */
     if (vga_interface_type != VGA_NONE) {
-        pci_vga_init(pci_bus);
+        pci_std_vga_init(pci_bus);
     }
 }
hw/mips_malta.c +1 -1
index ad23f26..c39dee5 100644
@@ -992,7 +992,7 @@ void mips_malta_init (ram_addr_t ram_size,
     } else if (vmsvga_enabled) {
         pci_vmsvga_init(pci_bus);
     } else if (std_vga_enabled) {
-        pci_vga_init(pci_bus);
+        pci_std_vga_init(pci_bus);
     }
 }
 
hw/pc.c +1 -1
index 112739a..8736a30 100644
@@ -1041,7 +1041,7 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
 #endif
     } else if (std_vga_enabled) {
         if (pci_bus) {
-            dev = pci_vga_init(pci_bus);
+            dev = pci_std_vga_init(pci_bus);
         } else {
             dev = isa_vga_init(isa_bus);
         }
hw/ppc_newworld.c +1 -1
index e95cfe8..84af948 100644
@@ -330,7 +330,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
         machine_arch = ARCH_MAC99;
     }
     /* init basic PC hardware */
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     escc_mem = escc_init(0, pic[0x25], pic[0x24],
                          serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
hw/ppc_oldworld.c +1 -1
index 1dcd8a6..8267eb4 100644
@@ -250,7 +250,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
     pci_bus = pci_grackle_init(0xfec00000, pic,
                                get_system_memory(),
                                get_system_io());
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
                                serial_hds[1], ESCC_CLOCK, 4);
hw/ppc_prep.c +1 -1
index 592b7b2..1fa7609 100644
@@ -611,7 +611,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
     memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory);
 
     /* init basic PC hardware */
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     if (serial_hds[0])
         serial_isa_init(isa_bus, 0, serial_hds[0]);
hw/spapr.c +1 -1
index c34b767..80735d6 100644
@@ -590,7 +590,7 @@ static int spapr_vga_init(PCIBus *pci_bus)
 {
     switch (vga_interface_type) {
     case VGA_STD:
-        pci_vga_init(pci_bus);
+        pci_std_vga_init(pci_bus);
         return 1;
     case VGA_NONE:
         return 0;
hw/sun4u.c +1 -1
index 07cd042..cca090f 100644
@@ -821,7 +821,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, env, IVEC_MAX);
     pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_bus2,
                            &pci_bus3, &pbm_irqs);
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     // XXX Should be pci_bus3
     isa_bus = pci_ebus_init(pci_bus, -1, pbm_irqs);
hw/vga-pci.c +3 -3
index 9abbada..992ffd9 100644
@@ -47,7 +47,7 @@ static const VMStateDescription vmstate_vga_pci = {
     }
 };
 
-static int pci_vga_initfn(PCIDevice *dev)
+static int pci_std_vga_initfn(PCIDevice *dev)
 {
      PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev);
      VGACommonState *s = &d->vga;
@@ -70,7 +70,7 @@ static int pci_vga_initfn(PCIDevice *dev)
      return 0;
 }
 
-DeviceState *pci_vga_init(PCIBus *bus)
+DeviceState *pci_std_vga_init(PCIBus *bus)
 {
     return &pci_create_simple(bus, -1, "VGA")->qdev;
 }
@@ -86,7 +86,7 @@ static void vga_class_init(ObjectClass *klass, void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->no_hotplug = 1;
-    k->init = pci_vga_initfn;
+    k->init = pci_std_vga_initfn;
     k->romfile = "vgabios-stdvga.bin";
     k->vendor_id = PCI_VENDOR_ID_QEMU;
     k->device_id = PCI_DEVICE_ID_QEMU_VGA;
hw/vga-pci.h +1 -1
index 49abf13..d111cdc 100644
@@ -4,7 +4,7 @@
 #include "qemu-common.h"
 
 /* vga-pci.c */
-DeviceState *pci_vga_init(PCIBus *bus);
+DeviceState *pci_std_vga_init(PCIBus *bus);
 
 /* cirrus_vga.c */
 DeviceState *pci_cirrus_vga_init(PCIBus *bus);
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 4/12 mips/malta: use the new pci_vga_init() function

In reply to Aurelien Jarno
---
 hw/mips_malta.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/mips_malta.c +1 -9
index c39dee5..632b466 100644
@@ -33,7 +33,6 @@
 #include "mips.h"
 #include "mips_cpudevs.h"
 #include "pci.h"
-#include "vmware_vga.h"
 #include "qemu-char.h"
 #include "sysemu.h"
 #include "arch_init.h"
@@ -48,7 +47,6 @@
 #include "blockdev.h"
 #include "exec-memory.h"
 #include "sysbus.h"             /* SysBusDevice */
-#include "vga-pci.h"
 
 //#define DEBUG_BOARD_INIT
 
@@ -987,13 +985,7 @@ void mips_malta_init (ram_addr_t ram_size,
     network_init();
 
     /* Optional PCI video card */
-    if (cirrus_vga_enabled) {
-        pci_cirrus_vga_init(pci_bus);
-    } else if (vmsvga_enabled) {
-        pci_vmsvga_init(pci_bus);
-    } else if (std_vga_enabled) {
-        pci_std_vga_init(pci_bus);
-    }
+    pci_vga_init(pci_bus);
 }
 
 static int mips_malta_sysbus_device_init(SysBusDevice *sysbusdev)
Signature · 1 line
1.7.10.4
#14 lore raw

PATCH 6/12 ppc/newworld: use the new pci_vga_init() function

In reply to Aurelien Jarno

As a bonus it allows new vga card types (including none).

---
 hw/ppc_newworld.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ppc_newworld.c +1 -2
index 84af948..b8d3c9c 100644
@@ -67,7 +67,6 @@
 #include "hw/usb.h"
 #include "blockdev.h"
 #include "exec-memory.h"
-#include "vga-pci.h"
 
 #define MAX_IDE_BUS 2
 #define CFG_ADDR 0xf0000510
@@ -330,7 +329,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
         machine_arch = ARCH_MAC99;
     }
     /* init basic PC hardware */
-    pci_std_vga_init(pci_bus);
+    pci_vga_init(pci_bus);
 
     escc_mem = escc_init(0, pic[0x25], pic[0x24],
                          serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
Signature · 1 line
1.7.10.4
#21 lore raw

PATCH 11/12 pc: use the new pci_vga_init() function

In reply to Aurelien Jarno

The CONFIG_SPICE is now tested in vl.c and thus not needed anymore. The various tests are still needed for the ISA cases.

---
 hw/pc.c |   41 +++++++++++++++--------------------------
 1 file changed, 15 insertions(+), 26 deletions(-)
hw/pc.c +15 -26
index 8736a30..8cdbd9e 100644
@@ -27,7 +27,6 @@
 #include "fdc.h"
 #include "ide.h"
 #include "pci.h"
-#include "vmware_vga.h"
 #include "monitor.h"
 #include "fw_cfg.h"
 #include "hpet_emul.h"
@@ -51,7 +50,6 @@
 #include "exec-memory.h"
 #include "arch_init.h"
 #include "bitmap.h"
-#include "vga-pci.h"
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
@@ -1019,34 +1017,25 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
 {
     DeviceState *dev = NULL;
 
-    if (cirrus_vga_enabled) {
-        if (pci_bus) {
-            dev = pci_cirrus_vga_init(pci_bus);
-        } else {
+    if (pci_bus) {
+        PCIDevice *pcidev = pci_vga_init(pci_bus);
+        dev = pcidev ? &pcidev->qdev : NULL;
+    } else {
+        switch (vga_interface_type) {
+        case VGA_CIRRUS:
             dev = &isa_create_simple(isa_bus, "isa-cirrus-vga")->qdev;
-        }
-    } else if (vmsvga_enabled) {
-        if (pci_bus) {
-            dev = pci_vmsvga_init(pci_bus);
-        } else {
-            fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
-        }
-#ifdef CONFIG_SPICE
-    } else if (qxl_enabled) {
-        if (pci_bus) {
-            dev = &pci_create_simple(pci_bus, -1, "qxl-vga")->qdev;
-        } else {
-            fprintf(stderr, "%s: qxl: no PCI bus\n", __FUNCTION__);
-        }
-#endif
-    } else if (std_vga_enabled) {
-        if (pci_bus) {
-            dev = pci_std_vga_init(pci_bus);
-        } else {
+            break;
+        case VGA_QXL:
+            fprintf(stderr, "%s: qxl: no PCI bus\n", __func__);
+            break;
+        case VGA_STD:
             dev = isa_vga_init(isa_bus);
+            break;
+        case VGA_VMWARE:
+            fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__);
+            break;
         }
     }
-
     return dev;
 }
 
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 5/12 alpha: use the new pci_vga_init() function

In reply to Aurelien Jarno

This remove the fallback to std-vga in case, as availability of the requested vga device is now tested in vl.c, and returns an error message to the user.

Cc Richard Henderson <[email protected]>
---
 hw/alpha_dp264.c |    2 +-
 hw/alpha_pci.c   |   24 ------------------------
 hw/alpha_sys.h   |    2 --
 3 files changed, 1 insertion(+), 27 deletions(-)
hw/alpha_dp264.c +1 -1
index 9eb939f..5ea04c7 100644
@@ -77,7 +77,7 @@ static void clipper_init(ram_addr_t ram_size,
     isa_create_simple(isa_bus, "i8042");
 
     /* VGA setup.  Don't bother loading the bios.  */
-    alpha_pci_vga_setup(pci_bus);
+    pci_vga_init(pci_bus);
 
     /* Serial code setup.  */
     for (i = 0; i < MAX_SERIAL_PORTS; ++i) {
hw/alpha_pci.c +0 -3
index 0352e72..8079a46 100644
@@ -10,8 +10,6 @@
 #include "alpha_sys.h"
 #include "qemu-log.h"
 #include "sysemu.h"
-#include "vmware_vga.h"
-#include "vga-pci.h"
 
 
 /* PCI IO reads/writes, to byte-word addressable memory.  */
@@ -109,25 +107,3 @@ const MemoryRegionOps alpha_pci_iack_ops = {
         .max_access_size = 4,
     },
 };
-

-void alpha_pci_vga_setup(PCIBus *pci_bus)
-{
- switch (vga_interface_type) {
-#ifdef CONFIG_SPICE
- case VGA_QXL:
- pci_create_simple(pci_bus, -1, "qxl-vga");
- return;
-#endif
- case VGA_CIRRUS:
- pci_cirrus_vga_init(pci_bus);
- return;
- case VGA_VMWARE:
- pci_vmsvga_init(pci_bus);
- return;
- }
- /* If VGA is enabled at all, and one of the above didn't work, then
- fallback to Standard VGA. */
- if (vga_interface_type != VGA_NONE) {
- pci_std_vga_init(pci_bus);
- }
-}

hw/alpha_sys.h +0 -2
index de40f8b..7604d09 100644
@@ -19,6 +19,4 @@ extern const MemoryRegionOps alpha_pci_bw_io_ops;
 extern const MemoryRegionOps alpha_pci_conf1_ops;
 extern const MemoryRegionOps alpha_pci_iack_ops;
 
-void alpha_pci_vga_setup(PCIBus *pci_bus);
-
 #endif
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH 7/12 ppc/oldworld: use the new pci_vga_init() function

In reply to Aurelien Jarno

As a bonus it allows new vga card types (including none).

---
 hw/ppc_oldworld.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ppc_oldworld.c +1 -2
index 8267eb4..2c4a478 100644
@@ -43,7 +43,6 @@
 #include "kvm_ppc.h"
 #include "blockdev.h"
 #include "exec-memory.h"
-#include "vga-pci.h"
 
 #define MAX_IDE_BUS 2
 #define CFG_ADDR 0xf0000510
@@ -250,7 +249,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
     pci_bus = pci_grackle_init(0xfec00000, pic,
                                get_system_memory(),
                                get_system_io());
-    pci_std_vga_init(pci_bus);
+    pci_vga_init(pci_bus);
 
     escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
                                serial_hds[1], ESCC_CLOCK, 4);
Signature · 1 line
1.7.10.4
#23 lore raw

PATCH 12/12 vga: cleanup after pci_vga_init() conversion

In reply to Aurelien Jarno

Now that all machines call pci_vga_init(), some unused code can be removed.

---
 hw/cirrus_vga.c |    6 ------
 hw/vga-pci.c    |    6 ------
 hw/vga-pci.h    |   12 ------------
 hw/vmware_vga.c |    1 -
 hw/vmware_vga.h |   15 ---------------
 sysemu.h        |    4 ----
 6 files changed, 44 deletions(-)
 delete mode 100644 hw/vga-pci.h
 delete mode 100644 hw/vmware_vga.h
hw/cirrus_vga.c +0 -6
index e8dcc6b..5d1d42f 100644
@@ -28,7 +28,6 @@
  */
 #include "hw.h"
 #include "pci.h"
-#include "vga-pci.h"
 #include "console.h"
 #include "vga_int.h"
 #include "loader.h"
@@ -2963,11 +2962,6 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
      return 0;
 }
 
-DeviceState *pci_cirrus_vga_init(PCIBus *bus)
-{
-    return &pci_create_simple(bus, -1, "cirrus-vga")->qdev;
-}
-
 static void cirrus_vga_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
hw/vga-pci.c +0 -6
index 992ffd9..996d47f 100644
@@ -24,7 +24,6 @@
 #include "hw.h"
 #include "console.h"
 #include "pci.h"
-#include "vga-pci.h"
 #include "vga_int.h"
 #include "pixel_ops.h"
 #include "qemu-timer.h"
@@ -70,11 +69,6 @@ static int pci_std_vga_initfn(PCIDevice *dev)
      return 0;
 }
 
-DeviceState *pci_std_vga_init(PCIBus *bus)
-{
-    return &pci_create_simple(bus, -1, "VGA")->qdev;
-}
-
 static Property vga_pci_properties[] = {
     DEFINE_PROP_UINT32("vgamem_mb", PCIVGAState, vga.vram_size_mb, 16),
     DEFINE_PROP_END_OF_LIST(),
hw/vga-pci.h deleted +0 -12
deleted file mode 100644
index d111cdc..0000000
@@ -1,12 +0,0 @@
-#ifndef VGA_PCI_H
-#define VGA_PCI_H
-
-#include "qemu-common.h"
-
-/* vga-pci.c */
-DeviceState *pci_std_vga_init(PCIBus *bus);
-
-/* cirrus_vga.c */
-DeviceState *pci_cirrus_vga_init(PCIBus *bus);
-
-#endif
hw/vmware_vga.c +0 -1
index f5e4f44..5796d89 100644
@@ -25,7 +25,6 @@
 #include "loader.h"
 #include "console.h"
 #include "pci.h"
-#include "vmware_vga.h"
 
 #undef VERBOSE
 #define HW_RECT_ACCEL
hw/vmware_vga.h deleted +0 -15
deleted file mode 100644
index 000fbdd..0000000
@@ -1,15 +0,0 @@
-#ifndef QEMU_VMWARE_VGA_H
-#define QEMU_VMWARE_VGA_H
-
-#include "qemu-common.h"
-
-/* vmware_vga.c */
-static inline DeviceState *pci_vmsvga_init(PCIBus *bus)
-{
-    PCIDevice *dev;
-
-    dev = pci_create_simple(bus, -1, "vmware-svga");
-    return &dev->qdev;
-}
-
-#endif
sysemu.h +0 -4
index 65552ac..0587b38 100644
@@ -105,11 +105,7 @@ typedef enum {
 } VGAInterfaceType;
 
 extern int vga_interface_type;
-#define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
-#define std_vga_enabled (vga_interface_type == VGA_STD)
 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
-#define vmsvga_enabled (vga_interface_type == VGA_VMWARE)
-#define qxl_enabled (vga_interface_type == VGA_QXL)
 
 extern int graphic_width;
 extern int graphic_height;
Signature · 1 line
1.7.10.4
#0 lore raw

cover Rework PCI video card initialization

This patch series is technically a new version of the "add a video card only when requested" series I sent yesterday. It uses a different approach though.

It creates a new pci_vga_init() function that takes care of initializing the requested PCI video card. This way there is no need to duplicate code in the various machines QEMU supports, and has the advantage that the newly added PCI video cards are available to all machines without having to touch machine specific code.

Cc Alexander Graf <[email protected]>
Cc Andreas Färber <[email protected]>
Cc Anthony Liguori <[email protected]>
Cc Blue Swirl <[email protected]>
Cc David Gibson <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Richard Henderson <[email protected]>

Aurelien Jarno (12):
vga: rename pci_vga_init() into pci_std_vga_init() vl.c: check for qxl availability
pci: add a pci_vga_init() function mips/malta: use the new pci_vga_init() function
alpha: use the new pci_vga_init() function ppc/newworld: use the new pci_vga_init() function ppc/oldworld: use the new pci_vga_init() function ppc/prep: use the new pci_vga_init() function ppc/pSeries: use the new pci_vga_init() function sun/sun4u: use the new pci_vga_init() function
pc: use the new pci_vga_init() function
vga: cleanup after pci_vga_init() conversion

 hw/alpha_dp264.c  |    2 +-
 hw/alpha_pci.c    |   24 ------------------------
 hw/alpha_sys.h    |    2 --
 hw/cirrus_vga.c   |    6 ------
 hw/mips_malta.c   |   10 +---------
 hw/pc.c           |   41 +++++++++++++++--------------------------
 hw/pci.c          |   18 ++++++++++++++++++
 hw/pci.h          |    3 +++
 hw/ppc_newworld.c |    1 -
 hw/ppc_oldworld.c |    1 -
 hw/ppc_prep.c     |    1 -
 hw/spapr.c        |    7 ++-----
 hw/sun4u.c        |    1 -
 hw/vga-pci.c      |   10 ++--------
 hw/vga-pci.h      |   12 ------------
 hw/vmware_vga.c   |    1 -
 hw/vmware_vga.h   |   15 ---------------
 sysemu.h          |    4 ----
 vl.c              |   12 +++++++++++-
 19 files changed, 53 insertions(+), 118 deletions(-)
 delete mode 100644 hw/vga-pci.h
 delete mode 100644 hw/vmware_vga.h
Signature · 1 line
1.7.10.4
#19 lore raw

PATCH 10/12 sun/sun4u: use the new pci_vga_init() function

As a bonus it allows new vga card types (including none).

---
 hw/sun4u.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/sun4u.c +1 -2
index cca090f..137a7c6 100644
@@ -39,7 +39,6 @@
 #include "elf.h"
 #include "blockdev.h"
 #include "exec-memory.h"
-#include "vga-pci.h"
 
 //#define DEBUG_IRQ
 //#define DEBUG_EBUS
@@ -821,7 +820,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, env, IVEC_MAX);
     pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_bus2,
                            &pci_bus3, &pbm_irqs);
-    pci_std_vga_init(pci_bus);
+    pci_vga_init(pci_bus);
 
     // XXX Should be pci_bus3
     isa_bus = pci_ebus_init(pci_bus, -1, pbm_irqs);
Signature · 1 line
1.7.10.4
Acked-by on v1 10/12
#20 lore raw

Re: [Qemu-devel] [PATCH 10/12] sun/sun4u: use the new pci_vga_init() function

Quoted 3 lines · Aurelien Jarno

As a bonus it allows new vga card types (including none).

Cc Blue Swirl <[email protected]>
Quoted 29 lines
---
 hw/sun4u.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/sun4u.c +1 -3
index cca090f..137a7c6 100644
@@ -39,7 +39,6 @@
 #include "elf.h"
 #include "blockdev.h"
 #include "exec-memory.h"
-#include "vga-pci.h"
 
 //#define DEBUG_IRQ
 //#define DEBUG_EBUS
@@ -821,7 +820,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, env, IVEC_MAX);
     pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_bus2,
                            &pci_bus3, &pbm_irqs);
-    pci_std_vga_init(pci_bus);
+    pci_vga_init(pci_bus);
 
     // XXX Should be pci_bus3
     isa_bus = pci_ebus_init(pci_bus, -1, pbm_irqs);
--

1.7.10.4

Acked-by on v1 1/12
#2 lore raw

Re: [Qemu-devel] [PATCH 01/12] vga: rename pci_vga_init() into pci_std_vga_init()

In reply to Aurelien Jarno
Quoted 7 lines · Aurelien Jarno

This better explains what is this function about. Adjust all callers.

Cc Richard Henderson <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Andreas Färber <[email protected]>
Cc David Gibson <[email protected]>
Cc Blue Swirl <[email protected]>
Quoted 165 lines
---
 hw/alpha_pci.c    |    2 +-
 hw/mips_malta.c   |    2 +-
 hw/pc.c           |    2 +-
 hw/ppc_newworld.c |    2 +-
 hw/ppc_oldworld.c |    2 +-
 hw/ppc_prep.c     |    2 +-
 hw/spapr.c        |    2 +-
 hw/sun4u.c        |    2 +-
 hw/vga-pci.c      |    6 +++---
 hw/vga-pci.h      |    2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)
hw/alpha_pci.c +1 -1
index ea546f8..0352e72 100644
@@ -128,6 +128,6 @@ void alpha_pci_vga_setup(PCIBus *pci_bus)
     /* If VGA is enabled at all, and one of the above didn't work, then
        fallback to Standard VGA.  */
     if (vga_interface_type != VGA_NONE) {
-        pci_vga_init(pci_bus);
+        pci_std_vga_init(pci_bus);
     }
 }
hw/mips_malta.c +1 -1
index ad23f26..c39dee5 100644
@@ -992,7 +992,7 @@ void mips_malta_init (ram_addr_t ram_size,
     } else if (vmsvga_enabled) {
         pci_vmsvga_init(pci_bus);
     } else if (std_vga_enabled) {
-        pci_vga_init(pci_bus);
+        pci_std_vga_init(pci_bus);
     }
 }
 
hw/pc.c +1 -1
index 112739a..8736a30 100644
@@ -1041,7 +1041,7 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
 #endif
     } else if (std_vga_enabled) {
         if (pci_bus) {
-            dev = pci_vga_init(pci_bus);
+            dev = pci_std_vga_init(pci_bus);
         } else {
             dev = isa_vga_init(isa_bus);
         }
hw/ppc_newworld.c +1 -1
index e95cfe8..84af948 100644
@@ -330,7 +330,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
         machine_arch = ARCH_MAC99;
     }
     /* init basic PC hardware */
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     escc_mem = escc_init(0, pic[0x25], pic[0x24],
                          serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
hw/ppc_oldworld.c +1 -1
index 1dcd8a6..8267eb4 100644
@@ -250,7 +250,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
     pci_bus = pci_grackle_init(0xfec00000, pic,
                                get_system_memory(),
                                get_system_io());
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
                                serial_hds[1], ESCC_CLOCK, 4);
hw/ppc_prep.c +1 -1
index 592b7b2..1fa7609 100644
@@ -611,7 +611,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
     memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory);
 
     /* init basic PC hardware */
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     if (serial_hds[0])
         serial_isa_init(isa_bus, 0, serial_hds[0]);
hw/spapr.c +1 -1
index c34b767..80735d6 100644
@@ -590,7 +590,7 @@ static int spapr_vga_init(PCIBus *pci_bus)
 {
     switch (vga_interface_type) {
     case VGA_STD:
-        pci_vga_init(pci_bus);
+        pci_std_vga_init(pci_bus);
         return 1;
     case VGA_NONE:
         return 0;
hw/sun4u.c +1 -1
index 07cd042..cca090f 100644
@@ -821,7 +821,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, env, IVEC_MAX);
     pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_bus2,
                            &pci_bus3, &pbm_irqs);
-    pci_vga_init(pci_bus);
+    pci_std_vga_init(pci_bus);
 
     // XXX Should be pci_bus3
     isa_bus = pci_ebus_init(pci_bus, -1, pbm_irqs);
hw/vga-pci.c +3 -3
index 9abbada..992ffd9 100644
@@ -47,7 +47,7 @@ static const VMStateDescription vmstate_vga_pci = {
     }
 };
 
-static int pci_vga_initfn(PCIDevice *dev)
+static int pci_std_vga_initfn(PCIDevice *dev)
 {
      PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev);
      VGACommonState *s = &d->vga;
@@ -70,7 +70,7 @@ static int pci_vga_initfn(PCIDevice *dev)
      return 0;
 }
 
-DeviceState *pci_vga_init(PCIBus *bus)
+DeviceState *pci_std_vga_init(PCIBus *bus)
 {
     return &pci_create_simple(bus, -1, "VGA")->qdev;
 }
@@ -86,7 +86,7 @@ static void vga_class_init(ObjectClass *klass, void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->no_hotplug = 1;
-    k->init = pci_vga_initfn;
+    k->init = pci_std_vga_initfn;
     k->romfile = "vgabios-stdvga.bin";
     k->vendor_id = PCI_VENDOR_ID_QEMU;
     k->device_id = PCI_DEVICE_ID_QEMU_VGA;
hw/vga-pci.h +1 -2
index 49abf13..d111cdc 100644
@@ -4,7 +4,7 @@
 #include "qemu-common.h"
 
 /* vga-pci.c */
-DeviceState *pci_vga_init(PCIBus *bus);
+DeviceState *pci_std_vga_init(PCIBus *bus);
 
 /* cirrus_vga.c */
 DeviceState *pci_cirrus_vga_init(PCIBus *bus);
--

1.7.10.4

Acked-by on v1 1/12
#3 lore raw

Re: [Qemu-devel] [PATCH 01/12] vga: rename pci_vga_init() into pci_std_vga_init()

In reply to Aurelien Jarno

Am 08.09.2012 13:26, schrieb Aurelien Jarno:

Quoted 9 lines

This better explains what is this function about. Adjust all callers.

Cc Richard Henderson <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Andreas Färber <[email protected]>
Cc David Gibson <[email protected]>
Cc Blue Swirl <[email protected]>
Cc Anthony Liguori <[email protected]>

Looks fine,

Andreas

#22 lore raw

Re: [Qemu-devel] [PATCH 11/12] pc: use the new pci_vga_init() function

In reply to Aurelien Jarno
Quoted 63 lines · Aurelien Jarno

The CONFIG_SPICE is now tested in vl.c and thus not needed anymore. The various tests are still needed for the ISA cases.

---
 hw/pc.c |   41 +++++++++++++++--------------------------
 1 file changed, 15 insertions(+), 26 deletions(-)
hw/pc.c +6 -25
index 8736a30..8cdbd9e 100644
@@ -27,7 +27,6 @@
 #include "fdc.h"
 #include "ide.h"
 #include "pci.h"
-#include "vmware_vga.h"
 #include "monitor.h"
 #include "fw_cfg.h"
 #include "hpet_emul.h"
@@ -51,7 +50,6 @@
 #include "exec-memory.h"
 #include "arch_init.h"
 #include "bitmap.h"
-#include "vga-pci.h"
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
@@ -1019,34 +1017,25 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
 {
     DeviceState *dev = NULL;
 
-    if (cirrus_vga_enabled) {
-        if (pci_bus) {
-            dev = pci_cirrus_vga_init(pci_bus);
-        } else {
+    if (pci_bus) {
+        PCIDevice *pcidev = pci_vga_init(pci_bus);
+        dev = pcidev ? &pcidev->qdev : NULL;
+    } else {
+        switch (vga_interface_type) {
+        case VGA_CIRRUS:
             dev = &isa_create_simple(isa_bus, "isa-cirrus-vga")->qdev;
-        }
-    } else if (vmsvga_enabled) {
-        if (pci_bus) {
-            dev = pci_vmsvga_init(pci_bus);
-        } else {
-            fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
-        }
-#ifdef CONFIG_SPICE
-    } else if (qxl_enabled) {
-        if (pci_bus) {
-            dev = &pci_create_simple(pci_bus, -1, "qxl-vga")->qdev;
-        } else {
-            fprintf(stderr, "%s: qxl: no PCI bus\n", __FUNCTION__);
-        }
-#endif
-    } else if (std_vga_enabled) {
-        if (pci_bus) {
-            dev = pci_std_vga_init(pci_bus);
-        } else {

hw/pc.c DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus) · line 1036

Quoted 10 lines
hw/pc.c +9 -0
+            break;
+        case VGA_QXL:
+            fprintf(stderr, "%s: qxl: no PCI bus\n", __func__);
+            break;
+        case VGA_STD:
             dev = isa_vga_init(isa_bus);
+            break;
+        case VGA_VMWARE:
+            fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__);
+            break;

Please move this to isa.[ch] (like PCI case), so other ISA bus users (actually just MIPS r4k) benefit also.

Quoted 10 lines
hw/pc.c +0 -2
         }
     }
-
     return dev;
 }
 
--

1.7.10.4

#5 lore raw

Re: [Qemu-devel] [PATCH 02/12] vl.c: check for qxl availability

In reply to Aurelien Jarno

Am 08.09.2012 13:26, schrieb Aurelien Jarno:

Quoted 15 lines

Check for qxl availability in vl.c. This will allow to remove #ifdef CONFIG_SPICE .. #endif later in this series

Cc Anthony Liguori <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
 vl.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
vl.c +0 -0
index 7c577fa..6363915 100644

vl.c static bool vmware_vga_available(void) · line 1708

Quoted 6 lines
vl.c +3 -0
@@ -1703,6 +1703,11 @@ static bool vmware_vga_available(void)
     return qdev_exists("vmware-svga");
 }
 
+static bool qxl_vga_available(void)
+{
+    return qdev_exists("qxl-vga");

I'd suggest to use the QOM equivalent:

object_class_by_name("qxl-vga")

Andreas

Quoted 20 lines
vl.c +8 -1
+}
+
 static void select_vgahw (const char *p)
 {
     const char *opts;
@@ -1732,7 +1737,12 @@ static void select_vgahw (const char *p)
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
     } else if (strstart(p, "qxl", &opts)) {
-        vga_interface_type = VGA_QXL;
+        if (qxl_vga_available()) {
+            vga_interface_type = VGA_QXL;
+        } else {
+            fprintf(stderr, "Error: QXL VGA not available\n");
+            exit(0);
+        }
     } else if (!strstart(p, "none", &opts)) {
     invalid_vga:
         fprintf(stderr, "Unknown vga type: %s\n", p);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw

Re: [Qemu-devel] [PATCH 05/12] alpha: use the new pci_vga_init() function

In reply to Aurelien Jarno
Quoted 53 lines · Aurelien Jarno

This remove the fallback to std-vga in case, as availability of the requested vga device is now tested in vl.c, and returns an error message to the user.

Cc Richard Henderson <[email protected]>

---

hw/alpha_dp264.c |    2 +-
hw/alpha_pci.c   |   24 ------------------------
hw/alpha_sys.h   |    2 --
3 files changed, 1 insertion(+), 27 deletions(-)
hw/alpha_dp264.c +1 -1
index 9eb939f..5ea04c7 100644
@@ -77,7 +77,7 @@ static void clipper_init(ram_addr_t ram_size,
    isa_create_simple(isa_bus, "i8042");
 
    /* VGA setup.  Don't bother loading the bios.  */
-    alpha_pci_vga_setup(pci_bus);
+    pci_vga_init(pci_bus);
 
    /* Serial code setup.  */
    for (i = 0; i < MAX_SERIAL_PORTS; ++i) {
hw/alpha_pci.c +0 -13
index 0352e72..8079a46 100644
@@ -10,8 +10,6 @@
 #include "alpha_sys.h"
 #include "qemu-log.h"
 #include "sysemu.h"
-#include "vmware_vga.h"
-#include "vga-pci.h"
 
 
 /* PCI IO reads/writes, to byte-word addressable memory.  */
@@ -109,25 +107,3 @@ const MemoryRegionOps alpha_pci_iack_ops = {
        .max_access_size = 4,
    },
 };
-
-void alpha_pci_vga_setup(PCIBus *pci_bus)
-{
-    switch (vga_interface_type) {
-#ifdef CONFIG_SPICE
-    case VGA_QXL:
-        pci_create_simple(pci_bus, -1, "qxl-vga");
-        return;
-#endif
-    case VGA_CIRRUS:
-        pci_cirrus_vga_init(pci_bus);

hw/alpha_pci.c const MemoryRegionOps alpha_pci_iack_ops = { · line 132

Quoted 10 lines
hw/alpha_pci.c +0 -10
-        return;
-    case VGA_VMWARE:
-        pci_vmsvga_init(pci_bus);
-        return;
-    }
-    /* If VGA is enabled at all, and one of the above didn't work, then
-       fallback to Standard VGA.  */
-    if (vga_interface_type != VGA_NONE) {
-        pci_std_vga_init(pci_bus);
-    }

You're removing the fallback logic here, no?

Alex

Quoted 16 lines
hw/alpha_pci.c +0 -1
-}
hw/alpha_sys.h +0 -2
index de40f8b..7604d09 100644
@@ -19,6 +19,4 @@ extern const MemoryRegionOps alpha_pci_bw_io_ops;
 extern const MemoryRegionOps alpha_pci_conf1_ops;
 extern const MemoryRegionOps alpha_pci_iack_ops;
 
-void alpha_pci_vga_setup(PCIBus *pci_bus);
-
 #endif
Signature · 1 line
1.7.10.4
#24 lore raw
In reply to Aurelien Jarno
Quoted 10 lines · Aurelien Jarno

This patch series is technically a new version of the "add a video card only when requested" series I sent yesterday. It uses a different approach though.

It creates a new pci_vga_init() function that takes care of initializing the requested PCI video card. This way there is no need to duplicate code in the various machines QEMU supports, and has the advantage that the newly added PCI video cards are available to all machines without having to touch machine specific code.

Quoted 7 lines
Cc Alexander Graf <[email protected]>
Cc Andreas Färber <[email protected]>
Cc Anthony Liguori <[email protected]>
Cc Blue Swirl <[email protected]>
Cc David Gibson <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Richard Henderson <[email protected]>

Apart from my comment and the bits already mentioned, the series looks very good. It's certainly a trenendous cleanup + simplification of the vga code.

Alex

Quoted 42 lines

Aurelien Jarno (12):
vga: rename pci_vga_init() into pci_std_vga_init() vl.c: check for qxl availability
pci: add a pci_vga_init() function mips/malta: use the new pci_vga_init() function
alpha: use the new pci_vga_init() function ppc/newworld: use the new pci_vga_init() function ppc/oldworld: use the new pci_vga_init() function ppc/prep: use the new pci_vga_init() function ppc/pSeries: use the new pci_vga_init() function sun/sun4u: use the new pci_vga_init() function
pc: use the new pci_vga_init() function
vga: cleanup after pci_vga_init() conversion

hw/alpha_dp264.c  |    2 +-
hw/alpha_pci.c    |   24 ------------------------
hw/alpha_sys.h    |    2 --
hw/cirrus_vga.c   |    6 ------
hw/mips_malta.c   |   10 +---------
hw/pc.c           |   41 +++++++++++++++--------------------------
hw/pci.c          |   18 ++++++++++++++++++
hw/pci.h          |    3 +++
hw/ppc_newworld.c |    1 -
hw/ppc_oldworld.c |    1 -
hw/ppc_prep.c     |    1 -
hw/spapr.c        |    7 ++-----
hw/sun4u.c        |    1 -
hw/vga-pci.c      |   10 ++--------
hw/vga-pci.h      |   12 ------------
hw/vmware_vga.c   |    1 -
hw/vmware_vga.h   |   15 ---------------
sysemu.h          |    4 ----
vl.c              |   12 +++++++++++-
19 files changed, 53 insertions(+), 118 deletions(-)

delete mode 100644 hw/vga-pci.h
delete mode 100644 hw/vmware_vga.h

Signature · 1 line
1.7.10.4
#10 lore raw

Re: [Qemu-devel] [PATCH 05/12] alpha: use the new pci_vga_init() function

In reply to Alexander Graf
Quoted 62 lines · Alexander Graf
Quoted 58 lines · Aurelien Jarno

This remove the fallback to std-vga in case, as availability of the requested vga device is now tested in vl.c, and returns an error message to the user.

Cc Richard Henderson <[email protected]>

---

hw/alpha_dp264.c |    2 +-
hw/alpha_pci.c   |   24 ------------------------
hw/alpha_sys.h   |    2 --
3 files changed, 1 insertion(+), 27 deletions(-)
hw/alpha_dp264.c +1 -1
index 9eb939f..5ea04c7 100644
@@ -77,7 +77,7 @@ static void clipper_init(ram_addr_t ram_size,
    isa_create_simple(isa_bus, "i8042");
 
    /* VGA setup.  Don't bother loading the bios.  */
-    alpha_pci_vga_setup(pci_bus);
+    pci_vga_init(pci_bus);
 
    /* Serial code setup.  */
    for (i = 0; i < MAX_SERIAL_PORTS; ++i) {
hw/alpha_pci.c +0 -17
index 0352e72..8079a46 100644
@@ -10,8 +10,6 @@
 #include "alpha_sys.h"
 #include "qemu-log.h"
 #include "sysemu.h"
-#include "vmware_vga.h"
-#include "vga-pci.h"
 
 
 /* PCI IO reads/writes, to byte-word addressable memory.  */
@@ -109,25 +107,3 @@ const MemoryRegionOps alpha_pci_iack_ops = {
        .max_access_size = 4,
    },
 };
-
 
-void alpha_pci_vga_setup(PCIBus *pci_bus)
-{
-    switch (vga_interface_type) {
-#ifdef CONFIG_SPICE
-    case VGA_QXL:
-        pci_create_simple(pci_bus, -1, "qxl-vga");
-        return;
-#endif
-    case VGA_CIRRUS:
-        pci_cirrus_vga_init(pci_bus);
-        return;
-    case VGA_VMWARE:
-        pci_vmsvga_init(pci_bus);
-        return;
Quoted 9 lines

hw/alpha_pci.c

Quoted 6 lines
hw/alpha_pci.c +0 -6
-    }
-    /* If VGA is enabled at all, and one of the above didn't work, then
-       fallback to Standard VGA.  */
-    if (vga_interface_type != VGA_NONE) {
-        pci_std_vga_init(pci_bus);
-    }

You're removing the fallback logic here, no?

Yes, because the availability of the other type is now checked in vl.c so that pci_vga_init() is able to create the requested card. That way the users get an error message instead of having a card different to what they request.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#11 lore raw

Re: [Qemu-devel] [PATCH 05/12] alpha: use the new pci_vga_init() function

Quoted 72 lines · Aurelien Jarno
Quoted 61 lines · Alexander Graf
Quoted 57 lines · Aurelien Jarno

This remove the fallback to std-vga in case, as availability of the requested vga device is now tested in vl.c, and returns an error message to the user.

Cc Richard Henderson <[email protected]>

---

hw/alpha_dp264.c |    2 +-
hw/alpha_pci.c   |   24 ------------------------
hw/alpha_sys.h   |    2 --
3 files changed, 1 insertion(+), 27 deletions(-)
hw/alpha_dp264.c +1 -1
index 9eb939f..5ea04c7 100644
@@ -77,7 +77,7 @@ static void clipper_init(ram_addr_t ram_size,
   isa_create_simple(isa_bus, "i8042");
 
   /* VGA setup.  Don't bother loading the bios.  */
-    alpha_pci_vga_setup(pci_bus);
+    pci_vga_init(pci_bus);
 
   /* Serial code setup.  */
   for (i = 0; i < MAX_SERIAL_PORTS; ++i) {
hw/alpha_pci.c +0 -17
index 0352e72..8079a46 100644
@@ -10,8 +10,6 @@
 #include "alpha_sys.h"
 #include "qemu-log.h"
 #include "sysemu.h"
-#include "vmware_vga.h"
-#include "vga-pci.h"
 
 
 /* PCI IO reads/writes, to byte-word addressable memory.  */
@@ -109,25 +107,3 @@ const MemoryRegionOps alpha_pci_iack_ops = {
       .max_access_size = 4,
   },
 };
-
-void alpha_pci_vga_setup(PCIBus *pci_bus)
-{
-    switch (vga_interface_type) {
-#ifdef CONFIG_SPICE
-    case VGA_QXL:
-        pci_create_simple(pci_bus, -1, "qxl-vga");
-        return;
-#endif
-    case VGA_CIRRUS:
-        pci_cirrus_vga_init(pci_bus);
-        return;
-    case VGA_VMWARE:
-        pci_vmsvga_init(pci_bus);
-        return;
Quoted 9 lines

hw/alpha_pci.c const MemoryRegionOps alpha_pci_iack_ops = { · line 132

Quoted 6 lines
hw/alpha_pci.c +0 -6
-    }
-    /* If VGA is enabled at all, and one of the above didn't work, then
-       fallback to Standard VGA.  */
-    if (vga_interface_type != VGA_NONE) {
-        pci_std_vga_init(pci_bus);
-    }

You're removing the fallback logic here, no?

Quoted 4 lines

Yes, because the availability of the other type is now checked in vl.c so that pci_vga_init() is able to create the requested card. That way the users get an error message instead of having a card different to what they request.

But this is alpha and you're calling pci_vga_init, not pc_vga_init :).

Alex

Quoted 4 lines
Signature · 3 lines
-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#12 lore raw

Re: [Qemu-devel] [PATCH 05/12] alpha: use the new pci_vga_init() function

Quoted 76 lines · Alexander Graf
Quoted 72 lines · Aurelien Jarno
Quoted 70 lines · Alexander Graf
Quoted 53 lines · Aurelien Jarno

This remove the fallback to std-vga in case, as availability of the requested vga device is now tested in vl.c, and returns an error message to the user.

Cc Richard Henderson <[email protected]>

---

hw/alpha_dp264.c |    2 +-
hw/alpha_pci.c   |   24 ------------------------
hw/alpha_sys.h   |    2 --
3 files changed, 1 insertion(+), 27 deletions(-)
hw/alpha_dp264.c +1 -1
index 9eb939f..5ea04c7 100644
@@ -77,7 +77,7 @@ static void clipper_init(ram_addr_t ram_size,
  isa_create_simple(isa_bus, "i8042");
 
  /* VGA setup.  Don't bother loading the bios.  */
-    alpha_pci_vga_setup(pci_bus);
+    pci_vga_init(pci_bus);
 
  /* Serial code setup.  */
  for (i = 0; i < MAX_SERIAL_PORTS; ++i) {
hw/alpha_pci.c +0 -13
index 0352e72..8079a46 100644
@@ -10,8 +10,6 @@
 #include "alpha_sys.h"
 #include "qemu-log.h"
 #include "sysemu.h"
-#include "vmware_vga.h"
-#include "vga-pci.h"
 
 
 /* PCI IO reads/writes, to byte-word addressable memory.  */
@@ -109,25 +107,3 @@ const MemoryRegionOps alpha_pci_iack_ops = {
      .max_access_size = 4,
  },
 };
-
-void alpha_pci_vga_setup(PCIBus *pci_bus)
-{
-    switch (vga_interface_type) {
-#ifdef CONFIG_SPICE
-    case VGA_QXL:
-        pci_create_simple(pci_bus, -1, "qxl-vga");
-        return;
-#endif
-    case VGA_CIRRUS:
-        pci_cirrus_vga_init(pci_bus);

hw/alpha_pci.c const MemoryRegionOps alpha_pci_iack_ops = { · line 132

Quoted 10 lines
hw/alpha_pci.c +0 -10
-        return;
-    case VGA_VMWARE:
-        pci_vmsvga_init(pci_bus);
-        return;
-    }
-    /* If VGA is enabled at all, and one of the above didn't work, then
-       fallback to Standard VGA.  */
-    if (vga_interface_type != VGA_NONE) {
-        pci_std_vga_init(pci_bus);
-    }

You're removing the fallback logic here, no?

Quoted 6 lines
Quoted 4 lines

Yes, because the availability of the other type is now checked in vl.c so that pci_vga_init() is able to create the requested card. That way the users get an error message instead of having a card different to what they request.

But this is alpha and you're calling pci_vga_init, not pc_vga_init :).

Ah, I misread the code. It's creating a pci std vga adapter as fallback. Then it's all fine :)

Alex

Quoted 8 lines

Alex

Quoted 4 lines
Signature · 3 lines
-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net