PCI Passthrough problem with an Intel WiFi card

Discussions related to using VirtualBox on Linux hosts.
Post Reply
bug.spencor
Posts: 2
Joined: 18. Dec 2014, 22:20
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux, Windows

PCI Passthrough problem with an Intel WiFi card

Post by bug.spencor »

I'm trying to use my Intel Wifi Adapter "Intel Corporation Wireless 8260 (rev 3a)" (PCIe) via PCI Passthrough in my linux guest, but I can't get it working.

On the guest I see errors when loading the iwlwifi module (obviously when the driver tries to load the firmware). Output is pasted below.
On the host I get an error "Intel® Dual Band Wireless-AC 8260".

See below for detailed output.

My setup is:

Host:

Intel NUC6i5SYH (VT-d, VT-x supported, full specs: https://ark.intel.com/products/89190/In ... -NUC6i5SYH)
Host OS: Debian GNU/Linux 8.11 (jessie) with kernel 4.9 from jessie backports: 4.9.0-0.bpo.7-amd64
Kernel parameter intel_iommu=on added to grub
Virtualbox 5.2.16 (from virtualbox.org repository) and Extension Pack 5.2.16


Guest: Ubuntu Server 18.04 64-bit, kernel: 4.15.0-29-generic


Here's some relevant output from host's dmesg:

Code: Select all

root@nuc:~# dmesg|grep -iE 'dmar|iommu'
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-0.bpo.7-amd64 root=UUID=867c7fc2-f74c-40e3-8ba9-2d331867f2cf ro intel_iommu=on
[    0.000000] ACPI: DMAR 0x000000007A57F980 0000CC (v01 INTEL  NUC6i5SY 00000043 INTL 00000001)
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-0.bpo.7-amd64 root=UUID=867c7fc2-f74c-40e3-8ba9-2d331867f2cf ro intel_iommu=on
[    0.000000] DMAR: IOMMU enabled
[    0.095456] DMAR: Host address width 39
[    0.095461] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[    0.095476] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[    0.095485] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[    0.095496] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[    0.095505] DMAR: RMRR base: 0x0000007a2ea000 end: 0x0000007a309fff
[    0.095511] DMAR: RMRR base: 0x0000007b800000 end: 0x0000007fffffff
[    0.095516] DMAR: ANDD device: 9 name: \_SB.PCI0.UA00
[    0.095522] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
[    0.095527] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[    0.095531] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
[    0.097049] DMAR-IR: Enabled IRQ remapping in x2apic mode
[    0.770120] DMAR: ACPI device "device:67" under DMAR at fed91000 as 00:1e.0
[    0.770133] DMAR: No ATSR found
[    0.770463] DMAR: dmar0: Using Queued invalidation
[    0.770474] DMAR: dmar1: Using Queued invalidation
[    0.770639] DMAR: Setting RMRR:
[    0.770699] DMAR: Setting identity map for device 0000:00:02.0 [0x7b800000 - 0x7fffffff]
[    0.770747] DMAR: Setting identity map for device 0000:00:14.0 [0x7a2ea000 - 0x7a309fff]
[    0.770761] DMAR: Prepare 0-16MiB unity mapping for LPC
[    0.770798] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[    0.770817] DMAR: Intel(R) Virtualization Technology for Directed I/O
[    0.770894] iommu: Adding device 0000:00:00.0 to group 0
[    0.770909] iommu: Adding device 0000:00:02.0 to group 1
[    0.770928] iommu: Adding device 0000:00:14.0 to group 2
[    0.770940] iommu: Adding device 0000:00:14.2 to group 2
[    0.770956] iommu: Adding device 0000:00:16.0 to group 3
[    0.770970] iommu: Adding device 0000:00:17.0 to group 4
[    0.770995] iommu: Adding device 0000:00:1c.0 to group 5
[    0.771013] iommu: Adding device 0000:00:1e.0 to group 6
[    0.771025] iommu: Adding device 0000:00:1e.6 to group 6
[    0.771050] iommu: Adding device 0000:00:1f.0 to group 7
[    0.771062] iommu: Adding device 0000:00:1f.2 to group 7
[    0.771075] iommu: Adding device 0000:00:1f.3 to group 7
[    0.771088] iommu: Adding device 0000:00:1f.4 to group 7
[    0.771101] iommu: Adding device 0000:00:1f.6 to group 7
[    0.771118] iommu: Adding device 0000:01:00.0 to group 5
[    0.788265] AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>
[    0.788294] AMD IOMMUv2 functionality not available on this system
[   20.089372] vboxpci: IOMMU found
[  728.806278] vboxpci: IOMMU found
[  740.800509] vboxpci: created IOMMU domain ffff8e94e82db488
[  741.524840] vboxpci: created IOMMU domain ffff8e9487cd74c8
[  875.988395] vboxpci: created IOMMU domain ffff8e9487cd7f48
[  876.114901] vboxpci 0000:01:00.0: failed to attach to IOMMU, error -22
[ 2757.903771] vboxpci: freeing IOMMU domain ffff8e94e82db488
[ 2782.126215] vboxpci: freeing IOMMU domain ffff8e9487cd74c8
[ 2782.485013] vboxpci: freeing IOMMU domain ffff8e9487cd7f48
[ 3359.587163] vboxpci: created IOMMU domain ffff8e94e82dbf08
[ 3724.127790] vboxpci: freeing IOMMU domain ffff8e94e82dbf08
The last lines are obviously from starting and stopping the VM with the attached PCI device (maybe also other VMs are started/stopped during that interval)
I'm not sure how these messages correlate to my start/stop actions, and I'm not sure when this "failed to attach message is coming from, but I saw it again later, when I re-attached the device and started the VM. ('VBoxManage modifyvm "vm" -pciattach 01:00.0' did not give an error on commandline, and no error in dmesg instantly).

(not sure where that "failed to attach" is coming from; maybe the VM was running when I tried to attach the device)

VBoxManage showvminfo shows:

Code: Select all

Attached physical PCI devices:

   Host device host01:00.0 at 01:00.0 attached as 01:00.0
Here's the output from lcpci -vv from the Wi-Fi adapter:

Code: Select all

01:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
        Subsystem: Intel Corporation Device 9010
        Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at df000000 (64-bit, non-prefetchable) [size=8K]
        Capabilities: [c8] Power Management version 3
                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [40] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 unlimited
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr+ NoSnoop+ FLReset-
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L1, Exit Latency L0s <4us, L1 <8us
                        ClockPM+ Surprise- LLActRep- BwNot-
                LnkCtl: ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+
                        ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Range B, TimeoutDis+, LTR+, OBFF Via WAKE#
                DevCtl2: Completion Timeout: 16ms to 55ms, TimeoutDis-, LTR+, OBFF Disabled
                LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
        Capabilities: [140 v1] Device Serial Number a0-c5-89-ff-ff-35-ab-8d
        Capabilities: [14c v1] Latency Tolerance Reporting
                Max snoop latency: 0ns
                Max no snoop latency: 0ns
        Capabilities: [154 v1] L1 PM Substates
                L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
                          PortCommonModeRestoreTime=30us PortTPowerOnTime=18us
        Kernel driver in use: pci-stub
When starting the VM here's what I see in host's dmesg:

Code: Select all

[ 4661.139775] vboxdrv: ffffffffc0ea3020 VMMR0.r0
[ 4661.290439] vboxdrv: ffffffffc016a020 VBoxDDR0.r0
[ 4661.389203] VBoxNetFlt: attached to 'eth0' / f4:4d:30:66:89:b5
[ 4661.391990] vboxpci: detected device: 8086:24f3 at 01:00.0, driver pci-stub
[ 4661.393079] vboxpci 0000:01:00.0: vboxPciOsDevInit
[ 4661.397351] vboxpci 0000:01:00.0: region 0: mmio df000000+8192
[ 4661.397681] vboxpci 0000:01:00.0: got irq 280
[ 4661.603564] vboxpci: created IOMMU domain ffff8e94e82db488
[ 4661.621790] device eth0 entered promiscuous mode
[ 4661.621872] vboxpci 0000:01:00.0: PCIRAW_POWER_ON
[ 4661.730857] vboxpci 0000:01:00.0: failed to attach to IOMMU, error -22
[ 4661.738354] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.196230] HPET: Using timer above configured range: 3
[ 4676.196261] HPET: Using timer above configured range: 3
[ 4676.371986] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.374181] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.375992] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.378067] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.379857] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.382526] vboxpci 0000:01:00.0: reg=0 start=df000000 size=8192
[ 4676.421043] HPET: Using timer above configured range: 3
("failed to attach" again. Maybe here's a problem already)


And finally from the guest when it's trying to load the iwlwifi module:

Code: Select all

[   13.544249] iwlwifi 0000:01:00.0: loaded firmware version 34.0.1 op_mode iwlmvm                          [50/1881]
[   13.734937] iwlwifi 0000:01:00.0: Detected Intel(R) Dual Band Wireless AC 8260, REV=0x208
[   13.931223] leds_ss4200: no LED devices found
[   13.947857] RAPL PMU: API unit is 2^-32 Joules, 5 fixed counters, 10737418240 ms ovfl timer
[   13.947866] RAPL PMU: hw unit of domain pp0-core 2^-0 Joules
[   13.947871] RAPL PMU: hw unit of domain package 2^-0 Joules
[   13.947876] RAPL PMU: hw unit of domain dram 2^-0 Joules
[   13.947880] RAPL PMU: hw unit of domain pp1-gpu 2^-0 Joules
[   13.947885] RAPL PMU: hw unit of domain psys 2^-0 Joules
[   14.951485] vboxvideo: module is from the staging directory, the quality is unknown, you have been warned.
[   14.951537] vboxvideo: module verification failed: signature and/or required key missing - tainting kernel
[   14.953289] [drm] VRAM 01000000
[   14.953397] [TTM] Zone  kernel: Available graphics memory: 504470 kiB
[   14.953398] [TTM] Initializing pool allocator
[   14.953401] [TTM] Initializing DMA pool allocator
[   14.955468] fbcon: vboxdrmfb (fb0) is primary device
[   14.959909] Console: switching to colour frame buffer device 100x37
[   14.961232] vboxvideo 0000:00:02.0: fb0: vboxdrmfb frame buffer device
[   14.988227] [drm] Initialized vboxvideo 1.0.0 20130823 for 0000:00:02.0 on minor 0
[   18.524029] audit: type=1400 audit(1532256798.144:2): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="/sbin/dhclient" pid=689 comm="apparmor_parser"
[   18.524034] audit: type=1400 audit(1532256798.144:3): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=689 comm="apparmor_parser"
[   18.524037] audit: type=1400 audit(1532256798.144:4): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=689 comm="apparmor_parser"
[   18.524040] audit: type=1400 audit(1532256798.144:5): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="/usr/lib/connman/scripts/dhclient-script" pid=689 comm="apparmor_parser"
[   18.538303] audit: type=1400 audit(1532256798.160:6): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="lxc-container-default" pid=688 comm="apparmor_parser"
[   18.538308] audit: type=1400 audit(1532256798.160:7): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="lxc-container-default-cgns" pid=688 comm="apparmor_parser"
[   18.538312] audit: type=1400 audit(1532256798.160:8): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="lxc-container-default-with-mounting" pid=688 comm="apparmor_parser"
[   18.538315] audit: type=1400 audit(1532256798.160:9): apparmor="STATUS" operation="profile_load" profile="unconfin
ed" name="lxc-container-default-with-nesting" pid=688 comm="apparmor_parser"
[   18.643224] audit: type=1400 audit(1532256798.264:10): apparmor="STATUS" operation="profile_load" profile="unconfi
ned" name="/usr/bin/lxc-start" pid=691 comm="apparmor_parser"
[   18.775645] audit: type=1400 audit(1532256798.396:11): apparmor="STATUS" operation="profile_load" profile="unconfi
ned" name="/usr/bin/man" pid=692 comm="apparmor_parser"
[   18.913107] iwlwifi 0000:01:00.0: Failed to load firmware chunk!
[   18.914784] iwlwifi 0000:01:00.0: iwlwifi transaction failed, dumping registers
[   18.916371] iwlwifi 0000:01:00.0: iwlwifi device config registers:
[   18.918606] iwlwifi 0000:01:00.0: 00000000: 24f38086 00100402 0280003a 00000000 e1500004 00000000 00000000 0000000
0
[   18.921995] iwlwifi 0000:01:00.0: 00000020: 00000000 00000000 00000000 90108086 00000000 000000c8 00000000 0000010
5
[   18.925749] iwlwifi 0000:01:00.0: iwlwifi device memory mapped registers:
[   18.928665] iwlwifi 0000:01:00.0: 00000000: 18c89008 00000040 00000000 08000000 00000000 00000000 00000019 0000000
0
[   18.933016] iwlwifi 0000:01:00.0: 00000020: 00000110 08000005 00000201 d55555d5 d55555d5 d55555d5 80008040 001f004
2
[   18.937997] iwlwifi 0000:01:00.0: iwlwifi device AER capability structure:
[   18.939655] iwlwifi 0000:01:00.0: 00000000: 14010001 00000000 00000000 00462031 00000000 00002000 00000000 0000000
0
[   18.942523] iwlwifi 0000:01:00.0: 00000020: 00000000 00000000 00000000
[   18.943606] iwlwifi 0000:01:00.0: iwlwifi parent port (0000:00:18.0) config registers:
[   18.944885] iwlwifi 0000:00:18.0: 00000000: 24488086 00200007 060401f2 00014000 00000000 00000000 00010100 000000f
0
[   18.946927] iwlwifi 0000:00:18.0: 00000020: e150e150 0001fff1 00000000 00000000 00000000 00000000 00000000 0000000
0
[   18.948772] iwlwifi 0000:01:00.0: Could not load the [0] uCode section
[   18.949620] iwlwifi 0000:01:00.0: Failed to start INIT ucode: -110
[   18.964794] iwlwifi 0000:01:00.0: Failed to run INIT ucode: -110
[   21.260746] 8021q: 802.1Q VLAN Support v1.8
[   21.264864] 8021q: adding VLAN 0 to HW filter on device enp0s3
This is how the guest sees the PCI device (lspci -vv) (There's a difference in the Capabilities MSI Enable+/- between host and guest; not sure if that's relevant).

Code: Select all

01:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
        Subsystem: Intel Corporation Wireless 8260
        Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 25
        Region 0: Memory at e1500000 (64-bit, non-prefetchable) [size=8K]
        Capabilities: [c8] Power Management version 3
                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable+ 64bit+
                Address: 00000000fee00000  Data: 4025
                Masking: 00000000  Pending: 00000000
        Capabilities: [40] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 unlimited
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr+ NoSnoop+ FLReset-
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L1, Exit Latency L0s <4us, L1 <8us
                        ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+
                LnkCtl: ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+
                        ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Range B, TimeoutDis+, LTR+, OBFF Via WAKE#
                DevCtl2: Completion Timeout: 16ms to 55ms, TimeoutDis-, LTR+, OBFF Disabled
                LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
        Capabilities: [140 v1] Device Serial Number a0-c5-89-ff-ff-35-ab-8d
        Capabilities: [14c v1] Latency Tolerance Reporting
                Max snoop latency: 0ns
                Max no snoop latency: 0ns
        Capabilities: [154 v1] L1 PM Substates
                L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
                          PortCommonModeRestoreTime=30us PortTPowerOnTime=18us
                L1SubCtl1: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+
                           T_CommonMode=0us LTR1.2_Threshold=163840ns
                L1SubCtl2: T_PwrOn=18us
        Kernel driver in use: iwlwifi
        Kernel modules: iwlwifi
What's maybe also worth noting: When the PCI is attached to the VM it cannot be properly shut down (after a clean shutdown it is in aborted state).
(vbox.log is attached)

Do you have an idea how this can be solved?

(Edit: added the vbox.log attachment, add VirtualBox version)
Attachments
vbox.log
vbox.log
(113.71 KiB) Downloaded 22 times
andyp73
Volunteer
Posts: 1631
Joined: 25. May 2010, 23:48
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Assorted Linux, Windows Server 2012, DOS, Windows 10, BIOS/UEFI emulation

Re: PCI Passthrough problem with an Intel WiFi card

Post by andyp73 »

Don't be surprised if you don't get much help on this. There are only 1.5 people in the whole world who have attempted to use PCI passthrough, only one who made it work and zero that actually liked the results.

-Andy.
My crystal ball is currently broken. If you want assistance you are going to have to give me all of the necessary information.
Please don't ask me to do your homework for you, I have more than enough of my own things to do.
Morris22
Posts: 1
Joined: 15. Jun 2019, 15:41

Re: PCI Passthrough problem with an Intel WiFi card

Post by Morris22 »

Managed to solve this by patching the driver:

Code: Select all

--- /usr/src/virtualbox-6.0.8/vboxpci/linux/VBoxPci-linux.c	2019-05-13 16:33:08.000000000 +0300
+++ VBoxPci-linux.c	2019-06-15 16:44:25.988861291 +0300
@@ -240,6 +240,9 @@
              *  flag IOMMU_CACHE later used when mapping physical
              *  addresses, which could improve performance.
              */
+            struct iommu_group * group = iommu_group_alloc();
+            iommu_group_remove_device(&pPciDev->dev);
+            iommu_group_add_device(group, &pPciDev->dev);
             int rcLnx = iommu_attach_device(pData->pIommuDomain, &pPciDev->dev);
             if (!rcLnx)
             {
@@ -1087,7 +1090,9 @@
             flags = IOMMU_READ | IOMMU_WRITE;
             /** @todo flags |= IOMMU_CACHE; */
 
-            r = iommu_map(domain, GuestStart, HostStart, get_order(cMemSize), flags);
+            r = iommu_map(domain, GuestStart, HostStart, cMemSize, flags);
+            //r = iommu_map(domain, GuestStart, HostStart, get_order(cMemSize), flags);
+            //printk(KERN_INFO "cMemSize=%llu get_order=%llu\n", cMemSize, get_order(cMemSize));
             if (r)
             {
                 printk(KERN_ERR "vboxPciOsContigMemInfo:"
@@ -1101,7 +1106,8 @@
         case PCIRAW_MEMINFO_UNMAP:
         {
             int order;
-            order = iommu_unmap(domain, GuestStart, get_order(cMemSize));
+            //order = iommu_unmap(domain, GuestStart, get_order(cMemSize));
+            order = iommu_unmap(domain, GuestStart, cMemSize);
             NOREF(order);
             break;
         }
@andyp73, please add one to the people who liked the results count :)
klaus
Oracle Corporation
Posts: 1110
Joined: 10. May 2007, 14:57

Re: PCI Passthrough problem with an Intel WiFi card

Post by klaus »

That looks very fishy to me... didn't check the docs of these functions, but I assume you added a resource leak (at least some memory will be allocated but never freed).
Post Reply