russel053/ 九月 2, 2018/ Proxmox VE, VM


先照 >> GRUB 開啟iommu

然後做 >> 開啟SR-IOV 功能

以下為差異部分

禁用Nvidia Drive on host

echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf

更新生效:

update-initramfs -u

找出顯卡PCI ID:

lspci

04:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750] (rev a2)
04:00.1 Audio device: NVIDIA Corporation Device 0fbc (rev a1)

細看規格:

lspci -n -s 04:00
04:00.0 0300: 10de:1381 (rev a2)
04:00.1 0403: 10de:0fbc (rev a1)

使用上面獲得的ID將GPU分配給vfio:

echo "options vfio-pci ids=10de:1381,10de:0fbc" > /etc/modprobe.d/vfio.conf

到虛擬機conf 修改或新增以下區塊:

bios: ovmf
machine: q35 (UEFI不用填寫)
cpu: host
numa: 1
hostpci0: 04:00,x-vga=on,pcie=1
如果純粹只需要顯卡算力,請改用以下格式:
hostpci0: 04:00,pcie=1(AMD系列GPU需要移除 pcie=1 選項)

KVM新增:

echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf
update-initramfs -u

Share this Post