Online Promoters™ :: Web Development made simple

XenServer: Use graphic card 3D in VM – Mapping the GPU to a VM

Mapping the GPU to a VM

This section explains how to use GPU Passthrough to assign a PCI graphics card to a guest operating system.

The following is a detailed step-by-step guide for XenServer, provided that your system meets the hardware and firmware requirements described above.

  • Enable IOMMU on the host.
    Edit “/boot/extlinux.conf” and add
    iommu=1 iommu_inclusive_mapping=1 
    right after all the instances of /boot/xen.gz
    As an example a line with those options looks like this:
    append /boot/xen.gz iommu=1 iommu_inclusive_mapping=1 com1=115200,8n1 console=com1,vga dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M --- /boot/vmlinuz-2.6-xen root=LABEL=root-rqrdbtjz ro console=tty0 xencons=hvc console=hvc0 --- /boot/initrd-2.6-xen.img
  • Regenerate the bootloader executing: extlinux /boot
  • Run the following command as root on the XenServer host:
    echo ‘modprobe pciback’ >> /etc/rc.local
  • Reboot the XenServer host:
    Check if 'pciback' module is loaded in dom0 using
    #lsmod | grep pciback
    If it is not loaded then use following command to load 'pciback'
    #modprobe pciback
    To verify if 'pciback' is successfully loaded use following command
    #lsmod | grep pciback

    It should show the output like below
    pciback     37768 0

  • Assign a PCI graphics card to a virtual machine. Get a list of PCI devices in the system executing lspci. You should see one or more devices like this: 
    02:00.0 VGA compatible controller: nVidia Corporation GT200GL [NVIDIA Quadro FX 3800] (rev a1)
  • Assign one of them to a virtual machine executing the following command: 
    xe vm-param-set other-config:pci=0/0000:02:00.0 uuid=uuid_of_the_VM

    where 02:00.0 is the PCI bus address of the graphics card you want to assign
    Use the command xe vm-list to get the uuid of the virtual machine.
  • Boot the virtual machine and install the correct driver for the new device. NVIDIA Display Adapter should be seen in Computer Management > Device Manager > Display Adapter which indicates that the GPU direct mapping is successful.
  • Install XenDesktop Virtual Desktop Agent followed by HDX 3D Pro Graphics on the virtual machine.