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
Unknown Object (File)
Tue, Jun 18, 2:08 AM
Unknown Object (File)
Fri, Jun 14, 10:17 PM
Unknown Object (File)
Mon, Jun 10, 7:30 AM
Unknown Object (File)
Jun 6 2024, 2:51 AM
Unknown Object (File)
May 25 2024, 12:28 PM
Unknown Object (File)
May 22 2024, 1:37 AM
Unknown Object (File)
May 22 2024, 1:36 AM
Unknown Object (File)
May 21 2024, 9:17 AM

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