Skip to content

Review fixups for the merged M4 Pro series - #392

Merged
RyanTheTide merged 9 commits into
integration/aurorafrom
m4pro/review-fixups-20261023
Oct 23, 2026
Merged

RyanTheTide merged 9 commits into
integration/aurorafrom
m4pro/review-fixups-20261023

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Follow-ups from reviewing jgoyvaerts' M4 Pro PRs (#368, #371, #373, #378), plus two older bugs found along the way.

  • macsmc: free the atomic write buffer when a write isn't sent or its reply comes late, and initialise its spinlock
  • rtkit: keep warning about unknown oslog messages (the host selftests rely on it)
  • selftests: replay the cpuidle probe for T6041 too
  • mailbox: only include reachable KUnit tests (fixes the M1 Pro/M2 link)
  • io-pgtable-dart: shift instead of dividing in the output size check (fixes the i386 PAE COMPILE_TEST link)
  • leds-pwm: keep LEDs marked retain-state-shutdown on at shutdown
  • avd av1: range-check the primary reference before using it
  • cs42l84: range-check DAC volume values before narrowing them

Built for J700, M1 Pro, M2 and M4 Pro. Asahi KUnit 67/67, rust_drm_sched 3/3, touched-driver KUnit 147/147, host selftests 57/57.

🤖 Generated with Claude Code

…eply comes late

apple_smc_write_atomic() now leaves atomic_pending set after a poll
timeout or a mismatched reply, and refuses later atomic writes with
-EBUSY while it is set, so that a command the SMC may still be running
never has its shared buffer overwritten.

Two paths leave the flag set for good. When the mailbox refuses the
message, the command was never sent and no reply will ever clear the
flag. And the late reply that would clear it is only seen by
apple_rtkit_poll(), which a refused write no longer calls. Either way
every later atomic write fails, and macsmc-reboot's power-off and
restart keys go unwritten.

Clear the flag when the send fails, and poll RTKit once before refusing
a write, so a late reply that has arrived releases the buffer.

Fixes: c243a5f ("mfd: macsmc: bound the atomic write poll")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 4e4c8c1dff0b1574b6c38c77a8877b0b824da3d9)
Commit db2943a ("soc: apple: rtkit: Log unknown oslog messages at
debug level") moved the default case of apple_rtkit_oslog_rx() to debug.
That default no longer catches the routine traffic it was aimed at:
types 3 to 5, the undocumented notifications coprocessors send during
normal operation, already have their own quiet case, as does the Neo
and M5 log notification. What is left is a type nobody has seen, which
is worth a line in the log; the apple-dcp oslog-events selftest checks
exactly that, and failed with the debug level.

Restore the warning. A new type that turns out to be routine should get
its own quiet case next to 3 to 5.

Fixes: db2943a ("soc: apple: rtkit: Log unknown oslog messages at debug level")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit c75d3fae0e78a4f49f6417061248265d4f5b74ee)
apple_cpuidle_probe() now checks its own node for "apple,t6041-cpuidle"
with of_device_is_compatible(). The cpuidle-s2idle replay called it with
a NULL device and had no such helper, so it stopped compiling.

Give the replay a platform device with a node and a compatibility stub,
and check the T6041 path: both states run WFI, the second has no flags,
and s2idle picks it and reaches tick_freeze().

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 647fb1809c224b26217b3586a3dd7e49b7c09fa5)
The mailbox driver can be built in while KUnit is modular. IS_ENABLED()
includes the G17 mailbox tests in that configuration, leaving vmlinux
with unresolved kunit allocation and assertion symbols at link time.

Use IS_REACHABLE() so built-in mailbox code only includes the tests when
KUnit is built in. Keep the tests available when KUnit is reachable,
including the built-in host GPU KUnit configuration.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 5e89e88d26047584fac5a72fa5dd301e6b1544f7)
…heck

Commit e218ef3 ("iommu/io-pgtable-dart: Reject mappings that cross
the output size") divides a 64-bit value by the runtime page size. On
32-bit COMPILE_TEST builds with a 64-bit phys_addr_t (x86 PAE, ARM
LPAE) that becomes a call to __udivdi3, which the kernel does not
provide, so the link fails.

pgsize has just been checked against pgsize_bitmap, which holds the one
page size of the table, so it is a power of two. Shift by its log2.

Fixes: e218ef3 ("iommu/io-pgtable-dart: Reject mappings that cross the output size")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 831a6c375dfe4af2cc8942e969b0d937fe1768d2)
Commit c70a440 ("leds: pwm: turn the LEDs off at shutdown") turns
every PWM LED off in the new shutdown hook. The LED core sets
LED_RETAIN_AT_SHUTDOWN for any LED whose node has
retain-state-shutdown, which leds/common.yaml documents for all LED
bindings, and gpio_led_shutdown() skips such LEDs. leds-pwm should do
the same, or a board that keeps a power or status LED lit across
reboot loses it.

Skip LEDs that carry the flag.

Fixes: c70a440 ("leds: pwm: turn the LEDs off at shutdown")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit bb75be045a9311a4993e254d092cbb414274aaca)
apple_smc_write_atomic() takes smc->lock, but apple_smc_probe() never
initialises it. The structure comes from devm_kzalloc(), so the lock
works by accident on most configurations, but lockdep and
CONFIG_DEBUG_SPINLOCK report a bad spinlock magic on the first
power-off or restart through macsmc-reboot.

Initialise it next to the mutex.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit df28d6fac84cda1274cd006da7c36f722f642a8a)
…g it

The AV1 frame control's primary_ref_frame and ref_frame_idx[] come from
user space, and the V4L2 control framework does not range-check them.
avd_av1_set_prob() already uses them to index ref_frame_idx[7] and
reference_frame_ts[8] for the CDF load. Commit 57b0e7c ("media:
apple: avd: av1: save a segmentation map with every frame") adds two
more such lookups, for the segmentation map and for the mapping check
in avd_av1_run(), the latter before any other use. A primary_ref_frame
above 7, or a negative or out-of-range index, reads past both arrays.

Refuse the job in avd_av1_run_preamble() when primary_ref_frame is
above AV1_PRIMARY_REF_NONE, or when the index it selects is outside
0..7.

Fixes: 57b0e7c ("media: apple: avd: av1: save a segmentation map with every frame")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 6a3a60c79d0e79d199eaa92292d9578c39a7d4de)
cs42l84_put_dac_vol() adds mc->min to the user's long values and checks
the int results. A value far outside the control's range can wrap into
range when it is narrowed. Commit eaefdaa ("ASoC: cs42l84: honour
the platform volume limit") then compares the original long against
platform_max, and a large negative value passes that test as well, so
the write can still set the DAC above the machine driver's ceiling.

Check both values as longs against 0..max-min first, as
soc_mixer_valid_ctl() does for the stock volsw handlers.

Fixes: eaefdaa ("ASoC: cs42l84: honour the platform volume limit")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 2582b3254e2537878c1a70a649259e40b353ec77)
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.

1 participant