diff --git a/drivers/gpu/drm/apple/dcp-fabric.c b/drivers/gpu/drm/apple/dcp-fabric.c index 150cd163924f1..d2e339c406d64 100644 --- a/drivers/gpu/drm/apple/dcp-fabric.c +++ b/drivers/gpu/drm/apple/dcp-fabric.c @@ -544,16 +544,22 @@ static int dcp_dpxbar_tunnel_select_source(struct mux_control *mux, int state) return ret; } +static bool dcp_t6041_ext_v27(const struct apple_dcp *dcp) +{ + return dcp->fw_compat == DCP_FIRMWARE_V_27_0 && dcp->desktop_external; +} + /* - * Desktop 26.x firmware does not power the DP PHY of a Type-C route itself: - * the route does, once its crossbar points at the pipeline, and gives it - * back before the crossbar is released. + * Desktop 26.x and T6041 firmware-27 external processors do not power the DP + * PHY of a Type-C route themselves: the route does, once its crossbar points at + * the pipeline, and gives it back before the crossbar is released. */ static int dcp_typec_route_phy_on(struct apple_dcp_typec_route *route) { int ret; - if (route->dcp->fw_compat != DCP_FIRMWARE_V_26_6_DESKTOP || + if ((route->dcp->fw_compat != DCP_FIRMWARE_V_26_6_DESKTOP && + !dcp_t6041_ext_v27(route->dcp)) || route->phy_powered) return 0; ret = phy_init(route->phy); @@ -597,7 +603,8 @@ int dcp_typec_phy_on(struct apple_dcp *dcp) */ if (route->tunnel) return 0; - if (dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP && + if ((dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + dcp_t6041_ext_v27(dcp)) && route->deactivate_xbar_done) return -ENODEV; return dcp_typec_route_phy_on(route); @@ -925,7 +932,8 @@ static int dcp_typec_route_deactivate(struct apple_dcp_typec_route *route) * attached. Desktop 26.x powers the PHY with the route, so an * idle pipeline must not point at one. */ - dcp->phy = dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP ? + dcp->phy = (dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + dcp_t6041_ext_v27(dcp)) ? NULL : dcp->typec_routes[0].phy; if (dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP) WRITE_ONCE(dcp->xbar, NULL); @@ -2016,6 +2024,7 @@ static int dcp_typec_route_apply(struct typec_mux_dev *mux, * when HPD returns. */ if (dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + dcp_t6041_ext_v27(dcp) || dcp_t8142_ext(dcp)) { port->preferred_route = port->owner; port->hpd = false; @@ -2142,6 +2151,7 @@ static int dcp_typec_route_apply(struct typec_mux_dev *mux, */ if (!port->owner && !hpd && (route->dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + dcp_t6041_ext_v27(route->dcp) || dcp_t8142_ext(route->dcp))) { port->applied_valid = true; return 0; @@ -2613,13 +2623,15 @@ int dcp_direct_crossbar_link(struct apple_dcp *dcp, bool up) struct mux_control *xbar = NULL; int ret; - if (dcp->fw_compat == DCP_FIRMWARE_V_27_0) + if (dcp->fw_compat == DCP_FIRMWARE_V_27_0 && !dcp_t6041_ext_v27(dcp)) return dcp_direct_crossbar_link_t6050(dcp, up); /* - * On T6030, a T8132 dcpext and the selected native26 pipeline, - * selecting a crossbar output only routes it; link-up enables clocks. + * On T6030, a T6041 firmware-27 dcpext, a T8132 dcpext and the selected + * native26 pipeline, selecting a crossbar output only routes it; + * link-up enables clocks. */ if (!of_machine_is_compatible("apple,t6030") && + !dcp_t6041_ext_v27(dcp) && !dcp_is_t8132_ext(dcp) && !dcp_is_ext26(dcp)) return 0; guard(mutex)(&dcp->tb_lock); diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 7cde46e009096..1e457be71d1cf 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -5853,9 +5854,10 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev) ret = dcp_read_fw_version(dev, "apple,firmware-version", fw_str); /* - * T6041 (M4 Pro/Max) is driven only with the 26.5.2 and 26.6.2 firmware - * its desktop IOMFB instance was written for: the boot firmware and its - * compatibility version must both be exactly the same one of those. + * T6041 (M4 Pro/Max) uses its desktop IOMFB instance on 26.5.2 and + * 26.6.2 firmware, where boot firmware and compatibility versions must + * match. J616c on 27.2 (26B123) uses the firmware-27 backend on its + * internal and external display processors. */ if (of_device_is_compatible(dev->of_node, "apple,t6041-dcp") || of_device_is_compatible(dev->of_node, "apple,t6041-dcpext")) { @@ -5865,7 +5867,23 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev) if (ret >= 0 && compat_ret >= 0 && !strcmp(fw_str, compat_str) && (!strcmp(fw_str, "26.5.2") || !strcmp(fw_str, "26.6.2"))) return DCP_FIRMWARE_V_26_6_DESKTOP; - dev_err(dev, "T6041 display not started: DCP firmware %s (compat %s) is not 26.5.2 or 26.6.2\n", + if (apple_t6041_j616c_dcp_v27_2(dev->of_node) || + apple_t6041_j616c_dcpext_v27_2(dev->of_node)) { + if (!iomfb_v27_methods(compat_str)) { + dev_err(dev, "DCP firmware-compat %s has no 27.x method table\n", + compat_str); + return DCP_FIRMWARE_UNKNOWN; + } + missing = iomfb_v27_missing_method(iomfb_v27_methods(compat_str), + &num_missing); + if (missing) { + dev_err(dev, "DCP firmware-compat %s not started: no ID known for %u methods (first: %s)\n", + compat_str, num_missing, missing); + return DCP_FIRMWARE_UNKNOWN; + } + return DCP_FIRMWARE_V_27_0; + } + dev_err(dev, "T6041 display not started: unsupported DCP firmware %s (compat %s)\n", ret >= 0 ? fw_str : "missing", compat_ret >= 0 ? compat_str : "missing"); return DCP_FIRMWARE_UNKNOWN; @@ -6088,6 +6106,32 @@ static int dcp_firmware_metadata_v27(struct apple_dcp *dcp) return -EINVAL; clocks: + /* + * T6041 device trees carry the single 712 MHz disp0 clock unless the + * boot loader publishes the two /arm-io/disp0 provider clocks + * (376 at 712 MHz and 460 at 0 Hz). Expose the same two-entry table + * when apple,clock-ids is absent so getClockFrequency(0/1) matches. + */ + if (!of_property_present(dev->of_node, "apple,clock-ids") && + of_device_is_compatible(dev->of_node, "apple,t6041-dcp")) { + struct clk *clk = devm_clk_get_optional(dev, NULL); + + if (IS_ERR(clk)) + return PTR_ERR(clk); + if (!clk) + return 0; + dcp->firmware_clocks = devm_kcalloc(dev, 2, + sizeof(*dcp->firmware_clocks), + GFP_KERNEL); + if (!dcp->firmware_clocks) + return -ENOMEM; + dcp->firmware_clocks[0].clk = clk; + dcp->num_firmware_clocks = 2; + return 0; + } + if (!of_property_present(dev->of_node, "apple,clock-ids") && + of_device_is_compatible(dev->of_node, "apple,t6041-dcpext")) + return 0; clocks = of_property_count_u32_elems(dev->of_node, "apple,clock-ids"); if (clocks == -ENODATA && of_property_present(dev->of_node, "apple,clock-ids")) @@ -6794,10 +6838,13 @@ VISIBLE_IF_KUNIT void dcp_comp_unbind(struct device *dev, struct device *main, v cancel_work_sync(&dcp->bl_register_wq); cancel_work_sync(&dcp->bl_update_wq); } - devm_clk_put(dev, dcp->clk); + if (dcp->clk) + devm_clk_put(dev, dcp->clk); dcp->clk = NULL; /* optional and possibly NULL, released with the bind's devres group */ dcp->clk_194 = NULL; + dcp->firmware_clocks = NULL; + dcp->num_firmware_clocks = 0; } static const struct component_ops dcp_comp_ops = { @@ -6966,7 +7013,9 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) fw_compat = dcp_check_firmware_version(dev); if (fw_compat == DCP_FIRMWARE_UNKNOWN) return -ENODEV; - if (fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP) { + if (fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + (fw_compat == DCP_FIRMWARE_V_27_0 && + of_device_is_compatible(dev->of_node, "apple,t6041-dcp"))) { ret = dcp_validate_t6041_dt(dev); if (ret) return ret; @@ -7086,6 +7135,24 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) if (fw_compat == DCP_FIRMWARE_V_27_0 && of_device_is_compatible(dev->of_node, "apple,t8142-dcp")) dcp->hw.iomfb_method_profile = DCP_IOMFB_METHODS_DEFAULT; + /* + * T6041 internal panel on firmware 27 adopts the running DCP session + * with 41-bit firmware DMA addressing and no DPTX port services, + * matching the H17-generation internal-panel profile. + */ + if (fw_compat == DCP_FIRMWARE_V_27_0 && + of_device_is_compatible(dev->of_node, "apple,t6041-dcp")) { + dcp->hw.firmware_dma_bits = 41; + dcp->hw.num_dptx_ports = 0; + dcp->hw.adopt_live_session = true; + } + if (fw_compat == DCP_FIRMWARE_V_27_0 && + of_device_is_compatible(dev->of_node, "apple,t6041-dcpext")) { + dcp->hw.firmware_dma_bits = 41; + dcp->hw.num_dptx_ports = 2; + dcp->hw.adopt_live_session = true; + dcp->hw.sink_metadata_edid = true; + } /* * A SoC with derived power words is offered the stop only when asked for, and only on * firmware 27.0, whose calls are the ones that ran with them. @@ -7235,7 +7302,8 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) } dcp->fixed_phy = dcp->phy; - if (fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP) { + if (fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + (fw_compat == DCP_FIRMWARE_V_27_0 && dcp->desktop_external)) { ret = dcp_desktop_probe_routes(dcp); if (ret) return ret; @@ -7357,7 +7425,8 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) if (IS_ERR(dcp->dp2hdmi_pwren)) return PTR_ERR(dcp->dp2hdmi_pwren); /* The converter rails must be stable before DCP requests the link. */ - if (fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP && + if ((fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || + (fw_compat == DCP_FIRMWARE_V_27_0 && dcp->desktop_external)) && (dcp->hdmi_pwren || dcp->dp2hdmi_pwren)) msleep(100); diff --git a/drivers/gpu/drm/asahi/fwid.rs b/drivers/gpu/drm/asahi/fwid.rs index df20d3c406626..c2f5e24c728eb 100644 --- a/drivers/gpu/drm/asahi/fwid.rs +++ b/drivers/gpu/drm/asahi/fwid.rs @@ -476,8 +476,8 @@ mod tests { else { panic!("T6041 must identify its loaded firmware"); }; - assert_eq!(builds.len(), 3); - // The last two admit the 25G83 images, with the 40- and the 32-core configuration. + assert_eq!(builds.len(), 4); + // Builds 1 and 2 admit the 25G83 images, with the 40- and the 32-core configuration. assert_eq!(builds[1].images.len(), builds[2].images.len()); for (a, b) in builds[1].images.iter().zip(builds[2].images) { assert_eq!((a.entropy, a.text_sha256), (b.entropy, b.text_sha256)); @@ -489,11 +489,29 @@ mod tests { let found = measured(build.images, image.data_size, entropy, digest); assert!(core::ptr::eq(found.unwrap(), image)); assert!(measured(other.images, image.data_size, entropy, digest).is_none()); + assert!(measured(builds[3].images, image.data_size, entropy, digest).is_none()); assert!(measured(build.images, 0x13c000, entropy, digest).is_none()); } } - // Only the 25G83 build runs its own configuration: the 25G83 register map, 40 cores. + for image in builds[3].images { + let digest = image.text_sha256; + let found = lookup(builds[3].images, image.text_size, image.data_size, |_| { + Some(digest) + }); + assert!(core::ptr::eq(found.unwrap(), image)); + assert!( + lookup(builds[0].images, image.text_size, image.data_size, |_| Some(digest)) + .is_none() + ); + assert!( + lookup(builds[1].images, image.text_size, image.data_size, |_| Some(digest)) + .is_none() + ); + assert!(lookup(builds[3].images, 0x60000, image.data_size, |_| Some(digest)).is_none()); + } + // Only the 25G83 builds run their own configurations; 25F84 and 26B123 use BASE. assert!(builds[0].config.is_none()); + assert!(builds[3].config.is_none()); let g83 = builds[1].config.unwrap(); let map = &crate::hw::t6041::REGISTER_WINDOWS_25G83; assert_eq!(g83.windows.len(), map.len()); diff --git a/drivers/gpu/drm/asahi/g17/fw/channels.rs b/drivers/gpu/drm/asahi/g17/fw/channels.rs index 1dd6ad86c9c4a..30e103b62e2ac 100644 --- a/drivers/gpu/drm/asahi/g17/fw/channels.rs +++ b/drivers/gpu/drm/asahi/g17/fw/channels.rs @@ -349,7 +349,7 @@ pub(crate) enum DeviceControlOp { IdlePowerOff = 0x0a, /// Release a logical queue's scheduler state ([`SchedulerStateRelease`]). SchedulerStateRelease = 0x14, - /// M5 encoding of the same scheduler-state release. + /// M5 and 26B123 encoding of the same scheduler-state release. M5SchedulerStateRelease = 0x13, /// Release a free list's buffer slot ([`FreeListRelease`]). FreeListRelease = 0x2e, @@ -363,7 +363,7 @@ impl DeviceControlOp { /// records it has drained and keeps the GPU cores powered while they /// differ. pub(crate) const fn asserts_gpu_power(self) -> bool { - !matches!(self, Self::FreeListRelease) + !matches!(self, Self::FreeListRelease | Self::M5SchedulerStateRelease) } } @@ -675,6 +675,26 @@ mod tests { assert!(bytes[24..].iter().all(|byte| *byte == 0)); } + #[test] + fn scheduler_state_release_opcodes_and_power() { + let legacy = ControlRecord::SchedulerStateRelease(SchedulerStateRelease::new( + 0x70_0420_0000, + *b"Q001", + )); + assert_eq!(legacy.opcode(), DeviceControlOp::SchedulerStateRelease); + assert!(legacy.opcode().asserts_gpu_power()); + + let mut rel27 = SchedulerStateRelease::new(0x70_0420_0000, *b"Q001"); + rel27.opcode = DeviceControlOp::M5SchedulerStateRelease as u32; + let record27 = ControlRecord::SchedulerStateRelease(rel27); + assert_eq!(record27.opcode(), DeviceControlOp::M5SchedulerStateRelease); + assert!(!record27.opcode().asserts_gpu_power()); + assert_eq!( + u32::from_le_bytes(record27.bytes()[..4].try_into().unwrap()), + 0x13 + ); + } + #[test] fn an_unrecognized_type_7_layout_stays_unknown() { assert_eq!(record(&[7, 1, 2, 128, 0x300]).decode(), Ok(Event::Unknown(7))); diff --git a/drivers/gpu/drm/asahi/g17/fw/initdata.rs b/drivers/gpu/drm/asahi/g17/fw/initdata.rs index caf2ba6b658e6..a70b5763eac4d 100644 --- a/drivers/gpu/drm/asahi/g17/fw/initdata.rs +++ b/drivers/gpu/drm/asahi/g17/fw/initdata.rs @@ -28,6 +28,7 @@ use kernel::prelude::*; use super::clear; pub(crate) mod v25g83; +pub(crate) mod v26b123; /// Interface version at root `+0x00`; the firmware rejects any other. pub(crate) const INTERFACE_VERSION: [u16; 4] = [0x04c0, 0x0396, 0xa322, 0x0c8a]; diff --git a/drivers/gpu/drm/asahi/g17/fw/initdata/v26b123.rs b/drivers/gpu/drm/asahi/g17/fw/initdata/v26b123.rs new file mode 100644 index 0000000000000..195ffa6d00aa3 --- /dev/null +++ b/drivers/gpu/drm/asahi/g17/fw/initdata/v26b123.rs @@ -0,0 +1,440 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +//! T6041 26B123 initialization wire layouts. +//! +//! The merged root keeps its geometry with a new interface version. The main +//! configuration keeps its control ring at `+0x4c0` while moving the unaligned +//! power pointer by 16 bytes. Register descriptors keep their encoding, with +//! 60 slots and a reordered resource table. + +use super::{ + MainConfig as LegacyMainConfig, MainConfigArgs, PrimaryViews, RegionC, RegisterMapEntry, + RegisterWindow, RootArgs, SecondaryRoot, +}; +use kernel::prelude::*; + +pub(crate) const INTERFACE_VERSION: [u16; 4] = [0x04c0, 0x8398, 0x6339, 0x0c8b]; +pub(crate) const REGISTER_MAP_SLOTS: usize = 60; +/// Separate GPTBAT MMIO resource, outside the 60-entry register table. +pub(crate) const GPTBAT_PHYS: u64 = 0x2_88d6_0000; +pub(crate) const GPTBAT_SIZE: u32 = 0x8000; + +/// Captured cold-start power state, including its limiter tuning. +#[repr(C)] +pub(crate) struct PowerState(pub(crate) [u8; 0x6d8]); + +// SAFETY: A byte array has no invalid representations or padding. +unsafe impl Zeroable for PowerState {} + +impl PowerState { + pub(crate) fn init(&mut self, max_power_mw: u32) { + self.0.fill(0); + for (offset, value) in [ + (0x10, 31), + (0x14, 0x3cf5c290), + (0x18, 0x3f19999a), + (0x1c, 40), + (0x20, 1), + (0xc8, 11000), + (0xcc, 8000), + (0xd8, 0x42080000), + (0xdc, 0x40baaaaa), + (0xf0, 9900), + (0xf4, 200), + (0x108, 0x42c80000), + (0x10c, 0x43c80000), + (0x110, 200), + (0x128, 1), + (0x12c, max_power_mw), + (0x130, 0x3e99999a), + (0x134, 0x3e0b4396), + (0x624, 0x41700000), + (0x628, 0x40a00000), + (0x62c, 32), + (0x630, 1000), + (0x640, 900), + ] { + self.0[offset..offset + 4].copy_from_slice(&value.to_le_bytes()); + } + } +} + +/// The first page of region C. Fields following `+0x38` shift by four bytes. +#[repr(C)] +pub(crate) struct RegionCPrefix(pub(crate) [u8; 0x1000]); + +// SAFETY: A byte array has no invalid representations or padding. +unsafe impl Zeroable for RegionCPrefix {} + +impl RegionCPrefix { + pub(crate) fn init(&mut self, legacy: &RegionC) { + // SAFETY: RegionC is packed and all fields are initialized integers. + let old = + unsafe { core::slice::from_raw_parts((legacy as *const RegionC).cast::(), 0x1000) }; + self.0[..0x38].copy_from_slice(&old[..0x38]); + self.0[0x38..0x3c].copy_from_slice(&1u32.to_le_bytes()); + self.0[0x3c..].copy_from_slice(&old[0x38..0xffc]); + // Cold-start policy words in previously reserved fields. + self.0[0x9dc..0x9e0].copy_from_slice(&50u32.to_le_bytes()); + self.0[0xe0c..0xe10].copy_from_slice(&250u32.to_le_bytes()); + } +} + +pub(crate) struct PowerArgs { + pub(crate) config_va: u64, + pub(crate) aon_va: u64, + /// Caller value of the build's variable startup word. + pub(crate) startup_word: u32, +} + +#[repr(C)] +pub(crate) struct PowerConfig(pub(crate) [u8; 0x6c48]); + +// SAFETY: Byte arrays have no invalid representations or padding. +unsafe impl Zeroable for PowerConfig {} + +static_assert!(size_of::() == 0x6c48); + +impl PowerConfig { + pub(crate) fn init( + &mut self, + legacy: &super::v25g83::PowerConfig25G83, + args: &PowerArgs, + ) -> Result { + let status = args.config_va.checked_add(0x80).ok_or(EINVAL)?; + if args.config_va == 0 || args.aon_va == 0 { + return Err(EINVAL); + } + let old = &legacy.0; + self.0.fill(0); + self.0[4..0x9c].copy_from_slice(&old[4..0x9c]); + self.0[0xb0..0xfc].copy_from_slice(&old[0xa0..0xec]); + self.0[0x934..0x2888].copy_from_slice(&old[0x924..0x2878]); + self.0[0x28a0..0x2cb0].copy_from_slice(&old[0x2878..0x2c88]); + self.0[0x2d20..0x3160].copy_from_slice(&old[0x2d00..0x3140]); + self.0[0x3b98..0x630c].copy_from_slice(&old[0x3b50..0x62c4]); + self.0[0x6348..0x63f0].copy_from_slice(&old[0x6320..0x63c8]); + // Cold native startup has no legacy reporter/timestamp state. Only the + // chip's leakage coefficients survive in the relocated tail. + self.0[0x6ad4..0x6bb4].copy_from_slice(&old[0x642c..0x650c]); + for (start, end) in [ + (0xac8, 0xacc), + (0xad0, 0xad4), + (0xaf0, 0xb34), + (0xb3c, 0xb40), + (0xb98, 0xb9c), + (0xba0, 0xba4), + (0xbd8, 0xbe8), + (0x2274, 0x2278), + (0x22d8, 0x22dc), + (0x2878, 0x287c), + (0x2884, 0x2888), + (0x2900, 0x2904), + (0x2a34, 0x2a38), + (0x2a54, 0x2a58), + (0x2a6c, 0x2b70), + (0x2bc4, 0x2bc8), + (0x2bec, 0x2bf8), + ] { + self.0[start..end].fill(0); + } + // T6041 cold-start policy observed on native 26B123 boots. Some legacy + // controller tunings revert to the shared defaults in this build. + for (offset, value) in [ + (0xa80, 8), + (0xa8c, 0x3f000000), + (0xa94, 0x3f000000), + (0xae0, 0x5dc00), + (0x2204, 0x42c80000), + (0x2220, 100), + (0x29e4, 124), + (0x29f0, 0x3f77bdef), + (0x29f8, 0x3d042108), + (0x2bbc, 0x45fa0000), + (0x2c10, 8000), + (0x2f0c, 0x42c80000), + ] { + self.word32(offset, value); + } + self.0[0x2a2c..0x2a30].copy_from_slice(&old[0x9e0..0x9e4]); + for offset in [0x44, 0x9c, 0xa0, 0xa4, 0xa8, 0x2f34, 0x6ac8] { + self.word32(offset, 1); + } + self.0[0x3b98..0x3ba0].copy_from_slice(&status.to_le_bytes()); + self.0[0x6340..0x6348].copy_from_slice(&args.aon_va.to_le_bytes()); + self.word32(0x6a7c, args.startup_word); + Ok(()) + } + + fn word32(&mut self, offset: usize, value: u32) { + self.0[offset..offset + 4].copy_from_slice(&value.to_le_bytes()); + } +} + +pub(crate) fn merged_root( + args: &RootArgs, + status_b_va: u64, + power_state_va: u64, + config_va: u64, +) -> SecondaryRoot { + let mut root = SecondaryRoot::merged(args, status_b_va, power_state_va, config_va); + root.root.version = INTERFACE_VERSION; + root +} + +/// The common main-config fields followed by the 26B123 power pointer. +#[repr(C, packed)] +pub(crate) struct MainConfig { + common: [u8; 0x471], + reserved_471: [u8; 0x10], + pub(crate) power_config_va: u64, + reserved_489: [u8; 0x37], +} + +/// Addresses of independently owned channel, descriptor and view objects. +pub(crate) struct MainArgs<'a> { + pub(crate) common: &'a MainConfigArgs, + pub(crate) primary_views: &'a PrimaryViews, + pub(crate) view_va: [u64; 5], + pub(crate) firmware_area_va: [u64; 2], + pub(crate) work_rings_va: u64, + pub(crate) power_config_va: u64, +} + +// SAFETY: This is a packed sequence of integers and byte arrays. +unsafe impl Zeroable for MainConfig {} + +static_assert!(core::mem::offset_of!(MainConfig, power_config_va) == 0x481); +static_assert!(size_of::() == 0x4c0); + +impl MainConfig { + /// Builds all fields, including the merged-role defaults, from host inputs. + /// Work rings may be placed independently of the hardware-data bundle. + pub(crate) fn init_merged(&mut self, args: &MainArgs<'_>) -> Result { + // SAFETY: LegacyMainConfig contains integers and byte arrays only. + let mut common: LegacyMainConfig = unsafe { core::mem::zeroed() }; + common.init_primary(args.common, args.primary_views); + common.view_va = args.view_va; + common.firmware_area_va = args.firmware_area_va; + common.unk_300 = 4; + common.unk_32c = 0; + common.unk_344 = 0; + for channel in 0..super::WORK_CHANNELS { + let offset = super::work_ring_offset(channel) - super::bundle::WORK_RINGS; + common.channels[channel].0[3] = args + .work_rings_va + .checked_add(offset as u64) + .ok_or(EINVAL)?; + } + self.init(&common, args.power_config_va); + Ok(()) + } + + /// Reuses the common channel/view/descriptor fields. The old power slot and + /// both reserved tails are zero, independently of the legacy pointer value. + pub(crate) fn init(&mut self, common: &LegacyMainConfig, power_config_va: u64) { + // SAFETY: LegacyMainConfig is packed and contains initialized integers + // only. The common prefix ends before its old power pointer. + let bytes = unsafe { + core::slice::from_raw_parts((common as *const LegacyMainConfig).cast::(), 0x471) + }; + self.common.copy_from_slice(bytes); + self.reserved_471.fill(0); + self.power_config_va = power_config_va; + self.reserved_489.fill(0); + } +} + +/// Slots with the reserved/shared bit, including descriptors with no mapping. +const SHARED_SLOTS: &[usize] = &[ + 0, 2, 3, 5, 6, 7, 8, 9, 11, 12, 17, 20, 22, 25, 26, 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 42, 43, 44, 45, 46, 47, 48, 52, 53, 54, 55, 58, +]; + +/// The 25 physical T6041 windows keep their tuples, but 13 change slots. +pub(crate) fn register_slot(old: usize) -> Result { + Ok(match old { + 0 | 3 | 4 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 20 | 22 => old, + 26 => 31, + 28 => 33, + 29 => 34, + 31 => 36, + 32 => 37, + 33 => 38, + 34 => 39, + 35 => 40, + 37 => 42, + 39 => 44, + 40 => 45, + 41 => 46, + 43 => 48, + _ => return Err(EINVAL), + }) +} + +/// Register descriptors at hardware-data `+0x640`. +#[repr(C)] +pub(crate) struct RegisterTable { + pub(crate) entries: [RegisterMapEntry; REGISTER_MAP_SLOTS], +} + +// SAFETY: RegisterMapEntry consists of integers; so does an array of it. +unsafe impl Zeroable for RegisterTable {} + +static_assert!(size_of::() == 0x960); + +impl RegisterTable { + /// Builds the table from host-owned mappings; no native GPUVAs are copied. + pub(crate) fn init(&mut self, windows: &[RegisterWindow]) -> Result { + if windows.len() != 25 { + return Err(EINVAL); + } + super::clear(self); + for &slot in SHARED_SLOTS { + self.entries[slot] = RegisterMapEntry::reserved(); + } + let mut used = [false; REGISTER_MAP_SLOTS]; + for window in windows { + let slot = register_slot(window.slot)?; + if window.phys == 0 || window.va == 0 || window.size == 0 || window.instances == 0 { + return Err(EINVAL); + } + window.size.checked_mul(window.instances).ok_or(EINVAL)?; + if used[slot] { + return Err(EINVAL); + } + used[slot] = true; + self.entries[slot] = RegisterMapEntry::window(window); + } + Ok(()) + } +} + +/// Addresses of separately owned objects and native calibration policy words. +pub(crate) struct HardwareArgs { + pub(crate) gptbat_va: u64, + pub(crate) gptbat_size: u32, + pub(crate) completion_low: [u64; 2], + pub(crate) completion_high: [u64; 2], + pub(crate) qos_va: u64, + pub(crate) auxiliary_va: u64, + /// Native relative-performance calibration words, preserving fractions. + pub(crate) relative_a_words: [u32; 11], + pub(crate) relative_b_words: [u32; 11], +} + +/// The logical hardware-data object, excluding the aggregate allocation's peers. +#[repr(C)] +pub(crate) struct HardwareData(pub(crate) [u8; 0x2850]); + +// SAFETY: A byte array has no invalid representations or padding. +unsafe impl Zeroable for HardwareData {} + +impl HardwareData { + /// Encodes the shared 25G83 fields in the 26B123 layout. Distinct insertions + /// surround the register table, completion descriptors and auxiliary pointer. + /// The supplied legacy object is an intermediate host value, not firmware data. + pub(crate) fn init( + &mut self, + legacy: &super::v25g83::HwData25G83, + registers: &RegisterTable, + pointers: &HardwareArgs, + ) -> Result { + if pointers.gptbat_size != GPTBAT_SIZE + || pointers.gptbat_va == 0 + || pointers.qos_va == 0 + || pointers.auxiliary_va == 0 + { + return Err(EINVAL); + } + // SAFETY: These packed integer objects contain initialized bytes only. + let old = unsafe { + core::slice::from_raw_parts( + (legacy as *const super::v25g83::HwData25G83).cast::(), + size_of::(), + ) + }; + let table = unsafe { + core::slice::from_raw_parts( + (registers as *const RegisterTable).cast::(), + size_of::(), + ) + }; + self.0.fill(0); + self.0[..0x640].copy_from_slice(&old[..0x640]); + self.0[0x640..0xfa0].copy_from_slice(table); + self.0[0xfb0..0xfdc].copy_from_slice(&old[0xe90..0xebc]); + self.0[0xfdc..0x2734].copy_from_slice(&old[0xec0..0x2618]); + self.0[0x2738..0x27e0].copy_from_slice(&old[0x2618..0x26c0]); + self.0[0x27e8..0x2850].copy_from_slice(&old[0x26c0..0x2728]); + self.word64(0xfa0, pointers.gptbat_va); + self.word32(0xfa8, pointers.gptbat_size); + // T6041-specific native startup policy words. + for (offset, value) in [ + (0x1044, 12), + (0x10c8, 0), + (0x10d4, 20), + (0x271c, 150), + (0x272c, 0), + (0x2734, 1), + (0x2844, 0x10000), + (0x2848, 0x10000), + ] { + self.word32(offset, value); + } + for (index, offset) in [0x2740, 0x2780].into_iter().enumerate() { + self.word64(offset, pointers.completion_low[index]); + self.word64(offset + 8, pointers.completion_high[index]); + } + self.word64(0x27d8, pointers.qos_va); + self.word64(0x27e0, pointers.auxiliary_va); + for index in 0..11 { + self.word32(0x19e4 + index * 4, pointers.relative_a_words[index]); + self.word32(0x1a24 + index * 4, pointers.relative_b_words[index]); + } + Ok(()) + } + + fn word32(&mut self, offset: usize, value: u32) { + self.0[offset..offset + 4].copy_from_slice(&value.to_le_bytes()); + } + + fn word64(&mut self, offset: usize, value: u64) { + self.0[offset..offset + 8].copy_from_slice(&value.to_le_bytes()); + } +} + +pub(crate) struct AonSensor { + pub(crate) key: [u8; 4], + pub(crate) selector: u32, + pub(crate) config: u32, +} + +/// Nineteen 12-byte native sensor rows, with unused rows zeroed. +#[repr(C)] +pub(crate) struct AonTable(pub(crate) [[u32; 3]; 19]); + +// SAFETY: Integer arrays only. +unsafe impl Zeroable for AonTable {} + +static_assert!(size_of::() == 0xe4); + +impl AonTable { + pub(crate) fn init(&mut self, sensors: &[AonSensor]) -> Result { + if sensors.len() > 19 { + return Err(EINVAL); + } + super::clear(self); + for (index, sensor) in sensors.iter().enumerate() { + if sensor.key == [0; 4] || sensors[..index].iter().any(|row| row.key == sensor.key) { + return Err(EINVAL); + } + self.0[index] = [ + u32::from_be_bytes(sensor.key), + sensor.selector, + sensor.config, + ]; + } + Ok(()) + } +} diff --git a/drivers/gpu/drm/asahi/g17/fw/variant.rs b/drivers/gpu/drm/asahi/g17/fw/variant.rs index 7c3ee790dc941..59e9a5382cf8c 100644 --- a/drivers/gpu/drm/asahi/g17/fw/variant.rs +++ b/drivers/gpu/drm/asahi/g17/fw/variant.rs @@ -87,6 +87,8 @@ pub(crate) struct Variant { pub(crate) compute: super::compute::ComputeProgram, pub(crate) opening_record: bool, pub(crate) split_firmware_area: bool, + /// Uses the 26B123 initialization layouts and scheduler-release opcode. + pub(crate) v26b123: bool, /// Command validation applies the M5 command set: resource commands, the M5 render and /// compute flags, 8x MSAA and the M5 tile-buffer limit. pub(crate) m5_commands: bool, @@ -157,6 +159,7 @@ pub(crate) const V26A428: Variant = Variant { compute: super::compute::ComputeProgram::G17P, opening_record: true, split_firmware_area: false, + v26b123: false, m5_commands: false, registration_power_hold: true, render_id_at_create: true, @@ -197,6 +200,7 @@ pub(crate) const V25G83: Variant = Variant { compute: super::compute::ComputeProgram::G17P, opening_record: true, split_firmware_area: false, + v26b123: false, m5_commands: false, registration_power_hold: true, render_id_at_create: false, @@ -225,8 +229,16 @@ pub(crate) const V25F84: Variant = Variant { ..V25G83 }; +/// The T6041 27.2 firmware (26B123, `mBoot-20457.41.3`). +pub(crate) const V26B123: Variant = Variant { + split_firmware_area: false, + v26b123: true, + ..V25F84 +}; + const _: () = { assert!(super::queue::PointerBlock::valid_layout(&V26A428.pointers)); assert!(super::queue::PointerBlock::valid_layout(&V25G83.pointers)); assert!(super::queue::PointerBlock::valid_layout(&V25F84.pointers)); + assert!(super::queue::PointerBlock::valid_layout(&V26B123.pointers)); }; diff --git a/drivers/gpu/drm/asahi/g17/initdata.rs b/drivers/gpu/drm/asahi/g17/initdata.rs index c505bbd5b3b45..45671b6181a93 100644 --- a/drivers/gpu/drm/asahi/g17/initdata.rs +++ b/drivers/gpu/drm/asahi/g17/initdata.rs @@ -17,6 +17,7 @@ use kernel::{c_str, prelude::*, sync::Arc}; use t8140::{kernel_window as high, low}; mod v25g83; +mod v26b123; mod m5; mod work_pair; pub(crate) mod outer_credit; @@ -172,6 +173,7 @@ impl WorkPublication<'_> { /// Session-long storage and mappings. Aliases are released before their backing objects. pub(super) struct InitData { m5: bool, + v26b123: bool, /// The M5 firmware build's layout, where [`Self::m5`]. graph: &'static super::fw::m5::initdata::Graph, outer_credits: Option>, @@ -186,6 +188,7 @@ pub(super) struct InitData { cluster: usize, bundle: usize, region_c: usize, + region_c_shift: usize, qos: usize, pb: usize, page_pool: usize, @@ -291,6 +294,7 @@ impl InitData { pub(super) fn new() -> Self { Self { m5: false, + v26b123: false, graph: &super::fw::m5::initdata::M5_GRAPH, outer_credits: None, _single_publisher: core::marker::PhantomData, @@ -301,6 +305,7 @@ impl InitData { cluster: 0, bundle: 0, region_c: 0, + region_c_shift: 0, qos: 0, pb: 0, page_pool: 0, @@ -477,7 +482,7 @@ impl InitData { /// A scheduler-state release record in the family's opcode. pub(super) fn scheduler_release(&self, page_va: u64, id: [u8; 4]) -> super::fw::channels::SchedulerStateRelease { let mut record = super::fw::channels::SchedulerStateRelease::new(page_va, id); - if self.m5 { + if self.m5 || self.v26b123 { record.opcode = super::fw::m5::queue::SCHEDULER_RELEASE_OPCODE; } record @@ -1171,6 +1176,7 @@ impl InitData { variant: &super::fw::Variant, ) -> Result { self.pm_metrics_va = cfg.pm_metrics()?.va; + self.v26b123 = variant.v26b123; self.recovery_slot_keys = cfg.recovery_slot_keys; let range = uat.geometry().kernel_range(); let env = BuildEnv { @@ -1679,7 +1685,12 @@ impl InitData { let region = self.object(self.region_c)?; let (effort_offset, override_offset) = if self.m5 { (super::fw::m5::power::EFFORT, super::fw::m5::power::EFFORT_OVERRIDE) - } else { (abi::RegionC::EFFORT, abi::RegionC::UNK_E8) }; + } else { + ( + abi::RegionC::EFFORT + self.region_c_shift, + abi::RegionC::UNK_E8 + self.region_c_shift, + ) + }; let override_word = region.word(override_offset)?; let effort_word = region.word(effort_offset)?; let line = region.pointer(effort_offset, 4)?; @@ -1697,7 +1708,11 @@ impl InitData { pub(super) fn effort(&self) -> Result { Ok(self .object(self.region_c)? - .word(if self.m5 { super::fw::m5::power::EFFORT } else { abi::RegionC::EFFORT })? + .word(if self.m5 { + super::fw::m5::power::EFFORT + } else { + abi::RegionC::EFFORT + self.region_c_shift + })? .load(Ordering::Relaxed)) } @@ -1876,8 +1891,11 @@ impl InitData { let ring = self.object(self.bundle)?.pointer(offset, record.len())?; let power = self .object(self.region_c)? - .pointer(if self.m5 { self.graph.power_assert_tally } - else { abi::RegionC::POWER_ASSERT_TALLY }, 4)?; + .pointer(if self.m5 { + self.graph.power_assert_tally + } else { + abi::RegionC::POWER_ASSERT_TALLY + self.region_c_shift + }, 4)?; let producer = self.control_producer()?; // SAFETY: The checked pointers remain valid for the lifetime of this non-Sync owner. // Firmware only reads records after the producer store and the device mutex serializes diff --git a/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs b/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs index c0485c4932e48..26b87dc1826b5 100644 --- a/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs +++ b/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs @@ -44,6 +44,18 @@ impl InitData { let objects = self.build_25g83_objects(env, variant.split_firmware_area)?; self.views = Some(objects.views); self.initialize_25g83(env, cfg, active_cores, &tables, &bundle, &objects, variant)?; + if variant.v26b123 { + self.upgrade_26b123( + env, + cfg, + active_cores, + &bundle, + objects.aon, + objects.power_state, + objects.firmware_area, + objects.views, + )?; + } if cfg.uat_quirks.clean_tables { // Write back every host-built byte before the firmware may read it. for object in self.objects.iter_mut() { diff --git a/drivers/gpu/drm/asahi/g17/initdata/v26b123.rs b/drivers/gpu/drm/asahi/g17/initdata/v26b123.rs new file mode 100644 index 0000000000000..556d6bdce67a1 --- /dev/null +++ b/drivers/gpu/drm/asahi/g17/initdata/v26b123.rs @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +//! T6041 26B123 initialization graph. Legacy constructors supply common values +//! in unpublished storage; the 26B123 views are built into distinct allocations +//! before the root is published, and the session retains every allocation until +//! ASC stop. + +use super::{abi, low, BuildEnv, BundleObjects, CpuMap, InitData}; +use crate::{ + g17::{Config, Role}, + mmu, +}; +use abi::{v25g83 as old, v26b123 as v}; +use core::sync::atomic::Ordering; +use kernel::prelude::*; + +// Relative-performance calibration observed on native 40-core T6041 26B123 boots. +const RELATIVE_A: [u32; 11] = [ + 0, 0x41219d11, 0x4194a46c, 0x41cd5835, 0x41f9b2d3, 0x42220d2d, 0x424ab13c, 0x4279cf40, + 0x428cb17b, 0x429da759, 0x42c80000, +]; +const RELATIVE_B: [u32; 11] = [ + 0, 0, 0x41b4a529, 0x4213bdf0, 0x423d0842, 0x42679ce6, 0x42882108, 0x429d18c6, 0x42a81085, + 0x42b694a5, 0x42c80000, +]; + +impl InitData { + #[expect(clippy::too_many_arguments, reason = "Explicit retained graph objects")] + pub(super) fn upgrade_26b123( + &mut self, + env: &BuildEnv<'_>, + cfg: &Config, + active_cores: u32, + bundle: &BundleObjects, + aon: usize, + power_state: usize, + firmware_area: usize, + views: [usize; 5], + ) -> Result { + use mmu::PROT_FW_PRIV_RW as FP; + use mmu::PROT_FW_SHARED_RW as FS; + use CpuMap::WriteCombined as WC; + + if cfg.chip_id != 0x6041 || active_cores != 40 || env.clusters != 4 { + return Err(EINVAL); + } + let chip = cfg.chip.ok_or(EINVAL)?; + let bundle_va = self.object(self.bundle)?.gpu_va(); + let cluster_va = self.object(self.cluster)?.gpu_va(); + let config_va = cluster_va + old::private::CONFIG as u64; + let aon_va = self.object(aon)?.gpu_va(); + // The existing register window already maps the complete GPTBAT span + // with firmware MMIO permissions; reuse its first 0x8000 bytes. + let gptbat = cfg + .windows + .iter() + .find(|window| window.phys == v::GPTBAT_PHYS && window.size >= v::GPTBAT_SIZE) + .ok_or(EINVAL)?; + let auxiliary = self.add(env.dynamic(mmu::UAT_PGSZ, mmu::UAT_PGSZ as u64, FP, WC)?)?; + let hardware = self.add(env.dynamic(mmu::UAT_PGSZ, mmu::UAT_PGSZ as u64, FP, WC)?)?; + let power = self.add(env.dynamic(0x8000, mmu::UAT_PGSZ as u64, FP, WC)?)?; + let region = self.add(env.dynamic(mmu::UAT_PGSZ, mmu::UAT_PGSZ as u64, FS, WC)?)?; + + // SAFETY: RegisterTable consists of initialized integer descriptors only. + let mut registers: v::RegisterTable = unsafe { core::mem::zeroed() }; + registers.init(cfg.windows)?; + let args = v::HardwareArgs { + gptbat_va: gptbat.va, + gptbat_size: v::GPTBAT_SIZE, + completion_low: bundle.completion_rings.map(|ring| ring.low_va), + completion_high: bundle.completion_rings.map(|ring| ring.high_va), + qos_va: self.object(bundle.qos)?.gpu_va(), + auxiliary_va: self.object(auxiliary)?.gpu_va(), + relative_a_words: RELATIVE_A, + relative_b_words: RELATIVE_B, + }; + let legacy_hw = self + .object(self.bundle)? + .pointer(0, size_of::())? + .cast::(); + self.object_mut(hardware)? + .initialize::(0, |hw| { + // SAFETY: This checked, initialized legacy view remains in a distinct + // retained allocation. No graph has been published to the firmware. + hw.init(unsafe { &*legacy_hw }, ®isters, &args) + })?; + let startup_word = self + .object(self.bundle)? + .word(old::POWER_CONFIG + 0x63d4)? + .load(Ordering::Relaxed); + let legacy_power = self + .object(self.bundle)? + .pointer(old::POWER_CONFIG, size_of::())? + .cast::(); + self.object_mut(power)? + .initialize::(0, |power| { + // SAFETY: The initialized legacy power view is in the distinct bundle. + power.init( + unsafe { &*legacy_power }, + &v::PowerArgs { + config_va, + aon_va, + startup_word, + }, + ) + })?; + let legacy_region = self + .object(self.region_c)? + .pointer(0, size_of::())? + .cast::(); + self.object_mut(region)? + .initialize::(0, |region| { + // SAFETY: The old region remains retained and is distinct from `region`. + region.init(unsafe { &*legacy_region }); + Ok(()) + })?; + self.region_c = region; + self.region_c_shift = 4; + self.object_mut(power_state)? + .initialize::(0, |state| { + state.init(chip.max_power_mw); + Ok(()) + })?; + self.object_mut(aon)? + .initialize::(0, |table| { + table.init(&[ + v::AonSensor { + key: *b"g0TR", + selector: 0x00c20001, + config: 0x1401, + }, + v::AonSensor { + key: *b"g1TR", + selector: 0x00970001, + config: 0x1401, + }, + v::AonSensor { + key: *b"g2TR", + selector: 0x00920001, + config: 0x1401, + }, + v::AonSensor { + key: *b"g3TR", + selector: 0x00c70001, + config: 0x1401, + }, + v::AonSensor { + key: *b"r0TR", + selector: 0x012c0001, + config: 0x1401, + }, + ]) + })?; + + let main_offset = abi::bundle::MAIN_CONFIG[Role::Primary as usize]; + let main_va = bundle_va + main_offset as u64; + let common = abi::MainConfigArgs { + bundle_va: self.object(hardware)?.gpu_va(), + main_config_va: main_va, + state_grid_va: cluster_va + self.state_offset(Role::Primary) as u64, + status_a_va: cluster_va + old::private::STATUS_A as u64, + pb_descriptors_low_va: low::PB_DESCRIPTORS, + page_pool_descriptors_low_va: low::PAGE_POOL_DESCRIPTORS, + }; + // Preserve the already constructed host-owned descriptor addresses. + let old_main = self + .object(self.bundle)? + .pointer(main_offset, size_of::())? + .cast::(); + // SAFETY: The bundle view is initialized and not yet published. Copy only + // integer values before initialize clears that same view below. + let primary_views = unsafe { + abi::PrimaryViews { + zero_page_va: (*old_main).zero_page_va, + pb_descriptors_va: (*old_main).pb_descriptors_va, + page_pool_descriptors_va: (*old_main).page_pool_descriptors_va, + } + }; + let mut view_va = [0; 5]; + for (va, index) in view_va.iter_mut().zip(views) { + *va = self.object(index)?.gpu_va(); + } + let firmware_area_va = self.object(firmware_area)?.gpu_va(); + let main_args = v::MainArgs { + common: &common, + primary_views: &primary_views, + view_va, + firmware_area_va: [firmware_area_va; 2], + work_rings_va: bundle_va + abi::bundle::WORK_RINGS as u64, + power_config_va: self.object(power)?.gpu_va(), + }; + self.object_mut(self.bundle)? + .initialize::(main_offset, |main| main.init_merged(&main_args))?; + let root = abi::RootArgs { + region_a_va: self.object(bundle.region_a)?.gpu_va(), + region_c_va: self.object(self.region_c)?.gpu_va(), + main_config_va: main_va, + status_a_va: common.status_a_va, + ias: cfg.uat_ias, + oas: cfg.uat_oas, + }; + let merged = v::merged_root( + &root, + cluster_va + old::private::STATUS_B as u64, + self.object(power_state)?.gpu_va(), + config_va, + ); + self.object_mut(self.roots)?.write(0, merged)?; + Ok(()) + } +} diff --git a/drivers/gpu/drm/asahi/hw/t6041.rs b/drivers/gpu/drm/asahi/hw/t6041.rs index 5dc8020b89f49..dc1fc5db672b0 100644 --- a/drivers/gpu/drm/asahi/hw/t6041.rs +++ b/drivers/gpu/drm/asahi/hw/t6041.rs @@ -72,7 +72,7 @@ pub(crate) const CONFIG: Config = Config { /// The 25G83 image is admitted twice, with the configuration of each measured core layout; /// the one that matches the probed cores is used. -const BUILDS: [fw::variant::Build; 3] = [ +const BUILDS: [fw::variant::Build; 4] = [ BUILD_25F84, fw::variant::Build { config: Some(&CONFIG_25G83), @@ -83,8 +83,47 @@ const BUILDS: [fw::variant::Build; 3] = [ config: Some(&super::t6041_25g83::CONFIG), ..BUILD_25G83 }, + BUILD_26B123, ]; +const BUILD_26B123: fw::variant::Build = fw::variant::Build { + os_version: [27, 2, 0], + name: "macOS 27.2 (26B123, iBoot mBoot-20457.41.3)", + images: &[ + crate::fwid::FirmwareBuild { + name: "Apple GFX 26B123 for T6041 (normalized loaded image)", + text_size: 0x64000, + data_size: 0xcc000, + entropy: &[[0x5d88c, 0x5d96f]], + boot_filled: &[], + text_sha256: [ + 0xcc, 0x4c, 0xb8, 0x28, 0x54, 0x6d, 0x5e, 0xc6, 0x39, 0xfa, 0x14, 0xc1, 0xcc, 0x6c, + 0xef, 0xc7, 0x27, 0x40, 0x40, 0xfd, 0xbd, 0x5c, 0xb5, 0xa6, 0xec, 0xc4, 0x38, 0xb0, + 0x3c, 0x84, 0x90, 0x3b, + ], + }, + crate::fwid::FirmwareBuild { + name: "Apple GFX 26B123 for T6041 (normalized loaded image, 40-core J616C)", + text_size: 0x64000, + data_size: 0xcc000, + entropy: &[[0x5d88c, 0x5d96f]], + // A second 40-core J616C: iBoot fills its loaded TEXT differently. Measured with + // only the entropy zeroed; the digest is the same on every boot measured. + boot_filled: &[], + text_sha256: [ + 0xdf, 0x03, 0x38, 0xa0, 0x9b, 0x6c, 0x8d, 0xfd, 0xb4, 0x8f, 0xcb, 0x05, 0xb8, 0xeb, + 0xbc, 0x80, 0x59, 0x58, 0x1a, 0x46, 0xc9, 0x25, 0x58, 0x4c, 0x60, 0x24, 0xc9, 0x27, + 0x94, 0x59, 0xfc, 0x5d, + ], + }, + ], + variant: &fw::variant::Variant { + ta_mode_1: true, + ..fw::variant::V26B123 + }, + config: None, +}; + const BUILD_25F84: fw::variant::Build = fw::variant::Build { os_version: [26, 5, 2], name: "macOS 26.5.2 (25F84, iBoot mBoot-18000.121.3)", diff --git a/drivers/soc/apple/display-gate-test.c b/drivers/soc/apple/display-gate-test.c index 3b0b162ed6799..6782be66bf9ab 100644 --- a/drivers/soc/apple/display-gate-test.c +++ b/drivers/soc/apple/display-gate-test.c @@ -1233,6 +1233,82 @@ static void __init gate_t6041_max_no_display(struct kunit *test) KUNIT_EXPECT_EQ(test, of_count_phandle_with_args(display, "iommus", "#iommu-cells"), 1); } +static void __init gt_max_set_j616c_machine(struct kunit *test) +{ + static const char * const machine_compat[] = { + "apple,j616c", "apple,t6041", "apple,arm-platform", + }; + struct device_node *root = gt_node(test, "/"); + struct property *prop = of_find_property(root, "compatible", NULL); + struct gate_test *t = test->priv; + + if (prop) + KUNIT_ASSERT_EQ(test, of_changeset_remove_property(&t->cs, root, prop), 0); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_string_array(&t->cs, root, "compatible", + machine_compat, + ARRAY_SIZE(machine_compat)), + 0); +} + +/* Unapproved firmware 27 adopts only the internal panel: external chains stay off. */ +static void __init gate_t6041_max_firmware27_internal_only(struct kunit *test) +{ + struct device_node *dcp = gt_node(test, "/dcp@402e00000"); + struct gate_test *t = test->priv; + static const u32 compat[3] = { 27, 2, 0 }; + + gt_max_set_j616c_machine(test); + gt_max_fill(test, 0); + gt_max_fill(test, 1); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_string(&t->cs, dcp, "apple,firmware-uuid", + "71F140DC-F18D-31B3-9772-537A5CC8400D"), + 0); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_u32_array(&t->cs, dcp, "apple,firmware-version", + compat, ARRAY_SIZE(compat)), + 0); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_u32_array(&t->cs, dcp, "apple,firmware-compat", + compat, ARRAY_SIZE(compat)), + 0); + gt_max_run(test); + gt_max_expect_chain(test, 0, false); + gt_max_expect_chain(test, 1, false); + gt_max_expect_display(test, 0); +} + +/* J616c on macOS 27.2 (26B123) admits filled external HDMI and USB-C DP chains. */ +static void __init gate_t6041_max_j616c_v27_2(struct kunit *test) +{ + struct device_node *dcp = gt_node(test, "/dcp@402e00000"); + struct gate_test *t = test->priv; + static const u32 compat[3] = { 27, 2, 0 }; + + gt_max_set_j616c_machine(test); + gt_max_fill(test, 0); + gt_max_fill(test, 1); + gt_max_fill(test, 2); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_string(&t->cs, dcp, "apple,firmware-uuid", + APPLE_J616C_DCP_26B123_UUID), + 0); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_u32_array(&t->cs, dcp, "apple,firmware-version", + compat, ARRAY_SIZE(compat)), + 0); + KUNIT_ASSERT_EQ(test, + of_changeset_add_prop_u32_array(&t->cs, dcp, "apple,firmware-compat", + compat, ARRAY_SIZE(compat)), + 0); + gt_max_run(test); + gt_max_expect_chain(test, 0, true); + gt_max_expect_chain(test, 1, true); + gt_max_expect_chain(test, 2, true); + gt_max_expect_display(test, BIT(0) | BIT(1) | BIT(2)); +} + static struct kunit_case gate_t6041_max_cases[] __refdata = { KUNIT_CASE(gate_t6041_max_enabled), KUNIT_CASE(gate_t6041_max_no_memory), @@ -1242,6 +1318,8 @@ static struct kunit_case gate_t6041_max_cases[] __refdata = { KUNIT_CASE(gate_t6041_max_enabled_by_loader), KUNIT_CASE(gate_t6041_max_missing_node), KUNIT_CASE(gate_t6041_max_no_display), + KUNIT_CASE(gate_t6041_max_firmware27_internal_only), + KUNIT_CASE(gate_t6041_max_j616c_v27_2), {} }; diff --git a/drivers/soc/apple/display-gate.c b/drivers/soc/apple/display-gate.c index 03db5ed73e343..eaf43e8513a16 100644 --- a/drivers/soc/apple/display-gate.c +++ b/drivers/soc/apple/display-gate.c @@ -108,6 +108,7 @@ #include #include #include +#include #include #include #include @@ -2139,10 +2140,14 @@ static void __init gate_t6041_internal(void) !gate_marked(nodes[T6041_PIODMA])) goto out; - /* The desktop IOMFB instance is written for the 26.6.2 firmware only. */ - if (of_property_count_u32_elems(nodes[T6041_DCP], "apple,firmware-compat") != 3 || - of_property_read_u32_array(nodes[T6041_DCP], "apple,firmware-compat", version, 3) || - version[0] != 26 || version[1] != 6 || version[2] != 2) + /* + * The desktop IOMFB instance is written for the 26.6.2 firmware; J616c + * on macOS 27.2 (26B123) uses the firmware-27 internal panel backend. + */ + if (!apple_t6041_j616c_dcp_v27_2(nodes[T6041_DCP]) && + (of_property_count_u32_elems(nodes[T6041_DCP], "apple,firmware-compat") != 3 || + of_property_read_u32_array(nodes[T6041_DCP], "apple,firmware-compat", version, 3) || + version[0] != 26 || version[1] != 6 || version[2] != 2)) goto out; nodes[T6041_DCP_DART] = gate_target(nodes[T6041_DCP], "iommus", "#iommu-cells", @@ -2180,6 +2185,9 @@ static void __init gate_t6041_internal(void) for (i = 0; i < ARRAY_SIZE(t6041_enable) && !ret; i++) ret = of_changeset_update_prop_string(&t6041_gate, nodes[t6041_enable[i]], "status", "okay"); + if (!ret && gate_disabled(nodes[T6041_PIODMA])) + ret = of_changeset_update_prop_string(&t6041_gate, nodes[T6041_PIODMA], + "status", "okay"); if (!ret) ret = of_changeset_apply(&t6041_gate); if (ret) @@ -3248,7 +3256,8 @@ static int __init t6041_max_apply(unsigned int i, struct device_node *display) */ static void __init gate_t6041_max_run(void) { - struct device_node *display; + struct device_node *display, *internal; + u32 compat[3]; unsigned int i; int ret; @@ -3267,6 +3276,27 @@ static void __init gate_t6041_max_run(void) of_node_put(display); return; } + /* + * T6041 external display processors support the desktop 26.x firmware + * and the J616c 27.2 (26B123) firmware-27 profile; leave their chains + * disabled on any other firmware-27 build. + */ + internal = of_find_node_by_path("dcp"); + if (!internal) + internal = of_find_compatible_node(NULL, NULL, gate_soc->dcp_compat); + if (internal && + !apple_t6041_j616c_dcp_v27_2(internal) && + of_property_count_u32_elems(internal, "apple,firmware-compat") == + ARRAY_SIZE(compat) && + !of_property_read_u32_array(internal, "apple,firmware-compat", + compat, ARRAY_SIZE(compat)) && + compat[0] == 27) { + staged_info("firmware 27 internal display only, external displays left off\n"); + of_node_put(internal); + of_node_put(display); + return; + } + of_node_put(internal); for (i = 0; i < ARRAY_SIZE(t6041_max_stages); i++) { const struct gate_staged *st = t6041_max_stage(i); const char *dcp = st->nodes[st->nr - 1]; diff --git a/drivers/soc/apple/t6041-gate-test.dtso b/drivers/soc/apple/t6041-gate-test.dtso index e77e3415199a3..094b4d10fecb8 100644 --- a/drivers/soc/apple/t6041-gate-test.dtso +++ b/drivers/soc/apple/t6041-gate-test.dtso @@ -228,6 +228,11 @@ #iommu-cells = <1>; }; + dcp@402e00000 { + compatible = "apple,t6041-dcp"; + status = "disabled"; + }; + display-subsystem { compatible = "apple,display-subsystem"; iommus = <&disp_dart 0>; diff --git a/include/linux/soc/apple/display.h b/include/linux/soc/apple/display.h index 1bf7c14f62178..4f9715275d1d9 100644 --- a/include/linux/soc/apple/display.h +++ b/include/linux/soc/apple/display.h @@ -2,6 +2,10 @@ #ifndef _LINUX_SOC_APPLE_DISPLAY_H_ #define _LINUX_SOC_APPLE_DISPLAY_H_ +#include +#include +#include + struct device; /* Initial native display admission, before starting retained GPU firmware. */ @@ -9,4 +13,39 @@ int apple_drm_t6030_link_device(struct device *consumer); int apple_drm_t6031_link_device(struct device *consumer); int apple_drm_t8132_link_device(struct device *consumer); +/* J616c (16-inch M4 Max) DCP image on macOS 27.2 (26B123). */ +#define APPLE_J616C_DCP_26B123_UUID "964EDE5B-8F78-38C2-A727-519CC9F0AF27" + +static inline bool apple_t6041_j616c_dcp_any_v27_2(const struct device_node *np, + const char *compat_name) +{ + const char *uuid; + u32 fw[3], compat[3]; + + if (!np || !of_machine_is_compatible("apple,j616c") || + !of_machine_is_compatible("apple,t6041") || + !of_device_is_compatible(np, compat_name) || + of_property_count_strings(np, "apple,firmware-uuid") != 1 || + of_property_read_string(np, "apple,firmware-uuid", &uuid) || + strcmp(uuid, APPLE_J616C_DCP_26B123_UUID) || + of_property_count_u32_elems(np, "apple,firmware-version") != 3 || + of_property_count_u32_elems(np, "apple,firmware-compat") != 3 || + of_property_read_u32_array(np, "apple,firmware-version", fw, 3) || + of_property_read_u32_array(np, "apple,firmware-compat", compat, 3)) + return false; + + return fw[0] == 27 && fw[1] == 2 && fw[2] == 0 && + compat[0] == 27 && compat[1] == 2 && compat[2] == 0; +} + +static inline bool apple_t6041_j616c_dcp_v27_2(const struct device_node *np) +{ + return apple_t6041_j616c_dcp_any_v27_2(np, "apple,t6041-dcp"); +} + +static inline bool apple_t6041_j616c_dcpext_v27_2(const struct device_node *np) +{ + return apple_t6041_j616c_dcp_any_v27_2(np, "apple,t6041-dcpext"); +} + #endif diff --git a/tools/asahi/dcpext26-crossbar-union-tests.py b/tools/asahi/dcpext26-crossbar-union-tests.py index 2edbcc37a4489..9607ad8ee202e 100644 --- a/tools/asahi/dcpext26-crossbar-union-tests.py +++ b/tools/asahi/dcpext26-crossbar-union-tests.py @@ -57,7 +57,7 @@ def function(text, name): struct device *dev; struct apple_dcp_typec_route *active_typec_route; struct mux_control *fixed_xbar, *direct_xbar_up; - bool fixed_route_selected; + bool fixed_route_selected, desktop_external; }; static const char *machine; static unsigned links, v27, locks; @@ -120,10 +120,13 @@ def function(text, name): d.fixed_route_selected = false; d.direct_xbar_up = NULL; reset(); assert(dcp_direct_crossbar_link(&d, true) == 0 && links == 0); - /* The V27 PHY helper precedes every family admission/lock. */ + /* The V27 PHY helper precedes every family admission/lock except T6041 dcpext. */ d.fw_compat = DCP_FIRMWARE_V_27_0; reset(); assert(dcp_direct_crossbar_link(&d, true) == 37); assert(v27 == 1 && links == 0 && locks == 0); + d.desktop_external = true; d.active_typec_route = &route; + reset(); assert(dcp_direct_crossbar_link(&d, true) == 0); + assert(v27 == 0 && links == 1 && locks == 1); } machine = "apple,other"; node.compatible = "apple,other-dcp"; struct apple_dcp unrelated = { .dev = &dev, .active_typec_route = &route }; @@ -134,6 +137,7 @@ def function(text, name): } ''' unit = pre + function(header, 'dcp_is_ext26') + '\n' +unit += function(source, 'dcp_t6041_ext_v27') + '\n' unit += function(source, 'dcp_is_t8132_ext') + '\n' + link + '\n' + cases with tempfile.TemporaryDirectory() as tmp: c = Path(tmp) / 'crossbar.c' diff --git a/tools/asahi/t6040-calibration-tests.py b/tools/asahi/t6040-calibration-tests.py index d802013175b97..5f2e3a0a0511d 100644 --- a/tools/asahi/t6040-calibration-tests.py +++ b/tools/asahi/t6040-calibration-tests.py @@ -170,6 +170,7 @@ def main(): for source, target in [ ("g17/fw/initdata.rs", "initdata.rs"), ("g17/fw/initdata/v25g83.rs", "initdata/v25g83.rs"), + ("g17/fw/initdata/v26b123.rs", "initdata/v26b123.rs"), ]: text = (DRIVER / source).read_text() (root / target).write_text(text.replace("use kernel::prelude::*;", "use crate::prelude::*;")) diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py index e634c2f04effd..1b70d453568f5 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py @@ -187,3 +187,203 @@ def syslog(root): return 0; } ''' + + +def t6041_v27_admission(root): + display_h = (root / 'include/linux/soc/apple/display.h').read_text() + helper = display_h[display_h.index('#define APPLE_J616C_DCP_26B123_UUID'): + display_h.index('\n#endif')] + iomfb_h = (root / 'drivers/gpu/drm/apple/iomfb.h').read_text() + methods_decl = iomfb_h[iomfb_h.index('enum dcpep_method {'): + iomfb_h.index('#define IOMFB_MAX_CB')] + v27_c = (root / 'drivers/gpu/drm/apple/iomfb_v27.c').read_text() + v27_tables = v27_c[v27_c.index('static const struct dcp_method_entry dcp_methods_27_0'): + v27_c.index('/* The template\'s calls resolve through')] + dcp_c = (root / 'drivers/gpu/drm/apple/dcp.c').read_text() + selector_full = block(dcp_c, 'static enum dcp_firmware_version dcp_check_firmware_version(') + cutoff = '\n\tret = dcp_read_fw_version(dev, "apple,firmware-compat", compat_str);\n\tif (ret < 0)' + selector = selector_full[:selector_full.index(cutoff)] + '\n\t(void)v14_board;\n\treturn DCP_FIRMWARE_UNKNOWN;\n}\n' + return r''' +#include +#include +#include +#include +#include +typedef uint32_t u32; +enum dcp_firmware_version { + DCP_FIRMWARE_UNKNOWN, + DCP_FIRMWARE_V_26_6_DESKTOP, + DCP_FIRMWARE_V_27_0, +}; +struct dcp_v14_board; +struct apple_dcp_hw_data { enum dcp_firmware_version firmware_compat; }; +struct device_node { + const char *compatible; + const char *uuid; + int uuid_count; + u32 fw[3]; + int fw_cells; + u32 compat[3]; + int compat_cells; +}; +struct device { + struct device_node *of_node; + const struct apple_dcp_hw_data *hw; +}; +static const char *machine_board; +static const char *machine_soc; +static int of_machine_is_compatible(const char *s) +{ + return (machine_board && !strcmp(s, machine_board)) || + (machine_soc && !strcmp(s, machine_soc)); +} +static int of_device_is_compatible(const struct device_node *np, const char *s) +{ + return np && np->compatible && !strcmp(np->compatible, s); +} +static int of_property_count_strings(const struct device_node *np, const char *name) +{ + assert(!strcmp(name, "apple,firmware-uuid")); + return np ? np->uuid_count : -1; +} +static int of_property_read_string(const struct device_node *np, const char *name, const char **out) +{ + assert(!strcmp(name, "apple,firmware-uuid")); + if (!np || np->uuid_count < 1 || !np->uuid) + return -1; + *out = np->uuid; + return 0; +} +static int of_property_count_u32_elems(const struct device_node *np, const char *name) +{ + if (!np) + return -1; + if (!strcmp(name, "apple,firmware-version")) + return np->fw_cells; + if (!strcmp(name, "apple,firmware-compat")) + return np->compat_cells; + return -1; +} +static int of_property_read_u32_array(const struct device_node *np, const char *name, u32 *out, size_t n) +{ + const u32 *src; + int cells; + if (!np || n != 3) + return -1; + if (!strcmp(name, "apple,firmware-version")) { + src = np->fw; + cells = np->fw_cells; + } else if (!strcmp(name, "apple,firmware-compat")) { + src = np->compat; + cells = np->compat_cells; + } else { + return -1; + } + if (cells != 3) + return -1; + memcpy(out, src, 3 * sizeof(u32)); + return 0; +} +#define DCP_FW_VERSION_STR_LEN 32 +#define GFP_KERNEL 0 +#define dev_err(...) ((void)0) +static void *devm_kmemdup(struct device *dev, const void *src, size_t len, unsigned int gfp) +{ + (void)dev; (void)src; (void)len; (void)gfp; + return NULL; +} +static const struct apple_dcp_hw_data *of_device_get_match_data(struct device *dev) +{ + return dev->hw; +} +static int dcp_read_fw_version(struct device *dev, const char *name, char *out) +{ + u32 v[3]; + if (of_property_count_u32_elems(dev->of_node, name) != 3 || + of_property_read_u32_array(dev->of_node, name, v, 3)) + return -1; + snprintf(out, DCP_FW_VERSION_STR_LEN, "%u.%u.%u", v[0], v[1], v[2]); + return 3; +} +''' + helper + '\n' + methods_decl + '\n' + v27_tables + '\n' + selector + r''' +static struct device_node node; +static struct apple_dcp_hw_data hw_t6041; +static struct device dev = { .of_node = &node, .hw = &hw_t6041 }; + +static void reset_j616c_26b123(bool ext) +{ + machine_board = "apple,j616c"; + machine_soc = "apple,t6041"; + node = (struct device_node){ + .compatible = ext ? "apple,t6041-dcpext" : "apple,t6041-dcp", + .uuid = APPLE_J616C_DCP_26B123_UUID, + .uuid_count = 1, + .fw = { 27, 2, 0 }, + .fw_cells = 3, + .compat = { 27, 2, 0 }, + .compat_cells = 3, + }; +} + +static void expect_rejected(void) +{ + assert(!apple_t6041_j616c_dcp_v27_2(&node)); + assert(!apple_t6041_j616c_dcpext_v27_2(&node)); + assert(dcp_check_firmware_version(&dev) == DCP_FIRMWARE_UNKNOWN); +} + +int main(void) +{ + assert(!apple_t6041_j616c_dcp_v27_2(NULL)); + assert(!apple_t6041_j616c_dcpext_v27_2(NULL)); + + /* Internal only matches apple_t6041_j616c_dcp_v27_2; external only matches dcpext. */ + reset_j616c_26b123(false); + assert(apple_t6041_j616c_dcp_v27_2(&node)); + assert(!apple_t6041_j616c_dcpext_v27_2(&node)); + assert(dcp_check_firmware_version(&dev) == DCP_FIRMWARE_V_27_0); + + reset_j616c_26b123(true); + assert(!apple_t6041_j616c_dcp_v27_2(&node)); + assert(apple_t6041_j616c_dcpext_v27_2(&node)); + assert(dcp_check_firmware_version(&dev) == DCP_FIRMWARE_V_27_0); + + for (unsigned ext = 0; ext < 2; ext++) { + /* Reject other boards, wrong/missing SoC compatible, and non-T6041 DCP compatibles. */ + reset_j616c_26b123(ext); machine_board = "apple,j614c"; expect_rejected(); + reset_j616c_26b123(ext); machine_board = "apple,j575c"; expect_rejected(); + reset_j616c_26b123(ext); machine_soc = "apple,t6040"; expect_rejected(); + reset_j616c_26b123(ext); machine_soc = NULL; expect_rejected(); + reset_j616c_26b123(ext); node.compatible = "apple,t6031-dcp"; expect_rejected(); + + /* Reject missing, multi-string, or non-26B123 firmware UUIDs (including 26B131). */ + reset_j616c_26b123(ext); node.uuid_count = 0; expect_rejected(); + reset_j616c_26b123(ext); node.uuid_count = 2; expect_rejected(); + reset_j616c_26b123(ext); node.uuid = "00000000-0000-0000-0000-000000000000"; expect_rejected(); + reset_j616c_26b123(ext); node.uuid = "71F140DC-F18D-31B3-9772-537A5CC8400D"; expect_rejected(); + + /* Reject malformed or non-27.2.0 firmware/compat tuples. */ + reset_j616c_26b123(ext); node.fw_cells = 2; expect_rejected(); + reset_j616c_26b123(ext); node.compat_cells = 4; expect_rejected(); + reset_j616c_26b123(ext); node.fw[1] = 0; expect_rejected(); + reset_j616c_26b123(ext); node.compat[1] = 0; expect_rejected(); + reset_j616c_26b123(ext); node.fw[2] = 1; node.compat[2] = 1; expect_rejected(); + } + + /* Desktop 26.5.2 and 26.6.2 remain DCP_FIRMWARE_V_26_6_DESKTOP on internal and external. */ + for (unsigned minor = 5; minor <= 6; minor++) { + for (unsigned ext = 0; ext < 2; ext++) { + reset_j616c_26b123(ext); + machine_board = "apple,j614c"; + node.uuid = "other"; + node.fw[0] = 26; node.fw[1] = minor; node.fw[2] = 2; + node.compat[0] = 26; node.compat[1] = minor; node.compat[2] = 2; + assert(!apple_t6041_j616c_dcp_v27_2(&node)); + assert(!apple_t6041_j616c_dcpext_v27_2(&node)); + assert(dcp_check_firmware_version(&dev) == DCP_FIRMWARE_V_26_6_DESKTOP); + } + } + puts("PASS J616c 26B123 v27.2 internal/external admission, refusal controls, and desktop 26.x preservation"); + return 0; +} +''' diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/run.py b/tools/testing/selftests/drivers/gpu/apple-dcp/run.py index 05a825197e978..1918958c334f6 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/run.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/run.py @@ -88,6 +88,7 @@ def main(): ('m4', 'm4-panel-timing', m4.timing, ((),), ('-Wno-unused-function', '-Wno-unused-const-variable')), ('boot', 'oslog-events', boot.oslog, ((),), ()), ('boot', 'syslog-policy', boot.syslog, ((),), ()), + ('boot', 't6041-v27-admission', boot.t6041_v27_admission, ((),), ()), ('edid', 'dpavserv-start', edid.startup, ((),), ()), ('edid', 'service-rebind', edid.rebind, ((),), ()), ('edid', 'provider-admission', edid.admission, ((),), ()), diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py b/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py index bcf5b0d3f1b0f..90005ca179a62 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py @@ -71,6 +71,7 @@ def check(name, unit, cases=((),), negative=False, flags=()): static bool dcp_typec_route_no_dp_alt(const struct apple_dcp_typec_route *route) { (void)route; return false; } struct apple_dcp; static bool dcp_is_t8132_ext(const struct apple_dcp *dcp) { (void)dcp; return false; } + static bool dcp_t6041_ext_v27(const struct apple_dcp *dcp) { (void)dcp; return false; } #define dcp_queue_typec_reconnect(dcp,delay) ((void)(dcp),(void)(delay)) #define dev_info_once(...) ((void)0) #define USB_TYPEC_DP_SID 0xff01