Page MenuHomeFreeBSD

LinuxKPI: pci: undo the pci_resource_len() check in lkpi_pci_request_region()
ClosedPublic

Authored by bz on Mon, Nov 24, 10:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 4, 8:14 PM
Unknown Object (File)
Mon, Dec 1, 10:47 AM
Unknown Object (File)
Mon, Dec 1, 10:44 AM
Unknown Object (File)
Mon, Dec 1, 10:43 AM
Unknown Object (File)
Mon, Dec 1, 10:11 AM
Unknown Object (File)
Sun, Nov 30, 6:18 PM
Unknown Object (File)
Sun, Nov 30, 6:14 PM
Unknown Object (File)
Sun, Nov 30, 6:13 PM

Details

Summary

Creating non-passthru SR-IOV interfaces on a mlx5en(4) failed.
The problem lies in the pci_resource_len() call but not that the BAR length
is tmeporary 0 but in that we call lkpi_pci_get_bar() with a true argument
which will create the BAR resource for us and report the approriate length
back. However, the later call to bus_alloc_resource_any() will then fail
given the resource already exists.

Restore the previous behaviour and let bus_alloc_resource_any() do the
work. Adjust the return values from -ENODEV to -EBUSY to match callers
expectations.

In linuxkpi_pcim_request_all_regions(), like in linuxkpi_pci_request_regions(),
filter out the -EBUSY errors as "not an error" and try the next bar.
This also seems to be consistent with the expectations of the callers.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 68833
Build 65716: arc lint + arc unit

Event Timeline

bz requested review of this revision.Mon, Nov 24, 10:30 PM
This revision is now accepted and ready to land.Wed, Nov 26, 10:08 AM
bz planned changes to this revision.Wed, Nov 26, 9:34 PM

@kib I'll do the update and push a new revision changing the return values; I had not checked pci_request_region() only the pci[m]_request_regions ones.

sys/compat/linuxkpi/common/src/linux_pci.c
1228

As a matter of fact this should be 0 for linuxkpi_pci_request_region().

1237

And this should be -EBUSY and the callers should equally check -EBUSY.

@kib are you still fine with this or is there anything which needs re-testing?

This revision is now accepted and ready to land.Sat, Nov 29, 11:24 PM