From 343a17b57b559af78422413335074007e10e7200 Mon Sep 17 00:00:00 2001 From: Ryan <81541646+RyanTheTide@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:09:52 +1100 Subject: [PATCH] drm/asahi: g17: read M4 Pro 25G83 pstate telemetry The M4 Pro (T6040) 25G83 firmware emits the same statistics records as the M4 Max (T6041) 25G83 build: performance state reports in tags 0x19 and 0x1b beside the 8 ms utilisation records (tag 0x13). It was left on Protocol::NONE only because it had not been measured, so pstate, the requested and achieved frequency and busy time read unsupported on the M4 Pro. Move PSTATE_8MS into V25G83 itself, drop the now redundant T6041 override, and keep 25F84 and 26B123 on NONE until measured. --- drivers/gpu/drm/asahi/g17/fw/variant.rs | 6 +++++- drivers/gpu/drm/asahi/g17/stats.rs | 7 +++---- drivers/gpu/drm/asahi/g17/telemetry.rs | 9 ++++----- drivers/gpu/drm/asahi/hw/t6041.rs | 3 --- drivers/gpu/drm/asahi/sysfs.c | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/asahi/g17/fw/variant.rs b/drivers/gpu/drm/asahi/g17/fw/variant.rs index 7d9267e30beaf..a013d6d561080 100644 --- a/drivers/gpu/drm/asahi/g17/fw/variant.rs +++ b/drivers/gpu/drm/asahi/g17/fw/variant.rs @@ -232,7 +232,9 @@ pub(crate) const V25G83: Variant = Variant { // 25G83 build since ec3ced95 and measured on the M4 Pro (J616s). render_id_at_create: true, objects_after_release: false, - telemetry_protocol: crate::g17::telemetry::Protocol::NONE, + // Pstate reports (tags 0x19/0x1b) and 8 ms timestamped utilisation records (tag 0x13), + // measured on T6040 (J616s) and T6041. + telemetry_protocol: crate::g17::telemetry::Protocol::PSTATE_8MS, }; /// The 26A428 firmware of the M5 GPUs, which runs the M5 protocol (the M5 graph, queues and @@ -265,6 +267,8 @@ pub(crate) const V25F84: Variant = Variant { // Not measured on 25F84 or on 26B123, which inherits this. render_stage_prefixes: false, render_id_at_create: false, + // Not measured on 25F84 or 26B123. + telemetry_protocol: crate::g17::telemetry::Protocol::NONE, ..V25G83 }; diff --git a/drivers/gpu/drm/asahi/g17/stats.rs b/drivers/gpu/drm/asahi/g17/stats.rs index 958d6815f236f..8711ae396ed37 100644 --- a/drivers/gpu/drm/asahi/g17/stats.rs +++ b/drivers/gpu/drm/asahi/g17/stats.rs @@ -121,10 +121,9 @@ pub(super) const fn max_age_ns(graph: InitGraph) -> u64 { /// Whether the firmware reports its performance state. V25G83 and V26A428 accept /// the logical pstate record (tag 0x10) but never emit it. V26A428 (A18 Pro and -/// M5) and T6041's 25G83 report the state in tags 0x19 and 0x1b instead -/// (`Variant::telemetry_protocol`); T6040's 25G83 is left on `Protocol::NONE` -/// because it has not been measured yet, so it is unsupported there. A firmware -/// that reports it reads valid or stale. +/// M5) and 25G83 (T6040, T6041) report the state in tags 0x19 and 0x1b instead +/// (`Variant::telemetry_protocol`). A firmware that reports it reads valid or +/// stale. pub(super) const fn reports_pstate(protocol: super::telemetry::Protocol) -> bool { protocol.reports_pstate() } diff --git a/drivers/gpu/drm/asahi/g17/telemetry.rs b/drivers/gpu/drm/asahi/g17/telemetry.rs index bb439ee4acc76..8c6c10ead6b3f 100644 --- a/drivers/gpu/drm/asahi/g17/telemetry.rs +++ b/drivers/gpu/drm/asahi/g17/telemetry.rs @@ -3,11 +3,10 @@ //! Qualified V25G83/V26A428 statistics, decoded from complete copied records. //! No record of these firmwares measures power or temperature. //! -//! The 26A428 firmware (the A18 Pro's, and the M5's) and T6041's 25G83 -//! firmware report the performance state the GPU runs at (tags 0x19 and 0x1b), -//! and their utilisation records carry their own timestamps, from which busy -//! time is integrated ([`Protocol`]). T6040's 25G83 is left on `Protocol::NONE` -//! because it has not been measured yet. +//! The 26A428 firmware (the A18 Pro's, and the M5's) and the 25G83 firmware +//! (T6040 and T6041) report the performance state the GPU runs at (tags 0x19 +//! and 0x1b), and their utilisation records carry their own timestamps, from +//! which busy time is integrated ([`Protocol`]). //! All state is protected by the device mutex. pub(super) const UNAVAILABLE: u32 = 0; diff --git a/drivers/gpu/drm/asahi/hw/t6041.rs b/drivers/gpu/drm/asahi/hw/t6041.rs index 00a721b71c8b3..77b7add87b118 100644 --- a/drivers/gpu/drm/asahi/hw/t6041.rs +++ b/drivers/gpu/drm/asahi/hw/t6041.rs @@ -205,11 +205,8 @@ pub(super) const BUILD_25G83: fw::variant::Build = fw::variant::Build { ], // 40-core T6041 parts (J614C, J575C) stay on TA mode 1 until clustered tiling is tested on // 40-core hardware; 32-core parts run [`BUILD_25G83_32CORE`] below. - // T6041's 25G83 firmware emits pstate reports (tags 0x19/0x1b) and 8 ms - // timestamped utilisation records (tag 0x13). variant: &fw::variant::Variant { ta_mode_1: true, - telemetry_protocol: crate::g17::telemetry::Protocol::PSTATE_8MS, ..fw::variant::V25G83 }, config: None, diff --git a/drivers/gpu/drm/asahi/sysfs.c b/drivers/gpu/drm/asahi/sysfs.c index 887c54c56545b..bf827d9d3fd5d 100644 --- a/drivers/gpu/drm/asahi/sysfs.c +++ b/drivers/gpu/drm/asahi/sysfs.c @@ -95,8 +95,8 @@ static ssize_t agx_qualified_stats_show(struct asahi_stats_attribute *stats, cha } /* * unsupported comes from the firmware match data (g17::stats): builds - * without a pstate telemetry protocol (such as T6040 25G83, left on - * Protocol::NONE pending measurement) have no qualified pstate support, + * without a pstate telemetry protocol (such as the unmeasured 25F84 and + * 26B123 G17 builds, on Protocol::NONE) have no qualified pstate support, * so it is not a transient state. * unavailable keeps meaning "no qualified sample yet". */