mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
Mali GPUs have three registers that indicate which parts of the hardware are powered at any moment. These take the form of bitmaps. In the case of SHADER_READY for example, a high bit indicates that the shader core corresponding to that bit index is powered on. These bitmaps aren't solely contiguous bits, as it's common to have holes in the sequence of shader core indices, and the actual set of which cores are present is defined by the "shader present" register. When the GPU finishes a power state transition, it fires a GPU_IRQ_POWER_CHANGED_ALL interrupt. After such an interrupt is received, the _READY registers will contain new interesting data. During power transitions, the GPU_IRQ_POWER_CHANGED interrupt will fire, and the registers will likewise contain potentially changed data. This is not to be confused with the PWR_IRQ_POWER_CHANGED_ALL interrupt, which is something related to Mali v14+'s power control logic. The _READY registers and corresponding interrupts are already available in v9 and onwards. Expose the data as a tracepoint to userspace. This allows users to debug various scenarios and gather interesting information, such as: knowing how much hardware is lit up at any given time, correlating graphics corruption with a specific powered shader core, measuring when hardware is allowed to go to a powered off state again, and so on. The registration/unregistration functions for the tracepoint go through a wrapper in panthor_hw.c, so that v14+ can implement the same tracepoint by adding its hardware specific IRQ on/off callbacks to the panthor_hw.ops member. Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://patch.msgid.link/20260116-panthor-tracepoints-v10-3-d925986e3d1b@collabora.com Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
58 lines
1.8 KiB
C
58 lines
1.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 or MIT */
|
|
/* Copyright 2018 Marty E. Plummer <hanetzer@startmail.com> */
|
|
/* Copyright 2019 Collabora ltd. */
|
|
|
|
#ifndef __PANTHOR_GPU_H__
|
|
#define __PANTHOR_GPU_H__
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct panthor_device;
|
|
|
|
int panthor_gpu_init(struct panthor_device *ptdev);
|
|
void panthor_gpu_unplug(struct panthor_device *ptdev);
|
|
void panthor_gpu_suspend(struct panthor_device *ptdev);
|
|
void panthor_gpu_resume(struct panthor_device *ptdev);
|
|
|
|
int panthor_gpu_block_power_on(struct panthor_device *ptdev,
|
|
const char *blk_name,
|
|
u32 pwron_reg, u32 pwrtrans_reg,
|
|
u32 rdy_reg, u64 mask, u32 timeout_us);
|
|
int panthor_gpu_block_power_off(struct panthor_device *ptdev,
|
|
const char *blk_name,
|
|
u32 pwroff_reg, u32 pwrtrans_reg,
|
|
u64 mask, u32 timeout_us);
|
|
|
|
/**
|
|
* panthor_gpu_power_on() - Power on the GPU block.
|
|
*
|
|
* Return: 0 on success, a negative error code otherwise.
|
|
*/
|
|
#define panthor_gpu_power_on(ptdev, type, mask, timeout_us) \
|
|
panthor_gpu_block_power_on(ptdev, #type, \
|
|
type ## _PWRON, \
|
|
type ## _PWRTRANS, \
|
|
type ## _READY, \
|
|
mask, timeout_us)
|
|
|
|
/**
|
|
* panthor_gpu_power_off() - Power off the GPU block.
|
|
*
|
|
* Return: 0 on success, a negative error code otherwise.
|
|
*/
|
|
#define panthor_gpu_power_off(ptdev, type, mask, timeout_us) \
|
|
panthor_gpu_block_power_off(ptdev, #type, \
|
|
type ## _PWROFF, \
|
|
type ## _PWRTRANS, \
|
|
mask, timeout_us)
|
|
|
|
void panthor_gpu_l2_power_off(struct panthor_device *ptdev);
|
|
int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
|
|
int panthor_gpu_flush_caches(struct panthor_device *ptdev,
|
|
u32 l2, u32 lsc, u32 other);
|
|
int panthor_gpu_soft_reset(struct panthor_device *ptdev);
|
|
void panthor_gpu_power_changed_off(struct panthor_device *ptdev);
|
|
int panthor_gpu_power_changed_on(struct panthor_device *ptdev);
|
|
|
|
#endif
|