PVE下联想m4500q直通i5-4590t核显

开启IOMMU和硬件直通功能

1、编辑GRUB文件

  • nano /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT 一行修改为

  • GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt initcall_blacklist=sysfb_init pcie_acs_override=downstream"

2、更新 GRUB

  • proxmox-boot-tool refresh

3、加载内核模块

  • nano /etc/modules

增加如下内容

  • vfio
  • vfio_iommu_type1
  • vfio_pci

4、重启 PVE

5、验证是否成功启用IOMMU

  • dmesg | grep -e DMAR -e IOMMU

输出以下类似内容

  • [ 0.009882] ACPI: DMAR 0x00000000DA9CF930 0000B8 (v01 LENOVO TC-FH 00001570 INTL 00000001)
  • [ 0.009902] ACPI: Reserving DMAR table memory at [mem 0xda9cf930-0xda9cf9e7]
  • [ 0.116381] DMAR: Host address width 39
  • [ 0.116382] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
  • [ 0.116393] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
  • [ 0.116396] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
  • [ 0.116399] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008020660462 ecap f010da
  • [ 0.116401] DMAR: RMRR base: 0x000000dbe4d000 end: 0x000000dbe73fff
  • [ 0.116403] DMAR: RMRR base: 0x000000dd000000 end: 0x000000df1fffff
  • [ 0.116406] DMAR-IR: IOAPIC id 8 under DRHD base 0xfed91000 IOMMU 1
  • [ 0.116407] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
  • [ 0.116409] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
  • [ 0.116924] DMAR-IR: Enabled IRQ remapping in x2apic mode
  • [ 0.268512] DMAR: No ATSR found
  • [ 0.268513] DMAR: No SATC found
  • [ 0.268514] DMAR: IOMMU feature pgsel_inv inconsistent
  • [ 0.268515] DMAR: IOMMU feature sc_support inconsistent
  • [ 0.268516] DMAR: IOMMU feature pass_through inconsistent
  • [ 0.268517] DMAR: dmar0: Using Queued invalidation
  • [ 0.268524] DMAR: dmar1: Using Queued invalidation
  • [ 0.355249] DMAR: Intel(R) Virtualization Technology for Directed I/O

6、验证是否启用IOMMU中断重映射

  • dmesg | grep remapping

输出类似以下内容

  • [ 0.116409] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
  • [ 0.116924] DMAR-IR: Enabled IRQ remapping in x2apic mode

 

显卡直通

1、屏蔽驱动

  • nano /etc/modprobe.d/pve-blacklist.conf

添加以下内容

  • # Intel
  • blacklist snd_hda_codec_hdmi
  • blacklist snd_hda_intel
  • blacklist snd_hda_codec
  • blacklist snd_hda_core

2、查看显卡和声卡ID

  • lspci -nn | grep VGA

得到如下内容

  • 00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)

则显卡ID为8086:0412

  • lspci -nn | grep Audio

得到以下内容

  • 00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)

则声卡ID为8086:0c0c

3、将ID写入vfio配置

  • nano /etc/modprobe.d/vfio.conf

添加如下内容

  • options vfio-pci ids=8086:0412,8086:0c0c

4、更新内核

  • update-initramfs -u

5、重启

6、检查 vfio-pci 是否应用成功

  • lspci -nnk

得到

  • 00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)
  • DeviceName: Onboard IGD
  • Subsystem: Lenovo Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [17aa:309e]
  • Kernel driver in use: vfio-pci
  • Kernel modules: i915
  • 00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)
  • Subsystem: Lenovo Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [17aa:309e]
  • Kernel driver in use: vfio-pci
  • Kernel modules: snd_hda_intel

其中的Kernel driver in use: vfio-pci 表示成功

 

创建Win10虚拟机

1、不启用虚拟机的开机自启动

2、系统设置完全保持默认,不修改

3、磁盘类型选择IDE,无缓存

4、CPU的类别选择成host

5、内存设置中打开高级,关闭Ballooning设备

6、添加声卡pci设备

7、不在虚拟机设置中添加显卡pci设备,直接修改虚拟机的配置文件

  • nano /etc/pve/nodes/vm226/qemu-server/228.conf

在文件的最后添加

  • args: -device vfio-pci,host=00:02.0,x-igd-opregion=on

 

安装驱动

直接在Intel的官网上下载最新驱动,打开Win10的远程桌面,利用mstsc连接到远程桌面并安装驱动

 

文章参考:www.cnblogs.comblog.sparkle.imlala.im

THE END
分享
二维码
海报