IGVT-g: Difference between revisions

From NixOS Wiki
imported>Gnidorah
No edit summary
imported>Gnidorah
No edit summary
Line 7: Line 7:
For client platforms, 5th, 6th or 7th Generation Intel® Core Processor Graphics is required. For server platforms, E3_v4, E3_v5 or E3_v6 Xeon Processor Graphics is required.
For client platforms, 5th, 6th or 7th Generation Intel® Core Processor Graphics is required. For server platforms, E3_v4, E3_v5 or E3_v6 Xeon Processor Graphics is required.


== NixOS configuration ==
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
  boot.kernelPackages = pkgs.linuxPackages_4_16;
  boot.kernelParams = [ "i915.enable_gvt=1" ];
  nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
    linux_4_16 = super.linux_4_16.override {
      extraConfig = ''
  # since 4.16-rc1
  DRM_I915_GVT y
  DRM_I915_GVT_KVMGT m
      '';
    };
  };
  environment.systemPackages = with pkgs; [
  virtmanager
  virt-viewer
  libossp_uuid
  ];
  virtualisation.libvirtd.enable = true;
  users.extraUsers.user.extraGroups = [ "libvirtd" ];
</nowiki>}}
== Create or destroy VGPU ==
== Create or destroy VGPU ==


Show mode information
Choose virtual GPU
 
<pre>
$ ls /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/
i915-GVTg_V5_4/  i915-GVTg_V5_8/
</pre>


<pre>
<pre>
Line 41: Line 25:
</pre>
</pre>


Create
Generate UUID


<pre>
<pre>
$ uuid
$ nix run nixpkgs.libossp_uuid -c uuid
a297db4a-f4c2-11e6-90f6-d3b88d6c9525
a297db4a-f4c2-11e6-90f6-d3b88d6c9525
# echo "a297db4a-f4c2-11e6-90f6-d3b88d6c9525" > "/sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_8/create"
</pre>
</pre>


Destroy
== NixOS configuration ==
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
<pre>
  boot.kernelPackages = pkgs.linuxPackages_4_16;
# echo 1 > /sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525/remove
  virtualisation.kvmgt.enable = true;
</pre>
  virtualisation.kvmgt.vgpus = {
    "i915-GVTg_V5_8" = {
      uuid = "a297db4a-f4c2-11e6-90f6-d3b88d6c9525";
    };
  };
  environment.systemPackages = with pkgs; [
  virtmanager
  virt-viewer
  ];
  virtualisation.libvirtd.enable = true;
  users.extraUsers.user.extraGroups = [ "libvirtd" ];
</nowiki>}}


== Configure KVM ==
== Configure KVM ==

Revision as of 18:24, 3 June 2018

Intel GVT-g is a full GPU virtualization solution with mediated pass-through which allows host and multiple guests to share same Intel integrated videocard. Guest gets a near-native graphics peformance.

Win7-32 / Win7-64 / Win8.1-64 /Win10-RS1-64 are validated.

Hardware Requirements

For client platforms, 5th, 6th or 7th Generation Intel® Core Processor Graphics is required. For server platforms, E3_v4, E3_v5 or E3_v6 Xeon Processor Graphics is required.

Create or destroy VGPU

Choose virtual GPU

$ ls /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/
i915-GVTg_V5_4/  i915-GVTg_V5_8/
$ cat /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_8/description 
low_gm_size: 64MB
high_gm_size: 384MB
fence: 4
resolution: 1024x768
weight: 2

Generate UUID

$ nix run nixpkgs.libossp_uuid -c uuid
a297db4a-f4c2-11e6-90f6-d3b88d6c9525

NixOS configuration

/etc/nixos/configuration.nix
  boot.kernelPackages = pkgs.linuxPackages_4_16;
  virtualisation.kvmgt.enable = true; 
  virtualisation.kvmgt.vgpus = {
    "i915-GVTg_V5_8" = {
      uuid = "a297db4a-f4c2-11e6-90f6-d3b88d6c9525";
    };
  };
  environment.systemPackages = with pkgs; [
  virtmanager
  virt-viewer
  ];
  virtualisation.libvirtd.enable = true;
  users.extraUsers.user.extraGroups = [ "libvirtd" ];

Configure KVM

Support for local display is present in Qemu 2.12.

Bare Qemu

  qemu-system-x86_64 \
     -enable-kvm \
     -m 1G \
     -nodefaults \
     -M graphics=off \
     -serial stdio \
     -display gtk,gl=on \
     -device vfio-pci,sysfsdev=/sys/bus/mdev/devices/a297db4a-f4c2-11e6-90f6-d3b88d6c9525,x-igd-opregion=on

libvirtd

If using virt-manager, create new or open existing VM.

sudo -E virsh edit win10

 <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
 <devices>
 <graphics type='spice'>
  <listen type='none'/>
  <gl enable='yes'/>
 </graphics>
 <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
  <source>
    <address uuid='a297db4a-f4c2-11e6-90f6-d3b88d6c9525'/>
  </source>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
 </hostdev>
 </devices>
  <qemu:commandline>
   <qemu:arg value='-set'/>
   <qemu:arg value='device.hostdev0.x-igd-opregion=on'/>
  </qemu:commandline>
 </domain>

Finally use sudo virt-viewer --attach win10

FAQ

  • No video output

Possible solutions

(libvirtd) Change main adapter type from QXL to say Cirrus

use BIOS (SeaBIOS) machine, UEFI (OVMF) is not supported

ensure that the recent Intel graphics driver is installed in the guest

  • (libvirtd) "Element domain has extra content: qemu:commandline" error after editing via virsh

you forgot to add xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'

  • (libvirtd) "no drm render node available" error in virt-manager

in virt-manager change SPICE display render node from auto to available one

  • "write_loop: No space left on device" error when creating mdev device

check dmesg output for gvt related error, most likely there is not enough VRAM

Used sources