"Echo: write error: Invalid argument" when trying to enable Intel IGVT-g

Hi there, I’m trying once again to get some graphic speedup on a libvirt/vmmanager windows guest on my old but trusted XPS 15 9560.

I realized only yesterday that to have GPU passthrough I need to focus on the intel card as done on more recent models.

So I went on and followed the IGVT-g guide on the wiki adn what I got so far is this:

  virtualisation.kvmgt = {
    enable = true;
    vgpus = {
      "i915-GVTg_V5_4" = {
        uuid = ["62cfb2d8-e197-11ef-ad44-73fb055d41f"];
      };
    };
  };

  # other configuration for context, maybe I'm doing something wrong here
  programs.virt-manager.enable = true;
  environment.systemPackages = with pkgs; [
    virt-viewer
    spice
    spice-gtk
    spice-protocol
  ];
  services.spice-vdagentd.enable = true;
  virtualisation.spiceUSBRedirection.enable = true;
  virtualisation.libvirtd = {
    enable = true;
    qemu = {
      package = pkgs.qemu_kvm;
      runAsRoot = false;
      ovmf.enable = true;
      ovmf.packages = [pkgs.OVMFFull.fd];
    };
  };

The problem is that after the kvmgt service returns an error:

/nix/store/4fvc5fm8bszmkydng1ivrvr5cbvr1g60-bash-5.2p37/bin/bash: line 1: echo: write error: Invalid argument

to me the ExecStart command of the service seems fine:

/nix/store/4fvc5fm8bszmkydng1ivrvr5cbvr1g60-bash-5.2p37/bin/bash -c echo 62cfb2d8-e197-11ef-ad44-73fb055d41f > /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_4/create

(that path exists, and I can see “1” on available_instances)

The same error happens if I try to run it manually

sudo bash -c "echo 62cfb2d8-e197-11ef-ad44-73fb055d41f > /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/i91
5-GVTg_V5_4/create"
bash: line 1: echo: write error: Invalid argument

I also tried with the other available mdev type (lower resolution), but nothing changed.

I saw an issue in the intel gvt-linux repo, but that was fixed in 2017, so I don’t think that’s the case… Or did the staging modue never made to the kernel since then?