Skip to content

Superseded by #1284: t600x PMU RTC wake alarm - #1225

Closed
RyanTheTide wants to merge 2 commits into
integration/aurorafrom
rtc/t600x-pmu-alarm-int2
Closed

RyanTheTide wants to merge 2 commits into
integration/aurorafrom
rtc/t600x-pmu-alarm-int2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by #1284, which adds the missing Maverick control-event latch clear and carries the corrected hardware explanation and verification plan.

The RTC alarm route is PMU peripheral interrupt 2 -> nub-spmi0 -> AIC 636 -> apple-spmi child IRQ -> apple-pmu-rtc. It is a direct SPMI route, not an SMC notification. The t6000 controller's RX-reply notification at 192 is separate from PMU peripheral interrupt 2.

Preserved trial evidence

  • The DT-only predecessor failed because the SPMI controller driver waited on notification 256; T6000 uses 192. Every SPMI transfer timed out, so the SMC RTC, reboot NVMEM cells, and PMU RTC could not read. The system was restored to its production kernel and DT with no trial marker left armed.
  • With the notification-index fix, interrupt-driven SPMI worked, rtc1 registered, RTC time was valid, and there were no SPMI errors.
  • The first awake J316s alarm still produced no IRQ. Its control register went from stale 0x03, to armed 0x43, then back to 0x03 at the deadline. That proves the comparator matched but the stale control-side event latch was preserved and suppressed the new event edge.

Maverick also has a separate W1C event register. Both latches must be clear before arming. #1284 clears control bit 1 on every control write, making the armed value 0x41, and extends the host model with stale-latch edge suppression. It remains draft until two awake J316s alarms increment the IRQ count once each and one subsequent guarded s2idle alarm wakes successfully.

The controller numbers its peripheral interrupts first and puts the RX
FIFO notification right after them. On t8103, t8112 and t8140 that is
256 peripheral interrupts with the notification at 256, which the
driver hard-codes. The M1 Pro, Max and Ultra (t6000) controller has 192
peripheral interrupts and raises the notification as interrupt 192, as
the firmware device tree for the nub SPMI bus lists it.

With the nub SPMI controller described as an interrupt controller, the
driver unmasked bit 256 and waited for a completion that never came,
so every transfer on an M1 Pro timed out ("failed to wait for RX FIFO
not empty") and the SMC RTC, the reboot nvmem cells and the PMU RTC all
failed to read.

Add the interrupt count to the per-SoC data, use it for the
notification index, the mask/ack ranges and the domain bounds, and
match apple,t6000-spmi with a 192-interrupt layout. Other SoCs keep 256.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Make the nub SPMI controller an interrupt controller and add the
Maverick PMU RTC under the PMIC, so rtcwake can wake M1 Pro, Max and
Ultra systems from s2idle. The PMU raises SPMI interrupt 2 for the
alarm.

Keep rtc0 on the SMC clock and give the alarm rtc1 on every t600x
board. The t602x boards share the board files but not this PMU, so
the aliases go in the t600x board files.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

M1 Pro (J316s) hardware receipts, 11-09 00:39 (test kernel 7.3.0-aurora-rtcm1 = fleet34 config + this branch, one-shot Stage 2 trial = live packaged boot.bin with only t6000-j316s.dtb swapped, never committed)

Commit 1 (SPMI notify index): PASS.

  • rtc1 = apple-pmu-rtc (2920a1300.spmi:pmic@f:rtc), with wakealarm yes and wakeup enabled. Time matches rtc0 within 1 s (rtc1 trails by the sub-second part of the offset).
  • 0 SPMI errors with the interrupt-driven FIFO, so notification 192 and AIC 636 are right. SMC RTC, reboot nvmem and PMU RTC all read fine.
  • kerr 0. Kernel warning classes are a subset of the fleet36 baseline. AVC 0, Enforcing.
  • Without commit 1 (DT only, stock fleet34): every SPMI transfer timed out.

Wake alarm: FAIL. Do not merge yet.
rtcwake -d rtc1 -m no -s 8 leaves SPMI irq 2 at count 0 and wakealarm is never cleared. PMU register reads through spmi_nvmem0 show the comparator does match, because the control ARM bit (0x40) clears itself at the deadline. But nothing latches where the AP can see it:

  • the event register keeps the same value;
  • no byte in the RTC block changes apart from ARM and the counter;
  • setting the irq mask bit to 0 or 1 makes no difference;
  • the monitor bit in control reads back as 1 even after writing 0;
  • a kprobe on macsmc_input_event saw no SMC notification across a fire either.

So on t6000 the alarm does not reach the AP's SPMI interrupt. It probably goes through the SMC/monitor path: the firmware device tree marks the PMU has_slpsmc and lists an rtc event for the SMC PMU. That needs its own investigation. Until the alarm reaches the AP, an rtc1 with wakealarm would let rtcwake, systemd or suspend-then-hibernate suspend with no wake, which is unrecoverable on a headless Mac. No s2idle was attempted. Keeping this as a draft.

The Mac is restored: fleet36 default, Stage 2 unchanged, no trial, test kernel removed.

🤖 Generated with Claude Code

@RyanTheTide
RyanTheTide marked this pull request as draft November 8, 2026 13:45
@RyanTheTide RyanTheTide changed the title t600x: PMU RTC wake alarm (SPMI notify index + DT) t600x: PMU RTC wake alarm (SPMI notify index + DT) [draft: alarm not routed to AP] Nov 8, 2026
@CoreyH

CoreyH commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

A data point from a J314s (also T6000), since it may help narrow this down. Here the alarm does reach the AP, through the path your table describes: SPMI interrupt 2 on nub-spmi0, AIC 636, notify 192. Awake it fires on its second and raises the interrupt, and rtcwake -m freeze sleeps end on it, with pm_wakeup_irq the RTC's IRQ (notes). That was a test build of the older rtc-macsmc alarm plus an rtc_alarm_event cell, not apple-pmu.

When it fires here, two things latch (raw log):

0x1401 0x14c0
armed 0x41 0x00
at the deadline 0x03 0x01

Each needs its own clear. Writing 1 to 0x14c0 clears 0x14c0 only. Writing 0x1401 back with bit 1 still set leaves bit 1 set; writing it with bit 1 as 0 clears it. The first time we looked, this Mac already read 0x1401 = 0x03 and 0x14c0 = 0x01: a wake macOS had scheduled had fired and left both latched, with nothing to clear them.

Something to rule out (a hypothesis; I haven't tested it here): on Maverick, apple_pmu_rtc_arm() keeps bit 1 of the control byte, because the event_bit mask only applies when the event shares the control byte. So a latched 0x02 gets written straight back on every arm. If the event only latches on bit 1 going from 0 to 1, a bit 1 left set by macOS or by an earlier fire would look like what you report: ARM clears at the deadline, nothing else in the block moves, and no interrupt.

A quick way to check: read 0x1401 before arming. If bit 1 is set, write 0x01 there and write 1 to 0x14c0, then arm and watch for 0x14c0 setting and irq 2 counting at the deadline. If bit 1 was already clear, this isn't it, and your J316s really does behave differently from this J314s.

🤖 Generated with Claude Code

@RyanTheTide RyanTheTide changed the title t600x: PMU RTC wake alarm (SPMI notify index + DT) [draft: alarm not routed to AP] Superseded by #1284: t600x PMU RTC wake alarm Nov 9, 2026
@RyanTheTide RyanTheTide closed this Nov 9, 2026
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