Page MenuHomeFreeBSD

linuxkpi: Define `PMD_SHIFT`
ClosedPublic

Authored by dumbbell on Mar 8 2026, 1:21 PM.
Tags
None
Referenced Files
F154859103: D55734.id173386.diff
Wed, Apr 29, 3:11 PM
F154857260: D55734.id173386.diff
Wed, Apr 29, 3:06 PM
Unknown Object (File)
Sun, Apr 26, 3:32 AM
Unknown Object (File)
Sat, Apr 25, 11:43 PM
Unknown Object (File)
Sat, Apr 25, 6:34 AM
Unknown Object (File)
Fri, Apr 24, 6:41 PM
Unknown Object (File)
Fri, Apr 24, 1:54 AM
Unknown Object (File)
Wed, Apr 22, 1:37 AM

Details

Summary

For now, only define it for x86 architectures.

The DRM generic code started to use it in Linux 6.11.

This is part of the update of DRM drivers to Linux 6.11.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

I don't really like this being done for x86 only, but I'd rather have it at least here for now and we can follow up with other architectures

This revision is now accepted and ready to land.Mar 8 2026, 3:38 PM

Define for several architectures to address @emaste concerns.

This revision now requires review to proceed.Mar 8 2026, 8:55 PM
bz requested changes to this revision.Mar 29 2026, 11:16 PM
bz added a subscriber: bz.

Where do these values come from? Do they match anything native? Do we want at least a comment which ones are considered "to be fixed"?

This revision now requires changes to proceed.Mar 29 2026, 11:16 PM

for i386 PDRSHIFT_PAE, for amd64 PDRSHIFT, but outside it doesn't seems that FreeBSD has direct match. Maybe arm64 / riscv64 L2_SHIFT?

Explain how the constants are computed on Linux and use the corresponding FreeBSD constants. This should address @bz concerns.

Thank you @david_ixit.cz for the initial lookup!

You made me run a grep on Linux; I assume your comments are for 6.11 as I just checked 7 and cannot find any hard coded 21ones anymore.

This revision is now accepted and ready to land.Thu, Apr 2, 12:29 AM
In D55734#1286250, @bz wrote:

You made me run a grep on Linux; I assume your comments are for 6.11 as I just checked 7 and cannot find any hard coded 21ones anymore.

Right, there could be a difference between Linux versions. In Linux 6.11 for instance, the x86 version is defined in arch/x86/include/asm/pgtable_64_types.h and arch/x86/include/asm/pgtable-3level_types.h as:

#define PMD_SHIFT	21
This revision was automatically updated to reflect the committed changes.