]> xenbits.xensource.com Git - xenclient/ioemu.git/commitdiff
- Disable the cirrus graphic card when we passthrough a graphic card as a
authorJean Guyader <jean.guyader@eu.citrix.com>
Thu, 9 Oct 2008 16:52:23 +0000 (17:52 +0100)
committerVincent Hanquez <vincent@snarc.org>
Fri, 31 Oct 2008 12:10:55 +0000 (12:10 +0000)
    primary in the guest.

hw/pc.c

diff --git a/hw/pc.c b/hw/pc.c
index 656f755b1f7bcef772c7d6bf32e191b78ce6a855..bd5add73b105dd322afc888978d78b32eeb5464f 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -53,6 +53,8 @@ static PITState *pit;
 static IOAPICState *ioapic;
 static PCIDevice *i440fx_state;
 
+extern int vga_passthrough;
+
 static void xen_relocator_hook(target_phys_addr_t *prot_addr_upd,
                                uint16_t protocol,
                               const uint8_t header[], int kernel_size,
@@ -768,6 +770,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     BlockDriverState *fd[MAX_FD];
     int rc;
+    unsigned long vga_pt_enabled = vga_passthrough;
 
     if (ram_size >= 0xe0000000 ) {
         above_4g_mem_size = ram_size - 0xe0000000;
@@ -844,21 +847,24 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     }
 
     /* VGA BIOS load */
-    if (cirrus_vga_enabled) {
-        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
-    } else {
-        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
-    }
-    vga_bios_size = get_image_size(buf);
-    if (vga_bios_size <= 0 || vga_bios_size > 65536)
-        goto vga_bios_error;
-    vga_bios_offset = qemu_ram_alloc(65536);
-
-    ret = load_image_targphys(buf, vga_bios_offset, vga_bios_size);
-    if (ret != vga_bios_size) {
-    vga_bios_error:
-        fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
-        exit(1);
+    if (!vga_pt_enabled)
+    {
+            if (cirrus_vga_enabled) {
+                    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
+            } else {
+                    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
+            }
+            vga_bios_size = get_image_size(buf);
+            if (vga_bios_size <= 0 || vga_bios_size > 65536)
+                    goto vga_bios_error;
+            vga_bios_offset = qemu_ram_alloc(65536);
+
+            ret = load_image_targphys(buf, vga_bios_offset, vga_bios_size);
+            if (ret != vga_bios_size) {
+vga_bios_error:
+                    fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
+                    exit(1);
+            }
     }
 
     /* setup basic memory access */
@@ -931,29 +937,32 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
 
     register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
 
-    if (cirrus_vga_enabled) {
-        if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus,
-                                ds, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        } else {
-            isa_cirrus_vga_init(ds, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        }
-    } else if (vmsvga_enabled) {
-        if (pci_enabled)
-            pci_vmsvga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
-                            vga_ram_addr, vga_ram_size);
-        else
-            fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
-    } else {
-        if (pci_enabled) {
-            pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
-        } else {
-            isa_vga_init(ds, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
-        }
+    if (!vga_pt_enabled)
+    {
+            if (cirrus_vga_enabled) {
+                    if (pci_enabled) {
+                            pci_cirrus_vga_init(pci_bus,
+                                                ds, phys_ram_base + vga_ram_addr,
+                                                vga_ram_addr, vga_ram_size);
+                    } else {
+                            isa_cirrus_vga_init(ds, phys_ram_base + vga_ram_addr,
+                                                vga_ram_addr, vga_ram_size);
+                    }
+            } else if (vmsvga_enabled) {
+                    if (pci_enabled)
+                            pci_vmsvga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
+                                            vga_ram_addr, vga_ram_size);
+                    else
+                            fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
+            } else {
+                    if (pci_enabled) {
+                            pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
+                                         vga_ram_addr, vga_ram_size, 0, 0);
+                    } else {
+                            isa_vga_init(ds, phys_ram_base + vga_ram_addr,
+                                         vga_ram_addr, vga_ram_size);
+                    }
+            }
     }
 
 #ifdef CONFIG_PASSTHROUGH
@@ -965,7 +974,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
         rc = pt_init(pci_bus, direct_pci); 
         if ( rc < 0 )
         {
-            fprintf(logfile, "Error: Initialization failed for pass-through devices\n");
+            fprintf(stdout, "Error: Initialization failed for pass-through devices\n");
             exit(1);
         }
     }