Page MenuHomeFreeBSD

LinuxKPI: Create `linux/util_macros.h`
Needs ReviewPublic

Authored by siri_racha.ca on Fri, Jun 5, 7:39 AM.
Tags
None
Referenced Files
F161398870: D57465.diff
Fri, Jul 3, 10:45 AM
Unknown Object (File)
Wed, Jul 1, 1:02 PM
Unknown Object (File)
Wed, Jun 24, 9:30 AM
Unknown Object (File)
Tue, Jun 23, 9:48 PM
Unknown Object (File)
Tue, Jun 23, 11:16 AM
Unknown Object (File)
Tue, Jun 23, 11:10 AM
Unknown Object (File)
Tue, Jun 23, 9:30 AM
Unknown Object (File)
Tue, Jun 23, 9:22 AM

Details

Reviewers
emaste
dumbbell
Group Reviewers
linuxkpi
Summary

In new amdgpu patches, the for_each_if macro starts being used. It is defined in linux/util_macros.h. This macro begins being used in the amdgpu driver provided in Linux kernel version 6.12, and 6.14. The macro is gaurded to only be used if LINUXKPI_VERSION is above `

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

siri_racha.ca updated this revision to Diff 179264.
This revision is now accepted and ready to land.Fri, Jun 5, 1:41 PM
dumbbell requested changes to this revision.EditedSun, Jun 14, 8:22 AM
dumbbell added a subscriber: dumbbell.

for_each_if() already exists in the DRM drivers. It was moved to <linux/util_macros.h> in Linux 6.15 (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b2108fc82a0acda34388bff3e3ee3544013b1623). Therefore it will need to be wrapped with:

#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 61500
#define for_each_if...
#endif

This is to avoid the risk of double definitions when used with DRM drivers from versions before 6.15.

sys/compat/linuxkpi/common/include/linux/pm.h
35 ↗(On Diff #179264)

Linux doesn’t do that, even on e.g. 7.0.

When the macro was moved to <linux/util_macros.h>, <drm/drm_util.h> started to include it directly. There should be no need for this include.

This revision now requires changes to proceed.Sun, Jun 14, 8:22 AM
sys/compat/linuxkpi/common/include/linux/pm.h
35 ↗(On Diff #179264)

Oh, I see. I originally made the patch the header wasn't there yet. I'm looking at Linux 6.18.4, and it seems to still include it here. Should I remove the include?

Now guarded so it is only used if LinuxKPI version is abov 61500

siri_racha.ca retitled this revision from LinuxKPI: Create linux/util_macros.h, and add it to linux/pm.h to satisify transitivie include in new amdgpu patches to LinuxKPI: Create `linux/util_macros.h`.Sun, Jun 14, 11:35 PM
siri_racha.ca edited the summary of this revision. (Show Details)
dumbbell added inline comments.
sys/compat/linuxkpi/common/include/linux/util_macros.h
35

I believe the second part has reversed logic: for_each_if() should be defined here if LINUXKPI_VERSION >= 61500. Before that, it is defined in <drm/drm_util.h>.

The first part is fine.

This revision now requires changes to proceed.Mon, Jun 15, 7:50 AM
siri_racha.ca added inline comments.
sys/compat/linuxkpi/common/include/linux/util_macros.h
35

Should be fixed