2026-04-01 08:32:50 +00:00
|
|
|
# Windows VM with GPU Passthrough
|
|
|
|
|
|
2026-04-01 08:33:23 +00:00
|
|
|
- [[Linux Host Setup|Linux/Guides/GPU Passthrough/Host]]
|
|
|
|
|
- [[Windows VM Setup|Linux/Guides/GPU Passthrough/VM]]
|
2026-04-01 08:32:50 +00:00
|
|
|
|
2026-03-26 06:38:29 +00:00
|
|
|
|
|
|
|
|
## Enable IOMMU
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo vim /etc/default/grub
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Add amd_iommu=on iommu=pt
|
|
|
|
|
|
|
|
|
|
`GRUB_CMDLINE_LINUX_DEFAULT="... amd_iommu=on iommu=pt"`
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
|
|
|
|
sudo reboot
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Verify
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo dmesg | grep -i iommu
|
|
|
|
|
```
|
2026-03-26 06:38:56 +00:00
|
|
|
|
2026-03-26 06:39:13 +00:00
|
|
|
## Find GPU IDs
|
|
|
|
|
|
2026-03-26 06:38:56 +00:00
|
|
|
```bash
|
|
|
|
|
lspci -nn | grep -E "VGA|Audio"
|
|
|
|
|
```
|
2026-04-01 07:41:02 +00:00
|
|
|
|
|
|
|
|
In my case, I get
|
|
|
|
|
|
|
|
|
|
- `10de:28a0`
|
|
|
|
|
- `10de:22be`
|
|
|
|
|
|
|
|
|
|
## VFIO Module Options
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo vim /etc/modprobe.d/vfio.conf
|
|
|
|
|
```
|
|
|
|
|
|
2026-04-01 08:18:13 +00:00
|
|
|
> ### Arch
|
|
|
|
|
> ```bash
|
|
|
|
|
> options vfio-pci ids=10de:28a0,10de:22be
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
> ### Fedora
|
|
|
|
|
> ```bash
|
|
|
|
|
> options vfio-pci ids=10de:28a0,10de:22be disable_vga=1
|
|
|
|
|
> softdep nvidia pre: vfio-pci
|
|
|
|
|
> softdep nouveau pre: vfio-pci
|
|
|
|
|
> ```
|
2026-04-01 07:44:46 +00:00
|
|
|
|
|
|
|
|
## Blacklist GPU
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo vim /etc/modprobe.d/blacklist-gpu.conf
|
|
|
|
|
```
|
|
|
|
|
|
2026-04-01 08:18:13 +00:00
|
|
|
> ### Arch
|
|
|
|
|
> ```
|
|
|
|
|
> blacklist nouveau
|
|
|
|
|
> blacklist nvidia
|
|
|
|
|
> blacklist nvidia_drm
|
|
|
|
|
> blacklist nvidia_modeset
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
> ### Fedora
|
|
|
|
|
> ```
|
|
|
|
|
> blacklist nouveau
|
|
|
|
|
> blacklist nvidia
|
|
|
|
|
> blacklist nvidia_drm
|
|
|
|
|
> blacklist nvidia_modeset
|
|
|
|
|
> blacklist nvidia_uvm
|
|
|
|
|
> blacklist rivafb
|
|
|
|
|
> blacklist nvidiafb
|
|
|
|
|
> blacklist snd_hda_intel
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
## Load VFIO
|
|
|
|
|
|
|
|
|
|
> ### Arch
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo vim /etc/mkinitcpio.conf
|
|
|
|
|
> ```
|
|
|
|
|
> ```
|
|
|
|
|
> MODULES=(vfio vfio_iommu_type1 vfio_pci)
|
|
|
|
|
> ```
|
|
|
|
|
> ```
|
|
|
|
|
> sudo mkinitcpio -P
|
|
|
|
|
> sudo reboot
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
> ### Fedora
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo vim /etc/dracut.conf.d/10-vfio.conf
|
|
|
|
|
> ```
|
|
|
|
|
> ```
|
|
|
|
|
> force_drivers+=" vfio vfio_iommu_type1 vfio_pci "
|
|
|
|
|
> ```
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo dracut -f
|
|
|
|
|
> ```
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo reboot
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
### Confirm Kernel Driver
|
2026-04-01 07:44:46 +00:00
|
|
|
|
2026-04-01 08:18:13 +00:00
|
|
|
```bash
|
|
|
|
|
lspci -nnk -d 10de:28a0
|
2026-04-01 07:44:46 +00:00
|
|
|
```
|
2026-04-01 08:18:13 +00:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
lspci -nnk -d 10de:22be
|
2026-04-01 07:44:46 +00:00
|
|
|
```
|
|
|
|
|
|
2026-04-01 08:18:13 +00:00
|
|
|
## Install Virtualization Stack
|
2026-04-01 07:44:46 +00:00
|
|
|
|
2026-04-01 08:18:13 +00:00
|
|
|
> ### Arch
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo pacman -S --needed virt-manager qemu-full libvirt dnsmasq ovmf swtpm
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
> ### Fedora
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo dnf install @virtualization virt-manager qemu-kvm libvirt-daemon-config-network libvirt-daemon-kvm bridge-utils edk2-ovmf swtpm
|
|
|
|
|
> ```
|
2026-04-01 08:28:58 +00:00
|
|
|
|
|
|
|
|
## User Groups and Permissions
|
|
|
|
|
|
|
|
|
|
> ### Arch
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo usermod -aG libvirt,kvm,input,render,libvirt-qemu $USER
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
> ### Fedora
|
|
|
|
|
> ```bash
|
|
|
|
|
> sudo usermod -aG libvirt,kvm,input,render $USER
|
|
|
|
|
> ```
|
|
|
|
|
|
|
|
|
|
Reboot the system.
|
|
|
|
|
|
|
|
|
|
And now verify:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
virsh list --all
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If it doesn't error, you're good.
|
|
|
|
|
|
|
|
|
|
# Create the VM
|
|
|
|
|
|
|
|
|
|
Start virt-manager
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
virt-manager
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
When creating VM:
|
|
|
|
|
|
|
|
|
|
- Local ISO
|
|
|
|
|
- Windows 11 ISO
|
|
|
|
|
- Firmware: UEFI (OVMF)
|
|
|
|
|
- Chipset: Q35
|
|
|
|
|
- TPM: emulated
|
|
|
|
|
|
|
|
|
|
Before you start the VM:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo vim /etc/default/ufw
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Find `DEFAULT_FORWARD_POLICY="DROP"` and change it to `DEFAULT_FORWARD_POLICY="ACCEPT"`
|
|
|
|
|
|
|
|
|
|
Now boot the VM.
|
|
|
|
|
|
|
|
|
|
## Network Issues
|
|
|
|
|
|
|
|
|
|
If the network is being wonky, or if you want to bypass updates... Shift-F10
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
OOBE\BYPASSNRO
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Now add the PCI devices in virt-manager.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
yay -S looking-glass
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
On Windows, download the host from https://looking-glass.io/downloads
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo virsh edit win11
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Inside `<devices>`
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<shmem name="looking-glass">
|
|
|
|
|
<model type="ivshmem-plain"/>
|
|
|
|
|
<size unit="M">128</size>
|
|
|
|
|
</shmem>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo vim /etc/tmpfiles.d/10-looking-glass.conf
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# Type Path Mode UID GID Age Argument
|
|
|
|
|
f /dev/shm/looking-glass 0660 YOURUSER kvm -
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo rm -f /dev/shm/looking-glass
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
sudo systemd-tmpfiles --create /etc/tmpfiles.d/10-looking-glass.conf
|
|
|
|
|
```
|
|
|
|
|
```bash
|
|
|
|
|
ls -l /dev/shm/looking-glass
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Should be owned by my user.
|
|
|
|
|
|
|
|
|
|
## Install Virtual Display Driver on Windows.
|
|
|
|
|
|
|
|
|
|
## Configure Looking Glass
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
vim ~/.looking-glass-client.ini
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```ini
|
|
|
|
|
[win]
|
|
|
|
|
fullscreen=yes
|
|
|
|
|
size=2880x18900
|
|
|
|
|
dontUpscale=yes
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
env -u WAYLAND_DISPLAY looking-glass-client
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Audio
|
|
|
|
|
|
|
|
|
|
Edit XML. Inside `<devices>`
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<sound model="ich9"/>
|
|
|
|
|
<audio id="1" type="spice"/>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Clipboard
|
|
|
|
|
|
|
|
|
|
Edit XML. Inside `<devices>`
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<channel type="spicevmc">
|
|
|
|
|
<target type="virtio" name="com.redhat.spice.0"/>
|
|
|
|
|
</channel>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## File Sharing
|
|
|
|
|
|
|
|
|
|
Enable Memory → Shared in the virt-manager
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo pacman -S virtiofsd
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
mkdir -p ~/vmshare
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Edit XML. Inside `<devices>`
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<filesystem type="mount" accessmode="passthrough">
|
|
|
|
|
<driver type="virtiofs"/>
|
|
|
|
|
<source dir="/home/USERNAME/vmshare"/>
|
|
|
|
|
<target dir="vmshare"/>
|
|
|
|
|
</filesystem>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Install virtio-guest-tools. Hey guess what, this also seems to make the windows key work.
|
|
|
|
|
|
|
|
|
|
Also install winfsp
|