Re: [PATCH 3/4] drm/panfrost: only put powered shader cores in the job affinity
From: Steven Price
Date: Mon Nov 23 2026 - 10:38:13 EST
On 06/11/2026 05:41, Young-Jun Hong wrote:
> On GPUs with more than one L2 (core group), panfrost powers only the
> first core group (panfrost_get_core_mask()), but the job affinity is
> written from shader_present, i.e. it also names the cores of the second,
> unpowered group (Mali-T628 MP6 on Exynos 5422: l2_present 0x11, 4+2
> cores, affinity 0x3f while only 0x0f is powered).
>
> Write the affinity from the same mask that was powered, so a job never
> names cores that are off.
>
> Tested on Samsung ARTIK 10 (Exynos 5422), Mali-T628 MP6.
>
> The analysis, the code and this changelog were produced with Claude
> Code (Anthropic), a coding assistant.
>
> Fixes: 6e55d273708b ("drm/panfrost: initial dual core group GPUs support")
> Signed-off-by: Young-Jun Hong <nirvanah@xxxxxxxxxxxxxx>
So this patch might be a valid fix. But:
a) It's AI generated and I'm not sure whether any human thought has gone
into it.
b) The next patch in the series basically undoes the change.
The T628 is an awkward beast because it has these two (non-coherent)
core groups. So far there hasn't been much appetite for trying to
support it well because it's pretty rare and AFAIK it's the only GPU
which has this setup.
My own understanding is that this patch is also irrelevant in that the
GPU hardware will effectively AND the affinity with the powered on
shaders. Hence I'd want to see an actual user report (not an AI-report)
that this "fix" actually helps. Sadly I don't have hardware to test this.
Thanks,
Steve
> ---
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 6 ++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.h | 1 +
> drivers/gpu/drm/panfrost/panfrost_job.c | 2 +-
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index 6081b27829e1..420d224276a5 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -452,6 +452,12 @@ static u64 panfrost_get_core_mask(struct panfrost_device *pfdev)
> return core_mask;
> }
>
> +/* cores that panfrost_gpu_power_on() powers */
> +u64 panfrost_powered_core_mask(struct panfrost_device *pfdev)
> +{
> + return pfdev->features.shader_present & panfrost_get_core_mask(pfdev);
> +}
> +
> void panfrost_gpu_power_on(struct panfrost_device *pfdev)
> {
> int ret;
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.h b/drivers/gpu/drm/panfrost/panfrost_gpu.h
> index b4fef11211d5..78a6270b7fcb 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.h
> @@ -13,6 +13,7 @@ void panfrost_gpu_fini(struct panfrost_device *pfdev);
> u32 panfrost_gpu_get_latest_flush_id(struct panfrost_device *pfdev);
>
> int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);
> +u64 panfrost_powered_core_mask(struct panfrost_device *pfdev);
> void panfrost_gpu_power_on(struct panfrost_device *pfdev);
> void panfrost_gpu_power_off(struct panfrost_device *pfdev);
> void panfrost_gpu_suspend_irq(struct panfrost_device *pfdev);
> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 4ddf4b722ddf..33da86587db7 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -143,7 +143,7 @@ static void panfrost_job_write_affinity(struct panfrost_device *pfdev,
> * Eventually we may need to support tiler only jobs and h/w with
> * multiple (2) coherent core groups
> */
> - affinity = pfdev->features.shader_present;
> + affinity = panfrost_powered_core_mask(pfdev);
>
> job_write(pfdev, JS_AFFINITY_NEXT_LO(js), lower_32_bits(affinity));
> job_write(pfdev, JS_AFFINITY_NEXT_HI(js), upper_32_bits(affinity));