This is a guide on the steps I took to get a Windows 10 virtual machine with dedicated graphics working. My goal is to primarily use Pop!_OS for general desktop use, development, etc, while also being able to play all of my games without compromises.
The steps below are mostly from following different guides I found online to get various things working correctly. I'm collecting them here so I can recreate the same setup in the future.
- Ryzen 7 1700 (Having 8 cores is useful. I'd recommend at least 6 cores)
- Gigabyte B450 Aorus M
- 2x 16GB ram running @ 2400 MHz (Need at least 16 GB, though I'd recommend 32 GB to be comfortable)
- PNY Quadro P400v2 (Host GPU)
- Radeon RX 5500 XT 8GB (Guest GPU)
- 500GB SATA SSD
- 750W PSU
(Steps originally from MathiasHueber.com)
-
Make sure AMD-V, IOMMU and SVM module are enabled in the BIOS
-
Install required software
sudo apt install qemu-kvm qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager ovmf
-
Enable IOMMU in the kernel
sudo kernelstub -o "amd_iommu=on amd_iommu=pt"
-
Identify PCI id of the guest GPU
Download and run
list-iommu.sh
below, and find the entry for your guest GPU. If you're lazy you can copy-paste this:curl -sL https://gist.githubusercontent.com/oktay-sen/24663b585f2c330cfca227014227667b/raw/bd77d5b97718a43eebc5d6dce6d1d231bd6eec98/list-iommu.sh | bash - | grep Radeon
You should see an output like
IOMMU Group 17 09:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] [1002:7340] (rev c5)
In this case the PCI id is
1002:7340
-
Enable vfio for the guest GPU
sudo kernelstub --add-options "vfio-pci.ids=1002:7340"
-
Reboot
-
Verify that step 5 worked by checking
lspci -nnv
output09:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] [1002:7340] (rev c5) (prog-if 00 [VGA controller]) Subsystem: ASRock Incorporation Navi 14 [Radeon RX 5500/5500M / Pro 5500M] [1849:5126] Flags: bus master, fast devsel, latency 0, IRQ 63 Memory at e0000000 (64-bit, prefetchable) [size=256M] Memory at f0000000 (64-bit, prefetchable) [size=2M] I/O ports at f000 [size=256] Memory at f7800000 (32-bit, non-prefetchable) [size=512K] Expansion ROM at f7880000 [disabled] [size=128K] Capabilities: <access denied> Kernel driver in use: vfio-pci Kernel modules: amdgpu
You should get
Kernel driver in use: vfio-pci
(Steps originally from MathiasHueber.com)
- Download the latest Windows 10 image from Microsoft
- Install Virtual Machine Manager from Pop!_Shop and open
- Click "Create new Virtual Machine"
- Select "Local Install Media"
- Choose "Use ISO Image" and select the Windows 10 image. Keep "Automatically detect operating system" selected.
- Configure the machine with the amount of RAM and threads you'd like. I recommend 16 GB ram and 8 cores.
- Create a disk image with a good amount of storage. I created a 200GB image for this.
- Select "Customise configuration before install" and finish.
- Make the following changes to the configuration:
- Chipset: Q35
- Firmware: UEFI x86_64: /usr/share/OVMF/OVMF_CODE.fd
- Model:
EPYC-IBPB
(Usually you should usehost-passthrough
) - Check "Enable available CPU security flaw mitigations"
- Sockets: 1
- Cores: 4
- Threads: 2 (Note: This is threads per core, not total threads)
- Add a "PCI Host Device" and select the guest GPU
- Install Windows 10 as normal
- Install latest VirtIO drivers for Windows