Page MenuHomeFreeBSD

LinuxKPI: device (pci): add a private lkpi_dma_get_mask() call
AbandonedPublic

Authored by bz on Dec 3 2025, 9:45 PM.
Tags
None
Referenced Files
F175721777: D54061.diff
Mon, Oct 12, 7:14 PM
Unknown Object (File)
Mon, Oct 12, 1:26 AM
Unknown Object (File)
Sun, Oct 11, 7:39 PM
Unknown Object (File)
Sat, Oct 10, 7:42 PM
Unknown Object (File)
Sat, Oct 10, 7:29 PM
Unknown Object (File)
Wed, Sep 30, 3:41 PM
Unknown Object (File)
Wed, Sep 30, 9:43 AM
Unknown Object (File)
Tue, Sep 29, 4:11 AM
Subscribers

Details

Reviewers
None
Group Reviewers
linuxkpi
Summary

For PCI (but really should do this for a device) we store device
private dma information like the DMA masks. Given is this currently
local to the implementation we cannot easily access that information.

Add a LinuxKPI private function to query the dma mask. This will be
used in page_pools to avoid allocating pages which will then need
excessive busdma bounce support (which quickly keels over even on amd64
currently [*]) but rather allows us to use an attribute to limit pages to
GPF_DMA32. The reason we can implement this there but were not able to
do so with skbuffs is because page pools can have a cached copy of the
device pointer which skbuffs cannot.

This implementation is used as a stopgap as it is unclear how a proper
Linux interface to this looks like (likely some direct access to entirely
different code).

  • Observed with mt76 by the logging implemented in LinuxKPI and the

sysctl counter: compat.linuxkpi.lkpi_pci_nseg1_fail: 8951

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

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

Event Timeline

bz requested review of this revision.Dec 3 2025, 9:45 PM
bz planned changes to this revision.Dec 12 2025, 9:23 PM

It seems with Linux v6.19-rcN this might no longer be needed as mt76 itself will set GPF_DMA32 and we may no longer require to figure out whether we need to or not.

No longer needed. Upstream fixed their code to DTRT.