这个问题不是i226的问题,而是iommu直通的问题,pve大神在pve论坛里解释了这个问题的根源,也就是说你一个网卡上有多个网卡,在系统中,iommu默认会认为你是一个组, 那么你的iommu的分组就是同一个组,可以通过lspci | grep iommu来查看,那么当其中一个网卡直通给一个虚拟机之后,其他网卡(i226的网口)也就不能直通给其他虚拟机了。解决办法有,1不使用直通,全部创建bridge,虚拟网卡来用;2,SR-IOV解决方案;3,尝试修改grub文件,添加这个参数进去 pcie_acs_override=downstream,multifunction . 不过这种方法据说有弊端。下面是pve staff的论坛回复。 The GUI doesn't check for IOMMU groups, that is your responsibility. Meaning, when you assigned the WiFi card to a different VM, it most likely *did* save, and get applied, but when you then try to start the VM, it sees that IOMMU group 1 is already connected to your NAS VM (since you pass through the SAS controller which is in the same group), and thus fails to use the WiFi card - since the same group *cannot* be connected to two VMs. The only solution is to move the WiFi card and the SAS controller to seperate IOMMU groups. This can be done in two ways: try a different physical PCIe slot, for either the SAS or WiFi card use the acs_override line I mentioned above - this will force every device into a seperate group, but will cause a security boundary breach (your NAS and WiFi VM could then potentially share data without the host knowing) and may introduce instabililty
实测,添加了 pcie_acs_override=downstream,multifunction 之后,90%的pcie设备都被分到了不同组,可以顺利直通任何不同虚拟机并成功开机 [ 0.338784] iommu: DMA domain TLB invalidation policy: lazy mode [ 0.518393] pci 0000:00:02.0: Adding to iommu group 0 [ 0.522154] pci 0000:00:00.0: Adding to iommu group 1 [ 0.522164] pci 0000:00:01.0: Adding to iommu group 2 [ 0.522170] pci 0000:00:03.0: Adding to iommu group 3 [ 0.522176] pci 0000:00:14.0: Adding to iommu group 4 [ 0.522186] pci 0000:00:16.0: Adding to iommu group 5 [ 0.522193] pci 0000:00:19.0: Adding to iommu group 6 [ 0.522199] pci 0000:00:1a.0: Adding to iommu group 7 [ 0.522205] pci 0000:00:1b.0: Adding to iommu group 8 [ 0.522212] pci 0000:00:1c.0: Adding to iommu group 9 [ 0.522219] pci 0000:00:1c.3: Adding to iommu group 10 [ 0.522225] pci 0000:00:1d.0: Adding to iommu group 11 [ 0.522240] pci 0000:00:1f.0: Adding to iommu group 12 [ 0.522247] pci 0000:00:1f.2: Adding to iommu group 12 [ 0.522254] pci 0000:00:1f.3: Adding to iommu group 12 [ 0.522261] pci 0000:01:00.0: Adding to iommu group 13 [ 0.522270] pci 0000:02:01.0: Adding to iommu group 14 [ 0.522279] pci 0000:02:02.0: Adding to iommu group 15 [ 0.522288] pci 0000:02:03.0: Adding to iommu group 16 [ 0.522298] pci 0000:02:04.0: Adding to iommu group 17 [ 0.522310] pci 0000:03:00.0: Adding to iommu group 18 [ 0.522321] pci 0000:04:00.0: Adding to iommu group 19 [ 0.522332] pci 0000:05:00.0: Adding to iommu group 20