Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions arch/arm64/boot/dts/apple/t6031-dcp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* Every node stays status = "disabled". The display gate enables the DCP,
* its mailbox, the two DARTs and the display subsystem only when the boot
* loader has set apple,t6031-handoff = <1> and the native display is
* requested: by default on the J516C, with apple_t6031_display.enable=1 on
* the other boards, never with apple_t6031_display.enable=0. Compatibles are t6031-specific,
* requested: by default on J514C and J516C, with apple_t6031_display.enable=1 on

Check warning on line 14 in arch/arm64/boot/dts/apple/t6031-dcp.dtsi

View workflow job for this annotation

GitHub Actions / ci / device trees

dt-check style

[line-length] line exceeds 80 columns (81)
* other T6031 boards, never with apple_t6031_display.enable=0. Compatibles are t6031-specific,

Check warning on line 15 in arch/arm64/boot/dts/apple/t6031-dcp.dtsi

View workflow job for this annotation

GitHub Actions / ci / device trees

dt-check style

[line-length] line exceeds 80 columns (95)
* so a kernel that does not know them leaves the nodes unbound.
*
* Only the T6031 board files include this file: t6034.dtsi includes
Expand Down
25 changes: 23 additions & 2 deletions drivers/gpu/drm/asahi/g15/boot.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT

//! Admission and firmware start to READY.
Expand Down Expand Up @@ -46,7 +46,7 @@
use super::hw;
use super::initdata::{self, InitData};
use super::object::Objects;
use super::{identity, regs, uat, Config, Shared};
use super::{identity, params, regs, uat, Config, Shared};
use crate::driver::AsahiDrmDevice as AsahiDevice;
use crate::mmu;

Expand Down Expand Up @@ -467,6 +467,15 @@
) -> Result<Admitted> {
let dev = pdev.as_ref();
let pmp = cfg.platform == hw::Platform::AdtWithPmp;
// J514C uses the same-die T6031 path on a normal boot. This does not qualify
// the inherited J516C reference words. Keep exact board AND SoC checks;
// T6034 boards must never inherit this four-cluster T6031 configuration.
// The remaining display, DT/ADT, full firmware identity, hardware identity
// and record-builder admission below is unchanged.
let j514c_board = cfg.chip_id == 0x6031
&& cfg.platform == hw::Platform::DeviceTree
&& glue::machine(kernel::c_str!("apple,j514c"))
&& glue::machine(kernel::c_str!("apple,t6031"));
if pmp {
if !glue::board() {
return Err(ENODEV);
Expand All @@ -481,7 +490,7 @@
}
return Err(err);
}
} else if !glue::machine(cfg.machine) {
} else if !glue::machine(cfg.machine) && !j514c_board {
dev_err!(dev, "G15: not a {} machine\n", cfg.name);
return Err(ENODEV);
} else {
Expand All @@ -496,6 +505,18 @@
return Err(err);
}
}
if j514c_board {
if let hw::Board::DeviceTree(reference) = cfg.board {
dev_warn!(
dev,
"J514C bring-up: unqualified J516C reference: max_power_mw={} relative_power={:?} fast_die_mask={:#018x} alarm_mask={:#018x}; OPP powers are boot-loader stand-ins\n",
reference.max_power_mw,
reference.relative_power,
reference.fast_die_mask,
reference.alarm_mask
);
}
}
let adt = adt::read(dev, cfg)
.inspect_err(|e| dev_err!(dev, "GPU regions not admitted: {:?}\n", e))?;
identity::firmware(dev, &adt, cfg.firmware)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/g15/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int asahi_g15_display_prepare(struct device *dev)
return ret;
np = of_find_compatible_node(NULL, NULL, "apple,t6031-display-subsystem");
if (!np || !of_device_is_available(np))
dev_info_once(dev, "G15: waiting for the T6031 native display, which this boot did not enable (it needs the boot loader's display handoff, and apple_t6031_display.enable=1 except on the J516C)\n");
dev_info_once(dev, "G15: waiting for the T6031 native display, which this boot did not enable (it needs the boot loader's display handoff, and an admitted native-display board)\n");
else
dev_info_once(dev, "G15: waiting for the T6031 native display to come up: the GPU firmware starts only after the display is published\n");
of_node_put(np);
Expand Down
29 changes: 24 additions & 5 deletions drivers/gpu/drm/asahi/g15/hw/t6031.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT

//! T6031 (M3 Max, G15C) configuration, admitted on J516C only.
//! T6031 (M3 Max, G15C) configuration, qualified on J516C only.
//!
//! J514C uses these reference words on normal boots after its board, firmware,
//! and hardware checks pass. This is not J514C power/thermal qualification.
//!
//! One die, four clusters of ten core slots. The firmware is the same RTKit 2419 generation as
//! the T6030's and the initdata graph keeps the T6030 canonical VAs; what differs is the SoC
//! identity, the 40-bit enabled-core mask (two words), the source of the GPU regions (the

Check warning on line 10 in drivers/gpu/drm/asahi/g15/hw/t6031.rs

View workflow job for this annotation

GitHub Actions / ci / commits

checkpatch NO_AUTHOR_SIGN_OFF (24a62a3d7237)

Missing Signed-off-by: line by nominal patch author 'Chris Kearney <303316+chriskearney@users.noreply.github.com>'
//! device tree node the boot loader fills, not an ADT export), the GPU power (its power domain;
//! there is no PMP vote), the initdata root version, a longer HardwareData record (0xb480
//! bytes, its fourth view at +0xb400) placed aligned and ASC-cached, the IOMapping table (17
Expand Down Expand Up @@ -136,7 +139,7 @@
firmware: &[
FirmwareBuild {
name: "macOS 14.7 stub firmware (iBoot-10151.140.19.700.2), J516C",
machine: None,
machine: Some(kernel::c_str!("apple,j516c")),
text_size: 0x64000,
data_size: 0x140000,
marker: 0x5cf28,
Expand All @@ -148,7 +151,7 @@
},
FirmwareBuild {
name: "macOS 14.8 stub firmware, J516C",
machine: None,
machine: Some(kernel::c_str!("apple,j516c")),
text_size: 0x64000,
data_size: 0x140000,
marker: 0x5cf28,
Expand All @@ -158,9 +161,25 @@
0x9d, 0x6b, 0xcd, 0xa0, 0x26, 0xcf,
],
},
// Measured by the normal driver on J514C's 14.7 boot chain (system
// firmware 26.5.2). Short native GL/Vulkan and normal-login checks passed;
// power/thermal qualification remains open. Exact board identity is required.
FirmwareBuild {
name: "J514C macOS 14.7 boot-chain firmware",
machine: Some(kernel::c_str!("apple,j514c")),
text_size: 0x64000,
data_size: 0x140000,
marker: 0x5cf28,
text_sha256: [
0x66, 0x99, 0x13, 0xfb, 0xa2, 0x73, 0x6e, 0x4b, 0x8f, 0x8a, 0x0f, 0x81,
0xea, 0xdc, 0x5a, 0xc0, 0x0c, 0x9d, 0xc5, 0x1f, 0xdd, 0x4c, 0x9d, 0x37,
0x70, 0xc6, 0x6d, 0x2b, 0x0a, 0x1e, 0x87, 0x86,
],
},
],
// The reference words and measured layout belong to the J516C, not
// every T6031 board (in particular, not the 14-inch J514C).
// This is the reference board. The exact J514C/T6031 pair also uses this
// configuration through normal admission, with the unmeasured reference
// power words reported explicitly for that chassis.
machine: kernel::c_str!("apple,j516c"),
platform: super::Platform::DeviceTree,
layout: &LAYOUT,
Expand Down
2 changes: 1 addition & 1 deletion drivers/pmdomain/apple/pmp-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ static const struct apple_pmp_report_offsets apple_pmp_offsets_t6031 = {
.status = 0x10,
.starts_pmp = true,
.name = "T6031",
.fallback = "leave out apple_t6031_display.enable=1",
.fallback = "apple_t6031_display.enable=0",
.pwrstate = "apple,t6031-pmgr-pwrstate",
.devices_ordered = true,
};
Expand Down
4 changes: 2 additions & 2 deletions drivers/soc/apple/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ config APPLE_T6030_DISPLAY_GATE

It also serves T6031 (M3 Max) device trees with apple,t6031-handoff,
in the same way and only with the PMP values the boot loader passes.
There the native display is on by default on the J516C, unless
There the native display is on by default on J514C and J516C, unless
apple_t6031_display.enable=0; the other T6031 boards need
apple_t6031_display.enable=1 on the kernel command line. The T6031
GPU driver starts its firmware only after this native display is
Expand Down Expand Up @@ -264,7 +264,7 @@ config APPLE_DISPLAY_GATE_KUNIT_TEST
help
Runs the display gate on test device trees with the T6030, T6031
and T8122 display nodes, without Apple hardware. On T6031: on by
default only on the default board (the J516C), otherwise only with
default only on J514C and J516C, otherwise only with
apple_t6031_display.enable=1, off with apple_t6031_display.enable=0,
only with the boot loader's handoff marker and this Mac's PMP values,
and with nothing changed when a check fails. On T6030: on by default, as
Expand Down
45 changes: 31 additions & 14 deletions drivers/soc/apple/t6030-display-gate-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* the T6031 switch does not change it. Run first: the T6031 and T8122
* trees describe a PMP, and the T6030 gate refuses to add a second one.
* - T6031 (t6031-gate-test.dtso): on by default only on the default board
* (the J516C; the cases point it at the test tree's own root to run that
* path), otherwise only with apple_t6031_display.enable=1, never with
* (J514C or J516C; the cases supply a synthetic root identity),
* otherwise only with apple_t6031_display.enable=1, never with
* apple_t6031_display.enable=0; always with the full handoff, and nothing
* changed when a check fails.
* - T8122 (t8122-gate-test.dtso): on by default, with the full handoff,
Expand Down Expand Up @@ -146,7 +146,7 @@ struct gate_test {
struct of_changeset cs; /* this case's own edits to the test tree */
bool requested, t6031_requested;
int t6031_switch;
const char *t6031_board;
const char *default_board;
};

static struct device_node *__init gt_node(struct kunit *test, const char *path)
Expand Down Expand Up @@ -385,6 +385,16 @@ static int __init gt_suite_init_t8122(struct kunit_suite *suite)
return gt_apply_fixture(&gt_t8122, &gt_fixture_t8122);
}

/* Static-stub resources are task-scoped and removed by KUnit case cleanup. */
static bool __init gt_root_is_compatible(const char *compat)
{
struct kunit *test = kunit_get_current_test();
struct gate_test *t = test->priv;

return t->default_board &&
(!strcmp(compat, "apple,t6031") || !strcmp(compat, t->default_board));
}

static int __init gt_init(struct kunit *test, const struct gt_soc *s)
{
struct gate_test *t = kunit_kzalloc(test, sizeof(*t), GFP_KERNEL);
Expand All @@ -397,7 +407,6 @@ static int __init gt_init(struct kunit *test, const struct gt_soc *s)
t->requested = gate_requested;
t->t6031_requested = gate_t6031_requested;
t->t6031_switch = gate_t6031_switch;
t->t6031_board = gate_t6031_board;
of_changeset_init(&t->cs);
gate_soc = s->soc;
gate_pmp_values = NULL;
Expand All @@ -408,6 +417,7 @@ static int __init gt_init(struct kunit *test, const struct gt_soc *s)
gate_t6031_switch = -1;
if (gt_live_soc)
kunit_skip(test, "the booted device tree has its own /soc");
kunit_activate_static_stub(test, gate_t6031_is_compatible, gt_root_is_compatible);
return 0;
}

Expand Down Expand Up @@ -452,7 +462,6 @@ static void __init gt_exit(struct kunit *test)
gate_requested = t->requested;
gate_t6031_requested = t->t6031_requested;
gate_t6031_switch = t->t6031_switch;
gate_t6031_board = t->t6031_board;
gate_soc = NULL;
}

Expand All @@ -465,7 +474,7 @@ static void __init gate_t6031_param(struct kunit *test)

KUNIT_EXPECT_FALSE(test, t->t6031_requested);
KUNIT_EXPECT_EQ(test, t->t6031_switch, -1);
KUNIT_EXPECT_STREQ(test, t->t6031_board, "apple,j516c");
KUNIT_EXPECT_NULL(test, gate_t6031_default_board());
KUNIT_EXPECT_TRUE(test, t->requested);

KUNIT_EXPECT_EQ(test, gate_setup_t6031("1"), 0);
Expand Down Expand Up @@ -503,21 +512,27 @@ static void __init gate_t6031_resolution(struct kunit *test)
KUNIT_EXPECT_TRUE(test, gate_t6031_wanted(1, false));
}

/* Points the default board at the test tree's root, so gate_run() takes that path. */
static const char * const gt_default_boards[] = {
"apple,j514c",
"apple,j516c",
};
KUNIT_ARRAY_PARAM(gt_default_board, gt_default_boards, NULL);

/* Exercise the real selector and gate_run(), with a test-scoped identity. */
static void __init gt_default_board(struct kunit *test)
{
const char *root = NULL;
struct gate_test *t = test->priv;

if (of_property_read_string(of_root, "compatible", &root) || !root)
kunit_skip(test, "the test tree's root has no compatible");
gate_t6031_board = root;
t->default_board = *(const char * const *)test->param_value;
KUNIT_ASSERT_STREQ(test, gate_t6031_default_board(), t->default_board);
}

/* On the default board, the full handoff and no switch: enabled. */
static void __init gate_t6031_default_board_on(struct kunit *test)
{
gt_default_board(test);
gt_run(test);
KUNIT_EXPECT_TRUE(test, gate_t6031_requested);
gt_expect_enabled(test);
}

Expand All @@ -527,6 +542,7 @@ static void __init gate_t6031_default_board_switched_off(struct kunit *test)
gt_default_board(test);
KUNIT_ASSERT_EQ(test, gate_setup_t6031("0"), 0);
gt_run(test);
KUNIT_EXPECT_FALSE(test, gate_t6031_requested);
gt_expect_untouched(test);
}

Expand All @@ -536,6 +552,7 @@ static void __init gate_t6031_default_board_no_marker(struct kunit *test)
gt_default_board(test);
gt_remove(test, gt_t6031.dcp, "apple,t6031-handoff");
gt_run(test);
KUNIT_EXPECT_TRUE(test, gate_t6031_requested);
gt_expect_untouched(test);
}

Expand Down Expand Up @@ -890,9 +907,9 @@ static struct kunit_case gate_t6031_cases[] __refdata = {
KUNIT_CASE(gate_t6031_param),
KUNIT_CASE(gate_t6031_resolution),
KUNIT_CASE(gate_t6031_off_by_default),
KUNIT_CASE(gate_t6031_default_board_on),
KUNIT_CASE(gate_t6031_default_board_switched_off),
KUNIT_CASE(gate_t6031_default_board_no_marker),
KUNIT_CASE_PARAM(gate_t6031_default_board_on, gt_default_board_gen_params),
KUNIT_CASE_PARAM(gate_t6031_default_board_switched_off, gt_default_board_gen_params),
KUNIT_CASE_PARAM(gate_t6031_default_board_no_marker, gt_default_board_gen_params),
KUNIT_CASE(gate_t6031_switched_off),
KUNIT_CASE(gate_t6031_enabled),
KUNIT_CASE(gate_t6031_no_dcp_marker),
Expand Down
39 changes: 31 additions & 8 deletions drivers/soc/apple/t6030-display-gate.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
* option.
*
* On T6031 (M3 Max) the gate serves the same handoff, marked
* apple,t6031-handoff. Its default is scoped to the J516C: there the native
* display is on unless apple_t6031_display.enable=0; the other T6031 boards
* apple,t6031-handoff. Its default is scoped to J514C and J516C: there the native
* display is on unless apple_t6031_display.enable=0; other T6031 boards
* need apple_t6031_display.enable=1. The T6031 GPU starts its firmware only
* after this native display is up, so enable=0 (or a display that never
* comes up) keeps the GPU off for that boot too: it is not a display-only
Expand Down Expand Up @@ -85,6 +85,10 @@
#include <linux/types.h>
#include <video/nomodeset.h>

#ifdef CONFIG_APPLE_DISPLAY_GATE_KUNIT_TEST
#include <kunit/static_stub.h>
#endif

enum {
GATE_DCP_DART,
GATE_DISP0_DART,
Expand Down Expand Up @@ -147,10 +151,29 @@ static bool gate_requested __initdata = true;

/*
* apple_t6031_display.enable: -1 while it is not on the command line, else 0
* or 1. Unset, the T6031 native display is on only on gate_t6031_board.
* or 1. Unset, the native display is on for the exact J514C/J516C + T6031 pairs.
*/
static int gate_t6031_switch __initdata = -1;
static const char *gate_t6031_board __initdata = "apple,j516c";

/* Only the current KUnit case may substitute its synthetic root identity. */
static bool __init gate_t6031_is_compatible(const char *compat)
{
#ifdef CONFIG_APPLE_DISPLAY_GATE_KUNIT_TEST
KUNIT_STATIC_STUB_REDIRECT(gate_t6031_is_compatible, compat);
#endif
return of_machine_is_compatible(compat);
}

static const char *__init gate_t6031_default_board(void)
{
if (!gate_t6031_is_compatible("apple,t6031"))
return NULL;
if (gate_t6031_is_compatible("apple,j516c"))
return "apple,j516c";
if (gate_t6031_is_compatible("apple,j514c"))
return "apple,j514c";
return NULL;
}
/* The resolved request, set by gate_run() on a T6031. */
static bool gate_t6031_requested __initdata;

Expand Down Expand Up @@ -252,7 +275,7 @@ static const struct gate_soc gate_t8122 __initconst = {

/*
* T6031 (M3 Max): the T6030 handoff at the T6031 addresses, on by default on
* the J516C and off unless apple_t6031_display.enable=1 on the other boards;
* J514C/J516C and off unless apple_t6031_display.enable=1 on other boards;
* apple_t6031_display.enable=0 keeps it, and with it the GPU, off everywhere.
* The PMP values must come from the boot
* loader: there is no built-in fallback. The PMP image is T6031's own;
Expand Down Expand Up @@ -1971,12 +1994,12 @@ static void __init gate_run(void)
gate_describe();

if (gate_soc == &gate_t6031) {
bool board = of_machine_is_compatible(gate_t6031_board);
const char *board = gate_t6031_default_board();

gate_t6031_requested = gate_t6031_wanted(gate_t6031_switch, board);
gate_t6031_requested = gate_t6031_wanted(gate_t6031_switch, !!board);
if (gate_t6031_switch < 0 && board)
gate_info("native display on by default on %s; apple_t6031_display.enable=0 keeps the boot framebuffer\n",
gate_t6031_board);
board);
}

if (!*gate_soc->requested) {
Expand Down
Loading
Loading