显卡直通

a、确认内核是否支持iommu
cat /proc/cmdline | grep iommu有输出则正常

如果没有输出,将intel_iommu=on添加到grub启动文件当中

编辑grub文件 :vim /etc/default/grub
update-grub

 
b、确认VT-D是否正常
dmesg | grep -e DMAR -e IOMMU有箭头标的输出则正常

c、测试是否支持虚拟化(VT)
egrep -o '(vmx|svm)' /proc/cpuinfo查看是否有输出,有输出则正常。

lspci -vv -s 05:00.0 | grep driver

lspci -nn | grep NVIDIA
05:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107GL [Quadro K620] [10de:13bb] (rev a2)
lspci -nn | grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0126] (rev 09)
05:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107GL [Quadro K620] [10de:13bb] (rev a2)

sudo modprobe vfio
sudo modprobe vfio-pci
sudo su
cd /sys/bus/pci/devices/0000:05:00.0/
echo 0000:05:00.0 > /sys/bus/pci/devices/0000:05:00.0/driver/unbind
echo 10de 13bb > /sys/bus/pci/drivers/vfio-pci/new_id
cd /sys/bus/pci/devices/0000:05:00.1/
echo 0000:05:00.1 > /sys/bus/pci/devices/0000:05:00.1/driver/unbind
echo 10de 0fbb > /sys/bus/pci/drivers/vfio-pci/new_id

virsh nodedev-dumpxml pci_0000_05_00_0

  pci_0000_05_00_0
  /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0
  pci_0000_00_1c_3
 
    vfio-pci
 

 
    0x030000
    0
    5
    0
    0
    GM107GL [Quadro K620]
    NVIDIA Corporation
   
     


     

   
   
     
     
   

 

printf %x 5
printf %x 0
printf %x 0
    5
    0
    0

virsh edit xp_sp3


 
     


 


 
     


 

sudo virsh nodedev-detach pci_0000_05_00_0
sudo virsh nodedev-detach pci_0000_05_00_1


 

你可能感兴趣的:(显卡直通)