NixOS Host (Intel Meteor Lake/Arc): QEMU 3D Acceleration fails with VK_ERROR_INITIALIZATION_FAILED on Guest (Kali)

System Environment:

  • Hardware: Lenovo ThinkPad E14 Gen 6 (Intel Core Ultra / Meteor Lake)
  • GPU: Intel Arc Graphics (Integrated) [8086:7d45]
  • Host OS: NixOS Unstable
  • Guest OS: Kali Linux
  • Hypervisor: QEMU/KVM via Libvirt
  • Drivers: Host using xe driver (Kernel) and Mesa

The Problem:
I am trying to enable 3D acceleration for a Linux VM using the new Intel xe kernel driver. I cannot get hardware acceleration to work using either VirGL (OpenGL) or Venus (Vulkan). The guest always falls back to llvmpipe or fails to initialize the renderer.

What I have tried so far:

1. SR-IOV (Hardware Virtualization)
I attempted to use SR-IOV to pass a Virtual Function (VF) to the VM.

  • Config: Enabled intel_iommu=on, iommu=pt, xe.max_vfs=7 and udev rules.
  • Result: Failed. echo 1 > /sys/bus/pci/devices/.../sriov_numvfs returns Numerical result out of range.
  • Cause: The BIOS on this specific laptop locks the Aperture Size/Stolen Memory to 256MB, which is insufficient for the xe driver to create VFs. SR-IOV is effectively impossible on this hardware.

2. Driver Selection (i915 vs xe)

  • Tried forcing i915 (i915.force_probe=7d45). Same results
  • Currently using the xe driver (xe.force_probe=7d45), which is the recommended driver for this architecture.

3. Permissions & Paths

  • Running QEMU as root to rule out permission issues accessing /dev/dri/renderD128.
  • Added correct ACLs to cgroup_device_acl.
  • Explicitly set VK_ICD_FILENAMES to point to the Nix store path for intel_icd.x86_64.json.

Configuration Snippets:

Host configuration.nix:

boot.kernelParams = [
  "xe.force_probe=7d45"
  "i915.force_probe=!7d45"
  "intel_iommu=on" "iommu=pt"
];

virtualisation.libvirtd.qemu = {
  package = pkgs.qemu_full;
  runAsRoot = true; 
  verbatimConfig = ''
    user = "root"
    group = "root"
    cgroup_device_acl = [ "/dev/dri/renderD128", "/dev/dri/card0", "/dev/kvm" ]
    env = [
      "VK_ICD_FILENAMES=/run/opengl-driver/share/vulkan/icd.d/intel_icd.x86_64.json",
      "MESA_VK_IGNORE_CONFORMANCE_WARNING=1"
    ]
  '';
};

Guest XML

<graphics type='spice'>
  <listen type='none'/>
  <gl enable='yes' rendernode='/dev/dri/renderD128'/>
</graphics>
    <video>
  <model type='virtio' heads='1' primary='yes'>
    <acceleration accel3d='yes'/>
  </model>
  <driver blob='yes'/>
</video>

The Error: When I boot the Guest (Kali) and try to force Zink/Venus using export MESA_LOADER_DRIVER_OVERRIDE=zink, glxinfo -B fails with:

MESA: error: ZINK: vkEnumeratePhysicalDevices failed (VK_ERROR_INITIALIZATION_FAILED)
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
failed to load driver: zink

If I unset the Zink variables and try standard VirGL, it defaults to llvmpipe.

Question: Is there a specific configuration required to make the xe driver work with QEMU’s virtio-gpu (either GL or Vulkan) on NixOS? It seems the Guest cannot initialize the Vulkan instance on the Host despite correct paths and root permissions or have some i915 configuration (same problem with i915)