Skip to content

mfd: macsmc: send the final power command after a protocol fault - #3000

Draft
Alyx-ML wants to merge 1 commit into
aurora-silicon:mainfrom
Alyx-ML:aurora/macsmc-fault-poweroff
Draft

Alyx-ML wants to merge 1 commit into
aurora-silicon:mainfrom
Alyx-ML:aurora/macsmc-fault-poweroff

Conversation

@Alyx-ML

@Alyx-ML Alyx-ML commented Nov 23, 2026

Copy link
Copy Markdown

Part of the #2755 split. Draft: it needs a power-off and reboot row.

Summary

 apple_smc_enter_atomic() / apple_smc_write_atomic()
-  saved fault -> refuse, so power-off sends no MBSE
+  saved fault -> still enter atomic mode and send the final power command
   ordinary writes after a fault -> still -EPROTO

Evidence

  • Before: after a fault, power-off and restart could not send MBSE off1 or phra, so the
    machine stayed on (found by reading).
  • After: a KUnit case in the macsmc suite: without a fault, notifications go off before
    atomic mode; with a saved fault, atomic mode is still entered and no command is sent; an
    ordinary write is still refused with -EPROTO. macsmc-reboot now prints the error code. Build
    and KUnit: passed, Apple build and KUnit.
  • Needed before merging: a power-off and a reboot after a real SMC fault, on a T6050 or J714s.

Merge Danger

Door: two-way

Blast Radius: power-off and reboot

Assisted-by: LLM (Claude:Opus 5.5)

On the T6050 and J714s profiles, the saved-state guard refuses every SMC
command once an unexpected reply sets saved_fault. Nothing clears the
fault. apple_smc_enter_atomic() and apple_smc_write_atomic() used the
same guard, so after a fault the power-off and restart handlers could
not send MBSE = off1 or phra. The machine then stayed on, and
macsmc-reboot only logged the failure without its cause.

Only the power-off and restart handlers enter atomic mode, and only the
final MBSE write follows. So apple_smc_enter_atomic() now still enters
atomic mode when the guard refuses commands. It skips the NTAP write and
warns. apple_smc_write_atomic() sends the final command and warns. It
stops routing replies to a saved-state command that is still marked
pending, so this command's reply is taken as this command's. Every other
command still goes through the guard. Atomic mode already refuses them
all.

macsmc-reboot now prints the error code. It also says that the next
power-off or restart handler is tried, which the notifier chain does on
NOTIFY_OK.

A KUnit case in the macsmc suite checks the guard paths. Without a
fault, notifications are turned off before atomic mode. With saved_fault
set, atomic mode is still entered and no command is sent. An ordinary
write is still refused with -EPROTO.

The kernel and the KUnit case were not compiled or run here (macOS host,
no arm64 kernel toolchain). A power-off and a reboot after a real SMC
fault, on a T6050 or J714s, are needed before this is merged.

Signed-off-by: Alyx-ML <256263590+Alyx-ML@users.noreply.github.com>
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