Page MenuHomeFreeBSD

LinuxKPI: Use macro for implementation of some dma_map_* functions
ClosedPublic

Authored by wulf on Jun 28 2021, 8:51 PM.
Tags
None
Referenced Files
F102777608: D30932.id91685.diff
Sun, Nov 17, 1:21 AM
F102777309: D30932.id91459.diff
Sun, Nov 17, 1:14 AM
F102777140: D30932.id91752.diff
Sun, Nov 17, 1:10 AM
Unknown Object (File)
Sun, Nov 3, 6:54 PM
Unknown Object (File)
Oct 11 2024, 12:03 PM
Unknown Object (File)
Oct 2 2024, 12:11 PM
Unknown Object (File)
Sep 29 2024, 5:18 AM
Unknown Object (File)
Sep 23 2024, 4:58 PM

Details

Summary

This allows to remove unimplemented attrs parameter which type differs
between Linux kernel versions and to compile both drm-kmod and ofed
callers unmodified.
Also convert it to 'unsigned long' type to match modern Linuxes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wulf requested review of this revision.Jun 28 2021, 8:51 PM

Did you test-build:

make buildkernel WITH_OFED=YES ?

Did you test-build:

make buildkernel WITH_OFED=YES ?

Just tried, and it succeeded.

If I understand build process correctly, OFED builds even if WITH_OFED is not included. It goes through sys/modules hierarchy

The one thing which scares me is to use unsigned long for pointers, which I think is not a good idea (and a bad Linuxism).
Would uintptr_t work between 32/64bit archs?

All of the LinuxKPI builds on that sizeof(long) == sizeof(void *) --- yeah bad Linux :-)

We even have an compile time assert for that.

In D30932#696344, @bz wrote:

The one thing which scares me is to use unsigned long for pointers, which I think is not a good idea (and a bad Linuxism).
Would uintptr_t work between 32/64bit archs?

Linux does not use unsigned long for pointers here. Initially they stored attrs as array of unsigned longs and passed it by reference. But after attrs stabilized, it is appeared that they fit in one byte and array of unsigned longs was replaced with single unsigned long passed directly.

In D30932#696380, @wulf wrote:
In D30932#696344, @bz wrote:

The one thing which scares me is to use unsigned long for pointers, which I think is not a good idea (and a bad Linuxism).
Would uintptr_t work between 32/64bit archs?

Linux does not use unsigned long for pointers here. Initially they stored attrs as array of unsigned longs and passed it by reference. But after attrs stabilized, it is appeared that they fit in one byte and array of unsigned longs was replaced with single unsigned long passed directly.

Ok. Thanks for the explanation. I guess we can also mark some of them __unused but I am good.

Add __unused keyword to unused parameters

Just make sure a kernel build WITH_OFED=YES builds.

This revision is now accepted and ready to land.Jul 3 2021, 8:09 AM