From: Julian Pidancet julian.pidancet@citrix.com
The Intel gfx VGA option ROM on certain platforms requires the 155f50 BIOS function to be implemented (even if it does nothing), to work properly. This series of patch allow VGA passthrough on Xen to work on these platforms.
An example of these platform is the Dell Lattitude E6410 laptop, on which these patchs were tested.
Julian Pidancet (3): vgahooks: Allow usage of VGA hooks in the Xen case vgahooks: Register 155f vga hooks for Xen Intel passthrough devices vgahooks: Create 155f50 hook.
src/Kconfig | 2 +- src/optionroms.c | 9 +++++++++ src/vgahooks.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-)
From: Julian Pidancet julian.pidancet@citrix.com
This patch enables the VGAHOOKS config option if the BIOS is configured for Xen. In the Xen VGA passthrough case, the option ROM can be extracted from the physical device by hvmloader and pre-deployed for seabios. This patch also allows setting up VGA hooks in case the VGA option ROM is already deployed by hvmloader.
Signed-off-by: Julian Pidancet julian.pidancet@citrix.com --- src/Kconfig | 2 +- src/optionroms.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/Kconfig b/src/Kconfig index 4270014..9ea48bb 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -283,7 +283,7 @@ menu "BIOS interfaces" Support S3 resume handler.
config VGAHOOKS - depends on COREBOOT + depends on COREBOOT || XEN bool "Hardware specific VGA helpers" default y help diff --git a/src/optionroms.c b/src/optionroms.c index 27cfffd..62de40e 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -427,6 +427,15 @@ vga_setup(void) ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
if (CONFIG_OPTIONROMS_DEPLOYED) { + /* Setup VGA hooks */ + struct pci_device *pci; + foreachpci(pci) { + if (!is_pci_vga(pci)) + continue; + vgahook_setup(pci); + break; + } + // Option roms are already deployed on the system. init_optionrom((void*)BUILD_ROM_START, 0, 1); } else {
From: Julian Pidancet julian.pidancet@citrix.com
Some Intel VGA option ROMs require some 155f hooks implemented in the BIOS.
Signed-off-by: Julian Pidancet julian.pidancet@citrix.com --- src/vgahooks.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/vgahooks.c b/src/vgahooks.c index a8f667c..ca12e31 100644 --- a/src/vgahooks.c +++ b/src/vgahooks.c @@ -11,6 +11,7 @@ #include "pci_ids.h" // PCI_VENDOR_ID_VIA #include "util.h" // handle_155f #include "config.h" // CONFIG_* +#include "xen.h" // usingXen
#define VH_VIA 1 #define VH_INTEL 2 @@ -228,6 +229,15 @@ getac_setup(struct pci_device *pci) { }
+static void +xen_vgapt_setup(struct pci_device *pci) +{ + if (pci->vendor == 0x8086 && pci->class == 0x300) { + VGAHookHandlerType = VH_INTEL; + IntelDisplayType = BOOT_DISPLAY_DEFAULT; + IntelDisplayId = 3; + } +}
/**************************************************************** * Entry and setup @@ -254,7 +264,15 @@ handle_155f(struct bregs *regs) void vgahook_setup(struct pci_device *pci) { - if (!CONFIG_VGAHOOKS || !CBvendor || !CBpart) + if (!CONFIG_VGAHOOKS) + return; + + if (usingXen()) { + xen_vgapt_setup(pci); + return; + } + + if (!CBvendor || !CBpart) return;
if (strcmp(CBvendor, "KONTRON") == 0 && strcmp(CBpart, "986LCD-M") == 0)
From: Julian Pidancet julian.pidancet@citrix.com
This patch adds a 155f50 hook which is mandatory for VGA option ROM to work on some platforms. This allows an Intel GFX device to be passed through to a Xen VM on some laptops using a Dell BIOS (Tested successfully on a Dell Lattitude E6410 laptop).
Signed-off-by: Julian Pidancet julian.pidancet@citrix.com --- src/vgahooks.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/vgahooks.c b/src/vgahooks.c index ca12e31..3ae50e5 100644 --- a/src/vgahooks.c +++ b/src/vgahooks.c @@ -187,11 +187,20 @@ intel_155f40(struct bregs *regs) }
static void +intel_155f50(struct bregs *regs) +{ + /* Mandatory hook on some Dell laptops */ + regs->ax = 0x005f; + set_success(regs); +} + +static void intel_155f(struct bregs *regs) { switch (regs->al) { case 0x35: intel_155f35(regs); break; case 0x40: intel_155f40(regs); break; + case 0x50: intel_155f50(regs); break; default: handle_155fXX(regs); break; } }