Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
9 changes: 5 additions & 4 deletions docs/m1-m3-handoff-sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ Repository links for these source revisions are
The panel and each external-controller transaction are atomic. The optional
native path is not exercised by a J516S boot using the legacy handoff.
* T6031 GPU probing requires the exact chosen string `asahi,t6031-gpu=1`.
On a J516C, `dt_set_m3_defaults()` sets it unless a config line set it.
On J514C and J516C, `dt_set_m3_defaults()` sets it unless a config line set it.
`chosen.asahi,t6031-gpu=0` keeps the handoff off. `chosen.asahi,m3-defaults=0`
prevents the default and keeps the owner's explicit lines as written, an
owner's `asahi,t6031-gpu=1` included. After a lost config line no T6031 line
is passed on, the owner's `=1` included. A J514C still needs the line. This
is passed on, the owner's `=1` included. No manual enable line is needed on
either supported board. This
does not qualify stand-in power data or widen the kernel's board gate.
* The T6031 display handoff requires the exact chosen string
`asahi,t6031-dcp=1`. On a J516C, `dt_set_m3_defaults()` sets it unless a
`asahi,t6031-dcp=1`. On J514C and J516C, `dt_set_m3_defaults()` sets it unless a
config line set it, beside the GPU default, with the same `=0`,
`m3-defaults=0` and lost-line rules. Each switch stands alone: `t6031-gpu=0`
keeps the GPU off and still gets the display default, and `t6031-dcp=0` the
other way round. A J514C still needs the line. Whether the kernel takes the
other way round. No manual enable line is needed. Whether the kernel takes the
display over is the kernel's decision; one that does not leaves the boot
framebuffer. Its `__OS_LOG` reservations are made on every J514C or J516C
boot without it.
Expand Down
26 changes: 18 additions & 8 deletions docs/t8122-gpu-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,17 @@ UUIDs and other machine-derived values outside git.

This switch runs the same fail-soft G15 GPU setup that `chosen.asahi,t6030-gpu=1`
runs on the M3 Pro (`dt_set_gpu_g15()` in `src/kboot_gpu.c`), with the T8122
entry of its SoC table. It is off by default: without it a T8122 boot does not
run the setup at all (there is no dry run), and only the diagnostic switches
above apply. With it, `asahi,t8122-gpu-handoff-diag` is ignored.
entry of its SoC table. On the M3 MacBook Airs (J613, J615) and the 14" M3
MacBook Pro (J504), a normal build sets it by default, together with
`asahi,t8122-dcp`, the stand-in power model (`asahi,t8122-gpu-power-standin`)
and the leakage fuse (`asahi,t8122-gpu-fuse-leakage`), unless a config line set
it (`dt_set_m3_defaults()` in `src/kboot.c`). `chosen.asahi,t8122-gpu=0` keeps
the GPU off; `chosen.asahi,t8122-dcp=0` or `chosen.asahi,m3-defaults=0` keeps
the default GPU switches off too, while an owner's own GPU line still counts.
Other T8122 boards (the J433/J434 iMacs) get no default. Without the switch a
T8122 boot does not run the setup at all (there is no dry run), and only the
diagnostic switches above apply. With it, `asahi,t8122-gpu-handoff-diag` is
ignored.

The setup needs a `gpu` alias to an `apple,agx-t8122` node with the same inputs
as the T6030 node (`reg`/`reg-names` for asc and sgx, `operating-points-v2`,
Expand All @@ -152,11 +160,13 @@ Any failure leaves the gpu node, the UAT regions and the mailbox disabled,
zeroes `apple,firmware-compat`, releases the GPU power closure recursively
and checks that it is off, and lets the boot continue.

The T8122 table does not have a known G15G firmware image, a leakage fuse or a
power model yet, so today step 2 stops the setup before any GPU register or
power access. It logs the loaded image (`FW: GFX: image uuid ...`) and that
the leakage fuse and power model are missing. The kernel also has no T8122 GPU
node or driver path yet.
The T8122 table knows the 14.8.3 G15G image the Airs and the J504 load. Its
power model is a stand-in worked out on the J613, not measured: it sets power
targets, not clocks. The leakage fuse decode was also worked out on the J613.
A boot with an unknown image still stops at step 2, before any GPU register or
power access, and logs the loaded image (`FW: GFX: image uuid ...`). The kernel
starts the GPU only on the boards in its own T8122 list (J613, J615, J504), at
a conservative cap.

Host tests (synthetic ADT, simulated bus, real libfdt):

Expand Down
39 changes: 31 additions & 8 deletions src/kboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ static int dt_set_t8140_wfx_args(int node)
* The J516C switches are its display handoff and GPU, each on its own as on the Pro: an owner's
* chosen.asahi,t6031-gpu=0 keeps the GPU off and the display default still goes in, and
* chosen.asahi,t6031-dcp=0 the other way round. The kernel decides whether it takes the display
* over; one that does not leaves it on the boot framebuffer. The J514C (a T6031 board the
* kernel's GPU driver refuses) and the T6034 Maxes (J514M, J516M) are not touched, nor is any
* other board.
* over; one that does not leaves it on the boot framebuffer. J514C gets the same two defaults
* on a normal build. J514M/T6034 gets independent display and GPU defaults;
* J516M and other boards are untouched.
*/
struct m3_default_board {
const char *soc;
Expand All @@ -411,16 +411,20 @@ static const char *const m3_air_switches[] = {
"asahi,t8122-gpu-fuse-leakage", NULL};
static const char *const m3_pro_boards[] = {"apple,j514s", "apple,j516s", NULL};
static const char *const m3_pro_switches[] = {"asahi,t6030-dcp", "asahi,t6030-gpu", NULL};
static const char *const m3_max_boards[] = {"apple,j516c", NULL};
static const char *const m3_max_boards[] = {"apple,j514c", "apple,j516c", NULL};
static const char *const m3_max_switches[] = {"asahi,t6031-dcp", "asahi,t6031-gpu", NULL};
static const char *const m3_max14_boards[] = {"apple,j514m", NULL};
static const char *const m3_max14_switches[] = {"asahi,t6034-dcp", "asahi,t6034-gpu", NULL};
static const char *const m3_air_graphics[] = {"asahi,t8122-", "asahi,j613-", "asahi,j615-", NULL};
static const char *const m3_pro_graphics[] = {"asahi,t6030-", NULL};
static const char *const m3_max_graphics[] = {"asahi,t6031-", NULL};
static const char *const m3_max14_graphics[] = {"asahi,t6034-", NULL};

static const struct m3_default_board m3_default_boards[] = {
{"apple,t8122", m3_air_boards, m3_air_switches, true, m3_air_graphics},
{"apple,t6030", m3_pro_boards, m3_pro_switches, false, m3_pro_graphics},
{"apple,t6031", m3_max_boards, m3_max_switches, false, m3_max_graphics},
{"apple,t6034", m3_max14_boards, m3_max14_switches, false, m3_max14_graphics},
};

#define M3_DEFAULTS_SWITCH "asahi,m3-defaults"
Expand Down Expand Up @@ -5319,15 +5323,17 @@ static int dt_set_display(void)
return 0;
} else if (!fdt_node_check_compatible(dt, 0, "apple,t6030") ||
!fdt_node_check_compatible(dt, 0, "apple,t8122") ||
!fdt_node_check_compatible(dt, 0, "apple,t6031")) {
!fdt_node_check_compatible(dt, 0, "apple,t6031") ||
t6034_board(dt)) {
/*
* Fail-soft handoff (kboot_display_handoff.c): it always returns 0, never uses the
* helpers above (they bail out of kboot or enable nodes) and never enables a node.
* On T8122 it does nothing unless chosen.asahi,t8122-dcp=1; the external DCP firmware is
* reserved only with chosen.asahi,t8122-dcpext=1 and that handoff. On T6031 it does nothing
* unless the board is a J514C or J516C, and reserves only __OS_LOG unless
* chosen.asahi,t6031-dcp=1 (on a J516C, dt_set_m3_defaults() sets it unless a config line
* set it).
* chosen.asahi,t6031-dcp=1. dt_set_m3_defaults() supplies it on J514C and J516C;
* an owner's explicit value always wins. J514M/T6034 uses its own handoff
* and defaults with the same independent owner choices.
*/
ret = dt_set_display_handoff(dt);
if (!fdt_node_check_compatible(dt, 0, "apple,t8122"))
Expand Down Expand Up @@ -5587,6 +5593,18 @@ static int dt_set_pmp_t6031(void)
return 0;
}

/* Fresh J514M ADT: the same PMP interrupt/DART layout, with a separate handoff. */
static const struct pmp_values_soc pmp_values_t6034 = {
"apple,t6034", "asahi,t6034-pmp", "T6034", {1181, 1180, 1183, 1182}, 0x290300000, 0x4000,
};

static int dt_set_pmp_t6034(void)
{
if (t6034_board(dt))
dt_pass_pmp(&pmp_values_t6034);
return 0;
}

/*
* T8122: pass this Mac's PMP values on either M3 Air with the display
* handoff switch, chosen.asahi,t8122-dcp=1.
Expand Down Expand Up @@ -6572,7 +6590,8 @@ int kboot_prepare_dt(void *fdt)
return -1;
if (dt_set_display())
return -1;
if (dt_set_gpu(dt))
/* A lost owner opt-out must also suppress the T6034 measurement. */
if (!(chip_id == T6034 && chosen_lost) && dt_set_gpu(dt))
return -1;
if (dt_set_multitouch())
return -1;
Expand Down Expand Up @@ -6646,6 +6665,10 @@ int kboot_prepare_dt(void *fdt)
dt_set_pmp_t6031();
dt_t6031_fw_uuids(dt);
dt_t6031_facts(dt);
} else if (chip_id == T6034) {
dt_set_pmp_t6034();
dt_t6031_fw_uuids(dt);
dt_t6031_facts(dt);
} else if (chip_id == T6032) {
dt_t6031_fw_uuids(dt);
}
Expand Down
39 changes: 35 additions & 4 deletions src/kboot_display_handoff.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
* nodes stay "disabled": only a kernel that sees apple,t8122-handoff may enable them, and a T8122
* kernel device tree without display nodes is normal. No T8122 PMP is handed off here.
*
* T6031 (M3 Max, J514C/J516C only; nothing at all on another board or chip, so not on a T6034):
* T6031 (M3 Max, J514C/J516C only; its profile never applies to T6034):
* the T8122 handoff with T6031 values, armed by chosen.asahi,t6031-dcp=1, as on T6030 and T8122.
* On a J516C dt_set_m3_defaults() (kboot.c) sets it unless a config line set it; a J514C still
* needs the boot.bin config line. The kernel decides whether to take the display over (a kernel
* dt_set_m3_defaults() (kboot.c) sets it on J514C and J516C unless a config line set it.
* The kernel decides whether to take the display over (a kernel
* may leave that to its command line), so the handoff must be harmless when ignored: the nodes
* stay disabled and only the marker and the memory description are added. On every boot, armed or
* not, the __OS_LOG buffers of dcp and dcpext0..3, taken from the ADT, are reserved. Armed, the
Expand Down Expand Up @@ -363,8 +363,39 @@ static const struct dcp_soc dcp_soc_t6031 = {
.pmgr_disp_cpu = 0x2922802a0UL,
};

static const struct dcp_soc *const dcp_socs[] = {&dcp_soc_t6030, &dcp_soc_t8122, &dcp_soc_t6031};
/* J514M/T6034: fresh ADT registers and image UUID match this checked layout. */
static const char *const dcp_boards_t6034[] = {"apple,j514m", NULL};

static const struct dcp_soc dcp_soc_t6034 = {
.name = "T6034",
.chip = T6034,
.compat = "apple,t6034",
.boards = dcp_boards_t6034,
.boards_desc = "J514M",
.dcp_compat = "apple,t6034-dcp",
.disp_compat = "apple,t6034-display-subsystem",
.marker = "apple,t6034-handoff",
.optin = "asahi,t6034-dcp",
.oslog_always = true,
.adt_psreg = true,
.board_gate = true,
.uuid = "F493F03E-CC40-3D89-9A08-5F259BA2B246",
.log_streams = true,
.os_fw = V14_7,
.os_fw_name = "14.7",
.coproc = 0x386c00000UL,
.dart_dcp = 0x38530c000UL,
.dart_disp = 0x385304000UL,
.vm_base = DCP6_DART_VM_BASE,
.vm_size = DCP6_DART_VM_SIZE,
.pmgr_disp_cpu = 0x2922802a0UL,
};

static const struct dcp_soc *const dcp_socs[] = {
&dcp_soc_t6030, &dcp_soc_t8122, &dcp_soc_t6031, &dcp_soc_t6034};

/* T6034 has its own exact J514M/profile/firmware checks above. It reuses only
* the measured register layout and the generic bounded handoff transaction. */
struct dcp6_seg {
u64 phys;
u64 size; /* rounded up to 16K */
Expand Down
Loading
Loading