qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization
@ 2012-09-11 19:10 Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init() Aurelien Jarno
                   ` (16 more replies)
  0 siblings, 17 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

This patch series tries to simplify ISA/PCI video card initialization
and to avoid having the same (buggy) code more or less duplicated in 
various machines.

It creates a new isa_vga_init() and a new pci_vga_init() functions that
take care of initializing the requested ISA/PCI video card. It avoid
duplication and also has the advantage that newly added PCI video cards
are available to all machines without having to touch machine specific
code, and that selecting a disabled video card returns an error message
to the user.

Changes v1 -> v2:
 - Do the same for ISA in addition to PCI, and use that in pc and 
   mips_r4k machines
 - Query availability of video cards with QOM instead of qdev_exists()
   and get rid of the latter function at the same time.
 - Default to std if cirrus is not available

Aurelien Jarno (17):
  vga: rename pci_vga_init() into pci_std_vga_init()
  vga: rename isa_vga_init() to isa_std_vga_init()
  vl.c: convert *vga_enabled functions to QOM
  vl.c: check for qxl availability
  vl.c: default to std if cirrus is not available
  pci: add a pci_vga_init() function
  isa: add a isa_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() and isa_vga_init() functions
  mips/r4k: use the new is_vga_init() function
  vga: cleanup after isa_vga_init() and 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/isa-bus.c      |   20 ++++++++++++++++++++
 hw/isa.h          |    2 ++
 hw/mips_malta.c   |   10 +---------
 hw/pc.c           |   35 ++++++-----------------------------
 hw/pc.h           |   13 -------------
 hw/pci.c          |   18 ++++++++++++++++++
 hw/pci.h          |    3 +++
 hw/ppc_newworld.c |    1 -
 hw/ppc_oldworld.c |    1 -
 hw/ppc_prep.c     |    1 -
 hw/qdev.c         |    5 -----
 hw/qdev.h         |    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          |    3 ---
 vl.c              |   27 +++++++++++++++++++++------
 24 files changed, 76 insertions(+), 144 deletions(-)
 delete mode 100644 hw/vga-pci.h
 delete mode 100644 hw/vmware_vga.h

--
1.7.10.4

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init()
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-12 16:54   ` Richard Henderson
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 02/17] vga: rename isa_vga_init() to isa_std_vga_init() Aurelien Jarno
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Anthony Liguori, Alexander Graf, Andreas Färber,
	Richard Henderson, Aurelien Jarno, David Gibson

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

Cc: Richard Henderson <rth@twiddle.net>
Cc: Alexander Graf <agraf@suse.de>
Cc: Andreas Färber <andreas.faerber@web.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 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(-)

diff --git a/hw/alpha_pci.c b/hw/alpha_pci.c
index ea546f8..0352e72 100644
--- a/hw/alpha_pci.c
+++ b/hw/alpha_pci.c
@@ -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);
     }
 }
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index ad23f26..c39dee5 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -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);
     }
 }
 
diff --git a/hw/pc.c b/hw/pc.c
index 112739a..8736a30 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -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);
         }
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index e95cfe8..84af948 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -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);
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 1dcd8a6..8267eb4 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -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);
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 592b7b2..1fa7609 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -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]);
diff --git a/hw/spapr.c b/hw/spapr.c
index c34b767..80735d6 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -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;
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 07cd042..cca090f 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -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);
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 9abbada..992ffd9 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -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;
diff --git a/hw/vga-pci.h b/hw/vga-pci.h
index 49abf13..d111cdc 100644
--- a/hw/vga-pci.h
+++ b/hw/vga-pci.h
@@ -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

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 02/17] vga: rename isa_vga_init() to isa_std_vga_init()
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init() Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 03/17] vl.c: convert *vga_enabled functions to QOM Aurelien Jarno
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Aurelien Jarno

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

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/mips_r4k.c |    2 +-
 hw/pc.c       |    2 +-
 hw/pc.h       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 967a76e..2115f7f 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -281,7 +281,7 @@ void mips_r4k_init (ram_addr_t ram_size,
         }
     }
 
-    isa_vga_init(isa_bus);
+    isa_std_vga_init(isa_bus);
 
     if (nd_table[0].used)
         isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]);
diff --git a/hw/pc.c b/hw/pc.c
index 8736a30..e3d4631 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1043,7 +1043,7 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
         if (pci_bus) {
             dev = pci_std_vga_init(pci_bus);
         } else {
-            dev = isa_vga_init(isa_bus);
+            dev = isa_std_vga_init(isa_bus);
         }
     }
 
diff --git a/hw/pc.h b/hw/pc.h
index e4db071..77c38d6 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -176,7 +176,7 @@ enum vga_retrace_method {
 
 extern enum vga_retrace_method vga_retrace_method;
 
-static inline DeviceState *isa_vga_init(ISABus *bus)
+static inline DeviceState *isa_std_vga_init(ISABus *bus)
 {
     ISADevice *dev;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 03/17] vl.c: convert *vga_enabled functions to QOM
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init() Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 02/17] vga: rename isa_vga_init() to isa_std_vga_init() Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 04/17] vl.c: check for qxl availability Aurelien Jarno
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

And get rid of qdev_exists().

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/qdev.c |    5 -----
 hw/qdev.h |    1 -
 vl.c      |    7 ++++---
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index b5a52ac..0eb30a2 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -52,11 +52,6 @@ const char *qdev_fw_name(DeviceState *dev)
     return object_get_typename(OBJECT(dev));
 }
 
-bool qdev_exists(const char *name)
-{
-    return !!object_class_by_name(name);
-}
-
 static void qdev_property_add_legacy(DeviceState *dev, Property *prop,
                                      Error **errp);
 
diff --git a/hw/qdev.h b/hw/qdev.h
index d699194..c6ac636 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -153,7 +153,6 @@ typedef struct GlobalProperty {
 
 DeviceState *qdev_create(BusState *bus, const char *name);
 DeviceState *qdev_try_create(BusState *bus, const char *name);
-bool qdev_exists(const char *name);
 int qdev_device_help(QemuOpts *opts);
 DeviceState *qdev_device_add(QemuOpts *opts);
 int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT;
diff --git a/vl.c b/vl.c
index 7c577fa..f7eed7a 100644
--- a/vl.c
+++ b/vl.c
@@ -1690,17 +1690,18 @@ static const QEMUOption qemu_options[] = {
 
 static bool vga_available(void)
 {
-    return qdev_exists("VGA") || qdev_exists("isa-vga");
+    return object_class_by_name("VGA") || object_class_by_name("isa-vga");
 }
 
 static bool cirrus_vga_available(void)
 {
-    return qdev_exists("cirrus-vga") || qdev_exists("isa-cirrus-vga");
+    return object_class_by_name("cirrus-vga")
+           || object_class_by_name("isa-cirrus-vga");
 }
 
 static bool vmware_vga_available(void)
 {
-    return qdev_exists("vmware-svga");
+    return object_class_by_name("vmware-svga");
 }
 
 static void select_vgahw (const char *p)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 04/17] vl.c: check for qxl availability
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (2 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 03/17] vl.c: convert *vga_enabled functions to QOM Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 05/17] vl.c: default to std if cirrus is not available Aurelien Jarno
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Gerd Hoffmann, 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 <aliguori@us.ibm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 vl.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index f7eed7a..ba2fa9f 100644
--- a/vl.c
+++ b/vl.c
@@ -1704,6 +1704,11 @@ static bool vmware_vga_available(void)
     return object_class_by_name("vmware-svga");
 }
 
+static bool qxl_vga_available(void)
+{
+    return object_class_by_name("qxl-vga");
+}
+
 static void select_vgahw (const char *p)
 {
     const char *opts;
@@ -1733,7 +1738,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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 05/17] vl.c: default to std if cirrus is not available
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (3 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 04/17] vl.c: check for qxl availability Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 06/17] pci: add a pci_vga_init() function Aurelien Jarno
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 vl.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vl.c b/vl.c
index ba2fa9f..6ca27f5 100644
--- a/vl.c
+++ b/vl.c
@@ -3606,8 +3606,12 @@ int main(int argc, char **argv, char **envp)
         exit(1);
 
     /* If no default VGA is requested, the default is "none".  */
-    if (default_vga && cirrus_vga_available()) {
-        vga_model = "cirrus";
+    if (default_vga) {
+        if (cirrus_vga_available()) {
+            vga_model = "cirrus";
+        } else if (vga_available()) {
+            vga_model = "std";
+        }
     }
     select_vgahw(vga_model);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 06/17] pci: add a pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (4 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 05/17] vl.c: default to std if cirrus is not available Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 07/17] isa: add a isa_vga_init() function Aurelien Jarno
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, 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).

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/pci.c |   18 ++++++++++++++++++
 hw/pci.h |    3 +++
 2 files changed, 21 insertions(+)

diff --git a/hw/pci.c b/hw/pci.c
index f855cf3..e5cee87 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -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)
diff --git a/hw/pci.h b/hw/pci.h
index 4b6ab3d..d50d26c 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -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),
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 07/17] isa: add a isa_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (5 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 06/17] pci: add a pci_vga_init() function Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 08/17] mips/malta: use the new pci_vga_init() function Aurelien Jarno
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

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

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/isa-bus.c |   20 ++++++++++++++++++++
 hw/isa.h     |    2 ++
 2 files changed, 22 insertions(+)

diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index f9b2373..00de20a 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -19,6 +19,7 @@
 #include "hw.h"
 #include "monitor.h"
 #include "sysbus.h"
+#include "sysemu.h"
 #include "isa.h"
 #include "exec-memory.h"
 
@@ -166,6 +167,25 @@ ISADevice *isa_create_simple(ISABus *bus, const char *name)
     return dev;
 }
 
+ISADevice *isa_vga_init(ISABus *bus)
+{
+    switch (vga_interface_type) {
+    case VGA_CIRRUS:
+        return isa_create_simple(bus, "isa-cirrus-vga");
+    case VGA_QXL:
+        fprintf(stderr, "%s: qxl: no PCI bus\n", __func__);
+        return NULL;
+    case VGA_STD:
+        return isa_create_simple(bus, "isa-vga");
+    case VGA_VMWARE:
+        fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__);
+        return NULL;
+    case VGA_NONE:
+    default:
+        return NULL;
+    }
+}
+
 static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent)
 {
     ISADevice *d = ISA_DEVICE(dev);
diff --git a/hw/isa.h b/hw/isa.h
index dc97052..8fb498a 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -47,6 +47,8 @@ ISADevice *isa_create(ISABus *bus, const char *name);
 ISADevice *isa_try_create(ISABus *bus, const char *name);
 ISADevice *isa_create_simple(ISABus *bus, const char *name);
 
+ISADevice *isa_vga_init(ISABus *bus);
+
 /**
  * isa_register_ioport: Install an I/O port region on the ISA bus.
  *
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 08/17] mips/malta: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (6 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 07/17] isa: add a isa_vga_init() function Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 09/17] alpha: " Aurelien Jarno
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/mips_malta.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index c39dee5..632b466 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -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)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 09/17] alpha: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (7 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 08/17] mips/malta: use the new pci_vga_init() function Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 10/17] ppc/newworld: " Aurelien Jarno
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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.

Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/alpha_dp264.c |    2 +-
 hw/alpha_pci.c   |   24 ------------------------
 hw/alpha_sys.h   |    2 --
 3 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/hw/alpha_dp264.c b/hw/alpha_dp264.c
index 9eb939f..5ea04c7 100644
--- a/hw/alpha_dp264.c
+++ b/hw/alpha_dp264.c
@@ -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) {
diff --git a/hw/alpha_pci.c b/hw/alpha_pci.c
index 0352e72..8079a46 100644
--- a/hw/alpha_pci.c
+++ b/hw/alpha_pci.c
@@ -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,
     },
 };
-\f

-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);
-    }
-}
diff --git a/hw/alpha_sys.h b/hw/alpha_sys.h
index de40f8b..7604d09 100644
--- a/hw/alpha_sys.h
+++ b/hw/alpha_sys.h
@@ -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
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 10/17] ppc/newworld: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (8 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 09/17] alpha: " Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 11/17] ppc/oldworld: " Aurelien Jarno
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Aurelien Jarno

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

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/ppc_newworld.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 84af948..b8d3c9c 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 11/17] ppc/oldworld: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (9 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 10/17] ppc/newworld: " Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 12/17] ppc/prep: " Aurelien Jarno
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Aurelien Jarno

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

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/ppc_oldworld.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 8267eb4..2c4a478 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 12/17] ppc/prep: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (10 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 11/17] ppc/oldworld: " Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 13/17] ppc/pSeries: " Aurelien Jarno
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

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

Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/ppc_prep.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 1fa7609..1544430 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -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]);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 13/17] ppc/pSeries: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (11 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 12/17] ppc/prep: " Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 14/17] sun/sun4u: " Aurelien Jarno
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Aurelien Jarno, David Gibson

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

Cc: Alexander Graf <agraf@suse.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/spapr.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/spapr.c b/hw/spapr.c
index 80735d6..8b0c390 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -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");
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 14/17] sun/sun4u: use the new pci_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (12 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 13/17] ppc/pSeries: " Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 15/17] pc: use the new pci_vga_init() and isa_vga_init() functions Aurelien Jarno
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

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

Acked-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/sun4u.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/sun4u.c b/hw/sun4u.c
index cca090f..137a7c6 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -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

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 15/17] pc: use the new pci_vga_init() and isa_vga_init() functions
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (13 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 14/17] sun/sun4u: " Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 16/17] mips/r4k: use the new is_vga_init() function Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 17/17] vga: cleanup after isa_vga_init() and pci_vga_init() conversion Aurelien Jarno
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Aurelien Jarno

The CONFIG_SPICE is now tested in vl.c and thus not needed anymore.

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/pc.c |   35 ++++++-----------------------------
 1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index e3d4631..562d288 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -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,13 @@ 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 {
-            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 {
-            dev = isa_std_vga_init(isa_bus);
-        }
+    if (pci_bus) {
+        PCIDevice *pcidev = pci_vga_init(pci_bus);
+        dev = pcidev ? &pcidev->qdev : NULL;
+    } else if (isa_bus) {
+        ISADevice *isadev = isa_vga_init(isa_bus);
+        dev = isadev ? &isadev->qdev : NULL;
     }
-
     return dev;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 16/17] mips/r4k: use the new is_vga_init() function
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (14 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 15/17] pc: use the new pci_vga_init() and isa_vga_init() functions Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 17/17] vga: cleanup after isa_vga_init() and pci_vga_init() conversion Aurelien Jarno
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/mips_r4k.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 2115f7f..967a76e 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -281,7 +281,7 @@ void mips_r4k_init (ram_addr_t ram_size,
         }
     }
 
-    isa_std_vga_init(isa_bus);
+    isa_vga_init(isa_bus);
 
     if (nd_table[0].used)
         isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Qemu-devel] [PATCH v3 17/17] vga: cleanup after isa_vga_init() and pci_vga_init() conversion
  2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
                   ` (15 preceding siblings ...)
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 16/17] mips/r4k: use the new is_vga_init() function Aurelien Jarno
@ 2012-09-11 19:10 ` Aurelien Jarno
  16 siblings, 0 replies; 19+ messages in thread
From: Aurelien Jarno @ 2012-09-11 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Aurelien Jarno

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

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/cirrus_vga.c |    6 ------
 hw/pc.h         |   13 -------------
 hw/vga-pci.c    |    6 ------
 hw/vga-pci.h    |   12 ------------
 hw/vmware_vga.c |    1 -
 hw/vmware_vga.h |   15 ---------------
 sysemu.h        |    3 ---
 7 files changed, 56 deletions(-)
 delete mode 100644 hw/vga-pci.h
 delete mode 100644 hw/vmware_vga.h

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index e8dcc6b..5d1d42f 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -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);
diff --git a/hw/pc.h b/hw/pc.h
index 77c38d6..9923d96 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -176,19 +176,6 @@ enum vga_retrace_method {
 
 extern enum vga_retrace_method vga_retrace_method;
 
-static inline DeviceState *isa_std_vga_init(ISABus *bus)
-{
-    ISADevice *dev;
-
-    dev = isa_try_create(bus, "isa-vga");
-    if (!dev) {
-        fprintf(stderr, "Warning: isa-vga not available\n");
-        return NULL;
-    }
-    qdev_init_nofail(&dev->qdev);
-    return &dev->qdev;
-}
-
 int isa_vga_mm_init(target_phys_addr_t vram_base,
                     target_phys_addr_t ctrl_base, int it_shift,
                     MemoryRegion *address_space);
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 992ffd9..996d47f 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -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(),
diff --git a/hw/vga-pci.h b/hw/vga-pci.h
deleted file mode 100644
index d111cdc..0000000
--- a/hw/vga-pci.h
+++ /dev/null
@@ -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
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index b68e883..784a67b 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -25,7 +25,6 @@
 #include "loader.h"
 #include "console.h"
 #include "pci.h"
-#include "vmware_vga.h"
 
 #undef VERBOSE
 #define HW_RECT_ACCEL
diff --git a/hw/vmware_vga.h b/hw/vmware_vga.h
deleted file mode 100644
index 000fbdd..0000000
--- a/hw/vmware_vga.h
+++ /dev/null
@@ -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
diff --git a/sysemu.h b/sysemu.h
index 65552ac..c0ab3ed 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -105,10 +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;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init()
  2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init() Aurelien Jarno
@ 2012-09-12 16:54   ` Richard Henderson
  0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2012-09-12 16:54 UTC (permalink / raw)
  To: Aurelien Jarno
  Cc: Anthony Liguori, Andreas Färber, qemu-devel, David Gibson,
	Alexander Graf

On 09/11/2012 12:10 PM, Aurelien Jarno wrote:
> This better explains what is this function about. Adjust all callers.
> 
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Andreas Färber <andreas.faerber@web.de>
> Cc: David Gibson <david@gibson.dropbear.id.au>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> Acked-by: Blue Swirl <blauwirbel@gmail.com>
> Acked-by: Andreas Färber <andreas.faerber@web.de>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Acked-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-09-12 16:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 19:10 [Qemu-devel] [PATCH v3 00/17] Rework ISA/PCI video card initialization Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 01/17] vga: rename pci_vga_init() into pci_std_vga_init() Aurelien Jarno
2012-09-12 16:54   ` Richard Henderson
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 02/17] vga: rename isa_vga_init() to isa_std_vga_init() Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 03/17] vl.c: convert *vga_enabled functions to QOM Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 04/17] vl.c: check for qxl availability Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 05/17] vl.c: default to std if cirrus is not available Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 06/17] pci: add a pci_vga_init() function Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 07/17] isa: add a isa_vga_init() function Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 08/17] mips/malta: use the new pci_vga_init() function Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 09/17] alpha: " Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 10/17] ppc/newworld: " Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 11/17] ppc/oldworld: " Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 12/17] ppc/prep: " Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 13/17] ppc/pSeries: " Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 14/17] sun/sun4u: " Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 15/17] pc: use the new pci_vga_init() and isa_vga_init() functions Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 16/17] mips/r4k: use the new is_vga_init() function Aurelien Jarno
2012-09-11 19:10 ` [Qemu-devel] [PATCH v3 17/17] vga: cleanup after isa_vga_init() and pci_vga_init() conversion Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).