This document describes how to divide a physical Intel GPU device into multiple virtual devices referred to as
mediated devices, and how to assign these mediated devices to KVM virtual machines.
Setting up Intel vGPU devices
This feature is still under development, and may not work properly.
To set up Intel vGPU devices, you need to obtain and install the correct driver for your GPU device, then create mediated devices, and assign each mediated device to a virtual machine.
Before you begin
Download and install the i915 driver for the host. For more information, see https://01.org/igvt-g. For information on the guest drivers for Windows, see https://github.com/intel/gvt-linux/wiki/GVTg_Setup_Guide#42-windows-guest-setup.
Configuring the host
/etc/default/grubin a text editor.
Append the following to the
i915.enable_gvt=1. For example:
GRUB_CMDLINE_LINUX="rd.lvm.lv=vg_VolGroup00/LogVol01 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=vg_VolGroup_1/root vconsole.keymap=us $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rhgb quiet intel_iommu=on pci-stub.ids=10de:11fa i915.enable_gvt=1"
Regenerate boot loader configuration:
# grub2-mkconfig -o /etc/grub2.cfg
`/etc/dracut.conf.d/local.confin a text editor.
Set the line with:
Regenerate the initial ramdisk for the current kernel, then reboot:
# dracut --force --regenerate-all # reboot
Alternatively, if you need to use a prior supported kernel version with mediated devices, regenerate the initial ramdisk for all installed kernel versions:
# dracut --regenerate-all --force # reboot
Get a list of available mdev types by entering the following lines in the terminal:
for device in /sys/class/mdev_bus/; do for mdev_type in $device/mdev_supported_types/; do MDEV_TYPE=$(basename $mdev_type) DESCRIPTION=$(cat $mdev_type/description) NAME=$(cat $mdev_type/name) echo "mdev_type: $MDEV_TYPE --- description: $DESCRIPTION --- name: $NAME"; done; done | sort | uniq
Use this code in a script.
The output is as follows:
fence: 4 high_gm_size: 384MB high_gm_size: 512MB mdev_type: i915-GVTg_V5_4 --- description: low_gm_size: 128MB mdev_type: i915-GVTg_V5_8 --- description: low_gm_size: 64MB resolution: 1024x768 resolution: 1920x1200 weight: 2 weight: 4
In the Administration Portal, click. Select a virtual machine and click Edit. The Edit Virtual Machine dialog appears.
Click Custom Properties. If you don’t see Custom Properties, click Show Advanced Options.
In the Custom Properties dialog, click. If you don’t see Please select a key, click the + button.
In the text field that appears, enter the GPU type or types that you identified previously. For example: i915-GVTg_V5_8.You can add multiple vGPUs to a virtual machine using a comma-separated list. For example: i915-GVTg_V5_8,i915-GVTg_V5_8.
Multiple vGPUs must be the same mdev type. You can’t, for example use i915-GVTg_V5_4,i915-GVTg_V5_8.
You have finished installing and configuring the GPU on the host. Now you can proceed to install and configure the vGPU on each virtual machine.
Installing the guest driver
To install the vGPU driver on a Linux or Windows virtual machine:
Start the virtual machine using a serial console, such as SPICE or VNC.
Download the driver to the virtual machine. For information on getting the driver, see ???
Install the vGPU driver, following the instructions in ???
After the driver finishes installing reboot the machine. For Windows virtual machines, fully power off the guest from the Administration portal or the VM portal, not from within the guest operating system.
Windows only: Powering off the virtual machine from within the Windows guest operating system sometimes sends the virtual machine into hibernate mode, which does not completely clear the memory, possibly leading to subsequent problems. Using the Administration portal or the VM portal to power off the virtual machine forces it to fully clean the memory.
Start the virtual machine using a remote visualizer, such as Mechdyne TGX and verify that the vGPU is recognized by ??? For more information, see ??? Alternatively, on Windows, open the Windows Device Manager. The vGPU should appear under Display adapters.
Removing Intel vGPU devices
To change the configuration of assigned vGPU mediated devices, the existing devices have to be removed from the assigned guests.
To remove a mediated vGPU device, use the following command when the device is inactive, and replace
uuidwith the UUID of the device, for example
# echo 1 > /sys/bus/mdev/devices/
Note that attempting to remove a vGPU device that is currently in use by a VM triggers the following error:
echo: write error: Device or resource busy