首页 > 其他分享 >PVE开启硬件显卡直通功能

PVE开启硬件显卡直通功能

时间:2022-11-04 17:05:20浏览次数:46  
标签:直通 GRUB boot blacklist etc pve PVE 显卡 root


首先编辑GRUB配置文件:


root@pve:~# vim /etc/default/grub
root@pve:~#
root@pve:~# 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 intel_iommu=on video=efifb:off"
GRUB_CMDLINE_LINUX=""




# 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-pc only)
#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"
root@pve:~#




开启IOMMU支持:




GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on video=efifb:off"
如果是AMD的CPU:




GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on video=efifb:off"


更新GRUB:


root@pve:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.22-5-pve
Found initrd image: /boot/initrd.img-5.11.22-5-pve
Found linux image: /boot/vmlinuz-5.11.22-4-pve
Found initrd image: /boot/initrd.img-5.11.22-4-pve
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
done
root@pve:~#


添加所需的系统模块(驱动):


root@pve:~#
root@pve:~# echo "vfio" >> /etc/modules
root@pve:~# echo "vfio_iommu_type1" >> /etc/modules
root@pve:~# echo "vfio_pci" >> /etc/modules
root@pve:~# echo "vfio_virqfd" >> /etc/modules
root@pve:~#
root@pve:~# 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.






# Generated by sensors-detect on Fri Sep 24 17:22:44 2021
# Chip drivers
coretemp
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd


接着添加模块(驱动)黑名单,即让GPU设备在下次系统启动之后不使用这些驱动,把设备腾出来给vfio驱动用:


Intel核显:


echo "blacklist snd_hda_intel" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist snd_hda_codec_hdmi" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist i915" >> /etc/modprobe.d/pve-blacklist.conf


N卡/A卡:


echo "blacklist nouveau" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist radeon" >> /etc/modprobe.d/pve-blacklist.conf


如果是N卡还需要加入下面的配置到kvm.conf(据老外说是避免一些莫名其妙的错误):


echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf


root@pve:~# echo "blacklist nouveau" >> /etc/modprobe.d/pve-blacklist.conf
root@pve:~# echo "blacklist radeon" >> /etc/modprobe.d/pve-blacklist.conf
root@pve:~#
root@pve:~# cat /etc/modprobe.d/pve-blacklist.conf
# This file contains a list of modules which are not supported by Proxmox VE




# nidiafb see bugreport https://bugzilla.proxmox.com/show_bug.cgi?id=701
blacklist nvidiafb
blacklist nouveau
blacklist radeon
root@pve:~#
root@pve:~# echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf
root@pve:~#
root@pve:~# cat /etc/modprobe.d/kvm.conf
options kvm ignore_msrs=1


更新内核:


root@pve:~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.11.22-5-pve
Running hook script 'zz-proxmox-boot'..
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
root@pve:~#


重启机器:


root@pve:~# reboot

重启上来之后检查模块是否正常加载:


root@pve:~# lsmod | grep vfio
vfio_pci 57344 1
vfio_virqfd 16384 1 vfio_pci
irqbypass 16384 11 vfio_pci,kvm
vfio_iommu_type1 36864 1
vfio 36864 5 vfio_iommu_type1,vfio_pci
root@pve:~#


查看显卡


root@pve:~# lspci -nn | grep NV
86:00.0 3D controller [0302]: NVIDIA Corporation TU104GL [Tesla T4] [10de:1eb8] (rev a1)
root@pve:~#
root@pve:~#


查看显卡ID,写入到配置中

root@pve:~# lspci -n -s 86:00
86:00.0 0302: 10de:1eb8 (rev a1)
root@pve:~#
root@pve:~#
root@pve:~# echo "options vfio-pci ids=10de:1eb8" > /etc/modprobe.d/vfio.conf
root@pve:~#


PVE开启硬件显卡直通功能_linux


PVE开启硬件显卡直通功能_linux_02



PVE开启硬件显卡直通功能_linux_03


标签:直通,GRUB,boot,blacklist,etc,pve,PVE,显卡,root
From: https://blog.51cto.com/u_12212643/5823979

相关文章

  • 记录一次实验室linux系统的GPU服务器死机排查过程——某显卡满负荷导致内核进程超时导
    在自己没有管理多台高负荷的ubuntu显卡服务器之前,我是万万想不到linux服务器居然也是如此容易死机的。什么每个版本的TensorFlow调用显卡驱动时和内核不兼容,什么系统自动......
  • NVIDIA 显卡配置
    NVIDIA显卡配置1、图像锐化,画面更尖锐鲜明,开启后会画面失真,中低端建议关闭,高端随意2、一般GPUs有一个选全部就好了3、限制游戏帧数对于那些游戏帧数过高,电脑发热响声过......
  • 深度学习:Nvidia显卡驱动安装
    导读本文将介绍如何在Ubuntu系统上,安装显卡驱动。1.下载驱动驱动程序下载打开上面的驱动下载链接,根据自己的显卡型号进行选择对应配置,如下图,后点击搜索。下载......
  • 硬件笔记之黑苹果更换显卡黑屏 卡进度条
    0x00概述系统是12.5.1Monterey蒙特雷,原显卡为588,更换5700XT后,开机黑屏,显示器没信号,卡进度条。 0x01故障表现5700XT是官方指定显卡,属于免驱卡,但是直接更换,开机会卡......
  • 【记录】在ubantu系统中安装显卡驱动
    我们在跑模型的时候,需要用GPU并行加速,需要用显卡跑,这就需要安装显卡驱动。参考方法,视频:https://www.bilibili.com/video/BV16Y411M7SC/?spm_id_from=333.788显卡驱动便捷......
  • PVE创建ubuntu CT并安装sqlServer
    一、创建LXC容器模板选择下载好的ubuntu20.04网络选择一个未分配的静态IP    二、登录到ubuntu系统,开启ssh登录......
  • Proxmox ve(Pve) 安装windows server
    1.安装proxmoxve点击直达官网地址 下载下来如果下载速度太慢可以去安装个IDMhttps://www.52pojie.cn/thread-1013874-1-1.html 然后需要制作u盘启动器下载一个Rufus......
  • PVEiommu分组命令
    1.修改/etc/default/grubGRUB_CMDLINE_LINUX_DEFAULT="quietintel_iommu=onpcie_acs_override=downstreamvideo=efifb:off,vesafb:off" 2.添加虚拟化驱动  na......
  • 在Proxmox VE pve中安装windows操作系统——以ltsc2019为例
    pve创建ltsc2019还是比较简单的。只是没有virtio驱动的话,选择磁盘的时候找不到磁盘。这里主要是列出如何加载virtio驱动1、创建虚拟机忽略。注意需要新建2个CDROM。一个......
  • VB调用Win32提取显卡信息,试用于其他Win32系统API
    VB:OnErrorResumeNextDimyeDimyexj00Setyexj00=GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_VideoController")......