diff --git a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi index f679c57b97709c..f79f0e217f8185 100644 --- a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi @@ -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 + * other T6031 boards, never with apple_t6031_display.enable=0. Compatibles are t6031-specific, * so a kernel that does not know them leaves the nodes unbound. * * Only the T6031 board files include this file: t6034.dtsi includes diff --git a/drivers/gpu/drm/asahi/g15/boot.rs b/drivers/gpu/drm/asahi/g15/boot.rs index 45e244531323d7..3b7daf647211a4 100644 --- a/drivers/gpu/drm/asahi/g15/boot.rs +++ b/drivers/gpu/drm/asahi/g15/boot.rs @@ -46,7 +46,7 @@ use super::fw::initdata::runtime; 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; @@ -467,6 +467,15 @@ pub(crate) fn admit( ) -> Result { 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); @@ -481,7 +490,7 @@ pub(crate) fn admit( } 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 { @@ -496,6 +505,18 @@ pub(crate) fn admit( 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) diff --git a/drivers/gpu/drm/asahi/g15/glue.c b/drivers/gpu/drm/asahi/g15/glue.c index 385b9fde390538..8e1767ea61912c 100644 --- a/drivers/gpu/drm/asahi/g15/glue.c +++ b/drivers/gpu/drm/asahi/g15/glue.c @@ -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); diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 8bac33989db648..19f7283ce4ec6a 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -1,6 +1,9 @@ // 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 @@ -136,7 +139,7 @@ pub(crate) const CONFIG: Config = Config { 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, @@ -148,7 +151,7 @@ pub(crate) const CONFIG: Config = Config { }, 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, @@ -158,9 +161,25 @@ pub(crate) const CONFIG: Config = Config { 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, diff --git a/drivers/pmdomain/apple/pmp-report.c b/drivers/pmdomain/apple/pmp-report.c index 9aac3ced17cda1..56e8ab67ae6970 100644 --- a/drivers/pmdomain/apple/pmp-report.c +++ b/drivers/pmdomain/apple/pmp-report.c @@ -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, }; diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index ba57db91f8860b..f00718c130dc43 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -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 @@ -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 diff --git a/drivers/soc/apple/t6030-display-gate-test.c b/drivers/soc/apple/t6030-display-gate-test.c index 15725a38ab5c7d..fc68bb6208a6e0 100644 --- a/drivers/soc/apple/t6030-display-gate-test.c +++ b/drivers/soc/apple/t6030-display-gate-test.c @@ -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, @@ -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) @@ -385,6 +385,16 @@ static int __init gt_suite_init_t8122(struct kunit_suite *suite) return gt_apply_fixture(>_t8122, >_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); @@ -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; @@ -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; } @@ -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; } @@ -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); @@ -503,14 +512,19 @@ 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. */ @@ -518,6 +532,7 @@ 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); } @@ -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); } @@ -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); } @@ -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), diff --git a/drivers/soc/apple/t6030-display-gate.c b/drivers/soc/apple/t6030-display-gate.c index 7ee02087c969b8..83960cf5b1697f 100644 --- a/drivers/soc/apple/t6030-display-gate.c +++ b/drivers/soc/apple/t6030-display-gate.c @@ -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 @@ -85,6 +85,10 @@ #include #include