Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Run Windows in a VM with GPU Acceleration on Arch Linux

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide shows you how to run a Windows virtual machine with GPU acceleration on Arch Linux, giving you near-native graphics performance for gaming, 3D rendering, or CUDA workloads. You'll pass a dedicated GPU (or an iGPU) directly to the VM using VFIO (Virtual Function I/O). This requires a motherboard and CPU that support IOMMU (Intel VT-d or AMD-Vi), a spare GPU (or integrated graphics) for the host, and a bit of patience. You'll also need to install QEMU, libvirt, and virt-manager, and edit your bootloader and kernel parameters.

What You'll Need

  • A CPU with IOMMU support (Intel VT-d or AMD-Vi) and a motherboard that enables it in BIOS/UEFI.
  • Two GPUs: one for the Linux host (can be integrated graphics) and one to pass through to Windows.
  • At least 16 GB of RAM (more is better for gaming).
  • A Windows installation ISO and, optionally, virtio drivers for better disk/network performance.
  • Arch Linux installed with a bootloader (GRUB or systemd-boot) and root access.

Step-by-Step

  1. Enable IOMMU in BIOS/UEFI. Reboot your PC, enter the firmware settings, and look for “VT-d” (Intel) or “SVM”/“IOMMU” (AMD). Enable it. Also enable “Above 4G Decoding” if available (often needed for PCIe passthrough). Save and reboot.
  2. Identify your GPUs. Run lspci -nnk | grep -A 3 -E "VGA|3D" to list your graphics devices and their vendor/device IDs. Note the IDs (like 10de:1b81 for a GTX 1080) for the GPU you want to pass through.
  3. Add kernel parameters. Edit your bootloader configuration to add IOMMU support. For GRUB, edit /etc/default/grub and add to GRUB_CMDLINE_LINUX_DEFAULT: intel_iommu=on iommu=pt (Intel) or amd_iommu=on iommu=pt (AMD). Also add vfio-pci.ids=XXXX:XXXX,YYYY:YYYY replacing with your GPU's vendor:device IDs. Then run grub-mkconfig -o /boot/grub/grub.cfg. For systemd-boot, edit /boot/loader/entries/arch.conf and append the same parameters to the options line.
  4. Load VFIO modules early. Create /etc/modprobe.d/vfio.conf with: options vfio-pci ids=XXXX:XXXX,YYYY:YYYY. Then edit /etc/mkinitcpio.conf and add vfio_pci, vfio, vfio_iommu_type1 to the MODULES array (before the GPU driver modules). Rebuild the initramfs with mkinitcpio -P.
  5. Reboot and verify. Run dmesg | grep -i vfio to confirm the GPU is bound to vfio-pci. You can also check lspci -nnk -s 01:00.0 (replace with your GPU's PCI address) and look for “Kernel driver in use: vfio-pci”.
  6. Install virtualization packages. Run sudo pacman -S qemu-full libvirt virt-manager ovmf dnsmasq edk2-ovmf. Also install iptables-nft if not present (libvirt needs it).
  7. Enable and start libvirt. Run sudo systemctl enable --now libvirtd. Add your user to the libvirt group: sudo usermod -aG libvirt $(whoami). Log out and back in.
  8. Create a VM in virt-manager. Open virt-manager, click “Create a new virtual machine”. Choose “Local install media”, browse to your Windows ISO, and select “Windows 10” or “Windows 11” as the OS type. Allocate at least 4 CPU cores and 8 GB RAM (more if you have it). Enable “Customize configuration before install” on the final step.
  9. Configure the VM for UEFI. In the customization window, under “Overview”, set the firmware to “UEFI x86_64: /usr/share/edk2-ovmf/x64/OVMF_CODE.fd”. Under “CPUs”, set the CPU model to “host-passthrough” and check “Copy host CPU configuration”.
  10. Add the GPU as a PCI host device. Click “Add Hardware” → “PCI Host Device”. Select your GPU (the one you bound to vfio-pci). Do the same for its audio function (if any) and any USB controllers you want to pass through (like a keyboard/mouse).
  11. Remove the default virtual display. Under “Video”, delete the default “VGA” device. Also remove the default “QXL” display if present. This is necessary because the GPU will take over display output.
  12. Add a virtio disk and network. Under “Disk”, change the bus to “VirtIO”. Under “NIC”, change the model to “virtio”. This improves performance but requires virtio drivers in Windows.
  13. Boot the VM and install Windows. Start the VM. If you see a black screen, that's normal—the GPU is outputting to your monitor. Connect a monitor to the passed-through GPU. Install Windows normally. When Windows asks for disk drivers, load the virtio drivers from the ISO you downloaded.
  14. Install virtio drivers in Windows. After Windows is installed, mount the virtio ISO inside the VM and run the installer for all components (balloon, netkvm, viostor, etc.).
  15. Install GPU drivers. Download and install the latest drivers for your passed-through GPU from NVIDIA or AMD. Reboot the VM.

Common Mistakes

  • Forgetting to enable IOMMU in BIOS – the VM won't start or the GPU won't pass through.
  • Not adding the GPU's audio function to the passthrough list, causing audio issues.
  • Using the same GPU for both host and guest – you need a dedicated GPU for the VM.
  • Not removing the virtual display – Windows may use the virtual GPU instead of the real one.
  • Not using UEFI firmware – some GPUs (especially newer ones) require UEFI to work properly.

Tips

  • Use a separate monitor for the VM or switch inputs on your monitor to see the Windows display.
  • For better performance, pin CPU cores to the VM using taskset or libvirt's CPU pinning feature.
  • Consider using lookup for the CPU model for better compatibility.
  • If you have an NVIDIA GPU, you may need to add options vfio-pci ids=... disable_vga=1 to avoid conflicts.

Troubleshooting

  • VM won't start with an error about IOMMU. Recheck your kernel parameters and ensure IOMMU is enabled in BIOS.
  • Black screen on the passed-through GPU. Make sure the GPU is bound to vfio-pci (check lspci -nnk). Also try adding video=efifb:off to the kernel parameters to disable the efifb framebuffer.
  • Windows BSOD with “INACCESSIBLE_BOOT_DEVICE”. This usually means the virtio disk driver isn't loaded. Boot from the Windows ISO, press Shift+F10 to open a command prompt, and use drvload to load the viostor driver from the virtio ISO, then retry.
  • GPU shows as “Microsoft Basic Display Adapter”. Install the correct GPU drivers from NVIDIA/AMD.
  • Audio doesn't work. Pass through the GPU's audio function (look for a separate PCI device with “Audio” in its name). You may also need to set the audio device in virt-manager to “ich9-intel-hda”.
  • Host freezes on VM start. This often happens when the host's GPU driver tries to claim the passed-through GPU. Ensure vfio-pci is loaded before the GPU driver (check mkinitcpio order).

Frequently Asked Questions

Can I use the same GPU for both host and Windows?

No, you need a separate GPU for the host. Passing through the only GPU would leave the host without a display.

Will this work with an AMD GPU?

Yes, AMD GPUs generally work well with VFIO. Some older NVIDIA GPUs have issues with reset bugs, but modern ones are fine.

Do I need a second monitor?

Not necessarily. You can use your main monitor and switch inputs, or use a KVM switch. But a dedicated monitor is simpler.

Can I pass through a USB controller instead of individual devices?

Yes, passing through a USB controller gives better compatibility and performance. Look for a PCI device with “USB” in its name.

Is it possible to run Windows 11 with this setup?

Yes, but you'll need to enable TPM 2.0 in the VM settings (add a TPM device) and ensure your CPU supports it.

Will GPU acceleration work for gaming?

Yes, with proper passthrough, you get near-native performance. Most games run at 90-100% of bare-metal speed.