Skip to content

drm/asahi: g18: Make the GPU driver load again when G18 is built (one __param section, not two) - #1972

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:integration/aurorafrom
funkzy:fix-g18-params
Nov 17, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:integration/aurorafrom
funkzy:fix-g18-params

Conversation

@funkzy

@funkzy funkzy commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What is missing

Since #1939 the shared defaults build the G18 backend (CONFIG_DRM_ASAHI_G18=y), and aurora.ko no longer loads,
so no Apple GPU probes on a kernel built from them, whatever the generation. On a Mac Studio (M5 Ultra, J775D) with
integration's head the module load stops at:

sysfs: cannot create duplicate filename '/module/aurora/sections/__param'
 sysfs_warn_dup+0x64/0x80
 ...
 mod_sysfs_setup+0x408/0x6d4
 load_module+0x1bd4/0x2200

and the GPU device stays without a driver: no render node, and the desktop session's dependencies fail.

The module has two sections named __param (readelf -S aurora.ko):

[30] __param  PROGBITS ... 000370 00  AR  0   0  8
[32] __param  PROGBITS ... 000f78 00   A  0   0  8

The first holds the 22 diagnostic parameters of g18/compat (0x370 bytes, 22 entries of 40). They declare their
kernel_param entries by hand with a plain #[used], which is #[used(linker)] on ELF targets: the section gets
SHF_GNU_RETAIN (the R), so the module link keeps it apart from the module's other __param input sections, whose
entries (kernel::module!'s, g18_param!'s) are #[used(compiler)]. Built without G18, the module has one
__param section: integration's head with G18 off, its parent b9ac02a, and 7c71d6d all do.

What this adds

One commit, in the G18 backend only. Every hand-written __param entry of the backend now goes through one macro,
g18_kernel_param! (g18/params.rs), which emits it the way rust/macros/module.rs does: #[used(compiler)], and
a raw address of __this_module instead of a reference to the mutable extern static. g18_param!, the application
compute knobs, the two render policy parameters and the 22 compat parameters use it; their names, permissions,
operations and arguments are unchanged. One definition means a new parameter cannot pick the other attribute again.

A side effect: the 23 "creating a shared reference to mutable static" warnings these entries added to the build
are gone.

Considered and not done: a __param rule in scripts/module.lds.S would merge such sections for every module, but
it changes the link of every module on every architecture for a mistake that is local to this backend, and the
in-tree macro already shows the right attribute.

Who runs the changed code

Only code built with CONFIG_DRM_ASAHI_G18 changes. Built without it, none of the changed code is compiled. Built
with it (integration's defaults since #1939), every board gets a GPU driver that loads again, and the G18 boards
(T8152, J873) keep the same parameters with the same names, permissions and handlers. No other GPU family's code is
touched.

Depends on

Nothing.

Validation

On integration/aurora at 0b03fe4:

  • Builds with integration's own configuration (defconfig + asahi.config, the GPU driver as a module with G18), alone
    and under the M5 Ultra commits, with 0 errors; on fc05050 under the M5 Ultra pull request alone, too.
    aurora.ko has one __param section of 0x12e8 bytes (121 entries, the 22 compat entries among them), where the
    head has two (0x370 and 0xf78).
  • Built in (CONFIG_DRM_ASAHI=y): all 53 G18 parameter entries, the 22 compat ones among them, lie inside vmlinux's
    __param table, so built-in kernels keep the same parameters.
  • Warnings: the GPU driver's go from 37 to 14. The 23 removed are all "creating a shared reference to mutable static"
    from these entries, and the other 14 are unchanged.
  • scripts/checkpatch.pl --strict: clean.

Hardware (Mac Studio, M5 Ultra, J775D)

integration/aurora at 0b03fe4 with integration's configuration and the M5 Ultra commits (then including a
compute-timestamp change that is no longer in this set), one boot each:

  • Without this commit: the module load fails as above; the GPU has no driver.
  • With it: the GPU probes and the session units that need it no longer fail. The GPU's compute and chained-submit checks pass, as do
    46 concurrent clients and a 628-case render CTS subset (571 pass, 57 not supported). All 477 timestamp and
    calibration CTS cases of the monolithic pipeline and multiview groups pass or are not supported (54 without a
    display). The kernel log shows no GPU recovery, fault or timeout. The light compute rows read as on 7c71d6d
    (16.9-17.2 us with 8 computes in flight against 16.7-17.6).
  • Rebased onto integration/aurora at fc05050 (the merge of drm/asahi: g17: let a refused render take back idle render pools #1948) with only the M5 Ultra pull request
    ("J775D GPU and CPU clusters" below), integration's configuration, one boot: the GPU probes, and the compute and
    chained-submit checks, 46 concurrent clients and the 628-case subset (571 pass, 57 not supported, two runs) pass,
    with no GPU recovery, fault or timeout in the kernel log. On another boot of the same kernel, 475 of the 477
    timestamp and calibration cases pass or are not supported; the two timestamp_stage cases fail (on a third boot
    too), as they do on the M5 Ultra until dj's Mesa usb: xhci: plat: fix the modpost break in xhci-plat-test (KUNIT_ALL_TESTS=m), add missing KUnit module descriptions #347 (open) is in, which makes them pass on the same kernel.
    This commit does not touch that path.

Not tested

  • A G18 board (T8152, J873): the parameters it reads are the same entries, now in one section.
  • KUnit (no code it covers changes). tools/asahi/run-host-tests.py did run, on integration/aurora at
    fc05050 with this and the M5 Ultra pull request: 321 of 321 pass, as on the head.

Part of the M5 Ultra platform pack

Each pull request below stands on its own; together they bring the Mac Studio (M5 Ultra, J775D) up from public
branches to the desktop.

… __param section, not two)

Since aurora-silicon#1939 turned the G18 backend on in the shared defaults
(CONFIG_DRM_ASAHI_G18=y), aurora.ko no longer loads, so no Apple GPU
probes, on any generation:

  sysfs: cannot create duplicate filename '/module/aurora/sections/__param'
  ... mod_sysfs_setup+0x408/0x6d4
  ... load_module+0x1bd4/0x2200

The module has two sections named __param. The 22 diagnostic parameters
of g18/compat declare their kernel_param entries by hand with a plain
used attribute, which is #[used(linker)] on ELF: their section gets
SHF_GNU_RETAIN, so the module link keeps it apart from the module's other
__param input sections, whose entries (kernel::module!'s, g18_param!'s)
are #[used(compiler)]. The import of the backend brought these entries;
with G18 off they are not built and the module has one __param section,
so the mistake stayed hidden until aurora-silicon#1939 exposed it by turning G18 on.

Declare every hand-written __param entry of the backend through one
macro, g18_kernel_param!, which emits it the way rust/macros/module.rs
does: #[used(compiler)], and a raw address of __this_module instead of a
reference to the mutable extern static. g18_param!, the application
compute knobs, the two render policy parameters and the 22 compat
parameters now go through it; their names, permissions, operations and
arguments are unchanged. Built with G18, aurora.ko has one __param
section again, and the 23 "creating a shared reference to mutable static"
warnings of these entries are gone.

Only code built with CONFIG_DRM_ASAHI_G18 changes. Without it none of this
is built; with it every board gets a GPU driver that loads, and the
G18 boards (T8152) keep the same parameters.

Fixes: b2e300a ("drm/asahi: g18: import the G18G (T8152) backend")
Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the G18-local parameter-emission refactor with an independent source review. All 22 compat names/ops/permissions/arguments retain their values; the generic, application and render parameters use the same declaration convention. The shared macro follows the kernel's #[used(compiler)] convention and avoids creating a reference to mutable __this_module; no parameter handlers or GPU policy change. Exact-head host CI is green. Author-supplied module/built-in table inspection and J775D module-load/regression rows support the fix at their stated compositions. No new Kbuild/hardware operation or G18 hardware qualification is claimed by this review.

@DjDeveloperr
DjDeveloperr merged commit f510691 into aurora-silicon:integration/aurora Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants