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
19 changes: 18 additions & 1 deletion drivers/gpu/drm/asahi/hw/t6041.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,33 @@ const CHIP: v25g83::Chip = v25g83::Chip {
cs_perf_table: false,
};

/// [`CHIP`] for 25G83: its hardware data has 0 at `+0x2610`.
/// [`CHIP`] for 25G83: its hardware data has 0 at `+0x2610`, and its power configuration keeps
/// the 25G83 starting values of the performance limiter ([`POWER_CONFIG_WORDS_25G83`]).
///
/// 25F84 runs with 1 there. On 25G83 the 40-core J614C then accepts work and marks it done,
/// but the GPU never runs it: no completion, no fault, every job times out. With 0, which is
/// also what the J616C's 25G83 contents have, compute and render work run.
const CHIP_25G83: v25g83::Chip = v25g83::Chip {
hw_data_words: HW_DATA_WORDS_25G83,
power_config_words: POWER_CONFIG_WORDS_25G83,
..CHIP
};

/// [`POWER_CONFIG_WORDS`] without its first three words, `+0x0 = 1`, `+0x44 = 0xc` and
/// `+0x9c = 338.0`.
///
/// They are state the firmware writes into its performance limiter while it runs (it sets
/// `+0x44` to 0xc itself, and `+0x9c` reaches 338.0 once the limit is at its floor), measured
/// from a running 25F84. Started with them, the 25G83 firmware lowers the limit at `+0x48`
/// (1000 at boot) on cold GPU power-ups and never raises it again: on the 40-core J575C it
/// reached 162 after 6,000 short Vulkan clients and the GPU ran at 46 % of its speed until a
/// reboot. With the 25G83 starting values (`+0x44 = 1`, as the M4 Pro and the J616C run),
/// the limit stays at 1000.
const POWER_CONFIG_WORDS_25G83: &[(usize, u32, usize)] = match POWER_CONFIG_WORDS {
[(0x0, 0x1, 1), (0x44, 0xc, 1), (0x9c, 0x43a9_0000, 1), rest @ ..] => rest,
_ => panic!("the first T6041 power configuration words must be +0x0, +0x44 and +0x9c"),
};

/// [`HW_DATA_WORDS`] without its last word, `+0x2610 = 1`.
const HW_DATA_WORDS_25G83: &[(usize, u32, usize)] = match HW_DATA_WORDS.split_last() {
Some((&(0x2610, 1, 1), rest)) => rest,
Expand Down
13 changes: 11 additions & 2 deletions tools/asahi/g17-t6041-initdata-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def item(source, start):
"const CHIP_25G83: ",
"const HW_DATA_WORDS: ",
"const HW_DATA_WORDS_25G83: ",
"const POWER_CONFIG_WORDS",
"const POWER_CONFIG_WORDS: ",
"const POWER_CONFIG_WORDS_25G83: ",
]

J616C_ITEMS = [
Expand Down Expand Up @@ -226,7 +227,15 @@ def aux(name, rows):
let (hw_g83, power_g83, region_g83) = build(t6041::CHIP_ID, &t6041::REGISTER_WINDOWS_25G83,
&[], &t6041::PERF, &T6041_OPPS, &T6041_AUX, &t6041::CHIP_25G83, &t6041::REGION_C, 40);
println!("T6041 25G83 initialization objects built");
assert_eq!(power_g83, power, "the register map changes only the hardware data");
// The power configuration keeps the 25G83 starting values of the performance limiter.
let word = |b: &[u8], at: usize| u32::from_le_bytes(b[at..at + 4].try_into().unwrap());
let changed = (0..power.len() / 4).map(|i| 4 * i)
.filter(|&at| word(&power, at) != word(&power_g83, at)).collect::<Vec<_>>();
assert_eq!(changed, [0x0, 0x44, 0x9c], "25G83 power configuration: only the limiter start");
assert_eq!([word(&power, 0x0), word(&power, 0x44), word(&power, 0x9c)], [1, 0xc, 0x43a9_0000],
"25F84 limiter state");
assert_eq!([word(&power_g83, 0x0), word(&power_g83, 0x44), word(&power_g83, 0x9c)], [0, 1, 0],
"25G83 limiter start");
assert_eq!(region_g83, region, "the register map changes only the hardware data");
let map = 0x640..0x640 + REGISTER_MAP_SLOTS * core::mem::size_of::<RegisterMapEntry>();
let outside = |a: &[u8], b: &[u8]| a.iter().zip(b).enumerate()
Expand Down