How to Set Up Intel® Media Server Studio with VT-d Virtualization

Intel® Graphics Virtualization Technology (Intel® GVT) is an extension of Intel® Virtualization Technology (Intel® VT) for Directed I/O (Intel® VT-d) that provides hardware accelerated I/O virtualization support for Intel® HD graphics - it is one of the GPU virtualization solutions. Intel GVT allows the Virtual Machine (VM) to call a GPU function via I/O.

Only "-d" (direct or "passthrough") virtualization is supported.  This means only one VM can use the GPU at a given time.  However, other VMs can perform any work that does not require the GPU.

For more information on general graphics (not Media SDK or OpenCL) access the GPU, see Intel GVT and KVMGT.


Host: The actual machine on which the virtualization takes place. Install the Intel Media Server Studio generic package on this system.
VM: Virtual Machine is an emulation of a particular computer system. Install the Intel Media Server Studio gold configuration on this system.
Remote OS: The OS for accessing the host and VM from a remote system

The following steps provide the methodology to enable Media Server Studio on an Intel VT-d environment. This includes the Host and VM installation, and verification of the installation.

1. Setting up the Host

1.0 Hardware Requirements

  • HOST: You will need a CPU that supports Intel® Media Server Studio. You can find the specifications in the Release Notes for Linux* here. In addition, ensure the CPU supports Intel VT-d: go to and search on your CPU mode as the keyword. In this article, we use the GIGABYTE* GB-BXi7-4770R as the HOST machine.
  • REMOTE OS: To access the HOST machine remotely, you can install either Microsoft* Windows* or Linux*. In this article, we use PuTTY on a Windows 8.1 system to access the Host from the Remote OS

1.1 Setting the BIOS on the Host

The following settings should be enabled on the BIOS: - VT-d options in BIOS - legacy boot up options (Setting UEFI boot option may cause VM boot failure)

1.2 Setting up the Host OS

1.Setup in "Server with GUI" mode

During installation of CentOS* 7.1, modify the "Software Selection" from the default "Base Environment" to "Server with GUI".

2. Setup proxy if your host is under proxy server

Add following line to /etc/yum.conf

3. If under a proxy, set up environment variables for wget

Add the following lines to ~/.bashrc to get wget access:
export http_proxy=proxy-server-ip:proxy-port
export https_proxy=proxy-server-ip:proxy-port
export ftp_proxy=proxy-server-ip:proxy-port

4. Install prerequisites/package dependencies:

# yum groupinstall "Development Tools"
# yum install -y uuid-c++-devel lzo-devel gcc gcc-c++ git patch texinfo python-devel acpica-tools libuuid-devel ncurses-devel glib2 glib2-devel libaio-devel openssl-devel yajl-devel glibc-devel glibc-devel.i686 pixman-devel libpciaccess-devel pciutils-devel pciutils-devel-static pciutils-libs
# yum install -y tigervnc tigervnc-server SDL.i686 bridge-utils
# wget
# rpm -Uvh dev86-0.16.17-15.1.el6.x86_64.rpm

2. Setup Dom0

2.1 Install Intel® Media Server Studio Generic Package

1. user mode driver and components installation

(For more information please see the Intel Media Server Studio getting started guide.)

$ mkdir driver-setup
$ tar xf SDK*/Generic/intel-linux-media-ocl_generic*.tar.gz -C driver-setup
$ cd driver-setup
(as root)
# ./
# reboot

2. kernel mode driver (KMD) installation

Follow these steps when installing as regular user:

$ wget
$ tar -xJf linux-3.14.5.tar.xz
$ cp  /opt/intel/mediasdk/opensource/patches/kmd/3.14.5/intel-kernel-patches.tar.bz2 .
$ tar -xvjf intel-kernel-patches.tar.bz2
$ cd linux-3.14.5
$ for i in ../intel-kernel-patches/*.patch; do patch -p1 < $i; done
$ cp config-3.14.5-VTd.txt .config  ## refer note for config-3.14.5-VTd.txt
$ make -j 8
(as root)
# make modules_install
# make install
# grub2-mkconfig –o /boot/grub2/grub.cfg
# reboot      ## ==> new kernel 3.14.5

2.2 Setup Dom0 on Xen

1. Build Xen from Source

$ git clone git://
$ cd xen
$ git checkout -b FOR-4.5.0 RELEASE-4.5.0
$ ./configure
$ make dist
(as root)
# make install

2. Setup Xen daemon and dynamic libraries

(as root)
# chkconfig --level 35 xencommons on
# chkconfig --level 35 xendomains on

# cd /etc/
# cat > libxen-x86_64.conf << EOF
# ldconfig -v
# reboot

3. Configuring Grub

a) Edit /etc/grub.d/40_custom, and copy new kernel boot entry from /boot/grub2/grub.cfg.

exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'CentOS Linux 7 (Core), with Linux 3.14.5-MSSr6+' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.14.5-MSSr6+-advanced-62f16e28-adcb-4a47-925a-f4813854416f' {
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos3'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3'  62f16e28-adcb-4a47-925a-f4813854416f
      search --no-floppy --fs-uuid --set=root 62f16e28-adcb-4a47-925a-f4813854416f
    linux16 /boot/vmlinuz-3.14.5-MSSr6+ root=UUID=62f16e28-adcb-4a47-925a-f4813854416f ro crashkernel=auto rhgb quiet
    initrd16 /boot/initramfs-3.14.5-MSSr6+.img

b) Insert line as below to set up dom0 memory and virtual CPU core allocation

multiboot /boot/xen.gz dom0_mem=2048M iommu=1 dom0_max_vcpus=2 dom0_vcpus_pin=1

c) Replace "linux16" and "initrd16" with "module", as shown below

menuentry 'CentOS Linux 7 (Core), with Linux 3.14.5-MSSr6+ Xen Hypervisor' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.14.5-MSSr6+-advanced-62f16e28-adcb-4a47-925a-f4813854416f' {
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos3'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3'  62f16e28-adcb-4a47-925a-f4813854416f
      search --no-floppy --fs-uuid --set=root 62f16e28-adcb-4a47-925a-f4813854416f

    multiboot /boot/xen.gz dom0_mem=2048M iommu=1 dom0_max_vcpus=8 dom0_vcpus_pin=1
    module /boot/vmlinuz-3.14.5-MSSr6+ root=UUID=62f16e28-adcb-4a47-925a-f4813854416f ro crashkernel=auto rhgb quiet
    module /boot/initramfs-3.14.5-MSSr6+.img

d) Update grub menu

(as root)
# grub2-mkconfig -o /boot/grub2/grub.cfg

e) Reboot and select 'CentOS Linux 7 (Core), with Linux 3.14.5-MSSr6+ Xen Hypervisor' in grub menu.

(as root)
# reboot

4. Check Xen environment

$ lsmod | grep xen
xen_pciback            55503  0
xen_netback            36536  0
xen_blkback            37265  0
xen_gntalloc           13626  0
xen_gntdev             18675  2
xen_evtchn             13033  1
xenfs                  12978  1
xen_privcmd            13243  4 xenfs

(as root)
# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  7852     8     r-----      54.4

# xl info
host                   : centos71.hsw.zhou
release                : 3.14.5-MSSr6+
version                : #1 SMP Tue Sep 1 13:36:53 CST 2015
machine                : x86_64

2.3 Check MediaSDK Function on Dom0

$ DISPLAY=:0.0 vainfo
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.35 (libva 1.3.1)
vainfo: Driver version:
vainfo: Supported profile and entrypoints

$ ./sample_multi_transcode_drm -hw -i::h264 input.h264 -o::h264 output.h264 -angle 180 -opencl
$ ./sample_encode_drm h264  -hw -i test.yuv -o test.h264 -w 720 -h 480 -la -lad 20

CAUTION: If you run media functions on dom0 and Dom0 is down for some reason, this will cause all VMs to fail.

3. Setup DomU

1. Start Host with "Linux 3.14.5-MSSr6+ Xen Hypervisor" menu entry

2. Create and set virtual xenbr0

a) Search the following file name: /etc/sysconfig/network-scripts/ifcfg- b) Enable Xenbr0

(as root)
# <NIC> xenbr0        ## refer to 7.1

c) Verify xenbr0

$ ifconfig xenbr0
xenbr0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        ether fc:aa:14:db:cf:0d  txqueuelen 0  (Ethernet)
        RX packets 136  bytes 14838 (14.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47  bytes 9236 (9.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3. Create a virtual machine

a) Create a virtual hard disk image

# dd if=/dev/zero of=./image30g.img seek=10000 bs=3M count=1

b) Create a VM configuration file - an example can be found at /etc/xen/xlexample.hvm

$ cat centos71-no-vtd.hvm
kernel = "hvmloader"
builder = 'hvm'
memory = 3072
vcpus = 6
cpus = "4,5,6,7"
name = "centos-vm1"
vif = [ 'mac=fc:aa:14:db:cf:4e, bridge=xenbr0, model=e1000' ]
disk = [ 'file:/home/lmsdk/setup-vtd/vm/image30g.img,hda,w', 'file:/home/lmsdk/setup-vtd/vm/CentOS-7-x86_64-DVD-1503-01.iso,hdc:cdrom,r' ]

c) Start the VM OS and setup CentOS 7.1

(as root)
# xl create centos71-no-vtd.hvm
# vncviewer :0   # input password (intel123) setting in VM configure file 

While installation, in "Software" – "Software Selection" – "Base Environment", choose "Server with GUI". d) Setup Intel Media Server Studio R6 with Gold configuration. Refer CentOS 7.1 Gold setup in media_server_studio_getting_started_guide.pdf e) Close the VM, without testing media functions

(as root)
# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  2048     8     r-----     977.1
centos-vm1                                   3  3072     6     -b----      39.8

# xl dest 3

4. Set VGA PCI to pass-through

1. Login to the host with putty and make sure the host has login X window

2. Set VGA PCI pass-through on the ssh client

(as root)
# xl pci-assignable-add 0000:00:02.0@1c,msitranslate=1
# xl pci-assignable-list

3. Modify the VM configuration to use Intel® GVT

$ cat centos71.hvm
kernel = "hvmloader"
builder = 'hvm'
memory = 2048
vcpus = 2
cpus = ["4", "5"]
name = "centos-vm1"
vif = [ 'mac=fc:aa:14:db:cf:4e, bridge=xenbr0, model=e1000' ]
disk = [ 'file:image30g.img,hda,w', 'file:CentOS-7-x86_64-DVD-1503-01.iso,hdc:cdrom,r' ]

4. Boot up VM with Intel® GVT

(as root)
# xl create centos71.hvm

5. Verify Intel® GVT on VM

1. Verify graphics PCI device

$ lspci –nn | grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:0d22] (rev 08)

2. See "Verify correct installation" section in Intel Media Server Studio R6 Getting Started Guide to ensure Intel Media Server Studio works on the VM with a root user.

3. Verify that OpenCL and look-ahead bit-rate control work on VM

(as root)
# DISPLAY=:0.0 ./sample_multi_transcode_drm -hw -i::h264 test.h264 -o::h264 output.h264 -angle 180 -opencl
# DISPLAY=:0.0 ./sample_encode_drm h264  -hw -i test.yuv -o test-la-out.h264 -w 720 -h 480 -la -lad 20

6. Script to set up Intel® GVT

1. Run to set up a virtual network bridge

if [ $# != 2 ] ; then
    echo "Usage: `basename $0`  "
    echo "       NIC: find it via ifconfig"
    echo "       BRIDGE: xenbr0 or br0"
    exit 1;


ifconfig $eth0 down                         # close eth0 first
brctl addbr $br0                            # add virtual bridge br0
brctl addif $br0 $eth0                      # add interface eth0 on br0
brctl stp $br0 off                          # only on bridge, so close generate tree protocol
brctl setfd $br0 1                          # set br0 delay time of forward
brctl sethello $br0 1                       # set br0 hello time
ifconfig $br0 promisc up            # open br0
ifconfig $eth0 promisc up           # open eth0
dhclient $br0                               # br0 get IP address from DHCP server
brctl show $br0                             # show virtual bridge list
brctl showstp $br0                          # show interface information on br0

7. Troubleshooting

The following articles and resources may help you work around installation issues

Иконка простого текстового файла config-3.14.5-VTd.txt162.35 КБ
Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.
Возможность комментирования русскоязычного контента была отключена. Узнать подробнее.