Citrix XenServer - VGA passthrough

Page 1 / 5
  • Published on : 21 May 2016 at 09:19 UTC
  • By Lionel Eppe

With the Citrix XenServer virtualization server, it's possible to dedicate a real graphics card (GPU) to a virtual machine using the "VGA passthrough" technology.

This technology is present in the Xen project, whose official website is "xenproject.org" and you can find the Wiki (documentation) on "wiki.xenproject.org" and "wiki.xen.org".
You will find particularly interesting information on the "Xen VGA Passthrough" page of the Xen wiki.

However, even if this technology is interesting (especially to run AutoCAD or other graphics-intensive resources programs), be aware that its implementation is not easy.
Indeed, the VGA passthrough doesn't support any hardware (CPU, motherboard and graphics card).

  1. Presentation
  2. Required configuration
  3. Configuration used
  4. BIOS setup of the server
  5. Checking the activation of the IOMMU or Intel VT-d
  6. Checking the availability of graphics cards on the server
  7. Create a Windows 7 x64 Virtual Machine
  8. Installation of Windows 7
  9. Enable remote connection over Remote Desktop
  10. Assign a graphics card to your virtual machine
  11. NVIDIA graphics driver installation
  12. Bonus : NVIDIA GRID

1. Presentation

Why use this feature ?

If you want to use graphics-intensive applications resources, it's interesting to assign a graphics card of the server to a specific virtual machine. Thus, the machine remains isolated from the system (through virtualization of the machine), but it will have a direct access to the graphics card that can be assigned to this virtual machine.

The VGA passthrough will also allow you to use the "HDX 3D Pro Graphics" function of Citrix XenDesktop.

Note that the primary graphics card of the server can't be passed to a virtual machine using VGA passthrough.
To overcome this problem, you will need to force the use of the internal graphics card of the motherboard and add a graphics card into the server.
For this, see our tutorial : Force the use of the internal graphics card (Onboard VGA)

How to prevent attacks by DMA (direct memory access) via the graphics card passed in VGA passthrough ?

It's very simple, you only need to activate the IOMMU (or Intel VT-D) in the BIOS of your motherboard. This feature allows you to "remap" access to hardware and to the memory to limit access to the device associated with the virtual machine.

In summary, the virtual machine can use the graphics card, but she will not have access to the rest of the server hardware.
Note : IOMMU (Input-output memory management unit) handles I / O and MMU (memory management unit) handles memory access.

2. Required configuration

IOMMU or Intel VT-d is required to use the "VGA passthrough" ?

Yes, as indicated on the Citrix website, IOMMU (for AMD) or Intel VT-d (for Intel processors) must be enabled in the BIOS of your motherboard.
If the BIOS of your motherboard does not support IOMMU or Intel VT-d, VGA passthrough will be impossible.

Also, be aware that some BIOSes don't properly support the IOMMU or Intel VT-D. So, as indicated on the "Xen PCI Passthrough" page of Xen, this will force Xen to disable the I/O virtualization support.

Code : Plain Text

Citation :
Unfortunately there are many buggy BIOSes causing Xen to disable IO virtualization because of errors in the BIOS DMAR/ACPI tables. Xen tries to workaround these bugs in the BIOS, but sometimes it's not possible. Please report all the details about your hardware and software to xen-devel mailinglist if IO virtualization gets disabled due to buggy BIOS.

Which version of Xen should you use ?

As shown in the Xen wiki, Xen 4.0.0 is the first version to support the VGA passthrough.
In our case, we will use the 6.5 version of XenServer.

Which hardware should you use ?

Preferably, a hardware referenced on the Citrix XenServer Hardware Compatibility List website.

Which motherboard should you use ?

A motherboard that supports the CPU virtualization (Intel VT-x or AMD-V) and VT-d or IOMMU because its support is mandatory. Without this technology, you will not be able to boot a virtual machine with a graphics card passed in passthrough.
Also, make sure she has an internal graphics card to avoid having to use an Nvidia or ATI for the XenServer console.

Which graphics card should you use ?

Preferably, a graphics card present in one of these compatibility lists :

Which CPU should you use ?

Preferably, a processor present on the Citrix XenServer Hardware Compatibility List website.

Or, a processor supporting these technologies will also do the job :

  • the virtualization : Intel VT-x or AMD-V
  • and VT-d (Directed I/O) or IOMMU

Conclusion

The main difficulty for the VGA passthrough is the compatibility with your hardware (motherboard, graphics card (GPU) and CPU).

3. Configuration used

We have used our own computer to test the VGA passthrough. This configuration doesn't use components listed on the Citrix or Xen websites, but it has allowed us to deepen this subject and to reach almost to the end of its implementation.
If you follow this tutorial with a configuration compatible with the VGA passthrough, you will can probably do this until the end.

Here is our configuration :

  • CPU : Intel Core i5-4460
  • Motherboard : ASUS Z97-PRO ‏(Wi-Fi ac)
  • Graphics card : Asus GTX750TI

This motherboard provides the "Intel Virtualization Technology" and "VT-d" options in the BIOS.

The Intel's website indicates that our "Intel Core i5-4460" processor supports :
- The virtualization : Intel® Virtualization Technology (VT-x)
- The virtualization of input/outpout (I/O) : Intel® Virtualization Technology for Directed I/O (VT-d)

And he also has a "Intel® HD Graphics 4600" graphics processor.