PCI passthrough

Discussions related to using VirtualBox on Linux hosts.

PCI passthrough

Postby Ilshavoh » 25. Aug 2012, 10:51

Morning.

PCI passthrough is not working in my particular hardware.
The symptoms are:

1) i can configure the passthrough via --pciattach
2) the device shows up in the guest (both windows or linux guest)
3) the device in the guest is receiving interrupts
4) i am able to get pci passthrough working fully with kvm_intel and qemu-kvm-1.0.1

from the log below it seems that there is a problem either with the configuration of the IOMMU memory mapping or with the configuration of the memory address on the device.
I am trying to track down the issue. I am willing to add any kind of diagnostic code to the linux kernel. Any guidelines on how to narrow down the cause of the problem would be appreciated.

my configuration is:

linux-3.4.9-amd64 on both host and guest.
optionally windows 7 professional as guest.
the problem is the same with either virtualbox-4.1.18, 4.1.20 or 4.2.0rc2
although 4.1.20 solves /ticket/8629 for me, meaning
4.1.18 would not work anyway for the other bug.


on the host i get the following error messages in the kernel log:

[ 1550.170414] vboxpci: vboxPciOsDevInit: dev=300
[ 1550.170430] vboxpci: detected device: 8086:422b at 03:00.0, driver <none>
[ 1550.170464] pci-stub 0000:03:00.0: claimed by stub
[ 1550.170486] vboxPciFileWrite: error -19
[ 1550.170495] vboxpci: vboxPciOsDevInit: dev=300 pdev=ffff88031d414000
[ 1550.170869] pci-stub 0000:03:00.0: irq 47 for MSI/MSI-X
[ 1550.170930] vboxpci: enabled MSI
[ 1550.171241] 300: linux vboxPciOsDevGetRegionInfo: reg=0
[ 1550.171243] got mmio region: e2300000:8192
[ 1550.171246] 300: linux vboxPciOsDevGetRegionInfo: reg=2
[ 1550.171248] 300: linux vboxPciOsDevGetRegionInfo: reg=3
[ 1550.171250] 300: linux vboxPciOsDevGetRegionInfo: reg=4
[ 1550.171252] 300: linux vboxPciOsDevGetRegionInfo: reg=5
[ 1550.171254] 300: linux vboxPciOsDevGetRegionInfo: reg=6
[ 1550.171295] got PCI IRQ: 47

... snip snip ...

[ 1550.172862] linux vboxPciOsDevMapRegion: reg=0 start=e2300000 size=8192
[ 1550.899049] created IOMMU domain ffff8802669c2b20
[ 1550.926357] power state: 0
[ 1551.036619] vboxpci: iommu_attach_device() success

... snip ...

[ 1559.758539] linux vboxPciOsDevMapRegion: reg=0 start=e2300000 size=8192
[ 1559.758544] request_mem_region() failed, don't care
[ 1559.760423] linux vboxPciOsDevMapRegion: reg=0 start=e2300000 size=8192
[ 1559.760428] request_mem_region() failed, don't care
[ 1559.762285] linux vboxPciOsDevMapRegion: reg=0 start=e2300000 size=8192
[ 1559.762289] request_mem_region() failed, don't care
[ 1559.764029] linux vboxPciOsDevMapRegion: reg=0 start=e2300000 size=8192
[ 1559.764033] request_mem_region() failed, don't care
[ 1559.765838] linux vboxPciOsDevMapRegion: reg=0 start=e2300000 size=8192
[ 1559.765842] request_mem_region() failed, don't care

... snip ...

[ 1577.607615] DRHD: handling fault status reg 2
[ 1577.607621] DMAR:[DMA Read] Request device [03:00.0] fault addr 96167000
[ 1577.607622] DMAR:[fault reason 06] PTE Read access is not set
[ 1577.615097] DRHD: handling fault status reg 3
[ 1577.615102] DMAR:[DMA Read] Request device [03:00.0] fault addr 93000000
[ 1577.615103] DMAR:[fault reason 06] PTE Read access is not set
[ 1582.769128] DRHD: handling fault status reg 2
[ 1582.769134] DMAR:[DMA Read] Request device [03:00.0] fault addr 96167000
[ 1582.769135] DMAR:[fault reason 06] PTE Read access is not set
[ 1582.772641] DRHD: handling fault status reg 3
[ 1582.772646] DMAR:[DMA Read] Request device [03:00.0] fault addr 93000000
[ 1582.772647] DMAR:[fault reason 06] PTE Read access is not set
[ 1587.788970] DRHD: handling fault status reg 2
[ 1587.788976] DMAR:[DMA Read] Request device [03:00.0] fault addr 96167000
[ 1587.788977] DMAR:[fault reason 06] PTE Read access is not set
[ 1587.792520] DRHD: handling fault status reg 3
[ 1587.792523] DMAR:[DMA Read] Request device [03:00.0] fault addr 93000000
[ 1587.792524] DMAR:[fault reason 06] PTE Read access is not set


the relevant info on device 03:00.0 from the host side:

03:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 35)
Subsystem: Intel Corporation Centrino Ultimate-N 6300 3x3 AGN
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-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 47
Region 0: Memory at e2300000 (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: 00000000fee00418 Data: 0000
Capabilities: [e0] Express (v1) 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 L0s L1, Latency L0 <128ns, L1 <32us
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
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: 12, GenCap- CGenEn- ChkCap- ChkEn-
Capabilities: [140 v1] Device Serial Number 24-77-03-ff-ff-63-c5-d8
Kernel driver in use: pci-stub
Ilshavoh
 
Posts: 2
Joined: 25. Aug 2012, 10:33

Re: PCI passthrough

Postby Ilshavoh » 27. Aug 2012, 09:51

replacing:

r = iommu_map(domain, GuestStart, HostStart, get_order(cMemSize), flags);

with:

r = iommu_map(domain, GuestStart, HostStart, cMemSize, flags);

in VBoxPci-linux.c seems to fix the isssue.
Ilshavoh
 
Posts: 2
Joined: 25. Aug 2012, 10:33

Re: PCI passthrough

Postby cmwang » 27. Dec 2012, 09:45

Ilshavoh wrote:replacing:

r = iommu_map(domain, GuestStart, HostStart, get_order(cMemSize), flags);

with:

r = iommu_map(domain, GuestStart, HostStart, cMemSize, flags);

in VBoxPci-linux.c seems to fix the isssue.


Hello,I had similar problem on A4-5300+A85X MB,but I failed to compile VirtualBox by myself. Could you upload the binary file for me,thanks!!
cmwang
 
Posts: 4
Joined: 27. Dec 2012, 04:53


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 20 guests