Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/tyr: gpu: fix GpuInfo::log model/version decoding

GpuInfo::log() was decoding GPU_ID like this:

major = (self.gpu_id >> 16) & 0xff;
minor = (self.gpu_id >> 8) & 0xff;
status = self.gpu_id & 0xff;

That does not match the Mali GPU_ID layout and mixes unrelated
fields. Due to that, model detection becomes `mali-unknown` on
rk3588s which is wrong.

We can already get all the version information with a single
GpuId::from call (less code and cleaner), so this patch uses it.

Also renamed `GpuModels` fields from `major/minor` to
`arch_major/prod_major` to reflect their real meaning.

This change was tested on Orange Pi 5 (rk3588s) board and the
results are as follows:

Before this change:

$ dmesg | grep 'tyr'
[ 19.698338] tyr fb000000.gpu: mali-unknown id 0xa867 major 0x67 minor 0x0 status 0x5
[ 19.699050] tyr fb000000.gpu: Features: L2:0x7120306 Tiler:0x809 Mem:0x301 MMU:0x2830 AS:0xff
[ 19.699817] tyr fb000000.gpu: shader_present=0x0000000000050005 l2_present=0x0000000000000001 tiler_present=0x0000000000000001
[ 19.702493] tyr fb000000.gpu: Tyr initialized correctly.

After this change:

$ dmesg | grep 'tyr'
[ 19.591692] tyr fb000000.gpu: mali-g610 id 0xa867 major 0x0 minor 0x0 status 0x5
[ 19.592374] tyr fb000000.gpu: Features: L2:0x7120306 Tiler:0x809 Mem:0x301 MMU:0x2830 AS:0xff
[ 19.593141] tyr fb000000.gpu: shader_present=0x0000000000050005 l2_present=0x0000000000000001 tiler_present=0x0000000000000001
[ 19.595831] tyr fb000000.gpu: Tyr initialized correctly.

Signed-off-by: Onur Özkan <work@onurozkan.dev>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Alvin Sun <sk.alvin.x@gmail.com>
Link: https://patch.msgid.link/20260210183812.261142-1-work@onurozkan.dev
Signed-off-by: Alice Ryhl <aliceryhl@google.com>

authored by

Onur Özkan and committed by
Alice Ryhl
289cf6f9 6de23f81

+9 -11
+9 -11
drivers/gpu/drm/tyr/gpu.rs
··· 84 84 } 85 85 86 86 pub(crate) fn log(&self, pdev: &platform::Device) { 87 - let major = (self.gpu_id >> 16) & 0xff; 88 - let minor = (self.gpu_id >> 8) & 0xff; 89 - let status = self.gpu_id & 0xff; 87 + let gpu_id = GpuId::from(self.gpu_id); 90 88 91 89 let model_name = if let Some(model) = GPU_MODELS 92 90 .iter() 93 - .find(|&f| f.major == major && f.minor == minor) 91 + .find(|&f| f.arch_major == gpu_id.arch_major && f.prod_major == gpu_id.prod_major) 94 92 { 95 93 model.name 96 94 } else { ··· 100 102 "mali-{} id 0x{:x} major 0x{:x} minor 0x{:x} status 0x{:x}", 101 103 model_name, 102 104 self.gpu_id >> 16, 103 - major, 104 - minor, 105 - status 105 + gpu_id.ver_major, 106 + gpu_id.ver_minor, 107 + gpu_id.ver_status 106 108 ); 107 109 108 110 dev_info!( ··· 164 166 165 167 struct GpuModels { 166 168 name: &'static str, 167 - major: u32, 168 - minor: u32, 169 + arch_major: u32, 170 + prod_major: u32, 169 171 } 170 172 171 173 const GPU_MODELS: [GpuModels; 1] = [GpuModels { 172 174 name: "g610", 173 - major: 10, 174 - minor: 7, 175 + arch_major: 10, 176 + prod_major: 7, 175 177 }]; 176 178 177 179 #[allow(dead_code)]