Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
19c543a
kboot: disable an untrained optional T6050 apcie0 port's root port an…
funkzy Nov 2, 2026
88a69d8
T6050: bring up apcie0 port 0, the N1 Wi-Fi/Bluetooth, after ports 2 …
funkzy Nov 2, 2026
0cda56f
T6050: hand an up GP port's link tunables to Linux on its root port node
funkzy Nov 2, 2026
2bc7518
T6050: number the GP ports' buses as Linux does, and hand over a tree…
funkzy Nov 3, 2026
678cb80
pcie-t6050: leave GP ports as found on boards without the required port
erikwb Nov 3, 2026
faf1a26
pcie-t6050: bring up the GP ports a board has
erikwb Nov 4, 2026
49be707
smc: release an ADT function-reset through the SMC, one helper
funkzy Nov 2, 2026
2968a0c
pmgr, pcie: power off the PCIe block's gates that ANS depends on
DjDeveloperr Nov 8, 2026
adf5580
nvme: power a post-M4 ANS off after use, and start it from off
DjDeveloperr Nov 8, 2026
4824178
nvme: disable a post-M4 controller before ANS is powered off
DjDeveloperr Nov 8, 2026
0376b1c
nvme: power a post-M4 ANS back on before nvme_init() reads it
DjDeveloperr Nov 8, 2026
1e74400
usb: support explicit T6050 Stage 2 CDC handoff
DjDeveloperr Nov 8, 2026
62acacd
kboot: allow up to 16 ADT i2c controllers
DjDeveloperr Nov 8, 2026
f6e5b83
kboot: T6050: reserve the display coprocessors' __OS_LOG buffers
DjDeveloperr Nov 8, 2026
1a2c212
kboot: find the dcp alias with exact node names
DjDeveloperr Nov 9, 2026
faa355c
kboot: T6050: hand the internal display over to the OS
DjDeveloperr Nov 9, 2026
9b7c306
kboot: T6050: copy the ATC combo PHY tunables from the ADT
DjDeveloperr Nov 9, 2026
ec204ea
kboot: T6050: hand the M5 Pro GPU over to the OS
DjDeveloperr Nov 9, 2026
0c9317a
build: make room in .init and .text for more boot code
DjDeveloperr Nov 9, 2026
3089662
kboot: let an OS at EL2 return from its own sleep
DjDeveloperr Nov 8, 2026
747b25b
smp: publish the S2R mailbox with only the boot core running
DjDeveloperr Nov 9, 2026
6c014df
smp: T6050: number the CPU start bits 6 * cluster + core
DjDeveloperr Nov 9, 2026
501bb76
smp: say on DockChannel how the boot core leaves an S2R reset
DjDeveloperr Nov 9, 2026
6dacafe
ctxr_exec: take the boot core as confined when CTXR_D is armed
DjDeveloperr Nov 9, 2026
95d2b69
kboot: T6050: hand the J716c and J714s cameras over to the OS
DjDeveloperr Nov 9, 2026
728e0ae
kboot: T6050: find the camera nodes by their exact paths
DjDeveloperr Nov 9, 2026
4a340fd
kboot: T6050: keep the camera handoff helpers in .init
DjDeveloperr Nov 9, 2026
523f111
kboot: T6050: reserve the ANS SART ranges for Linux
DjDeveloperr Nov 9, 2026
9e1a912
nvme, kboot: T6050: drive the split NVMe layout from an ESP Stage 2
DjDeveloperr Nov 9, 2026
310bc6e
main: an ESP Stage 2 opens the debugusb window unless one was offered
DjDeveloperr Nov 9, 2026
cbdebf7
pcie: bring up T6050 apcie0's GP ports in kboot, with storage checks
funkzy Nov 2, 2026
56e6d95
kboot: T6050: hand off the external display engines beside the intern…
DjDeveloperr Nov 9, 2026
5bcf3cb
kboot: T6050: find each external engine's nodes by their exact paths
DjDeveloperr Nov 9, 2026
3aa712c
rtkit, sart, asc: idle an IOP, and start it after a power loss
DjDeveloperr Nov 8, 2026
06deeca
build: size-optimize kboot.o so the T6050 handoffs fit
DjDeveloperr Nov 9, 2026
12a1bde
kboot: T6050: take an external engine's power from its gates' real pa…
DjDeveloperr Nov 9, 2026
7349ce8
pcie, pmgr: T6050: power ANS off and back as macOS does around a sleep
DjDeveloperr Nov 9, 2026
3dd2813
payload: an nvme.adopt from an older Stage 1 still marks a chained boot
DjDeveloperr Nov 9, 2026
f06f052
rtkit, asc, pcie: ANS's stop and start as macOS does them on T6050
DjDeveloperr Nov 9, 2026
5e5ea38
nvme: T6050: suspend the controller before ANS is powered off, as mac…
DjDeveloperr Nov 9, 2026
9f501f3
kboot: T6050: give the GPU node this part's leakage calibration words
DjDeveloperr Nov 10, 2026
76d0800
wdt: reset from a fault taken before wdt_disable()
DjDeveloperr Nov 9, 2026
6001516
pmgr: share the public ADT power-register collector with display handoff
DjDeveloperr Nov 10, 2026
bf51e45
usb: use the standalone boot wait helpers for the T6050 handoff
DjDeveloperr Nov 10, 2026
2893294
build: place run-once kboot preparation in the remaining init space
DjDeveloperr Nov 10, 2026
c634f90
nvme: recover a stalled T6050 adopted session for both ESP boot paths
DjDeveloperr Nov 10, 2026
3d1930f
docs: describe the T6050 Linux and shared storage handoff
DjDeveloperr Nov 10, 2026
0e4c153
nvme: use the shared session ownership when retrying controller setup
DjDeveloperr Nov 10, 2026
641ae8a
style: format the split M5 changes with clang-format 20
DjDeveloperr Nov 10, 2026
e4dbf4e
tests: refresh host fixtures for the M5 handoff APIs
DjDeveloperr Nov 10, 2026
153c462
tests: complete the display boot-args and CTXR probe fixtures
DjDeveloperr Nov 10, 2026
bedeef0
tests: use a native section in Darwin display fixtures
DjDeveloperr Nov 10, 2026
d934dfc
Merge public main into M5 Pro Linux bring-up
DjDeveloperr Nov 10, 2026
c838e96
tests: keep NVMe fixture fragments aligned with main
DjDeveloperr Nov 10, 2026
c2a40c0
tests: define T6050 in USB HS session fixture
DjDeveloperr Nov 10, 2026
87efd06
tests: mark unused USB session counter explicitly
DjDeveloperr Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ OBJECTS := \
memory.o memory_asm.o \
nvme.o \
payload.o \
j813_n1.o pcie.o pcie_fdt.o \
j813_n1.o pcie.o pcie_fdt.o pcie_t6050.o \
pmgr.o \
proxy.o \
ringbuffer.o \
Expand Down Expand Up @@ -284,6 +284,12 @@ $(BUILD_FP_OBJS): build/%.o: src/%.c
$(QUIET)mkdir -p "$(dir $@)"
$(QUIET)$(CC) -c $(BASE_CFLAGS) -MMD -MF $(DEPDIR)/$(*F).d -MQ "$@" -MP -o $@ $<

# Guest-only code in .init (aura.ld): its cL4 register switches are 5 KiB smaller at -Oz, which
# leaves room in .init for more of the guest-only objects.
build/sptm_virt_cl4.o: CFLAGS += -Oz
# Run-once OS handoff code: -Oz keeps .text within its 64 KiB steps (see _file_limit).
build/kboot.o: CFLAGS += -Oz

build/%.o: src/%.c build-tag build-cfg
$(QUIET)echo " CC $@"
$(QUIET)mkdir -p $(DEPDIR)
Expand Down
5 changes: 5 additions & 0 deletions aura-raw.ld
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ SECTIONS {
*/
*hv/hv_vm.o(.text .text.*)
*hv/hv_sprr.o(.text .text.*)
*hv/hv_virtio.o(.text .text.*)
*hv/hv_vuart.o(.text .text.*)
*hv/hv_wdt.o(.text .text.*)
/* Run-once OS preparation also fits in this slot. */
*kboot.o(.text .text.*)
} :text
.text : ALIGN(0x10000) {
*(.text)
Expand Down
5 changes: 5 additions & 0 deletions aura.ld
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ SECTIONS {
*/
*hv/hv_vm.o(.text .text.*)
*hv/hv_sprr.o(.text .text.*)
*hv/hv_virtio.o(.text .text.*)
*hv/hv_vuart.o(.text .text.*)
*hv/hv_wdt.o(.text .text.*)
/* Run-once OS preparation also fits in this slot. */
*kboot.o(.text .text.*)
} :text
.text : ALIGN(0x10000) {
*(.text)
Expand Down
22 changes: 22 additions & 0 deletions docs/boot-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ runs the OS inside the armed window and emits `/chosen/aurora,ctxr-exec-window`.
With no usable window it does not start the OS. Elsewhere nothing changes.
[The boot object notes](macho-boot-object.md#running-the-os) say what it needs.

## Sleep and CPU power-off for an OS at EL2

There is no option for this. An OS that aura starts at EL2 has no monitor below
it, so it powers cores off and suspends the system itself. From M4 on, the Neo's
A18 Pro included, iBoot locks every core's reset vector to the boot object, so each
core then restarts inside aura. On those chips kboot publishes
`/chosen/aurora,s2r-mailbox`, the physical address of a 32-byte mailbox in aura's
image:

- a secondary comes back through its spin-table release address, which still holds
the OS's;
- the boot core jumps to the resume address the OS left in the mailbox, at EL2 with
the MMU and caches off and interrupts masked, or reboots if the OS left none.

The CPUs keep `spin-table`. The property says they can power off and come back:
Linux with the T8140 sleep series gives them its parking spin table then, and an OS
that doesn't know the property ignores it. Whether to deep-sleep is the OS's choice.
Once the mailbox is published, reset paths don't print, since the OS owns the UART
and the display. The mailbox sits in aura's image, which kboot reserves anyway, so it
takes no memory of its own. On A7 to M3 RVBAR isn't locked, so nothing is published,
and a guest at EL1 gets nothing.

## DebugUSB interception (development builds)

A build made with `DEBUGUSB_PROXY=1` also opens the 15 second `aura-proxy`
Expand Down
6 changes: 4 additions & 2 deletions docs/macho-boot-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ These worked under the monitor, or were reachable through it, except power-off:
- **CPU hotplug.** Spin-table has no CPU off, and aura no longer parks a core for
the OS. The kernel in aurora-silicon/linux#985 has no `cpu_die` for spin-table, so
taking a CPU offline fails with `EOPNOTSUPP`. Suspend to RAM and hibernation take
the secondaries offline the same way, so they fail there too. A separate kernel
patch that parks the core itself ran once on a Neo, and it isn't in that PR.
the secondaries offline the same way, so they fail there too. aura publishes
`/chosen/aurora,s2r-mailbox` for an OS at EL2 on these chips, though, and a kernel
that reads it powers cores off and suspends itself
([boot options](boot-options.md#sleep-and-cpu-power-off-for-an-os-at-el2)).
- **PSCI `SYSTEM_RESET`.** Restart now needs `macsmc-reboot` or the Apple watchdog.
The monitor answered `SYSTEM_OFF` with a reset as well, so power-off never worked
through it, and now needs `macsmc-reboot`. The J700 tree describes both, but
Expand Down
33 changes: 33 additions & 0 deletions docs/t6050-linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# T6050 Linux handoff

The M5 Pro Linux path prepares the firmware-owned display engines, ATC PHYs,
GPU, cameras and PCIe links before entering Linux. It reserves the display logs,
ANS SART ranges and retained firmware buffers, and publishes the S2R mailbox.
GPU leakage calibration is read from the part's fuses rather than stored in a
board device tree. A matching Linux device tree and drivers are still required.

Build an ESP Stage 2 with:

```sh
make USE_CLANG=1 BUILDSTD=1 CHAINLOADING=1 ESP_STAGE2=1 DEBUGUSB_PROXY=1
```

`boot=` selects the kernel, initrd and device tree on the ESP; see
[boot-options.md](boot-options.md). `nvme.adopt=live-rtkit-v1` identifies an
inherited ANS session. An inherited T6050 controller that never becomes ready
gets one recovery attempt using the same suspend, SART preservation and ANS
power-cycle implementation used after normal storage access.

The optional GP ports are discovered from the board's ADT. Port 0 carries N1
Wi-Fi/Bluetooth where present; absent ports are left alone. The PCIe sequence
checks storage state while bringing up the GP side. An already trained link is
adopted, and the root-port bus numbers and tunables handed to Linux agree.

For a Stage 1 build omit `ESP_STAGE2=1 DEBUGUSB_PROXY=1`; the default build
without `CHAINLOADING=1` remains a separate configuration. Preserve artifacts
and their configuration and hashes for each build. Successful links do not
qualify other chips or replace hardware validation.

The macOS SPTM virtualization series depends on this shared storage and boot
infrastructure. Its ESP loader and ANS-to-XNU handoff are separate from this
Linux series. Full macOS sleep and wake remains under investigation.
17 changes: 17 additions & 0 deletions src/asc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ bool asc_cpu_running(asc_dev_t *asc)
return read32(asc->cpu_base + ASC_CPU_CONTROL) & ASC_CPU_CONTROL_START;
}

/* The mailbox's receive side (I2A) on or off, as macOS sets it around an IOP's power loss. */
void asc_i2a_enable(asc_dev_t *asc, bool on)
{
if (on)
set32(asc->base + ASC_MBOX_I2A_CONTROL, ASC_MBOX_CONTROL_ENABLE);
else
clear32(asc->base + ASC_MBOX_I2A_CONTROL, ASC_MBOX_CONTROL_ENABLE);
}

/* Stopped in its idle loop, as an IOP that acknowledged an idle request reads. */
bool asc_cpu_idle(asc_dev_t *asc)
{
u32 status = read32(asc->cpu_base + ASC_CPU_STATUS);

return (status & ASC_CPU_STATUS_STOPPED) && (status & ASC_CPU_STATUS_IDLE);
}

static bool asc_mailbox_empty(u32 control)
{
return (control & (ASC_MBOX_CONTROL_ENABLE | ASC_MBOX_CONTROL_EMPTY)) ==
Expand Down
2 changes: 2 additions & 0 deletions src/asc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ bool asc_is_v8(asc_dev_t *asc);
void asc_cpu_start(asc_dev_t *asc);
void asc_cpu_stop(asc_dev_t *asc);
bool asc_cpu_running(asc_dev_t *asc);
bool asc_cpu_idle(asc_dev_t *asc);
void asc_i2a_enable(asc_dev_t *asc, bool on);
/* Inherited display coprocessor states accepted for a handoff. */
enum asc_inherited_state {
ASC_INHERITED_RUNNING, /* started and not stopped */
Expand Down
15 changes: 7 additions & 8 deletions src/chainload.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ static bool chainload_start_trial(char **vars, size_t *var_cnt, size_t var_capac

int chainload_load(const char *spec, char **vars, size_t *var_cnt, size_t var_capacity)
{
static char adopt_var[] = "nvme.adopt=live-rtkit-v1";
#if defined(DEBUGUSB_PROXY) && !defined(ESP_STAGE2)
static char host_window_var[] = "aura.host-window=done";
#endif
Expand All @@ -378,19 +377,19 @@ int chainload_load(const char *spec, char **vars, size_t *var_cnt, size_t var_ca
return -1;
}

if (nvme_has_live_post_m4_session()) {
/* Post-M4: the SART entries the next stage starts ANS again with, after nvme_shutdown(). */
char *sart_var = nvme_sart_var();
if (sart_var) {
bool present = false;
for (size_t i = 0; i < *var_cnt; i++) {
if (!strcmp(vars[i], adopt_var))
present = true;
}
for (size_t i = 0; i < *var_cnt; i++)
present |= vars[i] == sart_var;
if (!present) {
if (*var_cnt >= var_capacity) {
printf("chainload: no room for ANS adoption variable\n");
printf("chainload: no room for nvme.sart\n");
nvme_shutdown();
return -1;
}
vars[(*var_cnt)++] = adopt_var;
vars[(*var_cnt)++] = sart_var;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/chickens.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "chickens.h"
#include "cpu_regs.h"
#include "midr.h"
#include "smp.h"
#include "uart.h"
#include "utils.h"

Expand Down Expand Up @@ -196,7 +197,7 @@ void init_cpu(void)
int part = FIELD_GET(MIDR_PART, midr);
int rev = (FIELD_GET(MIDR_REV_HIGH, midr) << 4) | FIELD_GET(MIDR_REV_LOW, midr);

bool quiet = (chip_id == T8142 || chip_id == T8152) && !is_boot_cpu();
bool quiet = ((chip_id == T8142 || chip_id == T8152) && !is_boot_cpu()) || smp_s2r_published();
if (!quiet)
printf(" CPU part: 0x%x rev: 0x%x\n", part, rev);

Expand Down
14 changes: 14 additions & 0 deletions src/ctxr_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ static void ctxr_exec_warn_unprobed(const char *why)
* leave the windows armed, and one that did not (M1 to M3, or a raw boot
* object) runs the probe and is not confined.
*/
static const char *ctxr_exec_problem(void);

bool ctxr_exec_confined(void)
{
static int confined = -1;
Expand All @@ -118,6 +120,18 @@ bool ctxr_exec_confined(void)
if (cpu != boot_cpu_idx && smp_is_alive(cpu))
break;
if (cpu == MAX_CPUS) {
u64 lower, upper;

/*
* The boot core runs outside CTXR_D now, but a reset brings it back like a secondary
* (an S2R wake). It can't run the OS there unless the OS is in the window.
*/
if (ctxr_range(CTXR_RANGE_D, &lower, &upper) && !ctxr_exec_problem()) {
printf("CTXR exec: no secondary is running; CTXR_D is armed, so a core leaving reset, "
"the boot core's too, is taken as confined\n");
confined = 1;
return true;
}
ctxr_exec_warn_unprobed("no secondary is running to probe");
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions src/isp.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ static int isp_firmware_end(const struct adt_segment_ranges *segments, u32 lengt

int isp_init(void)
{
/* The T6050 kernel owns power-up. Its handoff only reserves memory. */
if (chip_id == T6050)
return 0;

int err = -1;
/* T8142 takes the T8140 (ISP17a) path throughout. */
bool t8142 = chip_id == T8142;
Expand Down
34 changes: 4 additions & 30 deletions src/j873.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,44 +263,18 @@ int j873_pcie_prep(void)
return 0;
}

/* ADT pKW8("key", lo, hi): an eight-byte SMC write of (hi << 32) | lo | level. */
struct j873_smc_pw8 {
u32 phandle;
char four_cc[4];
u32 key;
u32 lo;
u32 hi;
};

/*
* The SMC holds the N1 (Wi-Fi/Bluetooth on apcie port 0) in reset: ADT
* pci-bridge0 function-reset = pKW8('pcIO', 0x800000, 0x130000). Write
* level 0, then 1; without it the port 0 link stays in detect.
*/
int j873_n1_power(void)
{
u32 len;

if (chip_id != T8152 || board_id != 0x24)
return -1;

int node = adt_path_offset(adt, "/arm-io/apcie/pci-bridge0");
const struct j873_smc_pw8 *fn =
node < 0 ? NULL : adt_getprop(adt, node, "function-reset", &len);
if (!fn || len != sizeof(*fn) || memcmp(fn->four_cc, "8WKp", 4)) {
printf("j873: N1: no pKW8 function-reset in the ADT\n");
return -1;
}

smc_dev_t *smc = smc_init();
if (!smc)
return -1;
int ret = 0;
for (u32 level = 0; level < 2 && !ret; level++) {
ret = smc_write_u64(smc, fn->key, ((u64)fn->hi << 32) | fn->lo | level);
mdelay(10);
}
smc_shutdown(smc);
printf("j873: N1 reset released: %d\n", ret);
return ret;
int ret = smc_adt_function_reset("/arm-io/apcie/pci-bridge0", 10);
if (ret > 0)
printf("j873: N1: no SMC function-reset in the ADT\n");
return ret ? -1 : 0;
}
Loading
Loading