drm/panthor: Add initial Mali v15 support
Subsystems (6)
v5 cover drm/panthor: Add initial Mali v15 support
This series extracts the initial hardware support from the previously posted Mali v15 virtualization series. The remaining virtualization support will follow separately.
v5:
- Collect R-bs from Boris.
- Removed unused DT properties.
- Link to v4: https://lore.kernel.org/all/[email protected]/
v4:
- Collect R-bs from Liviu and Boris
- Squashed 64-bit GPU_ID decoding [PATCH v3 05/10] into v15 enablement [PATCH v3 09/10].
- Defined devfreq_disabled flag panthor_soc_data to disable devfreq
if it is set.
- Link to v3: https://lore.kernel.org/all/[email protected]/
v3:
- Split out the initial Mali v15 support into a standalone series,
leaving virtualization and arbitration support for a follow-up.
- Rebased on drm-misc-next (fb191ef626555)
- Drop the $nodename constraint from the AM GPU binding.
- Require the arm,zena-css-mali integration compatible followed by
the arm,mali-gen5-am fallback.
- Update the binding example to use the new compatible, three-cell interrupt specifiers, and a single GPU clock.
- Omit drm-maxfreq-panthor from fdinfo when the maximum frequency
is unknown, as on AM systems without an OPP table.
- Fix the missing blank line after declarations in GPU_ID decoding.
- Link to v2: https://lore.kernel.org/all/[email protected]/
Kind regards,
Karunika
Karunika Choo (9):
drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup drm/panthor: Rename neural accelerator feature macro to NX drm/panthor: Move register access helpers out of panthor_device.h drm/panthor: Parse and store GPU_ID fields
drm/panthor: Move register base offsets to the HW description drm/panthor: Derive MMU AS register addresses from base and stride drm/panthor: Skip devfreq when explicitly disabled
dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema drm/panthor: Add Mali v15 hardware support
.../bindings/gpu/arm,mali-gen5-am.yaml | 63 ++++++ MAINTAINERS | 1 + drivers/gpu/drm/panthor/panthor_devfreq.c | 9 +- drivers/gpu/drm/panthor/panthor_device.h | 105 +++------ drivers/gpu/drm/panthor/panthor_device_io.h | 84 ++++++++ drivers/gpu/drm/panthor/panthor_drv.c | 14 +- drivers/gpu/drm/panthor/panthor_fw.c | 7 +- drivers/gpu/drm/panthor/panthor_fw_regs.h | 2 - drivers/gpu/drm/panthor/panthor_gpu.c | 9 +- .../drm/panthor/panthor_gpu_discover_regs.h | 42 ++++ drivers/gpu/drm/panthor/panthor_gpu_regs.h | 4 +- drivers/gpu/drm/panthor/panthor_heap.c | 3 +- drivers/gpu/drm/panthor/panthor_hw.c | 202 ++++++++++++++++-- drivers/gpu/drm/panthor/panthor_hw.h | 61 +++++- drivers/gpu/drm/panthor/panthor_mmu.c | 47 ++-- drivers/gpu/drm/panthor/panthor_mmu_regs.h | 23 +- drivers/gpu/drm/panthor/panthor_pwr.c | 2 +- drivers/gpu/drm/panthor/panthor_pwr_regs.h | 2 - include/uapi/drm/panthor_drm.h | 23 +- 19 files changed, 554 insertions(+), 149 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml create mode 100644 drivers/gpu/drm/panthor/panthor_device_io.h create mode 100644 drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
--
2.43.0
PATCH v5 1/9 drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup
When CONFIG_NVMEM is disabled, reading the optional "shader-present" nvmem cell can return -EOPNOTSUPP.
Treat this the same as the cell being absent so panthor can continue probing on platforms that do not provide shader-present fuses through nvmem.
---
v2:
- Picked up R-b from Liviu
v1:
- Picked up R-bs from Boris and Steve
- Added Fixes tag
drivers/gpu/drm/panthor/panthor_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_hw.c +1 -1
@@ -182,7 +182,7 @@ static int overload_shader_present(struct panthor_device *ptdev) &contents);if (!ret) ptdev->gpu_info.shader_present = contents; -else if (ret == -ENOENT ) +else if (ret == -ENOENT || ret == -EOPNOTSUPP )return 0 ;else return dev_err_probe(ptdev->base.dev, ret,
Signature · 1 line
2.43.0
PATCH v5 2/9 drm/panthor: Rename neural accelerator feature macro to NX
In reply to Karunika ChooRename GPU_FEATURES_NEURAL_ENGINE to GPU_FEATURES_NX. Update the panthor_hw helper to use the new name.
---
v4:
- Collect R-bs from Liviu and Boris
drivers/gpu/drm/panthor/panthor_gpu_regs.h | 2 +- drivers/gpu/drm/panthor/panthor_hw.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panthor/panthor_gpu_regs.h +1 -1
@@ -67,7 +67,7 @@#define GPU_FEATURES 0x60#define GPU_FEATURES_RAY_INTERSECTION BIT(2) -#define GPU_FEATURES_NEURAL_ENGINE BIT(4) +#define GPU_FEATURES_NX BIT(4)#define GPU_FEATURES_RAY_TRAVERSAL BIT(5)#define GPU_TIMESTAMP_OFFSET 0x88
drivers/gpu/drm/panthor/panthor_hw.h +1 -1
@@ -64,7 +64,7 @@ static inline bool panthor_hw_has_pwr_ctrl(struct panthor_device *ptdev)static inline bool panthor_hw_has_neural (struct panthor_device *ptdev) {return (GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) >=14 && - ptdev->gpu_info.gpu_features &GPU_FEATURES_NEURAL_ENGINE ); + ptdev->gpu_info.gpu_features &GPU_FEATURES_NX ); }#endif /* __PANTHOR_HW_H__ */
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v5 2/9] drm/panthor: Rename neural accelerator feature macro to NX
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/panthor: commit message does not explain why GPU_FEATURES_NX is renamed --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/panthor: commit message does not explain why GPU_FEATURES_NX is renamed
--
commit ce6e22c794606bedaa1915cc0ee7c58ac972744b
Author: Karunika Choo <[email protected]>
Quoted 8 lines
drm/panthor: Rename neural accelerator feature macro to NX
Rename
GPU_FEATURES_NEURAL_ENGINEtoGPU_FEATURES_NX. Update thepanthor_hwhelper to use the new name.Reviewed-by Boris Brezillon <[email protected]>Reviewed-by Liviu Dudau <[email protected]>Signed-off-by Karunika Choo <[email protected]>
[Severity: Low]
This isn't a bug, but the commit message only restates the rename without explaining why GPU_FEATURES_NEURAL_ENGINE is renamed to GPU_FEATURES_NX while panthor_hw_has_neural() keeps its existing name.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v5 2/9] drm/panthor: Rename neural accelerator feature macro to NX
In reply to Karunika ChooQuoted 2 lines · Karunika Choo
Rename
GPU_FEATURES_NEURAL_ENGINEtoGPU_FEATURES_NX. Update thepanthor_hwhelper to use the new name.
NIT: It would be good to explain why, i.e. that Arm now refers to this block as a "Neural Accelerator" (abbreviated to NX) rather than a neural engine. So we're updating to match the newer specs.
Quoted 3 lines
Reviewed-by Boris Brezillon <[email protected]>Reviewed-by Liviu Dudau <[email protected]>Signed-off-by Karunika Choo <[email protected]>
Quoted 34 lines
---
v4:
- Collect R-bs from Liviu and Borisdrivers/gpu/drm/panthor/panthor_gpu_regs.h | 2 +- drivers/gpu/drm/panthor/panthor_hw.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/panthor/panthor_gpu_regs.h +1
-1@@ -67,7 +67,7 @@#define GPU_FEATURES 0x60#define GPU_FEATURES_RAY_INTERSECTION BIT(2) -#define GPU_FEATURES_NEURAL_ENGINE BIT(4) +#define GPU_FEATURES_NX BIT(4)#define GPU_FEATURES_RAY_TRAVERSAL BIT(5)#define GPU_TIMESTAMP_OFFSET 0x88drivers/gpu/drm/panthor/panthor_hw.h +1
-1@@ -64,7 +64,7 @@ static inline bool panthor_hw_has_pwr_ctrl(struct panthor_device *ptdev)static inline bool panthor_hw_has_neural (struct panthor_device *ptdev) {return (GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) >=14 && - ptdev->gpu_info.gpu_features &GPU_FEATURES_NEURAL_ENGINE ); + ptdev->gpu_info.gpu_features &GPU_FEATURES_NX ); }#endif /* __PANTHOR_HW_H__ */
PATCH v5 3/9 drm/panthor: Move register access helpers out of panthor_device.h
In reply to Karunika ChooMove register access helpers out of panthor_device.h to allow reuse by other panthor drivers that will be added to enable v15 support.
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Fix includes raised by sashiko
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- Includes "panthor_device_io.h" directly in "panthor_device.h" instead of peppering multiple files with the header.
drivers/gpu/drm/panthor/panthor_device.h | 73 +----------------- drivers/gpu/drm/panthor/panthor_device_io.h | 84 +++++++++++++++++++++ 2 files changed, 86 insertions(+), 71 deletions(-) create mode 100644 drivers/gpu/drm/panthor/panthor_device_io.h
drivers/gpu/drm/panthor/panthor_device.h +2 -71
@@ -19,6 +19,8 @@#include <drm/gpu_scheduler.h> #include <drm/panthor_drm.h> +#include "panthor_device_io.h" +struct panthor_csf ;struct panthor_csf_ctx ;struct panthor_device ;
@@ -495,77 +497,6 @@ panthor_exception_is_fault(u32 exception_code)const char *panthor_exception_name (struct panthor_device *ptdev,u32 exception_code); -static inline void gpu_write (void __iomem *iomem,u32 reg,u32 data) -{ -writel (data, iomem + reg); -} - -static inline u32 gpu_read (void __iomem *iomem,u32 reg) -{ -return readl (iomem + reg); -} - -static inline u32 gpu_read_relaxed (void __iomem *iomem,u32 reg) -{ -return readl_relaxed (iomem + reg); -} - -static inline void gpu_write64 (void __iomem *iomem,u32 reg,u64 data) -{ -gpu_write (iomem, reg,lower_32_bits (data)); -gpu_write (iomem, reg +4 ,upper_32_bits (data)); -} - -static inline u64 gpu_read64 (void __iomem *iomem,u32 reg) -{ -return (gpu_read (iomem, reg) | ((u64 )gpu_read (iomem, reg +4 ) <<32 )); -} - -static inline u64 gpu_read64_relaxed (void __iomem *iomem,u32 reg) -{ -return (gpu_read_relaxed (iomem, reg) | - ((u64 )gpu_read_relaxed (iomem, reg +4 ) <<32 )); -} - -static inline u64 gpu_read64_counter (void __iomem *iomem,u32 reg) -{ -u32 lo, hi1, hi2; -do { - hi1 =gpu_read (iomem, reg +4 ); - lo =gpu_read (iomem, reg); - hi2 =gpu_read (iomem, reg +4 ); - }while (hi1 != hi2); -return lo | ((u64 )hi2 <<32 ); -} - -#define gpu_read_poll_timeout (iomem, reg, val, cond, delay_us, timeout_us) \ - read_poll_timeout(gpu_read, val, cond, delay_us, timeout_us, false, \ - iomem, reg) - -#define gpu_read_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout_atomic(gpu_read, val, cond, delay_us, timeout_us, \ - false, iomem, reg) - -#define gpu_read64_poll_timeout (iomem, reg, val, cond, delay_us, timeout_us) \ - read_poll_timeout(gpu_read64, val, cond, delay_us, timeout_us, false, \ - iomem, reg) - -#define gpu_read64_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout_atomic(gpu_read64, val, cond, delay_us, timeout_us, \ - false, iomem, reg) - -#define gpu_read_relaxed_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout_atomic(gpu_read_relaxed, val, cond, delay_us, \ - timeout_us, false, iomem, reg) - -#define gpu_read64_relaxed_poll_timeout (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout(gpu_read64_relaxed, val, cond, delay_us, timeout_us, \ - false, iomem, reg) -#define INT_RAWSTAT 0x0#define INT_CLEAR 0x4#define INT_MASK 0x8
drivers/gpu/drm/panthor/panthor_device_io.h new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v5 3/9] drm/panthor: Move register access helpers out of panthor_device.h
Quoted 6 lines · Karunika Choo
Move register access helpers out of
panthor_device.hto allow reuse by other panthor drivers that will be added to enable v15 support.Reviewed-by Boris Brezillon <[email protected]>Reviewed-by Liviu Dudau <[email protected]>Signed-off-by Karunika Choo <[email protected]>
Quoted 197 lines
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Fix includes raised by sashiko
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- Includes "panthor_device_io.h" directly in "panthor_device.h" instead of peppering multiple files with the header.drivers/gpu/drm/panthor/panthor_device.h | 73 +----------------- drivers/gpu/drm/panthor/panthor_device_io.h | 84 +++++++++++++++++++++ 2 files changed, 86 insertions(+), 71 deletions(-) create mode 100644 drivers/gpu/drm/panthor/panthor_device_io.hdrivers/gpu/drm/panthor/panthor_device.h +2
-71@@ -19,6 +19,8 @@#include <drm/gpu_scheduler.h> #include <drm/panthor_drm.h> +#include "panthor_device_io.h" +struct panthor_csf ;struct panthor_csf_ctx ;struct panthor_device ;@@ -495,77 +497,6 @@ panthor_exception_is_fault(u32 exception_code)const char *panthor_exception_name (struct panthor_device *ptdev,u32 exception_code); -static inline void gpu_write (void __iomem *iomem,u32 reg,u32 data) -{ -writel (data, iomem + reg); -} - -static inline u32 gpu_read (void __iomem *iomem,u32 reg) -{ -return readl (iomem + reg); -} - -static inline u32 gpu_read_relaxed (void __iomem *iomem,u32 reg) -{ -return readl_relaxed (iomem + reg); -} - -static inline void gpu_write64 (void __iomem *iomem,u32 reg,u64 data) -{ -gpu_write (iomem, reg,lower_32_bits (data)); -gpu_write (iomem, reg +4 ,upper_32_bits (data)); -} - -static inline u64 gpu_read64 (void __iomem *iomem,u32 reg) -{ -return (gpu_read (iomem, reg) | ((u64 )gpu_read (iomem, reg +4 ) <<32 )); -} - -static inline u64 gpu_read64_relaxed (void __iomem *iomem,u32 reg) -{ -return (gpu_read_relaxed (iomem, reg) | - ((u64 )gpu_read_relaxed (iomem, reg +4 ) <<32 )); -} - -static inline u64 gpu_read64_counter (void __iomem *iomem,u32 reg) -{ -u32 lo, hi1, hi2; -do { - hi1 =gpu_read (iomem, reg +4 ); - lo =gpu_read (iomem, reg); - hi2 =gpu_read (iomem, reg +4 ); - }while (hi1 != hi2); -return lo | ((u64 )hi2 <<32 ); -} - -#define gpu_read_poll_timeout (iomem, reg, val, cond, delay_us, timeout_us) \ - read_poll_timeout(gpu_read, val, cond, delay_us, timeout_us, false, \ - iomem, reg) - -#define gpu_read_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout_atomic(gpu_read, val, cond, delay_us, timeout_us, \ - false, iomem, reg) - -#define gpu_read64_poll_timeout (iomem, reg, val, cond, delay_us, timeout_us) \ - read_poll_timeout(gpu_read64, val, cond, delay_us, timeout_us, false, \ - iomem, reg) - -#define gpu_read64_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout_atomic(gpu_read64, val, cond, delay_us, timeout_us, \ - false, iomem, reg) - -#define gpu_read_relaxed_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout_atomic(gpu_read_relaxed, val, cond, delay_us, \ - timeout_us, false, iomem, reg) - -#define gpu_read64_relaxed_poll_timeout (iomem, reg, val, cond, delay_us, \ - timeout_us) \ - read_poll_timeout(gpu_read64_relaxed, val, cond, delay_us, timeout_us, \ - false, iomem, reg) -#define INT_RAWSTAT 0x0#define INT_CLEAR 0x4#define INT_MASK 0x8drivers/gpu/drm/panthor/panthor_device_io.h new file +84
-0@@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0 or MIT */ +/* Copyright 2026 ARM Limited. All rights reserved. */ + +#ifndef __PANTHOR_DEVICE_IO_H__ +#define __PANTHOR_DEVICE_IO_H__ + +#include <linux/io.h> +#include <linux/iopoll.h> +#include <linux/wordpart.h> + +static inline void gpu_write (void __iomem *iomem,u32 reg,u32 data) +{ +writel (data, iomem + reg); +} + +static inline u32 gpu_read (void __iomem *iomem,u32 reg) +{ +return readl (iomem + reg); +} + +static inline u32 gpu_read_relaxed (void __iomem *iomem,u32 reg) +{ +return readl_relaxed (iomem + reg); +} + +static inline void gpu_write64 (void __iomem *iomem,u32 reg,u64 data) +{ +gpu_write (iomem, reg,lower_32_bits (data)); +gpu_write (iomem, reg +4 ,upper_32_bits (data)); +} + +static inline u64 gpu_read64 (void __iomem *iomem,u32 reg) +{ +return (gpu_read (iomem, reg) | ((u64 )gpu_read (iomem, reg +4 ) <<32 )); +} + +static inline u64 gpu_read64_relaxed (void __iomem *iomem,u32 reg) +{ +return (gpu_read_relaxed (iomem, reg) | + ((u64 )gpu_read_relaxed (iomem, reg +4 ) <<32 )); +} + +static inline u64 gpu_read64_counter (void __iomem *iomem,u32 reg) +{ +u32 lo, hi1, hi2; + +do { + hi1 =gpu_read (iomem, reg +4 ); + lo =gpu_read (iomem, reg); + hi2 =gpu_read (iomem, reg +4 ); + }while (hi1 != hi2); +return lo | ((u64 )hi2 <<32 ); +} + +#define gpu_read_poll_timeout (iomem, reg, val, cond, delay_us, timeout_us) \ + read_poll_timeout(gpu_read, val, cond, delay_us, timeout_us, false, \ + iomem, reg) + +#define gpu_read_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ + timeout_us) \ + read_poll_timeout_atomic(gpu_read, val, cond, delay_us, timeout_us, \ + false, iomem, reg) + +#define gpu_read64_poll_timeout (iomem, reg, val, cond, delay_us, timeout_us) \ + read_poll_timeout(gpu_read64, val, cond, delay_us, timeout_us, false, \ + iomem, reg) + +#define gpu_read64_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ + timeout_us) \ + read_poll_timeout_atomic(gpu_read64, val, cond, delay_us, timeout_us, \ + false, iomem, reg) + +#define gpu_read_relaxed_poll_timeout_atomic (iomem, reg, val, cond, delay_us, \ + timeout_us) \ + read_poll_timeout_atomic(gpu_read_relaxed, val, cond, delay_us, \ + timeout_us, false, iomem, reg) + +#define gpu_read64_relaxed_poll_timeout (iomem, reg, val, cond, delay_us, \ + timeout_us) \ + read_poll_timeout(gpu_read64_relaxed, val, cond, delay_us, timeout_us, \ + false, iomem, reg) + + +#endif /* __PANTHOR_DEVICE_IO_H__ */
PATCH v5 4/9 drm/panthor: Parse and store GPU_ID fields
In reply to Karunika ChooPrepare for Mali v15, where GPU_ID expands to 64 bits and its field layout changes.
Introduce a small panthor_gpu_id structure and parse the GPU_ID fields once during hardware initialization. Convert existing users to consume the cached fields instead of extracting them repeatedly from the raw register value.
This centralizes GPU_ID decoding and makes it easier to support both the existing and v15 formats.
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Avoid modifying the printed id field for existing GPUs.
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- changed struct panthor_gpu_id into a flat structure instead of inconsistent groupings.
drivers/gpu/drm/panthor/panthor_device.h | 29 ++++++++++++++++++++++++ drivers/gpu/drm/panthor/panthor_fw.c | 4 ++-- drivers/gpu/drm/panthor/panthor_gpu.c | 2 +- drivers/gpu/drm/panthor/panthor_hw.c | 24 ++++++++++++++------ drivers/gpu/drm/panthor/panthor_hw.h | 4 ++-- 5 files changed, 51 insertions(+), 12 deletions(-)
drivers/gpu/drm/panthor/panthor_device.h +29 -0
@@ -111,6 +111,32 @@ struct panthor_irq {enum panthor_irq_state state; }; +/** +* struct panthor_gpu_id - Parsed GPU_ID fields +*/ +struct panthor_gpu_id { +/** @arch_major: Architecture major revision */ +u8 arch_major; + +/** @arch_minor: Architecture minor revision */ +u8 arch_minor; + +/** @arch_rev: Architecture patch revision */ +u8 arch_rev; + +/** @prod_major: Product identifier */ +u8 prod_major; + +/** @ver_major: Major release version number */ +u8 ver_major; + +/** @ver_minor: Minor release version number */ +u8 ver_minor; + +/** @ver_status: Status of GPU release */ +u8 ver_status; +}; +/** * enum panthor_device_profiling_mode - Profiling state */
@@ -170,6 +196,9 @@ struct panthor_device {/** @mmu_info: MMU info */ struct drm_panthor_mmu_info mmu_info; +/** @gpu_id: Parsed GPU_ID fields */ +struct panthor_gpu_id gpu_id; +/** @hw: GPU-specific data. */ struct panthor_hw *hw;
drivers/gpu/drm/panthor/panthor_fw.c +2 -2
@@ -809,8 +809,8 @@ static int panthor_fw_load(struct panthor_device *ptdev)int ret;snprintf (fw_path,sizeof (fw_path),"arm/mali/arch%d.%d/%s" , - (u32 )GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id), - (u32 )GPU_ARCH_MINOR (ptdev->gpu_info.gpu_id), + (u32 )ptdev->gpu_id.arch_major, + (u32 )ptdev->gpu_id.arch_minor,CSF_FW_NAME ); ret =request_firmware (&fw, fw_path, ptdev->base.dev);
drivers/gpu/drm/panthor/panthor_gpu.c +1 -1
@@ -74,7 +74,7 @@ static void panthor_gpu_l2_config_set(struct panthor_device *ptdev)if (!data || !data->asn_hash_enable)return ; -if (GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) <11 ) { +if (ptdev->gpu_id.arch_major <11 ) {drm_err (&ptdev->base,"Custom ASN hash not supported by the device" );return ; }
drivers/gpu/drm/panthor/panthor_hw.c +17 -7
@@ -119,9 +119,9 @@ void panthor_hw_power_status_unregister(void)static char *get_gpu_model_name (struct panthor_device *ptdev) { -const u32 gpu_id = ptdev->gpu_info.gpu_id; -const u32 product_id =GPU_PROD_ID_MAKE (GPU_ARCH_MAJOR (gpu_id), -GPU_PROD_MAJOR (gpu_id)); +const struct panthor_gpu_id *gpu_id = &ptdev->gpu_id; +const u32 product_id =GPU_PROD_ID_MAKE (gpu_id->arch_major, + gpu_id->prod_major);const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &GPU_FEATURES_RAY_INTERSECTION );const u8 shader_core_count =hweight64 (ptdev->gpu_info.shader_present);
@@ -245,9 +245,9 @@ static int panthor_hw_info_init(struct panthor_device *ptdev)if (ret)return ret; - major =GPU_VER_MAJOR (ptdev->gpu_info.gpu_id); - minor =GPU_VER_MINOR (ptdev->gpu_info.gpu_id); - status =GPU_VER_STATUS (ptdev->gpu_info.gpu_id); + major = ptdev->gpu_id.ver_major; + minor = ptdev->gpu_id.ver_minor; + status = ptdev->gpu_id.ver_status; drm_info(&ptdev->base, "%s id 0x%x major 0x%x minor 0x%x status 0x%x",
@@ -273,7 +273,7 @@ static int panthor_hw_info_init(struct panthor_device *ptdev)static int panthor_hw_bind_device (struct panthor_device *ptdev) {struct panthor_hw *hdev =NULL ; -const u32 arch_major =GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id); +const u32 arch_major = ptdev->gpu_id.arch_major;int i =0 ;for (i =0 ; i <ARRAY_SIZE (panthor_hw_match); i++) {
@@ -295,10 +295,20 @@ static int panthor_hw_bind_device(struct panthor_device *ptdev)static int panthor_hw_gpu_id_init (struct panthor_device *ptdev) { +struct panthor_gpu_id *gpu_id = &ptdev->gpu_id; ptdev->gpu_info.gpu_id =gpu_read (ptdev->iomem,GPU_ID ); +if (!ptdev->gpu_info.gpu_id)return -ENXIO ; + gpu_id->arch_major =GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id); + gpu_id->arch_minor =GPU_ARCH_MINOR (ptdev->gpu_info.gpu_id); + gpu_id->arch_rev =GPU_ARCH_REV (ptdev->gpu_info.gpu_id); + gpu_id->prod_major =GPU_PROD_MAJOR (ptdev->gpu_info.gpu_id); + gpu_id->ver_major =GPU_VER_MAJOR (ptdev->gpu_info.gpu_id); + gpu_id->ver_minor =GPU_VER_MINOR (ptdev->gpu_info.gpu_id); + gpu_id->ver_status =GPU_VER_STATUS (ptdev->gpu_info.gpu_id); +return 0 ; }
drivers/gpu/drm/panthor/panthor_hw.h +2 -2
@@ -58,12 +58,12 @@ static inline void panthor_hw_l2_power_off(struct panthor_device *ptdev)static inline bool panthor_hw_has_pwr_ctrl (struct panthor_device *ptdev) { -return GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) >=14 ; +return ptdev->gpu_id.arch_major >=14 ; }static inline bool panthor_hw_has_neural (struct panthor_device *ptdev) { -return (GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) >=14 && +return (ptdev->gpu_id.arch_major >=14 && ptdev->gpu_info.gpu_features &GPU_FEATURES_NX ); }
Signature · 1 line
2.43.0
Re: [PATCH v5 4/9] drm/panthor: Parse and store GPU_ID fields
Quoted 8 lines · Karunika Choo
Prepare for Mali v15, where
GPU_IDexpands to 64 bits and its field layout changes.Introduce a small
panthor_gpu_idstructure and parse theGPU_IDfields once during hardware initialization. Convert existing users to consume the cached fields instead of extracting them repeatedly from the raw register value.
Quoted 6 lines
This centralizes
GPU_IDdecoding and makes it easier to support both the existing and v15 formats.Reviewed-by Boris Brezillon <[email protected]>Reviewed-by Liviu Dudau <[email protected]>Signed-off-by Karunika Choo <[email protected]>
One nit below, but otherwise
Quoted 133 lines
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Avoid modifying the printed id field for existing GPUs.
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- changed structpanthor_gpu_idinto a flat structure instead of inconsistent groupings.drivers/gpu/drm/panthor/panthor_device.h | 29 ++++++++++++++++++++++++ drivers/gpu/drm/panthor/panthor_fw.c | 4 ++-- drivers/gpu/drm/panthor/panthor_gpu.c | 2 +- drivers/gpu/drm/panthor/panthor_hw.c | 24 ++++++++++++++------ drivers/gpu/drm/panthor/panthor_hw.h | 4 ++-- 5 files changed, 51 insertions(+), 12 deletions(-)drivers/gpu/drm/panthor/panthor_device.h +29
-0@@ -111,6 +111,32 @@ struct panthor_irq {enum panthor_irq_state state; }; +/** +* struct panthor_gpu_id - Parsed GPU_ID fields +*/ +struct panthor_gpu_id { +/** @arch_major: Architecture major revision */ +u8 arch_major; + +/** @arch_minor: Architecture minor revision */ +u8 arch_minor; + +/** @arch_rev: Architecture patch revision */ +u8 arch_rev; + +/** @prod_major: Product identifier */ +u8 prod_major; + +/** @ver_major: Major release version number */ +u8 ver_major; + +/** @ver_minor: Minor release version number */ +u8 ver_minor; + +/** @ver_status: Status of GPU release */ +u8 ver_status; +}; +/** * enum panthor_device_profiling_mode - Profiling state */ @@ -170,6 +196,9 @@ struct panthor_device {/** @mmu_info: MMU info */ struct drm_panthor_mmu_info mmu_info; +/** @gpu_id: Parsed GPU_ID fields */ +struct panthor_gpu_id gpu_id; +/** @hw: GPU-specific data. */ struct panthor_hw *hw;drivers/gpu/drm/panthor/panthor_fw.c +2
-2@@ -809,8 +809,8 @@ static int panthor_fw_load(struct panthor_device *ptdev)int ret;snprintf (fw_path,sizeof (fw_path),"arm/mali/arch%d.%d/%s" , - (u32 )GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id), - (u32 )GPU_ARCH_MINOR (ptdev->gpu_info.gpu_id), + (u32 )ptdev->gpu_id.arch_major, + (u32 )ptdev->gpu_id.arch_minor,CSF_FW_NAME ); ret =request_firmware (&fw, fw_path, ptdev->base.dev);drivers/gpu/drm/panthor/panthor_gpu.c +1
-1@@ -74,7 +74,7 @@ static void panthor_gpu_l2_config_set(struct panthor_device *ptdev)if (!data || !data->asn_hash_enable)return ; -if (GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) <11 ) { +if (ptdev->gpu_id.arch_major <11 ) {drm_err (&ptdev->base,"Custom ASN hash not supported by the device" );return ; }drivers/gpu/drm/panthor/panthor_hw.c +7
-7@@ -119,9 +119,9 @@ void panthor_hw_power_status_unregister(void)static char *get_gpu_model_name (struct panthor_device *ptdev) { -const u32 gpu_id = ptdev->gpu_info.gpu_id; -const u32 product_id =GPU_PROD_ID_MAKE (GPU_ARCH_MAJOR (gpu_id), -GPU_PROD_MAJOR (gpu_id)); +const struct panthor_gpu_id *gpu_id = &ptdev->gpu_id; +const u32 product_id =GPU_PROD_ID_MAKE (gpu_id->arch_major, + gpu_id->prod_major);const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &GPU_FEATURES_RAY_INTERSECTION );const u8 shader_core_count =hweight64 (ptdev->gpu_info.shader_present);@@ -245,9 +245,9 @@ static int panthor_hw_info_init(struct panthor_device *ptdev)if (ret)return ret; - major =GPU_VER_MAJOR (ptdev->gpu_info.gpu_id); - minor =GPU_VER_MINOR (ptdev->gpu_info.gpu_id); - status =GPU_VER_STATUS (ptdev->gpu_info.gpu_id); + major = ptdev->gpu_id.ver_major; + minor = ptdev->gpu_id.ver_minor; + status = ptdev->gpu_id.ver_status; drm_info(&ptdev->base, "%s id 0x%x major 0x%x minor 0x%x status 0x%x",@@ -273,7 +273,7 @@ static int panthor_hw_info_init(struct panthor_device *ptdev)static int panthor_hw_bind_device (struct panthor_device *ptdev) {struct panthor_hw *hdev =NULL ; -const u32 arch_major =GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id); +const u32 arch_major = ptdev->gpu_id.arch_major;int i =0 ;for (i =0 ; i <ARRAY_SIZE (panthor_hw_match); i++) {
drivers/gpu/drm/panthor/panthor_hw.c static int panthor_hw_bind_device(struct panthor_device *ptdev) · line 300
Quoted 6 lines
drivers/gpu/drm/panthor/panthor_hw.c +2
-0@@ -295,10 +295,20 @@ static int panthor_hw_bind_device(struct panthor_device *ptdev)static int panthor_hw_gpu_id_init (struct panthor_device *ptdev) { +struct panthor_gpu_id *gpu_id = &ptdev->gpu_id; ptdev->gpu_info.gpu_id =gpu_read (ptdev->iomem,GPU_ID ); +
NIT: Blank line in the wrong place - it should be after the declarations
- i.e. after gpu_id is defined, not after the (non declaration) assignment.
You might also want to consider using a compound literal assignment here instead and a local variable for the ID, e.g.:
ptdev->gpu_id = (struct panthor_gpu_id){
.arch_major = GPU_ARCH_MAJOR(gpu_id32),
.arch_minor = GPU_ARCH_MINOR(gpu_id32),
/* ... */
};Thanks,
Steve
Quoted 33 lines
drivers/gpu/drm/panthor/panthor_hw.c +8
-0if (!ptdev->gpu_info.gpu_id)return -ENXIO ; + gpu_id->arch_major =GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id); + gpu_id->arch_minor =GPU_ARCH_MINOR (ptdev->gpu_info.gpu_id); + gpu_id->arch_rev =GPU_ARCH_REV (ptdev->gpu_info.gpu_id); + gpu_id->prod_major =GPU_PROD_MAJOR (ptdev->gpu_info.gpu_id); + gpu_id->ver_major =GPU_VER_MAJOR (ptdev->gpu_info.gpu_id); + gpu_id->ver_minor =GPU_VER_MINOR (ptdev->gpu_info.gpu_id); + gpu_id->ver_status =GPU_VER_STATUS (ptdev->gpu_info.gpu_id); +return 0 ; }drivers/gpu/drm/panthor/panthor_hw.h +2
-2@@ -58,12 +58,12 @@ static inline void panthor_hw_l2_power_off(struct panthor_device *ptdev)static inline bool panthor_hw_has_pwr_ctrl (struct panthor_device *ptdev) { -return GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) >=14 ; +return ptdev->gpu_id.arch_major >=14 ; }static inline bool panthor_hw_has_neural (struct panthor_device *ptdev) { -return (GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id) >=14 && +return (ptdev->gpu_id.arch_major >=14 && ptdev->gpu_info.gpu_features &GPU_FEATURES_NX ); }
PATCH v5 5/9 drm/panthor: Move register base offsets to the HW description
In reply to Karunika ChooMali v15 reorders several register regions, including GPU_CONTROL, MCU_CONTROL and PWR_CONTROL, so the driver can no longer assume a single fixed base layout across all supported GPUs.
Add per-GPU register base offsets to the panthor hardware description and switch the GPU, FW and PWR local iomem setup to use those stored values. With the base addresses now owned by the hardware description, drop the corresponding fixed base-offset definitions from the register headers.
This prepares the driver for GPUs with different register layouts without changing the existing behaviour on currently supported parts.
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
v1:
- rebased on drm-misc-next
- use a generic panthor_hw_regbank structure for all register offsets.
drivers/gpu/drm/panthor/panthor_fw.c | 2 +- drivers/gpu/drm/panthor/panthor_fw_regs.h | 2 -- drivers/gpu/drm/panthor/panthor_gpu.c | 4 +-- drivers/gpu/drm/panthor/panthor_gpu_regs.h | 2 -- drivers/gpu/drm/panthor/panthor_hw.c | 23 +++++++++++++++-- drivers/gpu/drm/panthor/panthor_hw.h | 29 ++++++++++++++++++++-- drivers/gpu/drm/panthor/panthor_pwr.c | 2 +- drivers/gpu/drm/panthor/panthor_pwr_regs.h | 2 -- 8 files changed, 52 insertions(+), 14 deletions(-)
drivers/gpu/drm/panthor/panthor_fw.c +1 -1
@@ -1500,7 +1500,7 @@ int panthor_fw_init(struct panthor_device *ptdev)if (!fw)return -ENOMEM ; - fw->iomem = ptdev->iomem +MCU_CONTROL_BASE ; + fw->iomem = ptdev->iomem + ptdev->hw->regs.mcu_control.offset; ptdev->fw = fw;init_waitqueue_head (&fw->req_waitqueue);INIT_LIST_HEAD (&fw->sections);
drivers/gpu/drm/panthor/panthor_fw_regs.h +0 -2
@@ -4,8 +4,6 @@#ifndef __PANTHOR_FW_REGS_H__#define __PANTHOR_FW_REGS_H__ -#define MCU_CONTROL_BASE 0x700 -#define MCU_CONTROL 0x0#define MCU_CONTROL_ENABLE 1#define MCU_CONTROL_AUTO 2
drivers/gpu/drm/panthor/panthor_gpu.c +2 -2
@@ -159,7 +159,7 @@ int panthor_gpu_init(struct panthor_device *ptdev)if (!gpu)return -ENOMEM ; - gpu->iomem = ptdev->iomem +GPU_CONTROL_BASE ; + gpu->iomem = ptdev->iomem + ptdev->hw->regs.gpu_control.offset;spin_lock_init (&gpu->reqs_lock);init_waitqueue_head (&gpu->reqs_acked);mutex_init (&gpu->cache_flush_lock);
@@ -176,7 +176,7 @@ int panthor_gpu_init(struct panthor_device *ptdev)return irq; ret =panthor_irq_request (ptdev, &ptdev->gpu->irq, irq, - ptdev->iomem +GPU_INT_BASE ,"gpu" , + gpu->iomem +GPU_INT_BASE ,"gpu" , panthor_gpu_irq_threaded_handler);if (ret)return ret;
drivers/gpu/drm/panthor/panthor_gpu_regs.h +0 -2
@@ -4,8 +4,6 @@#ifndef __PANTHOR_GPU_REGS_H__#define __PANTHOR_GPU_REGS_H__ -#define GPU_CONTROL_BASE 0x0 -#define GPU_ID 0x0#define GPU_ARCH_MAJOR (x) ((x) >> 28)#define GPU_ARCH_MINOR (x) (((x) & GENMASK(27, 24)) >> 24)
drivers/gpu/drm/panthor/panthor_hw.c +21 -2
@@ -36,6 +36,14 @@ static struct panthor_hw panthor_hw_arch_v10 = { .power_changed_off = panthor_gpu_power_changed_off, .power_changed_on = panthor_gpu_power_changed_on, }, + .regs = { + .gpu_control = { + .offset = 0x0, + }, + .mcu_control = { + .offset = 0x700, + }, + }, }; static struct panthor_hw panthor_hw_arch_v14 = {
@@ -44,6 +52,17 @@ static struct panthor_hw panthor_hw_arch_v14 = { .l2_power_off = panthor_pwr_l2_power_off, .l2_power_on = panthor_pwr_l2_power_on, }, + .regs = { + .gpu_control = { + .offset = 0x0, + }, + .mcu_control = { + .offset = 0x700, + }, + .pwr_control = { + .offset = 0x800, + }, + }, };static struct panthor_hw_entry panthor_hw_match[] = {
@@ -195,7 +214,7 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev) {unsigned int i; -void __iomem *gpu_iomem = ptdev->iomem +GPU_CONTROL_BASE ; +void __iomem *gpu_iomem = ptdev->iomem + ptdev->hw->regs.gpu_control.offset; ptdev->gpu_info.csf_id =gpu_read (gpu_iomem,GPU_CSF_ID ); ptdev->gpu_info.gpu_rev =gpu_read (gpu_iomem,GPU_REVID );
@@ -221,7 +240,7 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev) ptdev->gpu_info.gpu_features =gpu_read64 (gpu_iomem,GPU_FEATURES );if (panthor_hw_has_pwr_ctrl (ptdev)) { -void __iomem *pwr_iomem = gpu_iomem +PWR_CONTROL_BASE ; +void __iomem *pwr_iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;/* Introduced in arch 14.x */ ptdev->gpu_info.l2_present =gpu_read64 (pwr_iomem,PWR_L2_PRESENT );
drivers/gpu/drm/panthor/panthor_hw.h +27 -2
@@ -27,14 +27,39 @@ struct panthor_hw_ops {void (*power_changed_off)(struct panthor_device *ptdev); }; +/** struct panthor_hw_regbank - Register offset and instance stride information */ +struct panthor_hw_regbank { +/** @offset: Register offset relative to &struct panthor_device.iomem */ +u32 offset; + +/** +* @stride: Register offset between instances, or 0 for non-instanced +* registers +*/ +u32 stride; +}; + +/** struct panthor_hw_regs_layout - Hardware register bank layout */ +struct panthor_hw_regs_layout { +/** @gpu_control: GPU_CONTROL register bank layout */ +struct panthor_hw_regbank gpu_control; + +/** @pwr_control: PWR_CONTROL register bank layout */ +struct panthor_hw_regbank pwr_control; + +/** @mcu_control: MCU_CONTROL register bank layout */ +struct panthor_hw_regbank mcu_control; +}; +/** * struct panthor_hw - GPU specific register mapping and functions */ struct panthor_hw { -/** @features: Bitmap containing panthor_hw_feature */ -/** @ops: Panthor HW specific operations */ struct panthor_hw_ops ops; + +/** @regs: Hardware register bank layout */ +struct panthor_hw_regs_layout regs; };int panthor_hw_init (struct panthor_device *ptdev);
drivers/gpu/drm/panthor/panthor_pwr.c +1 -1
@@ -502,7 +502,7 @@ int panthor_pwr_init(struct panthor_device *ptdev)if (!pwr)return -ENOMEM ; - pwr->iomem = ptdev->iomem +PWR_CONTROL_BASE ; + pwr->iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;spin_lock_init (&pwr->reqs_lock);init_waitqueue_head (&pwr->reqs_acked); ptdev->pwr = pwr;
drivers/gpu/drm/panthor/panthor_pwr_regs.h +0 -2
@@ -4,8 +4,6 @@#ifndef __PANTHOR_PWR_REGS_H__#define __PANTHOR_PWR_REGS_H__ -#define PWR_CONTROL_BASE 0x800 -#define PWR_INT_BASE 0x0#define PWR_IRQ_POWER_CHANGED_SINGLE BIT(0)#define PWR_IRQ_POWER_CHANGED_ALL BIT(1)
Signature · 1 line
2.43.0
Re: [PATCH v5 5/9] drm/panthor: Move register base offsets to the HW description
Quoted 10 lines · Karunika Choo
Mali v15 reorders several register regions, including
GPU_CONTROL,MCU_CONTROLandPWR_CONTROL, so the driver can no longer assume a single fixed base layout across all supported GPUs.Add per-GPU register base offsets to the panthor hardware description and switch the GPU, FW and PWR local iomem setup to use those stored values. With the base addresses now owned by the hardware description, drop the corresponding fixed base-offset definitions from the register headers.
Quoted 6 lines
This prepares the driver for GPUs with different register layouts without changing the existing behaviour on currently supported parts.
Reviewed-by Boris Brezillon <[email protected]>Reviewed-by Liviu Dudau <[email protected]>Signed-off-by Karunika Choo <[email protected]>
There's an unrelated change which shouldn't be in this patch (see below). But with that split out:
Quoted 163 lines
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
v1:
- rebased on drm-misc-next
- use a genericpanthor_hw_regbankstructure for all register offsets.drivers/gpu/drm/panthor/panthor_fw.c | 2 +- drivers/gpu/drm/panthor/panthor_fw_regs.h | 2 -- drivers/gpu/drm/panthor/panthor_gpu.c | 4 +-- drivers/gpu/drm/panthor/panthor_gpu_regs.h | 2 -- drivers/gpu/drm/panthor/panthor_hw.c | 23 +++++++++++++++-- drivers/gpu/drm/panthor/panthor_hw.h | 29 ++++++++++++++++++++-- drivers/gpu/drm/panthor/panthor_pwr.c | 2 +- drivers/gpu/drm/panthor/panthor_pwr_regs.h | 2 -- 8 files changed, 52 insertions(+), 14 deletions(-)drivers/gpu/drm/panthor/panthor_fw.c +1
-1@@ -1500,7 +1500,7 @@ int panthor_fw_init(struct panthor_device *ptdev)if (!fw)return -ENOMEM ; - fw->iomem = ptdev->iomem +MCU_CONTROL_BASE ; + fw->iomem = ptdev->iomem + ptdev->hw->regs.mcu_control.offset; ptdev->fw = fw;init_waitqueue_head (&fw->req_waitqueue);INIT_LIST_HEAD (&fw->sections);drivers/gpu/drm/panthor/panthor_fw_regs.h +0
-2@@ -4,8 +4,6 @@#ifndef __PANTHOR_FW_REGS_H__#define __PANTHOR_FW_REGS_H__ -#define MCU_CONTROL_BASE 0x700 -#define MCU_CONTROL 0x0#define MCU_CONTROL_ENABLE 1#define MCU_CONTROL_AUTO 2drivers/gpu/drm/panthor/panthor_gpu.c +2
-2@@ -159,7 +159,7 @@ int panthor_gpu_init(struct panthor_device *ptdev)if (!gpu)return -ENOMEM ; - gpu->iomem = ptdev->iomem +GPU_CONTROL_BASE ; + gpu->iomem = ptdev->iomem + ptdev->hw->regs.gpu_control.offset;spin_lock_init (&gpu->reqs_lock);init_waitqueue_head (&gpu->reqs_acked);mutex_init (&gpu->cache_flush_lock);@@ -176,7 +176,7 @@ int panthor_gpu_init(struct panthor_device *ptdev)return irq; ret =panthor_irq_request (ptdev, &ptdev->gpu->irq, irq, - ptdev->iomem +GPU_INT_BASE ,"gpu" , + gpu->iomem +GPU_INT_BASE ,"gpu" , panthor_gpu_irq_threaded_handler);if (ret)return ret;drivers/gpu/drm/panthor/panthor_gpu_regs.h +0
-2@@ -4,8 +4,6 @@#ifndef __PANTHOR_GPU_REGS_H__#define __PANTHOR_GPU_REGS_H__ -#define GPU_CONTROL_BASE 0x0 -#define GPU_ID 0x0#define GPU_ARCH_MAJOR (x) ((x) >> 28)#define GPU_ARCH_MINOR (x) (((x) & GENMASK(27, 24)) >> 24)drivers/gpu/drm/panthor/panthor_hw.c +21
-2@@ -36,6 +36,14 @@ static struct panthor_hw panthor_hw_arch_v10 = { .power_changed_off = panthor_gpu_power_changed_off, .power_changed_on = panthor_gpu_power_changed_on, }, + .regs = { + .gpu_control = { + .offset = 0x0, + }, + .mcu_control = { + .offset = 0x700, + }, + }, }; static struct panthor_hw panthor_hw_arch_v14 = {@@ -44,6 +52,17 @@ static struct panthor_hw panthor_hw_arch_v14 = { .l2_power_off = panthor_pwr_l2_power_off, .l2_power_on = panthor_pwr_l2_power_on, }, + .regs = { + .gpu_control = { + .offset = 0x0, + }, + .mcu_control = { + .offset = 0x700, + }, + .pwr_control = { + .offset = 0x800, + }, + }, };static struct panthor_hw_entry panthor_hw_match[] = {@@ -195,7 +214,7 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev) {unsigned int i; -void __iomem *gpu_iomem = ptdev->iomem +GPU_CONTROL_BASE ; +void __iomem *gpu_iomem = ptdev->iomem + ptdev->hw->regs.gpu_control.offset; ptdev->gpu_info.csf_id =gpu_read (gpu_iomem,GPU_CSF_ID ); ptdev->gpu_info.gpu_rev =gpu_read (gpu_iomem,GPU_REVID );@@ -221,7 +240,7 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev) ptdev->gpu_info.gpu_features =gpu_read64 (gpu_iomem,GPU_FEATURES );if (panthor_hw_has_pwr_ctrl (ptdev)) { -void __iomem *pwr_iomem = gpu_iomem +PWR_CONTROL_BASE ; +void __iomem *pwr_iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;/* Introduced in arch 14.x */ ptdev->gpu_info.l2_present =gpu_read64 (pwr_iomem,PWR_L2_PRESENT );drivers/gpu/drm/panthor/panthor_hw.h +20
-0@@ -27,14 +27,39 @@ struct panthor_hw_ops {void (*power_changed_off)(struct panthor_device *ptdev); }; +/** struct panthor_hw_regbank - Register offset and instance stride information */ +struct panthor_hw_regbank { +/** @offset: Register offset relative to &struct panthor_device.iomem */ +u32 offset; + +/** +* @stride: Register offset between instances, or 0 for non-instanced +* registers +*/ +u32 stride; +}; + +/** struct panthor_hw_regs_layout - Hardware register bank layout */ +struct panthor_hw_regs_layout { +/** @gpu_control: GPU_CONTROL register bank layout */ +struct panthor_hw_regbank gpu_control; + +/** @pwr_control: PWR_CONTROL register bank layout */ +struct panthor_hw_regbank pwr_control; +
drivers/gpu/drm/panthor/panthor_hw.h struct panthor_hw_ops { · line 35
Quoted 10 lines
drivers/gpu/drm/panthor/panthor_hw.h +4
-2+/** @mcu_control: MCU_CONTROL register bank layout */ +struct panthor_hw_regbank mcu_control; +}; +/** * struct panthor_hw - GPU specific register mapping and functions */ struct panthor_hw { -/** @features: Bitmap containing panthor_hw_feature */ -
Unrelated change shouldn't be in this patch.
Thanks,
Steve
Quoted 34 lines
drivers/gpu/drm/panthor/panthor_hw.h +3
-0/** @ops: Panthor HW specific operations */ struct panthor_hw_ops ops; + +/** @regs: Hardware register bank layout */ +struct panthor_hw_regs_layout regs; };int panthor_hw_init (struct panthor_device *ptdev);drivers/gpu/drm/panthor/panthor_pwr.c +1
-1@@ -502,7 +502,7 @@ int panthor_pwr_init(struct panthor_device *ptdev)if (!pwr)return -ENOMEM ; - pwr->iomem = ptdev->iomem +PWR_CONTROL_BASE ; + pwr->iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;spin_lock_init (&pwr->reqs_lock);init_waitqueue_head (&pwr->reqs_acked); ptdev->pwr = pwr;drivers/gpu/drm/panthor/panthor_pwr_regs.h +0
-2@@ -4,8 +4,6 @@#ifndef __PANTHOR_PWR_REGS_H__#define __PANTHOR_PWR_REGS_H__ -#define PWR_CONTROL_BASE 0x800 -#define PWR_INT_BASE 0x0#define PWR_IRQ_POWER_CHANGED_SINGLE BIT(0)#define PWR_IRQ_POWER_CHANGED_ALL BIT(1)
PATCH v5 6/9 drm/panthor: Derive MMU AS register addresses from base and stride
In reply to Karunika ChooMove the MMU address-space register layout into the hardware description by storing the MMU_AS base offset and per-AS stride in the Panthor HW map.
Use those values to compute the iomem pointer for each AS slot and make the MMU AS register definitions relative to the per-slot register window instead of hard-coding the slot offset in every register macro.
This prepares the MMU code for GPUs where the MMU AS register region is not at a fixed offset while keeping the existing register accesses scoped to a single AS window.
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Avoid enabling all AS IRQs on init and replace with explicit IRQ clear to preserve init behaviour. AS IRQs are enabled as part of panthor_mmu_as_enable(). This also prevents accessing NULL iomem pointers for initialized AS during init per sashiko's comment.
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- align with updated panthor_hw_regbank structure.
- moved AS iomem tracking into panthor_as_slot and introduced as_iomem() to retrieve it.
drivers/gpu/drm/panthor/panthor_hw.c | 8 ++++ drivers/gpu/drm/panthor/panthor_hw.h | 3 ++ drivers/gpu/drm/panthor/panthor_mmu.c | 47 ++++++++++++++-------- drivers/gpu/drm/panthor/panthor_mmu_regs.h | 23 +++++------ 4 files changed, 51 insertions(+), 30 deletions(-)
drivers/gpu/drm/panthor/panthor_hw.c +8 -0
@@ -43,6 +43,10 @@ static struct panthor_hw panthor_hw_arch_v10 = { .mcu_control = { .offset = 0x700, }, + .mmu_as_control = { + .offset = 0x2400, + .stride = 0x40, + }, }, };
@@ -62,6 +66,10 @@ static struct panthor_hw panthor_hw_arch_v14 = { .pwr_control = { .offset = 0x800, }, + .mmu_as_control = { + .offset = 0x2400, + .stride = 0x40, + }, }, };
drivers/gpu/drm/panthor/panthor_hw.h +3 -0
@@ -49,6 +49,9 @@ struct panthor_hw_regs_layout {/** @mcu_control: MCU_CONTROL register bank layout */ struct panthor_hw_regbank mcu_control; + +/** @mmu_as_control: MMU_AS_CONTROL register bank layout */ +struct panthor_hw_regbank mmu_as_control; };/**
drivers/gpu/drm/panthor/panthor_mmu.c +31 -16
127 lines not on this page · raw message
drivers/gpu/drm/panthor/panthor_mmu_regs.h +9 -14
@@ -11,13 +11,8 @@/* AS_COMMAND register commands */ -#define MMU_AS_BASE 0x2400 - -#define MMU_AS_SHIFT 6 -#define MMU_AS (as) ((as) << MMU_AS_SHIFT) - -#define AS_TRANSTAB (as) (MMU_AS(as) + 0x0) -#define AS_MEMATTR (as) (MMU_AS(as) + 0x8) +#define AS_TRANSTAB 0x0 +#define AS_MEMATTR 0x8#define AS_MEMATTR_AARCH64_INNER_ALLOC_IMPL (2 << 2)#define AS_MEMATTR_AARCH64_INNER_ALLOC_EXPL (w, r) ((3 << 2) | \ ((w) ? BIT(0) : 0) | \
@@ -29,8 +24,8 @@#define AS_MEMATTR_AARCH64_INNER_OUTER_NC (1 << 6)#define AS_MEMATTR_AARCH64_INNER_OUTER_WB (2 << 6)#define AS_MEMATTR_AARCH64_FAULT (3 << 6) -#define AS_LOCKADDR (as) (MMU_AS(as) + 0x10) -#define AS_COMMAND (as) (MMU_AS(as) + 0x18) +#define AS_LOCKADDR 0x10 +#define AS_COMMAND 0x18#define AS_COMMAND_NOP 0#define AS_COMMAND_UPDATE 1#define AS_COMMAND_LOCK 2
@@ -38,16 +33,16 @@#define AS_COMMAND_FLUSH_PT 4#define AS_COMMAND_FLUSH_MEM 5#define AS_LOCK_REGION_MIN_SIZE (1ULL << 15) -#define AS_FAULTSTATUS (as) (MMU_AS(as) + 0x1C) +#define AS_FAULTSTATUS 0x1C#define AS_FAULTSTATUS_ACCESS_TYPE_MASK (0x3 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_ATOMIC (0x0 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_EX (0x1 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3 << 8) -#define AS_FAULTADDRESS (as) (MMU_AS(as) + 0x20) -#define AS_STATUS (as) (MMU_AS(as) + 0x28) +#define AS_FAULTADDRESS 0x20 +#define AS_STATUS 0x28#define AS_STATUS_AS_ACTIVE BIT(0) -#define AS_TRANSCFG (as) (MMU_AS(as) + 0x30) +#define AS_TRANSCFG 0x30#define AS_TRANSCFG_ADRMODE_UNMAPPED (1 << 0)#define AS_TRANSCFG_ADRMODE_IDENTITY (2 << 0)#define AS_TRANSCFG_ADRMODE_AARCH64_4K (6 << 0)
@@ -65,6 +60,6 @@#define AS_TRANSCFG_DISABLE_AF_FAULT BIT(34)#define AS_TRANSCFG_WXN BIT(35)#define AS_TRANSCFG_XREADABLE BIT(36) -#define AS_FAULTEXTRA (as) (MMU_AS(as) + 0x38) +#define AS_FAULTEXTRA 0x38#endif /* __PANTHOR_MMU_REGS_H__ */
Signature · 1 line
2.43.0
Steven Price
maintainerRe: [PATCH v5 6/9] drm/panthor: Derive MMU AS register addresses from base and stride
Quoted 211 lines · Karunika Choo
Move the MMU address-space register layout into the hardware description by storing the
MMU_ASbase offset and per-AS stride in the Panthor HW map.Use those values to compute the iomem pointer for each AS slot and make the MMU AS register definitions relative to the per-slot register window instead of hard-coding the slot offset in every register macro.
This prepares the MMU code for GPUs where the MMU AS register region is not at a fixed offset while keeping the existing register accesses scoped to a single AS window.
Reviewed-by Boris Brezillon <[email protected]>Reviewed-by Liviu Dudau <[email protected]>Signed-off-by Karunika Choo <[email protected]>---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Avoid enabling all AS IRQs on init and replace with explicit IRQ clear to preserve init behaviour. AS IRQs are enabled as part ofpanthor_mmu_as_enable(). This also prevents accessing NULL iomem pointers for initialized AS during init per sashiko's comment.
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- align with updatedpanthor_hw_regbankstructure.
- moved AS iomem tracking intopanthor_as_slotand introducedas_iomem()to retrieve it.drivers/gpu/drm/panthor/panthor_hw.c | 8 ++++ drivers/gpu/drm/panthor/panthor_hw.h | 3 ++ drivers/gpu/drm/panthor/panthor_mmu.c | 47 ++++++++++++++-------- drivers/gpu/drm/panthor/panthor_mmu_regs.h | 23 +++++------ 4 files changed, 51 insertions(+), 30 deletions(-)drivers/gpu/drm/panthor/panthor_hw.c +8
-0@@ -43,6 +43,10 @@ static struct panthor_hw panthor_hw_arch_v10 = { .mcu_control = { .offset = 0x700, }, + .mmu_as_control = { + .offset = 0x2400, + .stride = 0x40, + }, }, };@@ -62,6 +66,10 @@ static struct panthor_hw panthor_hw_arch_v14 = { .pwr_control = { .offset = 0x800, }, + .mmu_as_control = { + .offset = 0x2400, + .stride = 0x40, + }, }, };drivers/gpu/drm/panthor/panthor_hw.h +3
-0@@ -49,6 +49,9 @@ struct panthor_hw_regs_layout {/** @mcu_control: MCU_CONTROL register bank layout */ struct panthor_hw_regbank mcu_control; + +/** @mmu_as_control: MMU_AS_CONTROL register bank layout */ +struct panthor_hw_regbank mmu_as_control; };/** drivers/gpu/drm/panthor/panthor_mmu.c +30
-15@@ -35,6 +35,7 @@#include "panthor_gpu.h" #include "panthor_gpu_regs.h" #include "panthor_heap.h" +#include "panthor_hw.h" #include "panthor_mmu.h" #include "panthor_mmu_regs.h" #include "panthor_sched.h" @@ -49,15 +50,15 @@ struct panthor_vm;struct panthor_as_slot {/** @vm: VM bound to this slot. NULL is no VM is bound. */ struct panthor_vm *vm; + +/** @iomem: CPU mapping for MMU_AS_CONTROL iomem region */ +void __iomem *iomem; };/** * struct panthor_mmu - MMU related data */ struct panthor_mmu { -/** @iomem: CPU mapping of MMU_AS_CONTROL iomem region */ -void __iomem *iomem; -/** @irq: The MMU irq. */ struct panthor_irq irq;@@ -533,6 +534,11 @@ static void free_pt(void *cookie, void *data, size_t size)kmem_cache_free (pt_cache, data); } +static void __iomem *as_iomem (struct panthor_mmu *mmu,u32 as_nr) +{ +return mmu->as.slots[as_nr].iomem; +} +static int wait_ready (struct panthor_device *ptdev,u32 as_nr) {struct panthor_mmu *mmu = ptdev->mmu;@@ -542,7 +548,7 @@ static int wait_ready(struct panthor_device *ptdev, u32 as_nr)/* Wait for the MMU status to indicate there is no active command, in * case one is pending. */ - ret =gpu_read_relaxed_poll_timeout_atomic (mmu->iomem,AS_STATUS (as_nr), val, + ret =gpu_read_relaxed_poll_timeout_atomic (as_iomem (mmu, as_nr),AS_STATUS , val, !(val &AS_STATUS_AS_ACTIVE ),10 ,100000 );if (ret) {@@ -560,7 +566,7 @@ static int as_send_cmd_and_wait(struct panthor_device *ptdev, u32 as_nr, u32 cmd/* write AS_COMMAND when MMU is ready to accept another command */ status =wait_ready (ptdev, as_nr);if (!status) { -gpu_write (ptdev->mmu->iomem,AS_COMMAND (as_nr), cmd); +gpu_write (as_iomem (ptdev->mmu, as_nr),AS_COMMAND , cmd); status =wait_ready (ptdev, as_nr); }@@ -603,9 +609,9 @@ static int panthor_mmu_as_enable(struct panthor_device *ptdev, u32 as_nr,panthor_irq_enable_events (&ptdev->mmu->irq,MMU_INT_AS_FAULT (as_nr)); -gpu_write64 (mmu->iomem,AS_TRANSTAB (as_nr), transtab); -gpu_write64 (mmu->iomem,AS_MEMATTR (as_nr), memattr); -gpu_write64 (mmu->iomem,AS_TRANSCFG (as_nr), transcfg); +gpu_write64 (as_iomem (mmu, as_nr),AS_TRANSTAB , transtab); +gpu_write64 (as_iomem (mmu, as_nr),AS_MEMATTR , memattr); +gpu_write64 (as_iomem (mmu, as_nr),AS_TRANSCFG , transcfg);return as_send_cmd_and_wait (ptdev, as_nr,AS_COMMAND_UPDATE ); }@@ -627,9 +633,9 @@ static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr)return ret; } -gpu_write64 (mmu->iomem,AS_TRANSTAB (as_nr),0 ); -gpu_write64 (mmu->iomem,AS_MEMATTR (as_nr),0 ); -gpu_write64 (mmu->iomem,AS_TRANSCFG (as_nr),AS_TRANSCFG_ADRMODE_UNMAPPED ); +gpu_write64 (as_iomem (mmu, as_nr),AS_TRANSTAB ,0 ); +gpu_write64 (as_iomem (mmu, as_nr),AS_MEMATTR ,0 ); +gpu_write64 (as_iomem (mmu, as_nr),AS_TRANSCFG ,AS_TRANSCFG_ADRMODE_UNMAPPED ); ret =as_send_cmd_and_wait (ptdev, as_nr,AS_COMMAND_UPDATE );if (ret)@@ -1799,7 +1805,7 @@ static int panthor_vm_lock_region(struct panthor_vm *vm, u64 start, u64 size)mutex_lock (&ptdev->mmu->as.slots_lock);if (vm->as.id >=0 && size) {/* Lock the region that needs to be updated */ -gpu_write64 (ptdev->mmu->iomem,AS_LOCKADDR (vm->as.id), +gpu_write64 (as_iomem (ptdev->mmu, vm->as.id),AS_LOCKADDR ,pack_region_range (ptdev, &start, &size));/* If the lock succeeded, update the locked_region info. */ @@ -1861,8 +1867,8 @@ static void panthor_mmu_irq_handler(struct panthor_irq *pirq, u32 status)u32 access_type;u32 source_id; - fault_status =gpu_read (mmu->iomem,AS_FAULTSTATUS (as)); - addr =gpu_read64 (mmu->iomem,AS_FAULTADDRESS (as)); + fault_status =gpu_read (as_iomem (mmu, as),AS_FAULTSTATUS ); + addr =gpu_read64 (as_iomem (mmu, as),AS_FAULTADDRESS );/* decode the fault status */ exception_type = fault_status &0xFF ;@@ -3429,8 +3435,11 @@ static void panthor_mmu_info_init(struct panthor_device *ptdev)int panthor_mmu_init (struct panthor_device *ptdev) {u32 va_bits =GPU_MMU_FEATURES_VA_BITS (ptdev->gpu_info.mmu_features); +unsigned long as_present_mask = ptdev->gpu_info.as_present; +struct panthor_hw_regbank *regbank = &ptdev->hw->regs.mmu_as_control;struct panthor_mmu *mmu;int ret, irq; +u32 as_id;panthor_mmu_info_init (ptdev);@@ -3449,7 +3458,13 @@ int panthor_mmu_init(struct panthor_device *ptdev)if (ret)return ret; - mmu->iomem = ptdev->iomem +MMU_AS_BASE ; +for_each_set_bit (as_id, &as_present_mask,MAX_AS_SLOTS ) { +u64 offset = regbank->offset + (regbank->stride * as_id); + +guard (mutex)(&mmu->as.slots_lock); + mmu->as.slots[as_id].iomem = ptdev->iomem + offset; + } + ptdev->mmu = mmu; irq =platform_get_irq_byname (to_platform_device (ptdev->base.dev),"mmu" );
drivers/gpu/drm/panthor/panthor_mmu.c int panthor_mmu_init(struct panthor_device *ptdev) · line 3497
Quoted 5 lines
drivers/gpu/drm/panthor/panthor_mmu.c +1
-1@@ -3479,7 +3494,7 @@ int panthor_mmu_init(struct panthor_device *ptdev)if (ret)return ret; -panthor_irq_enable_events (&mmu->irq,panthor_mmu_fault_mask (ptdev, ~0 )); +gpu_write (mmu->irq.iomem,INT_CLEAR ,panthor_mmu_fault_mask (ptdev, ~0 ));
This isn't equivalent and shouldn't be in this patch.
But I see Liviu has just pushed the series... so I won't bother reviewing the rest :(
Steve
Quoted 63 lines
drivers/gpu/drm/panthor/panthor_mmu.c +0
-0panthor_irq_resume (&mmu->irq);return 0 ; }drivers/gpu/drm/panthor/panthor_mmu_regs.h +9
-14@@ -11,13 +11,8 @@/* AS_COMMAND register commands */ -#define MMU_AS_BASE 0x2400 - -#define MMU_AS_SHIFT 6 -#define MMU_AS (as) ((as) << MMU_AS_SHIFT) - -#define AS_TRANSTAB (as) (MMU_AS(as) + 0x0) -#define AS_MEMATTR (as) (MMU_AS(as) + 0x8) +#define AS_TRANSTAB 0x0 +#define AS_MEMATTR 0x8#define AS_MEMATTR_AARCH64_INNER_ALLOC_IMPL (2 << 2)#define AS_MEMATTR_AARCH64_INNER_ALLOC_EXPL (w, r) ((3 << 2) | \ ((w) ? BIT(0) : 0) | \@@ -29,8 +24,8 @@#define AS_MEMATTR_AARCH64_INNER_OUTER_NC (1 << 6)#define AS_MEMATTR_AARCH64_INNER_OUTER_WB (2 << 6)#define AS_MEMATTR_AARCH64_FAULT (3 << 6) -#define AS_LOCKADDR (as) (MMU_AS(as) + 0x10) -#define AS_COMMAND (as) (MMU_AS(as) + 0x18) +#define AS_LOCKADDR 0x10 +#define AS_COMMAND 0x18#define AS_COMMAND_NOP 0#define AS_COMMAND_UPDATE 1#define AS_COMMAND_LOCK 2@@ -38,16 +33,16 @@#define AS_COMMAND_FLUSH_PT 4#define AS_COMMAND_FLUSH_MEM 5#define AS_LOCK_REGION_MIN_SIZE (1ULL << 15) -#define AS_FAULTSTATUS (as) (MMU_AS(as) + 0x1C) +#define AS_FAULTSTATUS 0x1C#define AS_FAULTSTATUS_ACCESS_TYPE_MASK (0x3 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_ATOMIC (0x0 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_EX (0x1 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2 << 8)#define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3 << 8) -#define AS_FAULTADDRESS (as) (MMU_AS(as) + 0x20) -#define AS_STATUS (as) (MMU_AS(as) + 0x28) +#define AS_FAULTADDRESS 0x20 +#define AS_STATUS 0x28#define AS_STATUS_AS_ACTIVE BIT(0) -#define AS_TRANSCFG (as) (MMU_AS(as) + 0x30) +#define AS_TRANSCFG 0x30#define AS_TRANSCFG_ADRMODE_UNMAPPED (1 << 0)#define AS_TRANSCFG_ADRMODE_IDENTITY (2 << 0)#define AS_TRANSCFG_ADRMODE_AARCH64_4K (6 << 0)@@ -65,6 +60,6 @@#define AS_TRANSCFG_DISABLE_AF_FAULT BIT(34)#define AS_TRANSCFG_WXN BIT(35)#define AS_TRANSCFG_XREADABLE BIT(36) -#define AS_FAULTEXTRA (as) (MMU_AS(as) + 0x38) +#define AS_FAULTEXTRA 0x38#endif /* __PANTHOR_MMU_REGS_H__ */
PATCH v5 7/9 drm/panthor: Skip devfreq when explicitly disabled
In reply to Karunika ChooOn Mali v15 AM systems, frequency scaling is handled outside panthor by the AM_GOVERNOR block, so the GPU DT node may not provide an OPP table.
Add generic devfreq_disabled field to panthor_soc_data to allow disabling of devfreq for other use GPUs and make panthor_devfreq_init() return early when this flag is set. Ensure frequency can be queried without devfreq instance and omit drm-maxfreq-panthor from fdinfo when the maximum frequency is unknown.
---
v5:
- Picked up R-b from Boris.
v4:
- Use panthor_soc_data flags instead of compatible to allow earlier GPUs to also disable devfreq. Resetting R-bs as a result.
v3:
- Omit drm-maxfreq-panthor from fdinfo when the maximum frequency is unknown, as on AM systems without an OPP table.
v2:
- Directly call functions instead of storing function pointers.
- Picked up R-b from Liviu
v1:
- Only skip panthor_devfreq init when OPP lookup returns -ENODEV instead of direct DT-property check.
- Support frequency query without devfreq.
drivers/gpu/drm/panthor/panthor_devfreq.c | 9 +++++++-- drivers/gpu/drm/panthor/panthor_device.h | 3 +++ drivers/gpu/drm/panthor/panthor_drv.c | 5 ++++- drivers/gpu/drm/panthor/panthor_hw.h | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-)
drivers/gpu/drm/panthor/panthor_devfreq.c +7 -2
@@ -12,6 +12,7 @@#include "panthor_devfreq.h" #include "panthor_device.h" +#include "panthor_hw.h" /** * struct panthor_devfreq - Device frequency management
@@ -154,6 +155,9 @@ int panthor_devfreq_init(struct panthor_device *ptdev) ptdev->devfreq = pdevfreq; +if (panthor_hw_is_devfreq_disabled (ptdev)) +return 0 ; +/* * The power domain associated with the GPU may have already added an * OPP table, complete with OPPs, as part of the platform bus
@@ -324,9 +328,10 @@ unsigned long panthor_devfreq_get_freq(struct panthor_device *ptdev)int ret;if (!pdevfreq->devfreq) -return 0 ; + ret =panthor_devfreq_get_cur_freq (ptdev->base.dev, &freq); +else + ret = pdevfreq->devfreq->profile->get_cur_freq (ptdev->base.dev, &freq); - ret = pdevfreq->devfreq->profile->get_cur_freq (ptdev->base.dev, &freq);if (ret)return 0 ;
drivers/gpu/drm/panthor/panthor_device.h +3 -0
@@ -45,6 +45,9 @@ struct panthor_soc_data {/** @asn_hash: ASN_HASH values when asn_hash_enable is true. */ u32 asn_hash[3 ]; + +/** @devfreq_disabled: True if devfreq is handled external to Panthor */ +bool devfreq_disabled; };/**
drivers/gpu/drm/panthor/panthor_drv.c +4 -1
@@ -1715,7 +1715,10 @@ static void panthor_gpu_show_fdinfo(struct panthor_device *ptdev,if (ptdev->profile_mask &PANTHOR_DEVICE_PROFILING_CYCLES )drm_printf (p,"drm-cycles-panthor:\t%llu\n" , pfile->stats.cycles); -drm_printf (p,"drm-maxfreq-panthor:\t%lu Hz\n" , ptdev->fast_rate); +/* Omit the maximum frequency when it is unknown */ +if (ptdev->fast_rate) +drm_printf (p,"drm-maxfreq-panthor:\t%lu Hz\n" , ptdev->fast_rate); +drm_printf (p,"drm-curfreq-panthor:\t%lu Hz\n" ,panthor_devfreq_get_freq (ptdev)); }
drivers/gpu/drm/panthor/panthor_hw.h +10 -0
@@ -95,4 +95,14 @@ static inline bool panthor_hw_has_neural(struct panthor_device *ptdev) ptdev->gpu_info.gpu_features & GPU_FEATURES_NX); } +static inline bool panthor_hw_is_devfreq_disabled (struct panthor_device *ptdev) +{ +const struct panthor_soc_data *data = ptdev->soc_data; + +if (!data) +return false; + +return data->devfreq_disabled; +} +#endif /* __PANTHOR_HW_H__ */
Signature · 1 line
2.43.0
Re: [PATCH v5 7/9] drm/panthor: Skip devfreq when explicitly disabled
Quoted 11 lines · Karunika Choo
On Mali v15 AM systems, frequency scaling is handled outside panthor by the
AM_GOVERNORblock, so the GPU DT node may not provide an OPP table.Add generic
devfreq_disabledfield topanthor_soc_datato allow disabling of devfreq for other use GPUs and makepanthor_devfreq_init()return early when this flag is set. Ensure frequency can be queried without devfreq instance and omit drm-maxfreq-panthor from fdinfo when the maximum frequency is unknown.Reviewed-by Boris Brezillon <[email protected]>Signed-off-by Karunika Choo <[email protected]>
Best regards,
Liviu
Quoted 110 lines
---
v5:
- Picked up R-b from Boris.
v4:
- Usepanthor_soc_dataflags instead of compatible to allow earlier GPUs to also disable devfreq. Resetting R-bs as a result.
v3:
- Omit drm-maxfreq-panthor from fdinfo when the maximum frequency is unknown, as on AM systems without an OPP table.
v2:
- Directly call functions instead of storing function pointers.
- Picked up R-b from Liviu
v1:
- Only skippanthor_devfreqinit when OPP lookup returns-ENODEVinstead of direct DT-property check.
- Support frequency query without devfreq.drivers/gpu/drm/panthor/panthor_devfreq.c | 9 +++++++-- drivers/gpu/drm/panthor/panthor_device.h | 3 +++ drivers/gpu/drm/panthor/panthor_drv.c | 5 ++++- drivers/gpu/drm/panthor/panthor_hw.h | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-)drivers/gpu/drm/panthor/panthor_devfreq.c +7
-2@@ -12,6 +12,7 @@#include "panthor_devfreq.h" #include "panthor_device.h" +#include "panthor_hw.h" /** * struct panthor_devfreq - Device frequency management @@ -154,6 +155,9 @@ int panthor_devfreq_init(struct panthor_device *ptdev) ptdev->devfreq = pdevfreq; +if (panthor_hw_is_devfreq_disabled (ptdev)) +return 0 ; +/* * The power domain associated with the GPU may have already added an * OPP table, complete with OPPs, as part of the platform bus @@ -324,9 +328,10 @@ unsigned long panthor_devfreq_get_freq(struct panthor_device *ptdev)int ret;if (!pdevfreq->devfreq) -return 0 ; + ret =panthor_devfreq_get_cur_freq (ptdev->base.dev, &freq); +else + ret = pdevfreq->devfreq->profile->get_cur_freq (ptdev->base.dev, &freq); - ret = pdevfreq->devfreq->profile->get_cur_freq (ptdev->base.dev, &freq);if (ret)return 0 ;drivers/gpu/drm/panthor/panthor_device.h +3
-0@@ -45,6 +45,9 @@ struct panthor_soc_data {/** @asn_hash: ASN_HASH values when asn_hash_enable is true. */ u32 asn_hash[3 ]; + +/** @devfreq_disabled: True if devfreq is handled external to Panthor */ +bool devfreq_disabled; };/** drivers/gpu/drm/panthor/panthor_drv.c +4
-1@@ -1715,7 +1715,10 @@ static void panthor_gpu_show_fdinfo(struct panthor_device *ptdev,if (ptdev->profile_mask &PANTHOR_DEVICE_PROFILING_CYCLES )drm_printf (p,"drm-cycles-panthor:\t%llu\n" , pfile->stats.cycles); -drm_printf (p,"drm-maxfreq-panthor:\t%lu Hz\n" , ptdev->fast_rate); +/* Omit the maximum frequency when it is unknown */ +if (ptdev->fast_rate) +drm_printf (p,"drm-maxfreq-panthor:\t%lu Hz\n" , ptdev->fast_rate); +drm_printf (p,"drm-curfreq-panthor:\t%lu Hz\n" ,panthor_devfreq_get_freq (ptdev)); }drivers/gpu/drm/panthor/panthor_hw.h +10
-0@@ -95,4 +95,14 @@ static inline bool panthor_hw_has_neural(struct panthor_device *ptdev) ptdev->gpu_info.gpu_features & GPU_FEATURES_NX); } +static inline bool panthor_hw_is_devfreq_disabled (struct panthor_device *ptdev) +{ +const struct panthor_soc_data *data = ptdev->soc_data; + +if (!data) +return false; + +return data->devfreq_disabled; +} +#endif /* __PANTHOR_HW_H__ */ Signature · 1 line
2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯PATCH v5 8/9 dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema
In reply to Karunika ChooAdd a separate device-tree schema for Mali 5th-Gen AM GPUs.
AM_GOVERNOR controls GPU frequency. The GPU node does not accept OPP, cooling or GPU supply properties.
---
v5:
- Removed nvmem-cells, nvmem-cell-names, power-domains and power-domain-names. Add them when an integration needs them.
- Require a single unnamed GPU clock and drop clock-names. v4:
- Pick up Ack from Boris
v3:
- Drop the $nodename constraint from the AM GPU binding.
- Require the arm,zena-css-mali integration compatible followed by the arm,mali-gen5-am fallback.
- Update the binding example to use the new compatible, three-cell interrupt specifiers, and a single GPU clock.
v2:
- Move arm,mali-gen5-am support from arm,mali-valhall-csf.yaml to a separate arm,mali-gen5-am.yaml schema.
- Move the AM GPU example to the new schema and add the interrupt binding headers.
- Add the new schema to the Panthor MAINTAINERS entry.
.../bindings/gpu/arm,mali-gen5-am.yaml | 63 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml
Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml new file +63 -0
@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpu/arm,mali-gen5-am.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ARM Mali 5th Gen AM GPU + +maintainers: + - Liviu Dudau <[email protected]> + - Boris Brezillon <[email protected]> + +properties: + compatible: + items: + - enum: + - arm,zena-css-mali + - const: arm,mali-gen5-am + + reg: + maxItems: 1 + + interrupts: + items: + - description: Job interrupt + - description: MMU interrupt + - description: GPU interrupt + + interrupt-names: + items: + - const: job + - const: mmu + - const: gpu + + clocks: + maxItems: 1 + + dma-coherent: true + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + gpu@100000 { + compatible = "arm,zena-css-mali", "arm,mali-gen5-am"; + reg = <0x100000 0x480000>; + interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "job", "mmu", "gpu"; + clocks = <&gpu_clk>; + }; +...
MAINTAINERS +1 -0
@@ -2404,6 +2404,7 @@ R: Chris Diamand <[email protected]> L: [email protected] S: Supported T: git https://gitlab.freedesktop.org/drm/misc/kernel.git +F: Documentation/devicetree/bindings/gpu/arm,mali-gen5-am*.yaml F: Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml F: drivers/gpu/drm/ci/xfails/panthor* F: drivers/gpu/drm/panthor/
--
2.43.0
[email protected]
AI reviewRe: [PATCH v5 8/9] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: gpu: arm,mali-gen5-am: interrupts listed before clocks --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: gpu: arm,mali-gen5-am: interrupts listed before clocks
--
commit 8146e86e1cef7b5ce16835f2b37c463e5fa71384
Author: Karunika Choo <[email protected]>
dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema
This commit adds a Device Tree binding schema for ARM Mali 5th-Gen AM GPUs and updates MAINTAINERS.
Quoted 6 lines
Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml new file +0
-0@@ -0,0 +1,63 @@
[ ... ]
Quoted 33 lines
Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml new file +33
-0+ reg: + maxItems: 1 + + interrupts: + items: + - description: Job interrupt + - description: MMU interrupt + - description: GPU interrupt + + interrupt-names: + items: + - const: job + - const: mmu + - const: gpu + + clocks: + maxItems: 1 + + dma-coherent: true + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h>
Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml line 62
Quoted 10 lines
Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml new file +10
-0+ + gpu@100000 { + compatible = "arm,zena-css-mali", "arm,mali-gen5-am"; + reg = <0x100000 0x480000>; + interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "job", "mmu", "gpu"; + clocks = <&gpu_clk>; + };
[Severity: Low]
This isn't a bug, but in Device Tree binding schemas and example nodes the canonical property order places clocks before interrupts and interrupt-names (after reg), in properties, required, and the gpu@100000 example node.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
Re: [PATCH v5 8/9] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema
In reply to Karunika ChooQuoted 9 lines · Karunika Choo
Add a separate device-tree schema for Mali 5th-Gen AM GPUs.
AM_GOVERNORcontrols GPU frequency. The GPU node does not accept OPP, cooling or GPU supply properties.Acked-by Boris Brezillon <[email protected]>Signed-off-by Karunika Choo <[email protected]>---
v5:
Best regards,
Krzysztof
Re: [PATCH v5 8/9] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema
In reply to Karunika ChooQuoted 7 lines · Karunika Choo
Add a separate device-tree schema for Mali 5th-Gen AM GPUs.
AM_GOVERNORcontrols GPU frequency. The GPU node does not accept OPP, cooling or GPU supply properties.Acked-by Boris Brezillon <[email protected]>Signed-off-by Karunika Choo <[email protected]>
Best regards,
Liviu
Quoted 109 lines
---
v5:
- Removed nvmem-cells, nvmem-cell-names, power-domains and power-domain-names. Add them when an integration needs them.
- Require a single unnamed GPU clock and drop clock-names. v4:
- Pick up Ack from Boris
v3:
- Drop the $nodename constraint from the AM GPU binding.
- Require the arm,zena-css-mali integration compatible followed by the arm,mali-gen5-am fallback.
- Update the binding example to use the new compatible, three-cell interrupt specifiers, and a single GPU clock.
v2:
- Move arm,mali-gen5-am support from arm,mali-valhall-csf.yaml to a separate arm,mali-gen5-am.yaml schema.
- Move the AM GPU example to the new schema and add the interrupt binding headers.
- Add the new schema to the PanthorMAINTAINERSentry..../bindings/gpu/arm,mali-gen5-am.yaml | 63 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yamlDocumentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml new file +63
-0@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpu/arm,mali-gen5-am.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ARM Mali 5th Gen AM GPU + +maintainers: + - Liviu Dudau <[email protected]> + - Boris Brezillon <[email protected]> + +properties: + compatible: + items: + - enum: + - arm,zena-css-mali + - const: arm,mali-gen5-am + + reg: + maxItems: 1 + + interrupts: + items: + - description: Job interrupt + - description: MMU interrupt + - description: GPU interrupt + + interrupt-names: + items: + - const: job + - const: mmu + - const: gpu + + clocks: + maxItems: 1 + + dma-coherent: true + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + gpu@100000 { + compatible = "arm,zena-css-mali", "arm,mali-gen5-am"; + reg = <0x100000 0x480000>; + interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "job", "mmu", "gpu"; + clocks = <&gpu_clk>; + }; +...MAINTAINERS +1
-1@@ -2404,6 +2404,7 @@ R: Chris Diamand <[email protected]> L: [email protected] S: Supported T: git https://gitlab.freedesktop.org/drm/misc/kernel.git +F: Documentation/devicetree/bindings/gpu/arm,mali-gen5-am*.yaml F: Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml F: drivers/gpu/drm/ci/xfails/panthor* F: drivers/gpu/drm/panthor/ --2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯PATCH v5 9/9 drm/panthor: Add Mali v15 hardware support
In reply to Karunika ChooAdd the panthor hardware description for Mali v15 GPUs and hook it into device matching.
This includes the v15 register map and product identification needed to populate the GPU information exposed by the driver and its uAPI, as well as add compatibility string for v15 GPUs.
Mali v15 also exposes a 64-bit GPU_ID register with a different field layout from earlier GPUs. Add the register definitions and decoding helpers for the new format, read GPU_ID_WIDE when the compatibility value indicates a v15 GPU, and populate both the cached GPU_ID fields and the uAPI gpu_id_wide field.
Bump drm minor to 10.
---
v5:
- Picked up R-b from Boris.
v4:
- squashed 64-bit GPU_ID decoding into this patch. Resetting R-bs as a result.
v2:
- check as_count is non-zero before generating as_present mask per sashiko's comment.
- Link: https://lore.kernel.org/all/[email protected]/
- clean up l2_features value assignment.
- removed duplicated GPU_FEATURES macro definitions
- Picked up R-b from Liviu
v1:
- make COHERENCY_FEATURES register read use cached gpu_info values.
- Added Mali-G2 name variants and NX aware model identification.
- fix premature reading of l2_features gpu_info field during panthor_hw_info_init().
- build as_present using GENMASK.
64-bit GPU_ID:
v3:
- Fix the missing blank line after declarations in GPU_ID decoding. v2:
- Picked up R-b from Liviu.
- Rename the register macro from GPU_WIDE_ID to GPU_ID_WIDE.
- Rename the uAPI field from gpu_wide_id to gpu_id_wide.
- Print the upper 32 bits of GPU_ID_WIDE as the logged 'id' for v15 and later GPUs. Keep the existing output for earlier GPUs. Continuation fix for previous sashiko comment.
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- Decode selected GPU_ID format after checking compatibility value.
- Document GPU_DISCOVER and GPU_CONTROL register offset differences between GPUs.
- Fix mask generation in panthor_gpu_discover_regs.h
drivers/gpu/drm/panthor/panthor_drv.c | 9 +- drivers/gpu/drm/panthor/panthor_fw.c | 1 + drivers/gpu/drm/panthor/panthor_gpu.c | 3 +- .../drm/panthor/panthor_gpu_discover_regs.h | 42 +++++ drivers/gpu/drm/panthor/panthor_heap.c | 3 +- drivers/gpu/drm/panthor/panthor_hw.c | 159 ++++++++++++++++-- drivers/gpu/drm/panthor/panthor_hw.h | 13 ++ include/uapi/drm/panthor_drm.h | 23 ++- 8 files changed, 230 insertions(+), 23 deletions(-) create mode 100644 drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
drivers/gpu/drm/panthor/panthor_drv.c +8 -1
@@ -1788,6 +1788,8 @@ static void panthor_debugfs_init(struct drm_minor *minor)* - 1.8 - extends DEV_QUERY_TIMESTAMP_INFO with flags * - 1.9 - adds DRM_PANTHOR_DEV_QUERY_MMU_INFO query * - adds DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE flag +* - 1.10 - adds thread_num_active_granularity, gpu_rev_wide, l2_features_wide, +* and gpu_id_wide to drm_panthor_gpu_info */ static const struct drm_driver panthor_drm_driver = { .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ |
@@ -1801,7 +1803,7 @@ static const struct drm_driver panthor_drm_driver = { .name = "panthor", .desc = "Panthor DRM driver", .major = 1, - .minor = 9, + .minor = 10, .gem_prime_import_sg_table = panthor_gem_prime_import_sg_table, .gem_prime_import = panthor_gem_prime_import,
@@ -1880,10 +1882,15 @@ static const struct panthor_soc_data soc_data_mediatek_mt8196 = { .asn_hash = { 0xb, 0xe, 0x0, }, }; +static const struct panthor_soc_data soc_data_gen5_am = { + .devfreq_disabled = true, +}; +static const struct of_device_id dt_match[] = { { .compatible ="mediatek,mt8196-mali" , .data = &soc_data_mediatek_mt8196, }, { .compatible ="rockchip,rk3588-mali" }, { .compatible ="arm,mali-valhall-csf" }, + { .compatible ="arm,mali-gen5-am" , .data = &soc_data_gen5_am, }, {} };MODULE_DEVICE_TABLE (of, dt_match);
drivers/gpu/drm/panthor/panthor_fw.c +1 -0
@@ -1563,3 +1563,4 @@ MODULE_FIRMWARE("arm/mali/arch11.8/mali_csffw.bin");MODULE_FIRMWARE ("arm/mali/arch12.8/mali_csffw.bin" );MODULE_FIRMWARE ("arm/mali/arch13.8/mali_csffw.bin" );MODULE_FIRMWARE ("arm/mali/arch14.8/mali_csffw.bin" ); +MODULE_FIRMWARE ("arm/mali/arch15.8/mali_csffw.bin" );
drivers/gpu/drm/panthor/panthor_gpu.c +1 -2
@@ -503,8 +503,7 @@ int panthor_gpu_coherency_init(struct panthor_device *ptdev)/* Check if the ACE-Lite coherency protocol is actually supported by the GPU. * ACE protocol has never been supported for command stream frontend GPUs. */ -if ((gpu_read (ptdev->gpu->iomem,GPU_COHERENCY_FEATURES ) & -GPU_COHERENCY_PROT_BIT (ACE_LITE ))) { +if ((ptdev->gpu_info.coherency_features &GPU_COHERENCY_PROT_BIT (ACE_LITE ))) { ptdev->gpu_info.selected_coherency =GPU_COHERENCY_ACE_LITE ;return 0 ; }
drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h new file +42 -0
42 lines not on this page · raw message
drivers/gpu/drm/panthor/panthor_heap.c +2 -1
@@ -11,6 +11,7 @@#include "panthor_gem.h" #include "panthor_gpu_regs.h" #include "panthor_heap.h" +#include "panthor_hw.h" #include "panthor_mmu.h" /*
@@ -105,7 +106,7 @@ struct panthor_heap_pool {static int panthor_heap_ctx_stride (struct panthor_device *ptdev) { -u32 l2_features = ptdev->gpu_info.l2_features; +u64 l2_features =panthor_hw_get_l2_features (ptdev);u32 gpu_cache_line_size =GPU_L2_FEATURES_LINE_SIZE (l2_features);return ALIGN (HEAP_CONTEXT_SIZE , gpu_cache_line_size);
drivers/gpu/drm/panthor/panthor_hw.c +142 -17
237 lines not on this page · raw message
drivers/gpu/drm/panthor/panthor_hw.h +13 -0
@@ -105,4 +105,17 @@ static inline bool panthor_hw_is_devfreq_disabled(struct panthor_device *ptdev) return data->devfreq_disabled; } +static inline bool panthor_hw_has_gpu_discover (struct panthor_device *ptdev) +{ +return ptdev->gpu_id.arch_major >=15 ; +} + +static inline u64 panthor_hw_get_l2_features (struct panthor_device *ptdev) +{ +if (panthor_hw_has_gpu_discover (ptdev)) +return ptdev->gpu_info.l2_features_wide; + +return ptdev->gpu_info.l2_features; +} +#endif /* __PANTHOR_HW_H__ */
include/uapi/drm/panthor_drm.h +21 -2
@@ -371,11 +371,30 @@ struct drm_panthor_gpu_info {/** @core_features: Used to discriminate core variants when they exist. */ __u32 core_features; -/** @pad: MBZ. */ -__u32 pad; +/** @thread_num_active_granularity: Granularity of number of active threads */ +__u32 thread_num_active_granularity;/** @gpu_features: Bitmask describing supported GPU-wide features */ __u64 gpu_features; + +/** +* @gpu_id_wide: 64-bit GPU ID for v15 and later GPUs. @gpu_id is 0 when +* this is populated. +*/ +__u64 gpu_id_wide; +#define DRM_PANTHOR_WIDE_ARCH_MAJOR (x) (((x) >> 56) & 0xff) +#define DRM_PANTHOR_WIDE_ARCH_MINOR (x) (((x) >> 48) & 0xff) +#define DRM_PANTHOR_WIDE_ARCH_REV (x) (((x) >> 40) & 0xff) +#define DRM_PANTHOR_WIDE_PRODUCT_MAJOR (x) (((x) >> 32) & 0xff) +#define DRM_PANTHOR_WIDE_VERSION_MAJOR (x) (((x) >> 16) & 0xff) +#define DRM_PANTHOR_WIDE_VERSION_MINOR (x) (((x) >> 8) & 0xff) +#define DRM_PANTHOR_WIDE_VERSION_STATUS (x) ((x) & 0xff) + +/** @gpu_rev_wide: 64-bit GPU revision for v15 onwards */ +__u64 gpu_rev_wide; + +/** @l2_features_wide: 64-bit L2_FEATURES for v15 onwards */ +__u64 l2_features_wide; };/**
Signature · 1 line
2.43.0
Re: [PATCH v5 9/9] drm/panthor: Add Mali v15 hardware support
Quoted 13 lines · Karunika Choo
Add the panthor hardware description for Mali v15 GPUs and hook it into device matching.
This includes the v15 register map and product identification needed to populate the GPU information exposed by the driver and its uAPI, as well as add compatibility string for v15 GPUs.
Mali v15 also exposes a 64-bit
GPU_IDregister with a different field layout from earlier GPUs. Add the register definitions and decoding helpers for the new format, readGPU_ID_WIDEwhen the compatibility value indicates a v15 GPU, and populate both the cachedGPU_IDfields and the uAPIgpu_id_widefield.
Quoted 4 lines
Bump drm minor to 10.
Reviewed-by Boris Brezillon <[email protected]>Signed-off-by Karunika Choo <[email protected]>
Best regards,
Liviu
Quoted 489 lines
---
v5:
- Picked up R-b from Boris.
v4:
- squashed 64-bitGPU_IDdecoding into this patch. Resetting R-bs as a result.
v2:
- checkas_countis non-zero before generatingas_presentmask per sashiko's comment.
- Link: https://lore.kernel.org/all/[email protected]/
- clean upl2_featuresvalue assignment.
- removed duplicatedGPU_FEATURESmacro definitions
- Picked up R-b from Liviu
v1:
- makeCOHERENCY_FEATURESregister read use cachedgpu_infovalues.
- Added Mali-G2 name variants and NX aware model identification.
- fix premature reading ofl2_featuresgpu_infofield duringpanthor_hw_info_init().
- buildas_presentusing GENMASK.64-bit
GPU_ID:
v3:
- Fix the missing blank line after declarations inGPU_IDdecoding. v2:
- Picked up R-b from Liviu.
- Rename the register macro fromGPU_WIDE_IDtoGPU_ID_WIDE.
- Rename the uAPI field fromgpu_wide_idtogpu_id_wide.
- Print the upper 32 bits ofGPU_ID_WIDEas the logged 'id' for v15 and later GPUs. Keep the existing output for earlier GPUs. Continuation fix for previous sashiko comment.
- Link: https://lore.kernel.org/all/[email protected]/
v1:
- Decode selectedGPU_IDformat after checking compatibility value.
- DocumentGPU_DISCOVERandGPU_CONTROLregister offset differences between GPUs.
- Fix mask generation inpanthor_gpu_discover_regs.hdrivers/gpu/drm/panthor/panthor_drv.c | 9 +- drivers/gpu/drm/panthor/panthor_fw.c | 1 + drivers/gpu/drm/panthor/panthor_gpu.c | 3 +- .../drm/panthor/panthor_gpu_discover_regs.h | 42 +++++ drivers/gpu/drm/panthor/panthor_heap.c | 3 +- drivers/gpu/drm/panthor/panthor_hw.c | 159 ++++++++++++++++-- drivers/gpu/drm/panthor/panthor_hw.h | 13 ++ include/uapi/drm/panthor_drm.h | 23 ++- 8 files changed, 230 insertions(+), 23 deletions(-) create mode 100644 drivers/gpu/drm/panthor/panthor_gpu_discover_regs.hdrivers/gpu/drm/panthor/panthor_drv.c +8
-1@@ -1788,6 +1788,8 @@ static void panthor_debugfs_init(struct drm_minor *minor)* - 1.8 - extends DEV_QUERY_TIMESTAMP_INFO with flags * - 1.9 - adds DRM_PANTHOR_DEV_QUERY_MMU_INFO query * - adds DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE flag +* - 1.10 - adds thread_num_active_granularity, gpu_rev_wide, l2_features_wide, +* and gpu_id_wide to drm_panthor_gpu_info */ static const struct drm_driver panthor_drm_driver = { .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ |@@ -1801,7 +1803,7 @@ static const struct drm_driver panthor_drm_driver = { .name = "panthor", .desc = "Panthor DRM driver", .major = 1, - .minor = 9, + .minor = 10, .gem_prime_import_sg_table = panthor_gem_prime_import_sg_table, .gem_prime_import = panthor_gem_prime_import,@@ -1880,10 +1882,15 @@ static const struct panthor_soc_data soc_data_mediatek_mt8196 = { .asn_hash = { 0xb, 0xe, 0x0, }, }; +static const struct panthor_soc_data soc_data_gen5_am = { + .devfreq_disabled = true, +}; +static const struct of_device_id dt_match[] = { { .compatible ="mediatek,mt8196-mali" , .data = &soc_data_mediatek_mt8196, }, { .compatible ="rockchip,rk3588-mali" }, { .compatible ="arm,mali-valhall-csf" }, + { .compatible ="arm,mali-gen5-am" , .data = &soc_data_gen5_am, }, {} };MODULE_DEVICE_TABLE (of, dt_match);drivers/gpu/drm/panthor/panthor_fw.c +1
-0@@ -1563,3 +1563,4 @@ MODULE_FIRMWARE("arm/mali/arch11.8/mali_csffw.bin");MODULE_FIRMWARE ("arm/mali/arch12.8/mali_csffw.bin" );MODULE_FIRMWARE ("arm/mali/arch13.8/mali_csffw.bin" );MODULE_FIRMWARE ("arm/mali/arch14.8/mali_csffw.bin" ); +MODULE_FIRMWARE ("arm/mali/arch15.8/mali_csffw.bin" );drivers/gpu/drm/panthor/panthor_gpu.c +1
-2@@ -503,8 +503,7 @@ int panthor_gpu_coherency_init(struct panthor_device *ptdev)/* Check if the ACE-Lite coherency protocol is actually supported by the GPU. * ACE protocol has never been supported for command stream frontend GPUs. */ -if ((gpu_read (ptdev->gpu->iomem,GPU_COHERENCY_FEATURES ) & -GPU_COHERENCY_PROT_BIT (ACE_LITE ))) { +if ((ptdev->gpu_info.coherency_features &GPU_COHERENCY_PROT_BIT (ACE_LITE ))) { ptdev->gpu_info.selected_coherency =GPU_COHERENCY_ACE_LITE ;return 0 ; }drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h new file +42
-0@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 or MIT */ +/* Copyright 2026 ARM Limited. All rights reserved. */ + +#ifndef __PANTHOR_GPU_DISCOVER_REGS_H__ +#define __PANTHOR_GPU_DISCOVER_REGS_H__ + +#include <linux/bits.h> + +#define GPU_ID_WIDE 0x0 +#define GPU_WIDE_COMPAT 0xF +#define GPU_WIDE_ARCH_MAJOR (x) (((x) & GENMASK_U64(63, 56)) >> 56) +#define GPU_WIDE_ARCH_MINOR (x) (((x) & GENMASK_U64(55, 48)) >> 48) +#define GPU_WIDE_ARCH_REV (x) (((x) & GENMASK_U64(47, 40)) >> 40) +#define GPU_WIDE_PROD_MAJOR (x) (((x) & GENMASK_U64(39, 32)) >> 32) +#define GPU_WIDE_VER_MAJOR (x) (((x) & GENMASK_U64(23, 16)) >> 16) +#define GPU_WIDE_VER_MINOR (x) (((x) & GENMASK_U64(15, 8)) >> 8) +#define GPU_WIDE_VER_STATUS (x) ((x) & GENMASK_U64(7, 0)) + +#define DISCOVER_REVIDR 0x8 +#define DISCOVER_GPU_FEATURES 0x20 +#define GPU_FEATURES_VARIABLE_RATE_SHADING BIT(0) +#define GPU_FEATURES_SIMD_STATE BIT(1) +#define GPU_FEATURES_CROSS_STREAM_SYNC BIT(3) +#define GPU_FEATURES_LD_LEA_TENSOR_INSTRUCTIONS BIT(6) +#define DISCOVER_MCU_FEATURES 0x40 +#define DISCOVER_PRFCNT_FEATURES 0x50 +#define PRFCNT_FEATURES_COUNTER_BLOCK_SIZE (x) (((x) & GENMASK(7, 0)) << 8) +#define DISCOVER_DOORBELL_FEATURES 0x60 +#define DISCOVER_MEM_FEATURES 0x100 +#define DISCOVER_MMU_FEATURES 0x108 +#define MMU_FEATURES_AS_COUNT (x) (((x) & GENMASK(23, 16)) >> 16) +#define DISCOVER_AMBA_FEATURES 0x120 + +#define DISCOVER_L2_FEATURES 0x128 +#define DISCOVER_TILER_FEATURES 0x200 +#define DISCOVER_CORE_FEATURES 0x300 +#define DISCOVER_THREAD_FEATURES 0x320 +#define DISCOVER_THREAD_MAX_THREADS 0x330 +#define DISCOVER_THREAD_NUM_ACTIVE_GRANULARITY 0x334 +#define DISCOVER_TEXTURE_FEATURES 0x360 + +#endif /* __PANTHOR_GPU_DISCOVER_REGS_H__ */ drivers/gpu/drm/panthor/panthor_heap.c +2
-1@@ -11,6 +11,7 @@#include "panthor_gem.h" #include "panthor_gpu_regs.h" #include "panthor_heap.h" +#include "panthor_hw.h" #include "panthor_mmu.h" /* @@ -105,7 +106,7 @@ struct panthor_heap_pool {static int panthor_heap_ctx_stride (struct panthor_device *ptdev) { -u32 l2_features = ptdev->gpu_info.l2_features; +u64 l2_features =panthor_hw_get_l2_features (ptdev);u32 gpu_cache_line_size =GPU_L2_FEATURES_LINE_SIZE (l2_features);return ALIGN (HEAP_CONTEXT_SIZE , gpu_cache_line_size);drivers/gpu/drm/panthor/panthor_hw.c +142
-17@@ -1,13 +1,16 @@// SPDX-License-Identifier: GPL-2.0 or MIT /* Copyright 2025 ARM Limited. All rights reserved. */ +#include <linux/bits.h> #include <linux/nvmem-consumer.h> #include <linux/platform_device.h> +#include <linux/wordpart.h> #include <drm/drm_print.h> #include "panthor_device.h" #include "panthor_gpu.h" +#include "panthor_gpu_discover_regs.h" #include "panthor_gpu_regs.h" #include "panthor_hw.h" #include "panthor_pwr.h" @@ -73,6 +76,29 @@ static struct panthor_hw panthor_hw_arch_v14 = { }, }; +static struct panthor_hw panthor_hw_arch_v15 = { + .ops = { + .soft_reset = panthor_pwr_reset_soft, + .l2_power_off = panthor_pwr_l2_power_off, + .l2_power_on = panthor_pwr_l2_power_on, + }, + .regs = { + .gpu_control = { + .offset =0x3000 , + }, + .mcu_control = { + .offset =0x3100 , + }, + .pwr_control = { + .offset =0x3800 , + }, + .mmu_as_control = { + .offset =0x2800 , + .stride =0x80 , + }, + }, +}; +static struct panthor_hw_entry panthor_hw_match[] = { { .arch_min =10 ,@@ -84,6 +110,11 @@ static struct panthor_hw_entry panthor_hw_match[] = { .arch_max = 14, .hwdev = &panthor_hw_arch_v14, }, + { + .arch_min = 15, + .arch_max = 15, + .hwdev = &panthor_hw_arch_v15, + } };static int panthor_hw_set_power_tracing (struct device *dev,void *data)@@ -151,8 +182,11 @@ static char *get_gpu_model_name(struct panthor_device *ptdev) gpu_id->prod_major);const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &GPU_FEATURES_RAY_INTERSECTION ); +const bool neural_present = !!(ptdev->gpu_info.gpu_features & +GPU_FEATURES_NX );const u8 shader_core_count =hweight64 (ptdev->gpu_info.shader_present); +switch (product_id) {case GPU_PROD_ID_MAKE (10 ,2 ):return "Mali-G710" ;@@ -195,6 +229,18 @@ static char *get_gpu_model_name(struct panthor_device *ptdev)return "Mali-G1-Premium" ;case GPU_PROD_ID_MAKE (14 ,3 ):return "Mali-G1-Pro" ; +case GPU_PROD_ID_MAKE (15 ,0 ): +return "Mali-G2-Ultra-NX" ; +case GPU_PROD_ID_MAKE (15 ,1 ): +if (neural_present) +return "Mali-G2-Premium-NX" ; + +return "Mali-G2-Premium" ; +case GPU_PROD_ID_MAKE (15 ,3 ): +if (neural_present) +return "Mali-G2-Pro-NX" ; + +return "Mali-G2-Pro" ; }return "(Unknown Mali GPU)" ;@@ -218,7 +264,7 @@ static int overload_shader_present(struct panthor_device *ptdev)return 0 ; } -static int panthor_gpu_info_init (struct panthor_device *ptdev) +static void panthor_gpu_info_v10_init (struct panthor_device *ptdev) {unsigned int i;@@ -259,31 +305,86 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev) ptdev->gpu_info.tiler_present =gpu_read64 (gpu_iomem,GPU_TILER_PRESENT ); ptdev->gpu_info.l2_present =gpu_read64 (gpu_iomem,GPU_L2_PRESENT ); } +} + +static void panthor_gpu_info_v15_init (struct panthor_device *ptdev) +{ +void __iomem *pwr_iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset; +u64 texture_features; +u32 as_count; + + ptdev->gpu_info.gpu_rev_wide =gpu_read64 (ptdev->iomem,DISCOVER_REVIDR ); + ptdev->gpu_info.l2_features_wide =gpu_read64 (ptdev->iomem,DISCOVER_L2_FEATURES ); + + texture_features =gpu_read64 (ptdev->iomem,DISCOVER_TEXTURE_FEATURES ); + ptdev->gpu_info.texture_features[0 ] =lower_32_bits (texture_features); + ptdev->gpu_info.texture_features[1 ] =upper_32_bits (texture_features); + + ptdev->gpu_info.thread_features =gpu_read (ptdev->iomem,DISCOVER_THREAD_FEATURES ); + ptdev->gpu_info.max_threads =gpu_read (ptdev->iomem,DISCOVER_THREAD_MAX_THREADS ); + ptdev->gpu_info.thread_num_active_granularity = +gpu_read (ptdev->iomem,DISCOVER_THREAD_NUM_ACTIVE_GRANULARITY ); + +/* The upper 32-bits of following registers do not contain any information (yet) */ + ptdev->gpu_info.gpu_features =gpu_read64 (ptdev->iomem,DISCOVER_GPU_FEATURES ); + ptdev->gpu_info.mem_features =gpu_read (ptdev->iomem,DISCOVER_MEM_FEATURES ); + ptdev->gpu_info.mmu_features =gpu_read (ptdev->iomem,DISCOVER_MMU_FEATURES ); + ptdev->gpu_info.coherency_features =gpu_read (ptdev->iomem,DISCOVER_AMBA_FEATURES ); + ptdev->gpu_info.tiler_features =gpu_read (ptdev->iomem,DISCOVER_TILER_FEATURES ); + ptdev->gpu_info.core_features =gpu_read (ptdev->iomem,DISCOVER_CORE_FEATURES ); + +/* AS_PRESENT register removed on v15+ create virtual mask from MMU_FEATURES.AS_COUNT */ + as_count =MMU_FEATURES_AS_COUNT (ptdev->gpu_info.mmu_features); +if (as_count) + ptdev->gpu_info.as_present =GENMASK (as_count -1 ,0 ); + + ptdev->gpu_info.l2_present =gpu_read64 (pwr_iomem,PWR_L2_PRESENT ); + ptdev->gpu_info.tiler_present =gpu_read64 (pwr_iomem,PWR_TILER_PRESENT ); + ptdev->gpu_info.shader_present =gpu_read64 (pwr_iomem,PWR_SHADER_PRESENT ); +} + +static int panthor_gpu_info_init (struct panthor_device *ptdev) +{ +if (panthor_hw_has_gpu_discover (ptdev)) +panthor_gpu_info_v15_init (ptdev); +else +panthor_gpu_info_v10_init (ptdev);return overload_shader_present (ptdev); }static int panthor_hw_info_init (struct panthor_device *ptdev) { -u32 major, minor, status; +u64 l2_features; +u32 prod_id, major, minor, status;int ret; ret =panthor_gpu_info_init (ptdev);if (ret)return ret; +/* +* The logged 'id' contains four 4-bit architecture and product fields +* in pre-v15 GPUs. In v15+ GPUs, this is now four 8-bit fields. +* Preserve the pre-v15 format for compatibility. Tools decoding these +* fields must handle the wider format for v15+ GPUs. +*/ +if (ptdev->gpu_id.arch_major <15 ) + prod_id =upper_16_bits (ptdev->gpu_info.gpu_id); +else + prod_id =upper_32_bits (ptdev->gpu_info.gpu_id_wide); + major = ptdev->gpu_id.ver_major; minor = ptdev->gpu_id.ver_minor; status = ptdev->gpu_id.ver_status; + l2_features =panthor_hw_get_l2_features (ptdev); -drm_info (&ptdev->base, -"%s id 0x%x major 0x%x minor 0x%x status 0x%x" , -get_gpu_model_name (ptdev), ptdev->gpu_info.gpu_id >>16 , - major, minor, status); +drm_info (&ptdev->base,"%s id 0x%x major 0x%x minor 0x%x status 0x%x" , +get_gpu_model_name (ptdev), prod_id, major, minor, status); drm_info(&ptdev->base, - "Features: L2:%#x Tiler:%#x Mem:%#x MMU:%#x AS:%#x", - ptdev->gpu_info.l2_features, + "Features: L2:%#llx Tiler:%#x Mem:%#x MMU:%#x AS:%#x", + l2_features, ptdev->gpu_info.tiler_features, ptdev->gpu_info.mem_features, ptdev->gpu_info.mmu_features,@@ -323,18 +424,42 @@ static int panthor_hw_bind_device(struct panthor_device *ptdev)static int panthor_hw_gpu_id_init (struct panthor_device *ptdev) {struct panthor_gpu_id *gpu_id = &ptdev->gpu_id; - ptdev->gpu_info.gpu_id =gpu_read (ptdev->iomem,GPU_ID ); +u32 gpu_id32 =gpu_read (ptdev->iomem,GPU_ID ); -if (!ptdev->gpu_info.gpu_id) +if (!gpu_id32)return -ENXIO ; - gpu_id->arch_major =GPU_ARCH_MAJOR (ptdev->gpu_info.gpu_id); - gpu_id->arch_minor =GPU_ARCH_MINOR (ptdev->gpu_info.gpu_id); - gpu_id->arch_rev =GPU_ARCH_REV (ptdev->gpu_info.gpu_id); - gpu_id->prod_major =GPU_PROD_MAJOR (ptdev->gpu_info.gpu_id); - gpu_id->ver_major =GPU_VER_MAJOR (ptdev->gpu_info.gpu_id); - gpu_id->ver_minor =GPU_VER_MINOR (ptdev->gpu_info.gpu_id); - gpu_id->ver_status =GPU_VER_STATUS (ptdev->gpu_info.gpu_id); +if (GPU_ARCH_MAJOR (gpu_id32) ==GPU_WIDE_COMPAT ) { +/* +* GPU_DISCOVER register block always starts at offset zero, +* so does the GPU_CONTROL register block on pre-v15 GPUs. +*/ +void __iomem *discover = ptdev->iomem; +u64 gpu_id64 =gpu_read64 (discover,GPU_ID_WIDE ); + +if (!gpu_id64) +return -ENXIO ; + + ptdev->gpu_info.gpu_id_wide = gpu_id64; + + gpu_id->arch_major =GPU_WIDE_ARCH_MAJOR (gpu_id64); + gpu_id->arch_minor =GPU_WIDE_ARCH_MINOR (gpu_id64); + gpu_id->arch_rev =GPU_WIDE_ARCH_REV (gpu_id64); + gpu_id->prod_major =GPU_WIDE_PROD_MAJOR (gpu_id64); + gpu_id->ver_major =GPU_WIDE_VER_MAJOR (gpu_id64); + gpu_id->ver_minor =GPU_WIDE_VER_MINOR (gpu_id64); + gpu_id->ver_status =GPU_WIDE_VER_STATUS (gpu_id64); + }else { + ptdev->gpu_info.gpu_id = gpu_id32; + + gpu_id->arch_major =GPU_ARCH_MAJOR (gpu_id32); + gpu_id->arch_minor =GPU_ARCH_MINOR (gpu_id32); + gpu_id->arch_rev =GPU_ARCH_REV (gpu_id32); + gpu_id->prod_major =GPU_PROD_MAJOR (gpu_id32); + gpu_id->ver_major =GPU_VER_MAJOR (gpu_id32); + gpu_id->ver_minor =GPU_VER_MINOR (gpu_id32); + gpu_id->ver_status =GPU_VER_STATUS (gpu_id32); + }return 0 ; }drivers/gpu/drm/panthor/panthor_hw.h +13
-0@@ -105,4 +105,17 @@ static inline bool panthor_hw_is_devfreq_disabled(struct panthor_device *ptdev) return data->devfreq_disabled; } +static inline bool panthor_hw_has_gpu_discover (struct panthor_device *ptdev) +{ +return ptdev->gpu_id.arch_major >=15 ; +} + +static inline u64 panthor_hw_get_l2_features (struct panthor_device *ptdev) +{ +if (panthor_hw_has_gpu_discover (ptdev)) +return ptdev->gpu_info.l2_features_wide; + +return ptdev->gpu_info.l2_features; +} +#endif /* __PANTHOR_HW_H__ */ include/uapi/drm/panthor_drm.h +21
-2@@ -371,11 +371,30 @@ struct drm_panthor_gpu_info {/** @core_features: Used to discriminate core variants when they exist. */ __u32 core_features; -/** @pad: MBZ. */ -__u32 pad; +/** @thread_num_active_granularity: Granularity of number of active threads */ +__u32 thread_num_active_granularity;/** @gpu_features: Bitmask describing supported GPU-wide features */ __u64 gpu_features; + +/** +* @gpu_id_wide: 64-bit GPU ID for v15 and later GPUs. @gpu_id is 0 when +* this is populated. +*/ +__u64 gpu_id_wide; +#define DRM_PANTHOR_WIDE_ARCH_MAJOR (x) (((x) >> 56) & 0xff) +#define DRM_PANTHOR_WIDE_ARCH_MINOR (x) (((x) >> 48) & 0xff) +#define DRM_PANTHOR_WIDE_ARCH_REV (x) (((x) >> 40) & 0xff) +#define DRM_PANTHOR_WIDE_PRODUCT_MAJOR (x) (((x) >> 32) & 0xff) +#define DRM_PANTHOR_WIDE_VERSION_MAJOR (x) (((x) >> 16) & 0xff) +#define DRM_PANTHOR_WIDE_VERSION_MINOR (x) (((x) >> 8) & 0xff) +#define DRM_PANTHOR_WIDE_VERSION_STATUS (x) ((x) & 0xff) + +/** @gpu_rev_wide: 64-bit GPU revision for v15 onwards */ +__u64 gpu_rev_wide; + +/** @l2_features_wide: 64-bit L2_FEATURES for v15 onwards */ +__u64 l2_features_wide; };/** Signature · 1 line
2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Quoted 8 lines · Karunika Choo
This series extracts the initial hardware support from the previously posted Mali v15 virtualization series. The remaining virtualization support will follow separately.
v5:
- Collect R-bs from Boris.
- Removed unused DT properties.
- Link to v4: https://lore.kernel.org/all/[email protected]/
Pushed to drm-misc-next.
Best regards,
Liviu
Quoted 62 lines
v4:
- Collect R-bs from Liviu and Boris
- Squashed 64-bitGPU_IDdecoding [PATCH v3 05/10] into v15 enablement [PATCH v3 09/10].
- Defineddevfreq_disabledflagpanthor_soc_datato disable devfreq
if it is set.
- Link to v3: https://lore.kernel.org/all/[email protected]/
v3:
- Split out the initial Mali v15 support into a standalone series,
leaving virtualization and arbitration support for a follow-up.
- Rebased on drm-misc-next (fb191ef626555)
- Drop the $nodename constraint from the AM GPU binding.
- Require the arm,zena-css-mali integration compatible followed by
the arm,mali-gen5-am fallback.
- Update the binding example to use the new compatible, three-cell interrupt specifiers, and a single GPU clock.
- Omit drm-maxfreq-panthor from fdinfo when the maximum frequency
is unknown, as on AM systems without an OPP table.
- Fix the missing blank line after declarations inGPU_IDdecoding.
- Link to v2: https://lore.kernel.org/all/[email protected]/Kind regards,
KarunikaKarunika Choo (9):
drm/panthor: Ignore-EOPNOTSUPPfor shader-present nvmem lookup drm/panthor: Rename neural accelerator feature macro to NX drm/panthor: Move register access helpers out ofpanthor_device.hdrm/panthor: Parse and storeGPU_IDfields
drm/panthor: Move register base offsets to the HW description drm/panthor: Derive MMU AS register addresses from base and stride drm/panthor: Skip devfreq when explicitly disabled
dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema drm/panthor: Add Mali v15 hardware support.../bindings/gpu/arm,mali-gen5-am.yaml | 63 ++++++ MAINTAINERS | 1 + drivers/gpu/drm/panthor/panthor_devfreq.c | 9 +- drivers/gpu/drm/panthor/panthor_device.h | 105 +++------ drivers/gpu/drm/panthor/panthor_device_io.h | 84 ++++++++ drivers/gpu/drm/panthor/panthor_drv.c | 14 +- drivers/gpu/drm/panthor/panthor_fw.c | 7 +- drivers/gpu/drm/panthor/panthor_fw_regs.h | 2 - drivers/gpu/drm/panthor/panthor_gpu.c | 9 +- .../drm/panthor/panthor_gpu_discover_regs.h | 42 ++++ drivers/gpu/drm/panthor/panthor_gpu_regs.h | 4 +- drivers/gpu/drm/panthor/panthor_heap.c | 3 +- drivers/gpu/drm/panthor/panthor_hw.c | 202 ++++++++++++++++-- drivers/gpu/drm/panthor/panthor_hw.h | 61 +++++- drivers/gpu/drm/panthor/panthor_mmu.c | 47 ++-- drivers/gpu/drm/panthor/panthor_mmu_regs.h | 23 +- drivers/gpu/drm/panthor/panthor_pwr.c | 2 +- drivers/gpu/drm/panthor/panthor_pwr_regs.h | 2 - include/uapi/drm/panthor_drm.h | 23 +- 19 files changed, 554 insertions(+), 149 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml create mode 100644 drivers/gpu/drm/panthor/panthor_device_io.h create mode 100644 drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h--
2.43.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯