Repository navigation
drm/apple: let sparse check the IOMFB template; static ops and annotation fixes - #2828
Conversation
…late iomfb_template.c includes dcp-internal.h, which pulls in iomfb_v14_7_tpl.h and iomfb_v26_6_desktop.h. When that happens for the first time inside a template instance, those headers rely on the push_macro/pop_macro pragmas to keep the instance's DCP_FW and DCP_FW_VER. sparse does not implement these pragmas, so for every instance it saw DCP_FW_VER undefined and DCP_FW unexpanded, and gave up on iomfb_template.c with ~190 bogus errors (incomplete struct dcp_swap_submit_req_DCP_FW, undefined preprocessor identifier DCP_FW_VER). The template was effectively never checked. Include dcp-internal.h with the other per-version headers, before each instance defines DCP_FW, as the existing comment already asks. The headers' include guards then make the template's own include a no-op. No functional change: the generated code of every iomfb_* object is identical before and after. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
- apple_drm_ops and dcp_playback_ops are only used in their own file: make them static (and const for the PCM ops, which snd_pcm_set_ops() takes as const). - ext_plane_disable() fills the scanout buffer with cpu_to_le32() values: type the pointer __le32. - dcp_crtc_next_flip_seq() was inserted between the kernel-doc comment of dcp_crtc_send_page_flip_event() and its function. Move it above the comment so the documentation is attached to the right function again. No functional change. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at ba15aed. Checked each change against the head:
Looks good. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist (§1–§6) review at ba15aedee99e0178e911db0bc7a63c98da2e6bb7:
- Technical / semantics check:
- IOMFB template include order (
d321d4b8): verified alliomfb_*.cfiles indrivers/gpu/drm/apple/— all 6 files that#include "iomfb_template.c"now includedcp-internal.hbefore definingDCP_FW(iomfb_v27.c:13already did; the remaining 5 —iomfb_v12_3.c,iomfb_v13_3.c,iomfb_v14_7_tpl.c,iomfb_h17p.c,iomfb_v26_6_desktop.c— are updated here).dcp-internal.hcontains zeroDCP_FW/DCP_FW_VERconditionals and pulls in the guardediomfb_v14_7_tpl.handiomfb_v26_6_desktop.hheaders once whileDCP_FWis undefined, making the re-include insideiomfb_template.c:32a clean no-op without relying on#pragma push_macroin sparse. Matches the identicalllvm-objdump -dacross all 6 objects. - Static ops & annotations (
ba15aede):apple_drm_ops(apple_drv.c:1932) anddcp_playback_ops(audio.c:742) have zero references or extern declarations outside their defining files;snd_pcm_set_ops()takesconst struct snd_pcm_ops *, sostatic constis sound.ext_plane_disable()(dcpext_drm.c:293):ext->pixels(dcpext_drm.c:39) andframe.pixels(dcpext_scanout.h:9) are plainvoid *(4-byte aligned, checked atdcpext_drm.c:417) and the only store throughdstisdst[i] = cpu_to_le32(0xff000000);(line 313). Typingdstas__le32 *fixes the endianness annotation with no__force/__iomemand zero runtime change.dcp.c: movesdcp_crtc_next_flip_seq()above the kernel-doc block fordcp_crtc_send_page_flip_event(), reattaching all four matching@crtc/@e/@now/@startdocs with no code change.
- IOMFB template include order (
- §1 No model gating / §2 Production-ready / §3 Safety: Pass.
- §4 Clean-room & attribution: Pass — both commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by, zero AI trailers in commits, andAssisted-by:in the PR body. - §5 Evidence: Pass — W=1 C=2 clean for
drivers/gpu/drm/apple/(save 1 unrelateddiv_u64sparse false positive indcp_backlight_test.c),llvm-objdump -dverified identical oniomfb_*.o,dcp.o,dcpext_drm.oand identical function sizes onapple_drv.o/audio.o,checkpatch --strictclean,Host tests/host-testsCI green, mergeable (clean). - §6 Naming: Pass.
Verdict: APPROVE — ready for MERGETRAIN-LINUX4.
Assisted-by: LLM (Gemini 4 Neon)
|
Merge-train adversarial review (MERGETRAIN-LINUX4) at ba15aed: no blockers. Merges clean on integration/aurora, alone and together with #2828-#2832. Full reviewVERDICT: NO BLOCKERS Blockers: none. Checked:
Nits: none. Assisted-by: LLM (Claude:Opus 5.5) |
|
Post-merge check at cdce3146 (#2828-#2831 merged onto integration/aurora 120d6aa, fleet79 config, LLVM arm64). dcp.o, dcpext_drm.o and the five IOMFB template objects disassemble identically before and after. apple_drv.o and audio.o differ only in function order and in relocations against .rodata, which is what making the ops static const should do. sparse C=2 on drivers/gpu/drm/apple goes from 331 errors / 406 warnings to 0 errors, with no warning left in the driver (the 3 remaining are in the vdso and math64 headers). kernel-doc on dcp.c goes from 4 warnings to 2; the 2 left are the older dcp_hold_resume_event return-value ones. |
Problem
A W=1 + sparse build of
drivers/gpu/drm/appleon the integration/aurora tip gives about 190 sparse errors iniomfb_template.c, plus a few real warnings. The template errors are bogus.iomfb_v14_7_tpl.handiomfb_v26_6_desktop.huse#pragma push_macro/pop_macroto keep the outer template instance'sDCP_FWwhen they are first included from inside one (throughdcp-internal.h). sparse doesn't implement those pragmas, so it sawDCP_FW_VERundefined andDCP_FWunexpanded in every instance. That means sparse has never really checked the IOMFB template.Change
iomfb_v12_3.c,iomfb_v13_3.c,iomfb_v14_7_tpl.c,iomfb_h17p.c,iomfb_v26_6_desktop.c) now includesdcp-internal.hwith its other per-version headers, before it definesDCP_FW. The existing comment in those files already asks for this. The include guards then make the template's own include a no-op.apple_drm_opsanddcp_playback_opsbecomestatic(the PCM ops alsoconst).ext_plane_disable()gets a__le32 *buffer pointer.dcp_crtc_next_flip_seq()moves above the kernel-doc ofdcp_crtc_send_page_flip_event(), which it had split from its function.No functional change.
Testing
drivers/gpu/drm/apple/with the fleet79 config (clang 22, rustc 1.97.1): no compiler, sparse or kernel-doc warnings from the driver. The one remaining sparse report is a false "division by zero" indcp_backlight_test.cthroughdiv_u64().llvm-objdump -dofiomfb_v12_3/v13_3/v14_7_tpl/h17p/v27/v26_6_desktop.o,dcp.oanddcpext_drm.ois identical before and after. Inapple_drv.oandaudio.oonly the layout changed (the ops tables moved to local rodata, and functions were reordered); every function has the same size.Tracking issue: #2827
Still to run
Nothing hardware-specific: the object code is unchanged. Any fleet boot with this in the tree covers it.
Details
The remaining sparse output for the whole directory after this change:
Logs (lab store):
traces/ci/20261123-code-health/logs/w1-sparse.log(before) anddrm-apple-after.log(after).Assisted-by: LLM (Claude:Opus 5.5)