Город МОСКОВСКИЙ
00:13:08

Windows Gaming VM on Linux with GPU Passthrough

Аватар
SQL и MySQL Операции с представлениями
Просмотры:
24
Дата загрузки:
08.12.2023 15:43
Длительность:
00:13:08
Категория:
Обучение

Описание

In this video, I show step by step how to set up a Windows VM on CentOS for gaming. This is the hardware I will be using in this tutorial:
Processor: Intel Core i5 10600K
Motherboard: MSI B460M PRO-VDH Wifi
Graphics: eVGA NVIDIA GeForce GTX 1060 (6GB)
RAM: 64GB DDR4 Team Group
HDD/SSD: 2TB Crucial MX500 SSD

This is the software I will be using:
Host OS: CentOS 8
Guest OS: Windows 10 Pro
Virtualization: KVM/QEMU/libvirt and virt-manager

VirtIO drivers: https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md#downloads
Download Windows 10 officially here: https://www.microsoft.com/en-us/software-download/windows10ISO

Commands to run on the host OS:
To get the topology of the CPU: cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | sort | uniq
Blurb to place at the end of GRUB_CMDLINE_LINUX inside of /etc/default/grub: "intel_iommu=on isolcpus=[thread list depending on topology of your CPU]" (e.g. intel_iommu=on isolcpus=1,2,3,4,5,7,8,9,10,11)
To update GRUB: grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
To identify graphics card: lspci -nn
Blurb to add to /etc/modprobe.d/vfio.conf: "options vfio-pci ids=[ids of the video and audio components of the graphics card]" (e.g. options vfio-pci ids=10de:1c03,10de:10f1)
To create /etc/modules-load.d/vfio-pci.conf and add "vfio-pci" to it: echo 'vfio-pci' ﹥ /etc/modules-load.d/vfio-pci.conf
To check that IOMMU is successfully enabled: dmesg | grep -E "DMAR|IOMMU"
Look for "DMAR: IOMMU enabled"
To check that vfio-pci successfully added the graphic card: dmesg | grep -i vfio
Look for "vfio_pci: add"

Guide for XML changes needed to avoid code 43 (for NVIDIA graphics cards): https://mathiashueber.com/fighting-error-43-nvidia-gpu-virtual-machine/ and https://passthroughpo.st/apply-error-43-workaround/ (correction: kvm section goes in the features section and not in the hyperv section)
An example XML configuration can be found here: https://pastebin.com/A4uVLBJ2

References:
Quick Guide: https://youtu.be/HXgQVAl4JB4
AMD CPU with two AMD graphics cards: https://youtu.be/3yhwJxWSqXI and https://youtu.be/GbhUBQdMoJg
More in-depth but using UnRaid (not free) instead of virt-manager (free): https://youtu.be/miYUGWq6l24 and https://youtu.be/A2dkrFKPOyw

Further reading:
Very thorough and comprehensive tutorial: https://www.heiko-sieger.info/running-windows-10-on-linux-using-kvm-with-vga-passthrough/
If you get code -22 and vfio is unable to add your graphics card, check that you have enabled virtualization (VT-d, VT-x, IOMMU, and/or I/O virtualization Passthrough) in the BIOS and set the command line arguments in GRUB: https://unix.stackexchange.com/questions/265541/pci-passthrough-kvm-with-vfio-pci-giving-einval-on-pci-probe and https://www.google.com/amp/s/amp.reddit.com/r/VFIO/comments/8oa6t8/trying_to_get_iommu_to_work_but_running_into/
Explanation on the importance of setting the default graphics to the integrated graphics: https://passthroughpo.st/explaining-csm-efifboff-setting-boot-gpu-manually/
Dealing with code 43: https://www.reddit.com/r/VFIO/comments/b5spp4/nvidia_error_43_with_q35_qemu_40/
Blue screen (BSOD) due to not setting the default graphics in the BIOS to the integrated graphics: https://www.reddit.com/r/VFIO/comments/6nkkch/windows_7_bsod_gpu_passthrough/ and https://appuals.com/fix-system-service-exception-virtualbox-bsod-on-host-machine/
Getting code 31 due to not using a guest VM UEFI BIOS and not setting the host BIOS to use integrated graphics by default: https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/display-adapterthis-device-is-not-working-properly/c8fa35f6-d25a-4b40-9332-71f1d3db45aa
Explanation on CPU pinning: https://www.reddit.com/r/VFIO/comments/7zcn5g/kvm_windows_10_guest_cpu_pinning_recommended/ and https://serverfault.com/questions/313333/kvm-and-virtual-to-physical-cpu-mapping
Mouse is unresponsive after installing VirtIO guest tools: https://forum.proxmox.com/threads/spice-with-windows-10-mouse-does-not-work.69515/
If you suspect the motherboard doesn't implement IOMMU correctly: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/iommu-example

Рекомендуемые видео