IGVT-g: Difference between revisions

From NixOS Wiki
imported>Gnidorah
No edit summary
imported>Gnidorah
No edit summary
Line 97: Line 97:
   </qemu:commandline>
   </qemu:commandline>
  </domain>
  </domain>
 
</nowiki>}}
Finally use sudo virt-viewer --attach '''win10'''
Finally use sudo virt-viewer --attach '''win10'''

Revision as of 19:30, 9 May 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. Install recent Intel driver into the guest.

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.

NixOS configuration

/etc/nixos/configuration.nix
  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" ];

Create or destroy VGPU

Show mode information

$ 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

Create

# uuid
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"

Destroy

# echo 1 > /sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525/remove

Configure KVM

Support for local display is present in Qemu 2.12. Only BIOS (SeaBIOS) machine is supported, UEFI (OVMF) is not supported.

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. Its impossible to remove primary QXL videocard, but it will conflict, so change it to Cirrus.

sudo -E virsh edit '''win10'''
 &lt;domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0&gt;
 &lt;!-- ... --&gt;
 &lt;devices&gt;
 &lt;!-- ... --&gt;
 &lt;graphics type='spice'&gt;
  &lt;listen type='none'/&gt;
  &lt;!-- choose renderer via virt-manager --&gt;
  &lt;gl enable='yes'/&gt;
 &lt;/graphics&gt;
 &lt;hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'&gt;
  &lt;source&gt;
    &lt;address uuid='a297db4a-f4c2-11e6-90f6-d3b88d6c9525'/&gt;
  &lt;/source&gt;
  &lt;!-- assign to first available slot --&gt;
  &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/&gt;
 &lt;/hostdev&gt;
 &lt;/devices&gt;
  &lt;qemu:commandline&gt;
   &lt;qemu:arg value='-set'/&gt;
   &lt;qemu:arg value='device.hostdev0.x-igd-opregion=on'/&gt;
  &lt;/qemu:commandline&gt;
 &lt;/domain&gt;

Finally use sudo virt-viewer --attach win10