[Midnightbsd-cvs] [MidnightBSD/src] 32f16d: linuxkpi: uplift to FreeBSD 14 level to support dr...

Lucas Holt noreply at github.com
Thu Jun 11 19:14:30 EDT 2026


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/src
  Commit: 32f16d69e4187c372004a638e7a28656a157298d
      https://github.com/MidnightBSD/src/commit/32f16d69e4187c372004a638e7a28656a157298d
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    A drm.md
    M sys/compat/linuxkpi/common/include/acpi/acpi.h
    A sys/compat/linuxkpi/common/include/asm/hypervisor.h
    M sys/compat/linuxkpi/common/include/asm/intel-family.h
    A sys/compat/linuxkpi/common/include/asm/memtype.h
    A sys/compat/linuxkpi/common/include/asm/neon.h
    A sys/compat/linuxkpi/common/include/kunit/static_stub.h
    A sys/compat/linuxkpi/common/include/linux/agp_backend.h
    A sys/compat/linuxkpi/common/include/linux/aperture.h
    A sys/compat/linuxkpi/common/include/linux/apple-gmux.h
    M sys/compat/linuxkpi/common/include/linux/bitmap.h
    A sys/compat/linuxkpi/common/include/linux/build_bug.h
    A sys/compat/linuxkpi/common/include/linux/cleanup.h
    M sys/compat/linuxkpi/common/include/linux/compiler.h
    A sys/compat/linuxkpi/common/include/linux/container_of.h
    M sys/compat/linuxkpi/common/include/linux/device.h
    A sys/compat/linuxkpi/common/include/linux/device/driver.h
    M sys/compat/linuxkpi/common/include/linux/dmi.h
    A sys/compat/linuxkpi/common/include/linux/dynamic_debug.h
    A sys/compat/linuxkpi/common/include/linux/fips.h
    A sys/compat/linuxkpi/common/include/linux/gpf.h
    A sys/compat/linuxkpi/common/include/linux/hdmi.h
    M sys/compat/linuxkpi/common/include/linux/interrupt.h
    A sys/compat/linuxkpi/common/include/linux/io-64-nonatomic-lo-hi.h
    A sys/compat/linuxkpi/common/include/linux/iommu.h
    A sys/compat/linuxkpi/common/include/linux/ioport.h
    A sys/compat/linuxkpi/common/include/linux/iosys-map.h
    A sys/compat/linuxkpi/common/include/linux/irqdomain.h
    M sys/compat/linuxkpi/common/include/linux/kernel.h
    A sys/compat/linuxkpi/common/include/linux/kstrtox.h
    A sys/compat/linuxkpi/common/include/linux/limits.h
    A sys/compat/linuxkpi/common/include/linux/math.h
    A sys/compat/linuxkpi/common/include/linux/minmax.h
    M sys/compat/linuxkpi/common/include/linux/mm.h
    A sys/compat/linuxkpi/common/include/linux/nodemask.h
    A sys/compat/linuxkpi/common/include/linux/of.h
    M sys/compat/linuxkpi/common/include/linux/pci.h
    M sys/compat/linuxkpi/common/include/linux/pm.h
    M sys/compat/linuxkpi/common/include/linux/slab.h
    A sys/compat/linuxkpi/common/include/linux/soc/mediatek/mtk_wed.h
    A sys/compat/linuxkpi/common/include/linux/string_helpers.h
    A sys/compat/linuxkpi/common/include/net/netmem.h
    A sys/compat/linuxkpi/common/include/net/page_pool/helpers.h
    A sys/compat/linuxkpi/common/include/net/page_pool/types.h
    A sys/compat/linuxkpi/common/include/video/cmdline.h
    A sys/compat/linuxkpi/common/include/video/vga.h
    A sys/compat/linuxkpi/common/include/xen/xen.h
    A sys/compat/linuxkpi/common/src/linux_aperture.c
    A sys/compat/linuxkpi/common/src/linux_cmdline.c
    M sys/compat/linuxkpi/common/src/linux_compat.c
    M sys/compat/linuxkpi/common/src/linux_devres.c
    A sys/compat/linuxkpi/common/src/linux_hdmi.c
    M sys/compat/linuxkpi/common/src/linux_pci.c
    M sys/compat/linuxkpi/common/src/linux_tasklet.c
    A sys/compat/linuxkpi/common/src/linuxkpi_hdmikmod.c
    A sys/compat/linuxkpi/common/src/linuxkpi_videokmod.c
    A sys/compat/linuxkpi/dummy/include/linux/sysfb.h
    A sys/compat/linuxkpi/dummy/include/linux/time64.h
    A sys/compat/linuxkpi/dummy/include/linux/util_macros.h
    M sys/modules/Makefile
    A sys/modules/linuxkpi_hdmi/Makefile
    A sys/modules/linuxkpi_video/Makefile

  Log Message:
  -----------
  linuxkpi: uplift to FreeBSD 14 level to support drm-515-kmod (#379)

* drm.md: add gap analysis and plan for building drm-515-kmod

Document the LinuxKPI gaps between MidnightBSD master (~FreeBSD 13.5-STABLE
level) and FreeBSD 14-STABLE that block graphics/drm-515-kmod, and lay out a
two-workstream plan (LinuxKPI uplift via vendor import + port Makefile
recognition of MidnightBSD). Scope is build/link only; runtime bring-up is
out of scope.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: backport devm_add_action()/devm_add_action_or_reset()

Add the devres managed-action helpers from FreeBSD 14-STABLE to the
LinuxKPI devres layer. linux_aperture.c (used by the new linuxkpi_video
module that drm depends on) requires devm_add_action_or_reset().

Implementation is verbatim from FreeBSD 14; builds on the existing
lkpi_devres_alloc()/devres_add() primitives already present in MidnightBSD.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: import FreeBSD 14 additive headers and HDMI/video modules

Bring the LinuxKPI header tree up to FreeBSD 14-STABLE level by importing
the headers MidnightBSD was missing (aperture.h, iosys-map.h, hdmi.h,
iommu.h, irqdomain.h, ioport.h, io-64-nonatomic-lo-hi.h, cleanup.h,
container_of.h, build_bug.h, minmax.h, math.h, limits.h, kstrtox.h,
string_helpers.h, nodemask.h, of.h, agp_backend.h, apple-gmux.h, the
device/ subdir, video/{cmdline,vga}.h, and supporting trees), plus the
dummy linux/sysfb.h.

Add the linuxkpi_hdmi and linuxkpi_video modules (HDMI infoframe helpers,
ACPI-video/backlight, framebuffer aperture handling) that graphics/drm-kmod
links against, and register them in sys/modules/Makefile.

These are required by drm-515-kmod. Existing LinuxKPI files are intentionally
left at MidnightBSD's base-compatible versions: a wholesale FreeBSD 14 import
was evaluated and rejected because it drags base-kernel API changes (AST
framework, protosw refactor, file/fileops API) that would require a much
larger base-kernel uplift. See drm.md.

Both new modules build clean; the core linuxkpi.ko is unchanged and still
builds.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* drm.md: revise to hybrid approach after empirical wholesale-import test

Wholesale FreeBSD 14 LinuxKPI import was tested and rejected: it fails on
base-kernel API deltas (AST framework, protosw refactor, file/fileops API)
that would require a large base-kernel uplift. Document the hybrid approach
(additive import + targeted backports) and record progress.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* drm.md: correct Workstream B to target mports, not FreeBSD ports

/usr/ports is the upstream FreeBSD ports tree and is not operational under
MidnightBSD make. The drm-515-kmod port must be created in MidnightBSD's
mports (/usr/mports) by modeling the existing drm-510-kmod.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: use single-argument vm_operations_struct.fault callback

drm 5.15 (ttm_bo_vm.c and others) installs fault handlers of type
vm_fault_t (*)(struct vm_fault *) — the modern Linux signature. Update
the LinuxKPI vm_operations_struct.fault prototype to match and drop the
redundant vm_area_struct argument at the two call sites in the cdev pager
fault path (the vma is already available via vmf->vma, set just above).

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: make linux/kernel.h pull in linux/math64.h

drm 5.15 sources (e.g. drm_mm.c) use div64_u64_rem() with only
<linux/kernel.h> in their include chain. FreeBSD 14 satisfies this via
kernel.h -> math.h; MidnightBSD's kernel.h did not reach the div64_*
helpers. Include <linux/math64.h> directly from kernel.h so the helpers
are visible wherever kernel.h is (transitively) included. No macro
overlap; linuxkpi.ko still builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: add pcie_aspm_enabled() and Alder Lake INTEL_FAM6 ids

amdgpu (amdgpu_device.c/amdgpu_drv.c) uses pcie_aspm_enabled() and the
INTEL_FAM6_ALDERLAKE* model ids. Add the pci.h stub (returns false, as in
FreeBSD 14) and sync asm/intel-family.h to FreeBSD 14.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: define noinline_for_stack

amdgpu's DML display code (display_mode_vba_30.c and others) uses the
noinline_for_stack attribute. Add it to linux/compiler.h as __noinline,
matching FreeBSD 14.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: add bitmap_to_arr32()

amdgpu's SMU power-management code (smu_v11_0.c, smu_v13_0.c) uses
bitmap_to_arr32(). Add it to linux/bitmap.h, matching FreeBSD 14.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: add acpi_put_table()

radeon (radeon_bios.c) releases ACPI tables with acpi_put_table(), the
companion to the already-present acpi_get_table(). Add it mapping to
ACPICA's AcpiPutTable(), matching FreeBSD 14.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: move BUILD_BUG machinery to linux/build_bug.h

i915 includes <linux/build_bug.h> directly; the imported FreeBSD 14
build_bug.h and MidnightBSD's kernel.h both defined the _O___CTASSERT /
BUILD_BUG_ON machinery, causing -Werror=macro-redefined. Follow FreeBSD
14: keep the machinery in build_bug.h and include it from kernel.h
(BUG/BUG_ON/WARN_ON remain in kernel.h). linuxkpi.ko builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: self-contain dmi.h errno use; import dummy util_macros.h

- dmi.h: include <linux/errno.h> (uses ENXIO; was relying on include order
  that drm's panel-orientation-quirks TU doesn't satisfy).
- import dummy linux/util_macros.h (i915 intel_snps_phy.c includes it).

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: backport tasklet callback API and ZERO_SIZE_PTR

i915 (intel_engine_cs.c, intel_execlists_submission.c, gen6_ppgtt.c) uses
the newer Linux tasklet callback API and ZERO_SIZE_PTR:
- interrupt.h: add tasklet_callback_t, tasklet_struct.callback/use_callback,
  from_tasklet(), and the tasklet_setup() prototype (with a forward decl of
  struct tasklet_struct).
- linux_tasklet.c: dispatch via ->callback when use_callback is set;
  initialise the new fields; add tasklet_setup().
- slab.h: define ZERO_SIZE_PTR and have ZERO_OR_NULL_PTR() test it.
All from FreeBSD 14. linuxkpi.ko builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: import linux/time64.h for i915 (intel_guc_ct.c)

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: add PCI/device power-state bits used by i915 debugfs

i915_debugfs.c reads dev->power.usage_count, pdev->current_state and
pci_power_name(). Backport from FreeBSD 14:
- pm.h: struct dev_pm_info { atomic_t usage_count; }
- device.h: struct device.power
- pci.h: struct pci_dev.current_state, extern pci_power_names[6],
  pci_power_name()
- linux_pci.c: define pci_power_names[].
linuxkpi.ko builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: move U*_MAX/S*_MAX limit macros to linux/limits.h

i915 includes <linux/limits.h>; the imported FreeBSD 14 limits.h and
MidnightBSD's kernel.h both defined U8_MAX..S64_MIN, causing
-Werror=macro-redefined. Follow FreeBSD 14: keep them in limits.h and
include it from kernel.h (the U8_C/S8_C etc. helper macros stay in
kernel.h). linuxkpi.ko builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* drm.md: record successful build of all six drm-515 modules

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

* linuxkpi: NULL-guard hdmi_spd_infoframe_init()

Defense-in-depth requested in PR review: validate frame/vendor/product
before use. This is a deliberate MidnightBSD-local divergence from the
otherwise-verbatim FreeBSD 14 linux_hdmi.c; re-apply after future LinuxKPI
re-syncs.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply at anthropic.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications



More information about the Midnightbsd-cvs mailing list