Created
November 20, 2024 04:20
-
-
Save azidanit/5f287fd3787b8c0fd0a0f119e785438b to your computer and use it in GitHub Desktop.
VFIO nvidia gpu passthrough linux VM proxmox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/modprobe.d/nvidia.conf | |
blacklist nvidiafb | |
blacklist nouveau | |
================================== | |
update-initramfs -c -d -u | |
================================== | |
dmesg | grep -i iommu | |
dmesg | grep -e DMAR -e IOMMU | |
================================== | |
cat /proc/cmdline | |
BOOT_IMAGE=/boot/vmlinuz-6.8.12-2-pve root=/dev/mapper/pve-root ro quiet amd_iommu=on iommu=pt initcall_blacklist=sysfb_init | |
================================== | |
lspci | grep -i vga | |
================================== | |
cat /etc/default/grub | |
BOOT_IMAGE=/boot/vmlinuz-6.8.12-2-pve root=/dev/mapper/pve-root ro quiet amd_iommu=on iommu=pt initcall_blacklist=sysfb_init | |
root@pve2:~# cat /etc/default/grub | |
# If you change this file, run 'update-grub' afterwards to update | |
# /boot/grub/grub.cfg. | |
# For full documentation of the options in this file, see: | |
# info -f grub -n 'Simple configuration' | |
GRUB_DEFAULT=0 | |
GRUB_TIMEOUT=5 | |
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` | |
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt initcall_blacklist=sysfb_init" | |
GRUB_CMDLINE_LINUX="" | |
# If your computer has multiple operating systems installed, then you | |
# probably want to run os-prober. However, if your computer is a host | |
# for guest OSes installed via LVM or raw disk devices, running | |
# os-prober can cause damage to those guest OSes as it mounts | |
# filesystems to look for things. | |
#GRUB_DISABLE_OS_PROBER=false | |
# Uncomment to enable BadRAM filtering, modify to suit your needs | |
# This works with Linux (no patch required) and with any kernel that obtains | |
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) | |
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" | |
# Uncomment to disable graphical terminal | |
#GRUB_TERMINAL=console | |
# The resolution used on graphical terminal | |
# note that you can use only modes which your graphic card supports via VBE | |
# you can see them in real GRUB with the command `vbeinfo' | |
#GRUB_GFXMODE=640x480 | |
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux | |
#GRUB_DISABLE_LINUX_UUID=true | |
# Uncomment to disable generation of recovery mode menu entries | |
#GRUB_DISABLE_RECOVERY="true" | |
# Uncomment to get a beep at grub start | |
#GRUB_INIT_TUNE="480 440 1" | |
================================== | |
update-grub | |
================================== | |
root@pve2:~# cat /etc/modules | |
# /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. | |
# Parameters can be specified after the module name. | |
vfio | |
vfio_iommu_type1 | |
vfio_pci | |
vfio_virqfd | |
vfio_nvidia | |
================================== | |
root@pve2:~# cat /etc/modprobe.d/blacklist.conf | |
blacklist nouveau | |
blacklist nvidia | |
blacklist nvidiafb | |
blacklist snd_hda_intel | |
================================== | |
root@pve2:~# cat /etc/modprobe.d/vfio.conf | |
options vfio-pci ids=10de:2503,10de:228e disable_vga=1 disable_idle_d3=1 initcall_blacklist=sysfb_init | |
================================== | |
update-initramfs -u -k all | |
================================== | |
root@pve2:~# lspci -nn | grep -i nvidia | |
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP107M [GeForce GTX 1050 3 GB Max-Q] [10de:1c91] (rev a1) | |
01:00.1 Audio device [0403]: NVIDIA Corporation GP107GL High Definition Audio Controller [10de:0fb9] (rev a1) | |
03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA106 [GeForce RTX 3060] [10de:2503] (rev a1) | |
03:00.1 Audio device [0403]: NVIDIA Corporation GA106 High Definition Audio Controller [10de:228e] (rev a1) | |
================================== | |
root@pve2:~# cat /etc/modprobe.d/nvidia.conf | |
blacklist nvidiafb | |
blacklist nouveau | |
================================== | |
lsmod | grep vfio | |
================================== | |
root@pve2:~# cat iommu_group.sh | |
#!/bin/bash | |
shopt -s nullglob | |
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do | |
echo "IOMMU Group ${g##*/}:" | |
for d in $g/devices/*; do | |
echo -e "\t$(lspci -nns ${d##*/})" | |
done; | |
done; | |
================================== | |
63 chmod +x iommu_group.sh | |
64 ./iommu_group.sh | |
================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment