Skip to content

Instantly share code, notes, and snippets.

@mallendeo
Last active October 14, 2024 20:59
Show Gist options
  • Save mallendeo/61e7d0dc5d1de96d3ee1c584e6a26168 to your computer and use it in GitHub Desktop.
Save mallendeo/61e7d0dc5d1de96d3ee1c584e6a26168 to your computer and use it in GitHub Desktop.
Windows 11 Gaming VM on Proxmox VFIO
##/etc/pve/qemu-server/100.conf
##Network and disks not included in this example
##Set halt_poll_ns
#set_halt_poll 0
##CPU pinning
#cpu_taskset 1-7
#assign_interrupts --sleep=10s 1-7 --all
agent: 1
args: -cpu 'host,+kvm_pv_unhalt,+kvm_pv_eoi,hv_vendor_id=NV43FIX,kvm=off'
balloon: 0
bios: ovmf
boot: order=sata0;ide2;net0;ide0
cores: 7
cpu: host,flags=+pdpe1gb;+aes
cpuunits: 10000
efidisk0: local-lvm:vm-100-disk-1,efitype=4m,pre-enrolled-keys=1,size=4M
hookscript: local:snippets/exec-cmds
hostpci0: 0000:01:00,pcie=1,x-vga=1
hugepages: 1024
machine: pc-q35-6.0
memory: 16384
name: win11
numa: 1
ostype: win10
sockets: 1
tpmstate0: local-lvm:vm-100-disk-2,size=4M,version=v2.0
vga: none
## macOS BigSur VM
##/etc/pve/qemu-server/101.conf
##Set halt_poll_ns
#set_halt_poll 0
##CPU pinning
#cpu_taskset 12-15
#assign_interrupts --sleep=10s 12-15 --all
##hostpci0: 0000:02:00,pcie=1
##hostpci1: 0000:03:00,pcie=1
##hostpci2: 0000:06:00.0,pcie=1
agent: 1
args: -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -cpu host,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+fma4,+bmi1,+bmi2,+xsave,+xsaveopt,check
balloon: 0
bios: ovmf
boot: order=virtio0;ide2;net0;ide0
cores: 4
cpu: Penryn
efidisk0: local-lvm:vm-109-disk-0,efitype=4m,size=4M
hookscript: local:snippets/exec-cmds
hugepages: 1024
ide0: local:109/vm-109-disk-0.raw,backup=0,cache=unsafe,size=14G
ide2: local:109/vm-109-disk-1.raw,cache=unsafe
machine: q35
memory: 16384
name: bigsur
net0: vmxnet3=00:00:00:00:00:00,bridge=vmbr0
numa: 1
ostype: other
scsihw: virtio-scsi-pci
smbios1: uuid=00000000-0000-0000-0000-000000000000
sockets: 1
unused0: local-lvm:vm-109-disk-1
unused1: local-lvm:vm-109-disk-2
vga: vmware
virtio0: local-lvm:vm-109-disk-3,cache=unsafe,discard=on,size=200G
vmgenid: 00000000-0000-0000-0000-000000000000

Upgrade PVE

Comment out the enterprise repo if you are not using it on /etc/apt/sources.list.d/pve-enterprise.list.

Add this line to /etc/apt/sources.list

deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription

Run pveupdate and pveupgrade, then reboot.

Install PVE helpers

https://github.com/ayufan/pve-helpers/

Install Windows 11

https://dannyda.com/2021/10/08/how-to-install-windows-11-on-proxmox-ve-pve-without-workarounds/

Windows Gaming VM

  • nvidia fix
  • cpu pinning (using pve-helpers)
  • hugepages
  • TPM v2.0 (secure boot required for Windows 11)

You can also use this MSI tool if you have HDMI audio problems: https://www.mediafire.com/file/ewpy1p0rr132thk/MSI_util_v3.zip/file

See: https://forums.guru3d.com/threads/windows-line-based-vs-message-signaled-based-interrupts-msi-tool.378044/

GRUB_CMDLINE_LINUX=""
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX intel_iommu=on kvm_intel.ept=Y kvm_intel.nested=Y"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX isolcpus=1-7,9-15 nohz_full=1-7,9-15 rcu_nocbs=1-7,9-15"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX hugepagesz=1G hugepages=48"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX cgroup_enable=memory swapaccount=1"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX intel_pstate=disable"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX pci=noaer pcie_acs_override=downstream,multifunction"
# ============================================================================= #
# WARNING: THE LINE BELOW WILL DISABLE HOST MELTDOWN AND SPECTRE MITIGATIONS!! #
# ============================================================================= #
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX mitigations=off"
## Don't forget to `update-grub`
# /etc/modprobe.d/kvm.conf
options kvm ignore_msrs=1 report_ignored_msrs=0
## Don't forget to `update-initramfs -u -k all`
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
# Enable if you have an AMD GPU < RX6000 series
# See https://github.com/ayufan/pve-helpers/#22-use-vendor-reset-for-fixing-amd-radeon-reset-bug
# Also you need the pve-headers for your kernel (e.g pve-headers-5.15.35-2-pve)
#vendor-reset
## Don't forget to `update-initramfs -u -k all`
## PCIe Devices passthrough
## /etc/modprobe.d/vfio.conf
# Nvidia
options vfio-pci ids=10de:1e87,10de:10f8,10de:1ad8,10de:1ad9
# AMD RX580
options vfio-pci ids=1002:67df,1002:aaf0
# Fresco USB
options vfio-pci 1b73:1100
# Wifi
options vfio-pci 14e4:43a0
## Don't forget to `update-initramfs -u -k all`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment