[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 passthru:: graphics passthrough



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1251801376 -3600
# Node ID 05f3ca68f62ddad6145c8cd87bb11c5053e1b016
# Parent  a7de5bd776ca392f6059acd29771bddbcbc74ba1
x86 passthru:: graphics passthrough

This patch supports basic gfx passthrough on xen side:
  - add a VGA type for gfx passthrough, and get the size of VGA bios
  of passthrouged gfx in hvmloader
  - add a config option 'gfx_passthru' for gfx passthrough

Signed-off-by: Ben Lin <ben.y.lin@xxxxxxxxx>
Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx>
---
 tools/firmware/hvmloader/hvmloader.c |   11 +++++++++--
 tools/python/xen/xend/XendConfig.py  |    1 +
 tools/python/xen/xend/image.py       |    2 +-
 tools/python/xen/xm/create.py        |    7 ++++++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff -r a7de5bd776ca -r 05f3ca68f62d tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Sep 01 11:34:31 2009 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Tue Sep 01 11:36:16 2009 +0100
@@ -113,7 +113,7 @@ unsigned long pci_mem_start = PCI_MEM_ST
 unsigned long pci_mem_start = PCI_MEM_START;
 unsigned long pci_mem_end = PCI_MEM_END;
 
-static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
+static enum { VGA_none, VGA_std, VGA_cirrus, VGA_pt } virtual_vga = VGA_none;
 
 static void init_hypercalls(void)
 {
@@ -212,8 +212,10 @@ static void pci_setup(void)
         case 0x0300:
             if ( (vendor_id == 0x1234) && (device_id == 0x1111) )
                 virtual_vga = VGA_std;
-            if ( (vendor_id == 0x1013) && (device_id == 0xb8) )
+            else if ( (vendor_id == 0x1013) && (device_id == 0xb8) )
                 virtual_vga = VGA_cirrus;
+            else
+                virtual_vga = VGA_pt;
             break;
         case 0x0680:
             /* PIIX4 ACPI PM. Special device with special PCI config space. */
@@ -684,6 +686,11 @@ int main(void)
         memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
                vgabios_stdvga, sizeof(vgabios_stdvga));
         vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
+        break;
+    case VGA_pt:
+        printf("Loading VGABIOS of passthroughed gfx ...\n");
+        vgabios_sz =
+            round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
         break;
     default:
         printf("No emulated VGA adaptor ...\n");
diff -r a7de5bd776ca -r 05f3ca68f62d tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Tue Sep 01 11:34:31 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Tue Sep 01 11:36:16 2009 +0100
@@ -175,6 +175,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'pci_msitranslate': int,
     'pci_power_mgmt': int,
     'xen_platform_pci': int,
+    "gfx_passthru": int,
 }
 
 # Xen API console 'other_config' keys.
diff -r a7de5bd776ca -r 05f3ca68f62d tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Sep 01 11:34:31 2009 +0100
+++ b/tools/python/xen/xend/image.py    Tue Sep 01 11:36:16 2009 +0100
@@ -807,7 +807,7 @@ class HVMImageHandler(ImageHandler):
 
         dmargs = [ 'boot', 'fda', 'fdb', 'soundhw',
                    'localtime', 'serial', 'stdvga', 'isa',
-                   'acpi', 'usb', 'usbdevice' ]
+                   'acpi', 'usb', 'usbdevice', 'gfx_passthru' ]
 
         for a in dmargs:
             v = vmConfig['platform'].get(a)
diff -r a7de5bd776ca -r 05f3ca68f62d tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Tue Sep 01 11:34:31 2009 +0100
+++ b/tools/python/xen/xm/create.py     Tue Sep 01 11:36:16 2009 +0100
@@ -546,6 +546,10 @@ gopts.var('sdl', val='',
 gopts.var('sdl', val='',
           fn=set_value, default=None,
           use="""Should the device model use SDL?""")
+
+gopts.var('gfx_passthru', val='',
+          fn=set_value, default=None,
+          use="""Passthrough graphics card?""")
 
 gopts.var('opengl', val='',
           fn=set_value, default=None,
@@ -957,7 +961,8 @@ def configure_hvm(config_image, vals):
              'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
              'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
              'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate',
-             'vpt_align', 'pci_power_mgmt', 'xen_platform_pci' ]
+             'vpt_align', 'pci_power_mgmt', 'xen_platform_pci',
+             'gfx_passthru' ]
 
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.