From 1f7f70e4c1779f417fa32a0795398854ab8cde25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 1/9] drm/imagination: apple: Size an S8003 dataset's free list by its initial pages On the iPad 5, vkCreateDevice() fails with VK_ERROR_INITIALIZATION_FAILED. CREATE_HWRT_DATASET returns -EINVAL without a log line when Mesa creates the dummy render target used during device creation. The A9 allocates the parameter manager's pages itself. Its free list is not grown by pvr_free_list_create(), so current_pages stays zero, but hwrt_init_kernel_structure() still checks it against the minimum. For chips with own_pm_pages, check initial_num_pages instead. This is the limit used to size the S8003 parameter manager's render blocks. Affects the Apple A9 (S8003). The A10 is unchanged. Assisted-by: LLM --- ...apple-Size-an-S8003-dataset-s-free-l.patch | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0026-drm-imagination-apple-Size-an-S8003-dataset-s-free-l.patch diff --git a/kernel/patches/drivers/gpu/0026-drm-imagination-apple-Size-an-S8003-dataset-s-free-l.patch b/kernel/patches/drivers/gpu/0026-drm-imagination-apple-Size-an-S8003-dataset-s-free-l.patch new file mode 100644 index 00000000..3f9cc12a --- /dev/null +++ b/kernel/patches/drivers/gpu/0026-drm-imagination-apple-Size-an-S8003-dataset-s-free-l.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 12:45:47 +0100 +Subject: [PATCH] drm/imagination: apple: Size an S8003 dataset's free list by + its initial pages + +On the iPad 5, vkCreateDevice() fails with VK_ERROR_INITIALIZATION_FAILED. +CREATE_HWRT_DATASET returns -EINVAL without a log line when Mesa creates +the dummy render target used during device creation. + +The A9 allocates the parameter manager's pages itself. Its free list is +not grown by pvr_free_list_create(), so current_pages stays zero, but +hwrt_init_kernel_structure() still checks it against the minimum. + +For chips with own_pm_pages, check initial_num_pages instead. This is +the limit used to size the S8003 parameter manager's render blocks. + +Affects the Apple A9 (S8003). The A10 is unchanged. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_hwrt.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_hwrt.c b/drivers/gpu/drm/imagination/pvr_hwrt.c +index ec50237..dd91ed9 100644 +--- a/drivers/gpu/drm/imagination/pvr_hwrt.c ++++ b/drivers/gpu/drm/imagination/pvr_hwrt.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0-only OR MIT + /* Copyright (c) 2023 Imagination Technologies Ltd. */ + ++#include "pvr_apple.h" + #include "pvr_free_list.h" + #include "pvr_hwrt.h" + #include "pvr_gem.h" +@@ -45,6 +46,7 @@ hwrt_init_kernel_structure(struct pvr_file *pvr_file, + struct pvr_hwrt_dataset *hwrt) + { + struct pvr_device *pvr_dev = pvr_file->pvr_dev; ++ u32 local_pages; + int err; + + hwrt->pvr_dev = pvr_dev; +@@ -62,8 +64,16 @@ hwrt_init_kernel_structure(struct pvr_file *pvr_file, + } + } + +- if (hwrt->free_lists[ROGUE_FW_LOCAL_FREELIST]->current_pages < +- pvr_get_free_list_min_pages(pvr_dev)) { ++ /* ++ * On a chip that allocates the parameter manager's pages itself, a ++ * free list never holds pages (pvr_apple_free_list_has_pages()); its ++ * initial size is how many a render may take. ++ */ ++ local_pages = hwrt->free_lists[ROGUE_FW_LOCAL_FREELIST]->current_pages; ++ if (pvr_device_is_apple(pvr_dev) && !pvr_apple_free_list_has_pages(pvr_dev)) ++ local_pages = hwrt->free_lists[ROGUE_FW_LOCAL_FREELIST]->initial_num_pages; ++ ++ if (local_pages < pvr_get_free_list_min_pages(pvr_dev)) { + err = -EINVAL; + goto err_put_free_lists; + } + From 81b5e548f9a30fc69500a19325729fe6840a3990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 2/9] drm/imagination: Don't free a job's command twice when its stream is rejected After a rejected command stream on the iPad 5, the next exec in another process oopses in free_bprm with a bad rss-counter. slub_debug reports "Object already free" on kmalloc-512: the object was allocated and freed in pvr_fw_cmd_init(), then freed again from pvr_job_put(). When stream parsing fails, pvr_job_process_stream() frees the command. The caller then releases the job, whose release path frees it again. Clear the command pointer and length after freeing the rejected command. Upstream has the same code. Affects every PowerVR device. Fixes: eaf01ee5ba28 ("drm/imagination: Implement job submission and scheduling") Assisted-by: LLM --- ...Don-t-free-a-job-s-command-twice-whe.patch | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0027-drm-imagination-Don-t-free-a-job-s-command-twice-whe.patch diff --git a/kernel/patches/drivers/gpu/0027-drm-imagination-Don-t-free-a-job-s-command-twice-whe.patch b/kernel/patches/drivers/gpu/0027-drm-imagination-Don-t-free-a-job-s-command-twice-whe.patch new file mode 100644 index 00000000..a69f3590 --- /dev/null +++ b/kernel/patches/drivers/gpu/0027-drm-imagination-Don-t-free-a-job-s-command-twice-whe.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 18:28:34 +0100 +Subject: [PATCH] drm/imagination: Don't free a job's command twice when its + stream is rejected + +After a rejected command stream on the iPad 5, the next exec in another +process oopses in free_bprm with a bad rss-counter. slub_debug reports +"Object already free" on kmalloc-512: the object was allocated and freed +in pvr_fw_cmd_init(), then freed again from pvr_job_put(). + +When stream parsing fails, pvr_job_process_stream() frees the command. +The caller then releases the job, whose release path frees it again. +Clear the command pointer and length after freeing the rejected command. + +Upstream has the same code. Affects every PowerVR device. + +Fixes: eaf01ee5ba28 ("drm/imagination: Implement job submission and scheduling") + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_job.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_job.c b/drivers/gpu/drm/imagination/pvr_job.c +index 95c5d2e..48a1cbc 100644 +--- a/drivers/gpu/drm/imagination/pvr_job.c ++++ b/drivers/gpu/drm/imagination/pvr_job.c +@@ -79,8 +79,11 @@ pvr_job_process_stream(struct pvr_device *pvr_dev, const struct pvr_stream_cmd_d + job->cmd_len = cmd_defs->dest_size; + + err = pvr_stream_process(pvr_dev, cmd_defs, stream, stream_size, job->cmd); +- if (err) ++ if (err) { + kfree(job->cmd); ++ job->cmd = NULL; ++ job->cmd_len = 0; ++ } + + return err; + } + From 3002362ee59b257841bc40095194b4b99543a762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 3/9] drm/imagination: apple: Require each chip's own register extension Every geometry and fragment job on the iPad 5 is refused with -EINVAL, without a log line. The stream parser requires the A10's type-1 register extension on every Apple chip, while the A9 supplies its registers in extension type 2. Put each chip's required extension type and mask beside its stream definitions and obtain them through an Apple accessor. Keep the A10's values and leave compute without an Apple must-have entry. Affects the Apple A9 (S8003). The A10's validation values are unchanged. Assisted-by: LLM --- ...apple-Require-each-chip-s-own-regist.patch | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0028-drm-imagination-apple-Require-each-chip-s-own-regist.patch diff --git a/kernel/patches/drivers/gpu/0028-drm-imagination-apple-Require-each-chip-s-own-regist.patch b/kernel/patches/drivers/gpu/0028-drm-imagination-apple-Require-each-chip-s-own-regist.patch new file mode 100644 index 00000000..360aad59 --- /dev/null +++ b/kernel/patches/drivers/gpu/0028-drm-imagination-apple-Require-each-chip-s-own-regist.patch @@ -0,0 +1,181 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 18:28:34 +0100 +Subject: [PATCH] drm/imagination: apple: Require each chip's own register + extension + +Every geometry and fragment job on the iPad 5 is refused with -EINVAL, +without a log line. The stream parser requires the A10's type-1 register +extension on every Apple chip, while the A9 supplies its registers in +extension type 2. + +Put each chip's required extension type and mask beside its stream +definitions and obtain them through an Apple accessor. Keep the A10's +values and leave compute without an Apple must-have entry. + +Affects the Apple A9 (S8003). The A10's validation values are unchanged. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_apple.c | 26 +++++++++++++++++++ + drivers/gpu/drm/imagination/pvr_apple.h | 9 +++++++ + drivers/gpu/drm/imagination/pvr_apple_chip.h | 8 ++++++ + drivers/gpu/drm/imagination/pvr_apple_s8003.c | 4 +++ + drivers/gpu/drm/imagination/pvr_apple_t8010.c | 4 +++ + drivers/gpu/drm/imagination/pvr_stream.c | 11 +++++--- + 6 files changed, 58 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_apple.c b/drivers/gpu/drm/imagination/pvr_apple.c +index e147626..b0505a2 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple.c ++++ b/drivers/gpu/drm/imagination/pvr_apple.c +@@ -1636,3 +1636,29 @@ const struct pvr_stream_cmd_defs *pvr_apple_cmd_stream(struct pvr_device *pvr_de + return chip->compute_stream ?: &pvr_cmd_compute_stream; + return type == DRM_PVR_JOB_TYPE_GEOMETRY ? chip->geom_stream : chip->frag_stream; + } ++ ++/** ++ * pvr_apple_stream_musthave() - Required register extension for a chip's stream ++ * @pvr_dev: Target device. ++ * @type: Geometry or fragment stream type. ++ * @ext_type: Extension header type to which the returned mask applies. ++ * ++ * Return: the chip's required register bits, or zero for other stream types. ++ */ ++u32 pvr_apple_stream_musthave(struct pvr_device *pvr_dev, enum pvr_stream_type type, ++ u32 *ext_type) ++{ ++ const struct pvr_apple_chip *chip = pvr_dev->device_data->apple_chip; ++ ++ if (type == PVR_STREAM_TYPE_GEOM) { ++ *ext_type = chip->geom_ext_type; ++ return chip->geom_ext_mask; ++ } ++ if (type == PVR_STREAM_TYPE_FRAG) { ++ *ext_type = chip->frag_ext_type; ++ return chip->frag_ext_mask; ++ } ++ ++ *ext_type = 0; ++ return 0; ++} +diff --git a/drivers/gpu/drm/imagination/pvr_apple.h b/drivers/gpu/drm/imagination/pvr_apple.h +index cdc8e96..d1de0ad 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple.h ++++ b/drivers/gpu/drm/imagination/pvr_apple.h +@@ -10,6 +10,7 @@ + #include + + #include "pvr_rogue_fwif_client.h" ++#include "pvr_stream.h" + + struct dma_fence; + struct pvr_apple_chip; +@@ -167,6 +168,8 @@ int pvr_apple_resume(struct pvr_device *pvr_dev); + void pvr_apple_device_info_init(struct pvr_device *pvr_dev); + bool pvr_apple_takes_jobs(struct pvr_device *pvr_dev); + bool pvr_apple_free_list_has_pages(struct pvr_device *pvr_dev); ++u32 pvr_apple_stream_musthave(struct pvr_device *pvr_dev, enum pvr_stream_type type, ++ u32 *ext_type); + struct dma_fence *pvr_apple_submit_job(struct pvr_job *job); + struct dma_fence *pvr_apple_submit_compute_job(struct pvr_device *pvr_dev, + struct pvr_vm_context *vm_ctx, u64 stream, +@@ -200,6 +203,12 @@ static inline int pvr_apple_resume(struct pvr_device *pvr_dev) { return 0; } + static inline void pvr_apple_device_info_init(struct pvr_device *pvr_dev) {} + static inline bool pvr_apple_takes_jobs(struct pvr_device *pvr_dev) { return false; } + static inline bool pvr_apple_free_list_has_pages(struct pvr_device *pvr_dev) { return true; } ++static inline u32 pvr_apple_stream_musthave(struct pvr_device *pvr_dev, ++ enum pvr_stream_type type, u32 *ext_type) ++{ ++ *ext_type = 0; ++ return 0; ++} + static inline int pvr_apple_vm_init(struct pvr_device *pvr_dev, struct pvr_vm_context *vm_ctx) + { + return -ENODEV; +diff --git a/drivers/gpu/drm/imagination/pvr_apple_chip.h b/drivers/gpu/drm/imagination/pvr_apple_chip.h +index 201d72a..d524415 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_chip.h ++++ b/drivers/gpu/drm/imagination/pvr_apple_chip.h +@@ -164,6 +164,10 @@ struct pvr_apple { + * @render_job_size: Bytes @prepare_geom and @prepare_frag fill. + * @geom_stream: How a geometry job's command stream from userspace is decoded. + * @frag_stream: The same for a fragment job. ++ * @geom_ext_type: Required geometry register extension header type. ++ * @geom_ext_mask: Required bits within that geometry extension header. ++ * @frag_ext_type: Required fragment register extension header type. ++ * @frag_ext_mask: Required bits within that fragment extension header. + * @init: At probe, with Fender mapped: map and allocate what the chip needs, + * load the firmware (pvr_apple_fw_load()), set &pvr_apple.heap, + * &pvr_apple.layout and &pvr_apple.chip_data. Device-managed. +@@ -238,6 +242,10 @@ struct pvr_apple_chip { + size_t render_job_size; + const struct pvr_stream_cmd_defs *geom_stream; + const struct pvr_stream_cmd_defs *frag_stream; ++ u32 geom_ext_type; ++ u32 geom_ext_mask; ++ u32 frag_ext_type; ++ u32 frag_ext_mask; + const struct pvr_stream_cmd_defs *compute_stream; + unsigned int scenes; + bool own_pm_pages; +diff --git a/drivers/gpu/drm/imagination/pvr_apple_s8003.c b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +index 468dd71..8115176 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_s8003.c ++++ b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +@@ -2550,6 +2550,10 @@ const struct pvr_apple_chip pvr_apple_chip_s8003 = { + .perf_state_max = S8003_PERF_STATE_MAX, + .geom_stream = &pvr_apple_g5p_cmd_geom_stream, + .frag_stream = &pvr_apple_g5p_cmd_frag_stream, ++ .geom_ext_type = PVR_STREAM_EXTHDR_TYPE_GEOM_G5P, ++ .geom_ext_mask = PVR_STREAM_EXTHDR_GEOM_G5P_REGS, ++ .frag_ext_type = PVR_STREAM_EXTHDR_TYPE_FRAG_G5P, ++ .frag_ext_mask = PVR_STREAM_EXTHDR_FRAG_G5P_REGS, + .compute_stream = &pvr_apple_g5p_cmd_compute_stream, + .scenes = 2, + .own_pm_pages = true, +diff --git a/drivers/gpu/drm/imagination/pvr_apple_t8010.c b/drivers/gpu/drm/imagination/pvr_apple_t8010.c +index f3ee833..5c62c13 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_t8010.c ++++ b/drivers/gpu/drm/imagination/pvr_apple_t8010.c +@@ -461,6 +461,10 @@ const struct pvr_apple_chip pvr_apple_chip_t8010 = { + .render_job_size = sizeof(union pvr_apple_t8010_render_job), + .geom_stream = &pvr_apple_cmd_geom_stream, + .frag_stream = &pvr_apple_cmd_frag_stream, ++ .geom_ext_type = PVR_STREAM_EXTHDR_TYPE_GEOM_APPLE, ++ .geom_ext_mask = PVR_STREAM_EXTHDR_GEOM_APPLE_REGS, ++ .frag_ext_type = PVR_STREAM_EXTHDR_TYPE_FRAG_APPLE, ++ .frag_ext_mask = PVR_STREAM_EXTHDR_FRAG_APPLE_REGS, + .init = pvr_apple_t8010_init, + .boot = pvr_apple_t8010_boot, + .start = pvr_apple_t8010_start, +diff --git a/drivers/gpu/drm/imagination/pvr_stream.c b/drivers/gpu/drm/imagination/pvr_stream.c +index 7db6eb1..d83b7db 100644 +--- a/drivers/gpu/drm/imagination/pvr_stream.c ++++ b/drivers/gpu/drm/imagination/pvr_stream.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0-only OR MIT + /* Copyright (c) 2023 Imagination Technologies Ltd. */ + ++#include "pvr_apple.h" + #include "pvr_device.h" + #include "pvr_rogue_fwif_stream.h" + #include "pvr_stream.h" +@@ -272,10 +273,12 @@ pvr_stream_create_musthave_masks(struct pvr_device *pvr_dev) + PVR_STREAM_EXTHDR_FRAG0_BRN47217; + + if (pvr_device_is_apple(pvr_dev)) { +- pvr_dev->stream_musthave_quirks[PVR_STREAM_TYPE_GEOM][PVR_STREAM_EXTHDR_TYPE_GEOM_APPLE] |= +- PVR_STREAM_EXTHDR_GEOM_APPLE_REGS; +- pvr_dev->stream_musthave_quirks[PVR_STREAM_TYPE_FRAG][PVR_STREAM_EXTHDR_TYPE_FRAG_APPLE] |= +- PVR_STREAM_EXTHDR_FRAG_APPLE_REGS; ++ u32 ext_type, mask; ++ ++ mask = pvr_apple_stream_musthave(pvr_dev, PVR_STREAM_TYPE_GEOM, &ext_type); ++ pvr_dev->stream_musthave_quirks[PVR_STREAM_TYPE_GEOM][ext_type] |= mask; ++ mask = pvr_apple_stream_musthave(pvr_dev, PVR_STREAM_TYPE_FRAG, &ext_type); ++ pvr_dev->stream_musthave_quirks[PVR_STREAM_TYPE_FRAG][ext_type] |= mask; + } + + if (pvr_device_has_uapi_quirk(pvr_dev, 49927)) { + From 14ff1676cfaf10dfb0ec3d71ade2400dc47fb26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 4/9] drm/imagination: apple: Drop a fragment job's reference on its geometry job Once rendering works on the iPad 5, every fragment job warns at WARN_ON(job->paired_job) in pvr_job.c, thousands of times a minute. Geometry jobs are never freed, and clients hang when destroying a render target: glmark2 and vkcube run until killed. Apple queues receive jobs linked by pvr_jobs_link_geom_frag(), but their free path does not drop the fragment job's paired geometry reference. That reference also keeps the geometry job's HWRT and context alive. Follow pvr_queue_free_job(): drop the paired geometry reference and clear paired_job before dropping the scheduler's reference. Affects the shared Apple queue used by the A9 (S8003) and A10 (T8010). The A10 has been build-tested only. Assisted-by: LLM --- ...apple-Drop-a-fragment-job-s-referenc.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0029-drm-imagination-apple-Drop-a-fragment-job-s-referenc.patch diff --git a/kernel/patches/drivers/gpu/0029-drm-imagination-apple-Drop-a-fragment-job-s-referenc.patch b/kernel/patches/drivers/gpu/0029-drm-imagination-apple-Drop-a-fragment-job-s-referenc.patch new file mode 100644 index 00000000..51b02b97 --- /dev/null +++ b/kernel/patches/drivers/gpu/0029-drm-imagination-apple-Drop-a-fragment-job-s-referenc.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 19:08:29 +0100 +Subject: [PATCH] drm/imagination: apple: Drop a fragment job's reference on + its geometry job + +Once rendering works on the iPad 5, every fragment job warns at +WARN_ON(job->paired_job) in pvr_job.c, thousands of times a minute. +Geometry jobs are never freed, and clients hang when destroying a +render target: glmark2 and vkcube run until killed. + +Apple queues receive jobs linked by pvr_jobs_link_geom_frag(), but their +free path does not drop the fragment job's paired geometry reference. +That reference also keeps the geometry job's HWRT and context alive. + +Follow pvr_queue_free_job(): drop the paired geometry reference and +clear paired_job before dropping the scheduler's reference. + +Affects the shared Apple queue used by the A9 (S8003) and A10 (T8010). +The A10 has been build-tested only. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_apple_queue.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/gpu/drm/imagination/pvr_apple_queue.c b/drivers/gpu/drm/imagination/pvr_apple_queue.c +index 80bc17b..d176fe6 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_queue.c ++++ b/drivers/gpu/drm/imagination/pvr_apple_queue.c +@@ -89,6 +89,11 @@ static void pvr_apple_free_job(struct drm_sched_job *sched_job) + struct pvr_job *job = container_of(sched_job, struct pvr_job, base); + + drm_sched_job_cleanup(sched_job); ++ ++ if (job->type == DRM_PVR_JOB_TYPE_FRAGMENT && job->paired_job) ++ pvr_job_put(job->paired_job); ++ ++ job->paired_job = NULL; + pvr_job_put(job); + } + + From 631f82d52507fab7749048014f911ac9576fa12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 5/9] drm/imagination: apple: Let every geometry job take its VM's scene first A client's first render on the iPad 5 fails without a log line when another client rendered last. Its geometry job returns -EBUSY, then its fragment job is refused with "fragment job without a geometry job". The call that takes a VM's PM sets is inside the dependency choice for consecutive jobs of the same VM. A new VM can therefore reach submission without a PM set when the previous fragment belonged to another VM. Call vm_scenes for every geometry job before selecting its dependency. Keep the existing prev_frag/last_frag choice and locking context. Affects the Apple A9 (S8003). The A10 has no vm_scenes callback and is unchanged. Assisted-by: LLM --- ...apple-Let-every-geometry-job-take-it.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0030-drm-imagination-apple-Let-every-geometry-job-take-it.patch diff --git a/kernel/patches/drivers/gpu/0030-drm-imagination-apple-Let-every-geometry-job-take-it.patch b/kernel/patches/drivers/gpu/0030-drm-imagination-apple-Let-every-geometry-job-take-it.patch new file mode 100644 index 00000000..2f432c80 --- /dev/null +++ b/kernel/patches/drivers/gpu/0030-drm-imagination-apple-Let-every-geometry-job-take-it.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 19:32:10 +0100 +Subject: [PATCH] drm/imagination: apple: Let every geometry job take its VM's + scene first + +A client's first render on the iPad 5 fails without a log line when +another client rendered last. Its geometry job returns -EBUSY, then +its fragment job is refused with "fragment job without a geometry job". + +The call that takes a VM's PM sets is inside the dependency choice for +consecutive jobs of the same VM. A new VM can therefore reach submission +without a PM set when the previous fragment belonged to another VM. + +Call vm_scenes for every geometry job before selecting its dependency. +Keep the existing prev_frag/last_frag choice and locking context. + +Affects the Apple A9 (S8003). The A10 has no vm_scenes callback and is +unchanged. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_apple.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_apple.c b/drivers/gpu/drm/imagination/pvr_apple.c +index b0505a2..5a43e3f 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple.c ++++ b/drivers/gpu/drm/imagination/pvr_apple.c +@@ -1229,14 +1229,18 @@ int pvr_apple_job_add_deps(struct pvr_job *job) + { + struct pvr_apple *apple = to_apple(job->pvr_dev); + struct dma_fence *last; ++ unsigned int scenes = 1; + + if (job->type != DRM_PVR_JOB_TYPE_GEOMETRY && job->type != DRM_PVR_JOB_TYPE_FRAGMENT) + return 0; + spin_lock_irq(&apple->fence_lock); ++ /* Take this VM's first scene even when another VM rendered last. */ ++ if (job->type == DRM_PVR_JOB_TYPE_GEOMETRY && apple->chip->vm_scenes) ++ scenes = apple->chip->vm_scenes(apple, job->ctx->vm_ctx); + if (job->type == DRM_PVR_JOB_TYPE_FRAGMENT) + last = apple->last_geom; + else if (apple->chip->scenes > 1 && apple->last_frag_vm == job->ctx->vm_ctx && +- apple->chip->vm_scenes(apple, job->ctx->vm_ctx) > 1) ++ scenes > 1) + last = apple->prev_frag; + else + last = apple->last_frag; + From dd9efa632f1578b90d8944060fc8e1ade934c049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 6/9] drm/imagination: Say why a command stream is rejected The iPad 5's rejected geometry and fragment streams return -EINVAL without explaining which check failed. Applications fail to render, and the kernel gives no values with which to diagnose the rejection. Report malformed headers, invalid destination entries, short input, unsupported extensions and missing must-have bits at the rejecting check. Include the command type, entry or extension, and checked values. Use one rate-limited warning per rejected stream; callers log short reads so that propagated errors do not produce duplicate messages. Keep successful parsing and error returns unchanged. Affects every PowerVR device. Assisted-by: LLM --- ...Say-why-a-command-stream-is-rejected.patch | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0031-drm-imagination-Say-why-a-command-stream-is-rejected.patch diff --git a/kernel/patches/drivers/gpu/0031-drm-imagination-Say-why-a-command-stream-is-rejected.patch b/kernel/patches/drivers/gpu/0031-drm-imagination-Say-why-a-command-stream-is-rejected.patch new file mode 100644 index 00000000..ed8c8522 --- /dev/null +++ b/kernel/patches/drivers/gpu/0031-drm-imagination-Say-why-a-command-stream-is-rejected.patch @@ -0,0 +1,251 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 18:29:37 +0100 +Subject: [PATCH] drm/imagination: Say why a command stream is rejected + +The iPad 5's rejected geometry and fragment streams return -EINVAL +without explaining which check failed. Applications fail to render, +and the kernel gives no values with which to diagnose the rejection. + +Report malformed headers, invalid destination entries, short input, +unsupported extensions and missing must-have bits at the rejecting +check. Include the command type, entry or extension, and checked values. +Use one rate-limited warning per rejected stream; callers log short +reads so that propagated errors do not produce duplicate messages. + +Keep successful parsing and error returns unchanged. Affects every +PowerVR device. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_stream.c | 101 +++++++++++++++++------ + 1 file changed, 77 insertions(+), 24 deletions(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_stream.c b/drivers/gpu/drm/imagination/pvr_stream.c +index d83b7db..d0c5a1e 100644 +--- a/drivers/gpu/drm/imagination/pvr_stream.c ++++ b/drivers/gpu/drm/imagination/pvr_stream.c +@@ -7,6 +7,7 @@ + #include "pvr_stream.h" + + #include ++#include + #include + #include + #include +@@ -49,6 +50,8 @@ pvr_stream_get_data(u8 *stream, u32 *stream_offset, u32 stream_size, u32 data_si + /** + * pvr_stream_process_1() - Process a single stream and fill destination structure + * @pvr_dev: Device pointer. ++ * @type: Command stream type. ++ * @ext_type: Extension header type, or -1 for the main stream. + * @stream_def: Stream definition. + * @nr_entries: Number of entries in &stream_def. + * @stream: Pointer to stream. +@@ -63,14 +66,20 @@ pvr_stream_get_data(u8 *stream, u32 *stream_offset, u32 stream_size, u32 data_si + * * -%EINVAL on malformed stream. + */ + static int +-pvr_stream_process_1(struct pvr_device *pvr_dev, const struct pvr_stream_def *stream_def, +- u32 nr_entries, u8 *stream, u32 stream_offset, u32 stream_size, ++pvr_stream_process_1(struct pvr_device *pvr_dev, enum pvr_stream_type type, int ext_type, ++ const struct pvr_stream_def *stream_def, u32 nr_entries, u8 *stream, ++ u32 stream_offset, u32 stream_size, + u8 *dest, u32 dest_size, u32 *stream_offset_out) + { + int err = 0; + + for (u32 i = 0; i < nr_entries; i++) { ++ u32 data_size = 0; ++ + if (stream_def[i].offset >= dest_size) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: destination type=%u ext_type=%d entry=%u offset=%u dest_size=%u\n", ++ type, ext_type, i, stream_def[i].offset, dest_size); + err = -EINVAL; + break; + } +@@ -80,41 +89,42 @@ pvr_stream_process_1(struct pvr_device *pvr_dev, const struct pvr_stream_def *st + + switch (stream_def[i].size) { + case PVR_STREAM_SIZE_8: ++ data_size = sizeof(u8); + err = pvr_stream_get_data(stream, &stream_offset, stream_size, sizeof(u8), + sizeof(u8), dest + stream_def[i].offset); +- if (err) +- return err; + break; + + case PVR_STREAM_SIZE_16: ++ data_size = sizeof(u16); + err = pvr_stream_get_data(stream, &stream_offset, stream_size, sizeof(u16), + sizeof(u16), dest + stream_def[i].offset); +- if (err) +- return err; + break; + + case PVR_STREAM_SIZE_32: ++ data_size = sizeof(u32); + err = pvr_stream_get_data(stream, &stream_offset, stream_size, sizeof(u32), + sizeof(u32), dest + stream_def[i].offset); +- if (err) +- return err; + break; + + case PVR_STREAM_SIZE_64: ++ data_size = sizeof(u64); + err = pvr_stream_get_data(stream, &stream_offset, stream_size, sizeof(u64), + sizeof(u64), dest + stream_def[i].offset); +- if (err) +- return err; + break; + + case PVR_STREAM_SIZE_ARRAY: ++ data_size = stream_def[i].array_size; + err = pvr_stream_get_data(stream, &stream_offset, stream_size, + stream_def[i].array_size, sizeof(u64), + dest + stream_def[i].offset); +- if (err) +- return err; + break; + } ++ if (err) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: short data type=%u ext_type=%d entry=%u offset=%u size=%u stream_size=%u\n", ++ type, ext_type, i, stream_offset, data_size, stream_size); ++ return err; ++ } + } + + if (stream_offset_out) +@@ -143,18 +153,30 @@ pvr_stream_process_ext_stream(struct pvr_device *pvr_dev, + + err = pvr_stream_get_data(ext_stream, &stream_offset, ext_stream_size, sizeof(u32), + sizeof(ext_header), &ext_header); +- if (err) ++ if (err) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: short extension header type=%u ext_type=-1 entry=-1 offset=%u size=%zu stream_size=%u\n", ++ cmd_defs->type, stream_offset, sizeof(ext_header), ext_stream_size); + return err; ++ } + + type = (ext_header & PVR_STREAM_EXTHDR_TYPE_MASK) >> PVR_STREAM_EXTHDR_TYPE_SHIFT; + data = ext_header & PVR_STREAM_EXTHDR_DATA_MASK; + +- if (type >= cmd_defs->ext_nr_headers) ++ if (type >= cmd_defs->ext_nr_headers) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: extension type=%u ext_type=%u ext_nr_headers=%u\n", ++ cmd_defs->type, type, cmd_defs->ext_nr_headers); + return -EINVAL; ++ } + + header = &cmd_defs->ext_headers[type]; +- if (data & ~header->valid_mask) ++ if (data & ~header->valid_mask) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: extension bits type=%u ext_type=%u data=0x%08x valid_mask=0x%08x\n", ++ cmd_defs->type, type, data, header->valid_mask); + return -EINVAL; ++ } + + musthave_masks[type] &= ~data; + +@@ -165,10 +187,15 @@ pvr_stream_process_ext_stream(struct pvr_device *pvr_dev, + continue; + + /* Quirk 0: the extension is not tied to a hardware quirk. */ +- if (ext_def->quirk && !pvr_device_has_uapi_quirk(pvr_dev, ext_def->quirk)) ++ if (ext_def->quirk && !pvr_device_has_uapi_quirk(pvr_dev, ext_def->quirk)) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: unsupported quirk type=%u ext_type=%u entry=%u quirk=%u data=0x%08x mask=0x%08x\n", ++ cmd_defs->type, type, i, ext_def->quirk, data, ext_def->header_mask); + return -EINVAL; ++ } + +- err = pvr_stream_process_1(pvr_dev, ext_def->stream, ext_def->stream_len, ++ err = pvr_stream_process_1(pvr_dev, cmd_defs->type, type, ++ ext_def->stream, ext_def->stream_len, + ext_stream, stream_offset, + ext_stream_size, dest, + cmd_defs->dest_size, &stream_offset); +@@ -182,8 +209,12 @@ pvr_stream_process_ext_stream(struct pvr_device *pvr_dev, + * for this command was not present. + */ + for (u32 i = 0; i < cmd_defs->ext_nr_headers; i++) { +- if (musthave_masks[i]) ++ if (musthave_masks[i]) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: missing must-have type=%u ext_type=%u leftover_mask=0x%08x\n", ++ cmd_defs->type, i, musthave_masks[i]); + return -EINVAL; ++ } + } + + return 0; +@@ -213,13 +244,21 @@ pvr_stream_process(struct pvr_device *pvr_dev, const struct pvr_stream_cmd_defs + u32 padding; + int err; + +- if (!stream || !stream_size) ++ if (!stream || !stream_size) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: empty input type=%u stream_present=%u stream_size=%u\n", ++ cmd_defs->type, !!stream, stream_size); + return -EINVAL; ++ } + + err = pvr_stream_get_data(stream, &stream_offset, stream_size, sizeof(u32), + sizeof(u32), &main_stream_len); +- if (err) ++ if (err) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: short main_stream_len type=%u ext_type=-1 entry=-1 offset=%u size=%zu stream_size=%u\n", ++ cmd_defs->type, stream_offset, sizeof(u32), stream_size); + return err; ++ } + + /* + * u32 after stream length is padding to ensure u64 alignment, but may be used for expansion +@@ -227,13 +266,22 @@ pvr_stream_process(struct pvr_device *pvr_dev, const struct pvr_stream_cmd_defs + */ + err = pvr_stream_get_data(stream, &stream_offset, stream_size, sizeof(u32), + sizeof(u32), &padding); +- if (err) ++ if (err) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: short padding type=%u ext_type=-1 entry=-1 offset=%u size=%zu stream_size=%u\n", ++ cmd_defs->type, stream_offset, sizeof(u32), stream_size); + return err; ++ } + +- if (main_stream_len < stream_offset || main_stream_len > stream_size || padding) ++ if (main_stream_len < stream_offset || main_stream_len > stream_size || padding) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: main header type=%u main_stream_len=%u stream_size=%u padding=0x%08x\n", ++ cmd_defs->type, main_stream_len, stream_size, padding); + return -EINVAL; ++ } + +- err = pvr_stream_process_1(pvr_dev, cmd_defs->main_stream, cmd_defs->main_stream_len, ++ err = pvr_stream_process_1(pvr_dev, cmd_defs->type, -1, ++ cmd_defs->main_stream, cmd_defs->main_stream_len, + stream, stream_offset, main_stream_len, dest_out, + cmd_defs->dest_size, &stream_offset); + if (err) +@@ -250,8 +298,13 @@ pvr_stream_process(struct pvr_device *pvr_dev, const struct pvr_stream_cmd_defs + * quirks for this command. + */ + for (u32 i = 0; i < cmd_defs->ext_nr_headers; i++) { +- if (pvr_dev->stream_musthave_quirks[cmd_defs->type][i]) ++ if (pvr_dev->stream_musthave_quirks[cmd_defs->type][i]) { ++ dev_warn_ratelimited(from_pvr_device(pvr_dev)->dev, ++ "stream rejected: no extension must-have type=%u ext_type=%u leftover_mask=0x%08x\n", ++ cmd_defs->type, i, ++ pvr_dev->stream_musthave_quirks[cmd_defs->type][i]); + return -EINVAL; ++ } + } + } + From 637a573d06ea01556d5a4a4a3ed283032c969928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Sun, 15 Nov 2026 21:27:08 +0100 Subject: [PATCH 7/9] drm/imagination: apple: Say why an S8003 job was not submitted Render failures on the iPad 5 can leave a fragment job without its geometry job. S8003 submission errors otherwise return silently, so the kernel does not say which engine or stage failed. Add one rate-limited warning at each failing submission stage with the engine, error, VM and reason. Separate the PM pool build and record slot wait checks so that their errors can be distinguished. Keep submission and recovery behaviour unchanged. A fragment without its geometry scene is still refused. Affects the Apple A9 (S8003). The A10 is unchanged. Assisted-by: LLM --- ...apple-Say-why-an-S8003-job-was-not-s.patch | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0032-drm-imagination-apple-Say-why-an-S8003-job-was-not-s.patch diff --git a/kernel/patches/drivers/gpu/0032-drm-imagination-apple-Say-why-an-S8003-job-was-not-s.patch b/kernel/patches/drivers/gpu/0032-drm-imagination-apple-Say-why-an-S8003-job-was-not-s.patch new file mode 100644 index 00000000..82d05d7b --- /dev/null +++ b/kernel/patches/drivers/gpu/0032-drm-imagination-apple-Say-why-an-S8003-job-was-not-s.patch @@ -0,0 +1,149 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Sun, 15 Nov 2026 19:32:10 +0100 +Subject: [PATCH] drm/imagination: apple: Say why an S8003 job was not + submitted + +Render failures on the iPad 5 can leave a fragment job without its +geometry job. S8003 submission errors otherwise return silently, so +the kernel does not say which engine or stage failed. + +Add one rate-limited warning at each failing submission stage with the +engine, error, VM and reason. Separate the PM pool build and record +slot wait checks so that their errors can be distinguished. + +Keep submission and recovery behaviour unchanged. A fragment without +its geometry scene is still refused. + +Affects the Apple A9 (S8003). The A10 is unchanged. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_apple_s8003.c | 49 +++++++++++++------ + 1 file changed, 33 insertions(+), 16 deletions(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_apple_s8003.c b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +index e4868b6..b31ec3e 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_s8003.c ++++ b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +@@ -2262,6 +2262,15 @@ static bool s8003_pm_idle(struct pvr_apple *apple, const struct s8003_pm *pm) + return false; + } + ++static int s8003_submit_error(struct pvr_apple *apple, struct s8003_vm *vm, ++ const char *engine, int err, const char *reason) ++{ ++ dev_warn_ratelimited(apple_dev(apple), ++ "%s job not submitted: error=%d VM=%p: %s\n", ++ engine, err, vm->vm_ctx, reason); ++ return err; ++} ++ + static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struct pvr_job *job) + { + const struct pvr_hwrt_dataset *hwrt = job->hwrt->hwrt_dataset; +@@ -2275,7 +2284,7 @@ static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struc + + err = s8003_rt_derive(hwrt, &rt); + if (err) +- return err; ++ return s8003_submit_error(apple, vm, "geometry", err, "rt derive"); + /* The VM's sets were taken when the job was ordered (pvr_apple_s8003_vm_scenes()) */ + for (i = 0; i < 2 && !pm; i++) + if (vm->pm[i].set >= 0 && s8003_pm_idle(apple, &vm->pm[i])) +@@ -2289,7 +2298,7 @@ static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struc + !s8003_wait_done(apple, APPLE_ENGINE_GEOM, vm->pm[i].ta_seq)) + pm = &vm->pm[i]; + if (!pm) +- return -EBUSY; ++ return s8003_submit_error(apple, vm, "geometry", -EBUSY, "no PM set"); + + /* As many 128 KiB blocks as the free list has 4 KiB pages, and enough for the target */ + blocks = max(DIV_ROUND_UP(hwrt->free_lists[0]->initial_num_pages, 32), +@@ -2136,9 +2145,11 @@ static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struc + err = s8003_pm_build(apple, vm, pm, min(blocks, S8003_PM_BLOCKS_MAX)); ++ if (err) ++ return s8003_submit_error(apple, vm, "geometry", err, "PM pool build failed"); + /* The record slot of the job before the last one is free again */ +- if (!err && apple->ta_seq) ++ if (apple->ta_seq) + err = s8003_wait_done(apple, APPLE_ENGINE_GEOM, apple->ta_seq - 1); + if (err) +- return err; ++ return s8003_submit_error(apple, vm, "geometry", err, "record slot wait"); + + seq = apple->ta_seq + 1; + s8003_fill_ta(p + s8003_slot_of(seq, false).w, job->cmd, job->hwrt, &rt); +@@ -2320,7 +2331,9 @@ static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struc + pm->td_seq = 0; + apple->ta_seq = seq; + err = s8003_publish(apple, APPLE_ENGINE_GEOM, seq, (2 * seq) % S8003_CH_ENTRIES); +- return err ?: seq; ++ if (err) ++ return s8003_submit_error(apple, vm, "geometry", err, "publish"); ++ return seq; + } + + static int s8003_submit_frag(struct pvr_apple *apple, struct s8003_vm *vm, struct pvr_job *job) +@@ -2337,21 +2350,21 @@ static int s8003_submit_frag(struct pvr_apple *apple, struct s8003_vm *vm, struc + for (i = 0; i < 2; i++) + if (vm->pm[i].scene == s->gen && vm->pm[i].hwrt == job->hwrt && !vm->pm[i].td_seq) + pm = &vm->pm[i]; +- if (!pm) { +- dev_warn_ratelimited(apple_dev(apple), +- "fragment job without a geometry job: not run\n"); +- return -ECANCELED; +- } ++ if (!pm) ++ return s8003_submit_error(apple, vm, "fragment", -ECANCELED, ++ "its geometry job failed or was not submitted"); + err = s8003_rt_derive(job->hwrt->hwrt_dataset, &rt); +- if (!err && apple->frag_seq) ++ if (err) ++ return s8003_submit_error(apple, vm, "fragment", err, "rt derive"); ++ if (apple->frag_seq) + err = s8003_wait_done(apple, APPLE_ENGINE_FRAG, apple->frag_seq - 1); + if (err) +- return err; ++ return s8003_submit_error(apple, vm, "fragment", err, "record slot wait"); + + seq = apple->frag_seq + 1; + err = s8003_fill_3d(p + s8003_slot_of(seq, true).w, job->cmd, job->hwrt, &rt); + if (err) +- return err; ++ return s8003_submit_error(apple, vm, "fragment", err, "3D record fill"); + s8003_job_write(p, s8003_channel_addr(APPLE_ENGINE_FRAG), + s8003_object_addr(&s->layout, S8003_CHANNEL + 1), + s8003_meta_addr(s8003_pm_set_va(pm, 0)), pm->set + 1, vm->slot[1], true, seq, +@@ -2359,7 +2372,9 @@ static int s8003_submit_frag(struct pvr_apple *apple, struct s8003_vm *vm, struc + pm->td_seq = seq; + apple->frag_seq = seq; + err = s8003_publish(apple, APPLE_ENGINE_FRAG, seq, (2 * seq) % S8003_CH_ENTRIES); +- return err ?: seq; ++ if (err) ++ return s8003_submit_error(apple, vm, "fragment", err, "publish"); ++ return seq; + } + + /* +@@ -2382,7 +2397,7 @@ static int s8003_submit_compute(struct pvr_apple *apple, struct s8003_vm *vm, st + + err = s8003_wait_done(apple, APPLE_ENGINE_COMPUTE, apple->last_seq); + if (err) +- return err; ++ return s8003_submit_error(apple, vm, "compute", err, "record slot wait"); + seq = apple->last_seq + 1; + { + const u32 useq[] = { +@@ -2428,7 +2443,9 @@ static int s8003_submit_compute(struct pvr_apple *apple, struct s8003_vm *vm, st + put32(p + S8003_CH_RING + ((seq - 1) % S8003_CH_ENTRIES) * 4, w); + apple->last_seq = seq; + err = s8003_publish(apple, APPLE_ENGINE_COMPUTE, seq, seq % S8003_CH_ENTRIES); +- return err ?: seq; ++ if (err) ++ return s8003_submit_error(apple, vm, "compute", err, "publish"); ++ return seq; + } + + static int pvr_apple_s8003_submit(struct pvr_apple *apple, struct pvr_job *job) + From 3bec95f46f804148d9a9c2f7e2a2bb166040e92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Mon, 16 Nov 2026 11:03:58 +0100 Subject: [PATCH 8/9] drm/imagination: apple: Keep VM tag bumps off an S8003 slot pair while it loads The iPad 5 loses Firefox's WebGL context under multiple GPU clients. Firmware slot loads return -EIO, geometry jobs fail, and their fragment jobs are refused. Single-client runs do not hit the failure. VM map and unmap flushes take tag_lock but not submit_lock. They can bump a slot's host tag while DC_SLOT loads its root. With two or more bumps, firmware can copy an intermediate tag that matches neither the loaded tag nor the current host tag, falsely failing the load check. Mark each slot as loading under tag_lock while publishing its root and tag. Defer flushes on those slots, verify the exact loaded tag, then clear loading and apply any pending bump through the shared helper on both success and failure. submit_lock keeps the VM's job behind the pending bump, so firmware still invalidates stale translations before using the slot. Report the slot, loaded, firmware and current tags on a mismatch. Affects: Apple A9 (S8003). The A10 is unchanged. Assisted-by: LLM --- ...ff-an-S8003-slot-pair-while-it-loads.patch | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0033-drm-imagination-apple-Keep-VM-tag-bumps-off-an-S8003-slot-pair-while-it-loads.patch diff --git a/kernel/patches/drivers/gpu/0033-drm-imagination-apple-Keep-VM-tag-bumps-off-an-S8003-slot-pair-while-it-loads.patch b/kernel/patches/drivers/gpu/0033-drm-imagination-apple-Keep-VM-tag-bumps-off-an-S8003-slot-pair-while-it-loads.patch new file mode 100644 index 00000000..e05d3253 --- /dev/null +++ b/kernel/patches/drivers/gpu/0033-drm-imagination-apple-Keep-VM-tag-bumps-off-an-S8003-slot-pair-while-it-loads.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Mon, 16 Nov 2026 11:03:58 +0100 +Subject: [PATCH] drm/imagination: apple: Keep VM tag bumps off an S8003 slot + pair while it loads + +The iPad 5 loses Firefox's WebGL context under multiple GPU clients. +Firmware slot loads return -EIO, geometry jobs fail, and their fragment +jobs are refused. Single-client runs do not hit the failure. + +VM map and unmap flushes take tag_lock but not submit_lock. They can +bump a slot's host tag while DC_SLOT loads its root. With two or more +bumps, firmware can copy an intermediate tag that matches neither the +loaded tag nor the current host tag, falsely failing the load check. + +Mark each slot as loading under tag_lock while publishing its root and +tag. Defer flushes on those slots, verify the exact loaded tag, then +clear loading and apply any pending bump through the shared helper on +both success and failure. submit_lock keeps the VM's job behind the +pending bump, so firmware still invalidates stale translations before +using the slot. Report the slot, loaded, firmware and current tags on +a mismatch. + +Affects: Apple A9 (S8003). The A10 is unchanged. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_apple_s8003.c | 55 ++++++++++++++----- + 1 file changed, 41 insertions(+), 14 deletions(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_apple_s8003.c b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +index bc6f300..40ca888 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_s8003.c ++++ b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +@@ -276,6 +276,8 @@ struct pvr_apple_s8003 { + u32 gen; + spinlock_t tag_lock; /* @tag and the host's tags in the shared memory */ + u32 tag[S8003_SLOTS]; /* 0: slot not loaded */ ++ DECLARE_BITMAP(loading, S8003_SLOTS); /* tag held until DC_SLOT completes */ ++ DECLARE_BITMAP(bump_pending, S8003_SLOTS); /* flush deferred while loading */ + DECLARE_BITMAP(slots, S8003_SLOTS); + DECLARE_BITMAP(parked, S8003_SLOTS); /* left on @park_vm's tables */ + u32 next_slot; +@@ -1315,6 +1317,21 @@ static int s8003_device_control(struct pvr_apple *apple, const u32 (*cmd)[2], un + S8003_DC_TIMEOUT_US, false, apple, ctl); + } + ++/* Bump a loaded slot's tag with tag_lock held; leave empty slots at zero. */ ++static void s8003_slot_tag_bump(struct pvr_apple_s8003 *s, u32 slot) ++{ ++ u32 tag = s->tag[slot]; ++ ++ lockdep_assert_held(&s->tag_lock); ++ if (!tag) ++ return; ++ tag += S8003_TAG_CATALOGUE; ++ if (!tag) ++ tag = S8003_TAG_CATALOGUE; ++ s->tag[slot] = tag; ++ put32(s8003_object(s, S8003_TAG_HOST) + 4 * slot, tag); ++} ++ + /* Point a pair of slots at a page-table root (0: at none) under @tag */ + static int s8003_slots_load(struct pvr_apple *apple, const u32 *slot, u64 root, u32 tag) + { +@@ -1326,6 +1343,7 @@ static int s8003_slots_load(struct pvr_apple *apple, const u32 *slot, u64 root, + + spin_lock_irqsave(&s->tag_lock, flags); + for (e = 0; e < 2; e++) { ++ __set_bit(slot[e], s->loading); + put64(s8003_object(s, S8003_MMU_ROOT) + 8 * slot[e], root); + put32(s8003_object(s, S8003_TAG_HOST) + 4 * slot[e], tag); + s->tag[slot[e]] = tag; +@@ -1333,16 +1351,30 @@ static int s8003_slots_load(struct pvr_apple *apple, const u32 *slot, u64 root, + spin_unlock_irqrestore(&s->tag_lock, flags); + + err = s8003_device_control(apple, cmd, 2); +- /* The firmware copies the tag it loaded the root under */ ++ if (err) ++ dev_err(apple_dev(apple), "GFX firmware slot load failed: %d\n", err); ++ /* The firmware must copy the tag we held stable while loading the root. */ + for (e = 0; e < 2 && !err; e++) { + u32 seen = get32(s8003_object(s, S8003_TAG_SEEN) + 4 * slot[e]); + +- if (seen != tag && seen != READ_ONCE(s->tag[slot[e]])) ++ if (seen != tag) { ++ dev_err(apple_dev(apple), ++ "GFX firmware did not load slot %u: loaded tag %#x, firmware saw %#x, now %#x\n", ++ slot[e], tag, seen, READ_ONCE(s->tag[slot[e]])); + err = -EIO; ++ } + } +- if (err) +- dev_err(apple_dev(apple), "GFX firmware did not load slots %u and %u: %d\n", +- slot[0], slot[1], err); ++ /* The attach holds submit_lock: deferred flushes precede the VM's job. */ ++ spin_lock_irqsave(&s->tag_lock, flags); ++ for (e = 0; e < 2; e++) { ++ __clear_bit(slot[e], s->loading); ++ if (test_bit(slot[e], s->bump_pending)) { ++ s8003_slot_tag_bump(s, slot[e]); ++ __clear_bit(slot[e], s->bump_pending); ++ } ++ } ++ spin_unlock_irqrestore(&s->tag_lock, flags); ++ wmb(); + return err; + } + +@@ -1406,15 +1438,10 @@ static void pvr_apple_s8003_mmu_flush(struct pvr_apple *apple) + return; + spin_lock_irqsave(&s->tag_lock, flags); + for (slot = S8003_SLOT_FIRST; slot < S8003_SLOTS; slot++) { +- u32 tag = s->tag[slot]; +- +- if (!tag) +- continue; +- tag += S8003_TAG_CATALOGUE; +- if (!tag) +- tag = S8003_TAG_CATALOGUE; +- s->tag[slot] = tag; +- put32(s8003_object(s, S8003_TAG_HOST) + 4 * slot, tag); ++ if (test_bit(slot, s->loading)) ++ __set_bit(slot, s->bump_pending); ++ else ++ s8003_slot_tag_bump(s, slot); + } + spin_unlock_irqrestore(&s->tag_lock, flags); + wmb(); From 37fbf0c05e526c53ac93e18bf0c5f1bc8dc80786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= Date: Mon, 16 Nov 2026 17:46:27 +0100 Subject: [PATCH 9/9] drm/imagination: apple: Report firmware-measured S8003 GPU time in debugfs Host in-flight durations include queueing and firmware overhead, so they cannot show how long the GPU geometry and fragment phases actually ran. Read the retired phase-time u64 at W+0x550 or W+0x8ac before the record is cleared. Both submission paths wait for last_seq - 1 before writing the two-slot ring's next record, so its previous occupant has retired. Order that shared-memory read with dma_rmb(), preserve it across the fill, and account only successful fills before the result word is cleared. Expose accumulated geometry and fragment time, jobs and zero samples in apple_jobs, converting 24 MHz ticks by ticks * 125 / 3. Add only the small chip debugfs callback needed by that line; no timing parameters, phase-gap attribution or memory census. Submission ordering and power policy stay unchanged. Affects: Apple A9 (S8003), measurement only. The A10 is unchanged. Assisted-by: LLM --- ...e-measured-S8003-GPU-time-in-debugfs.patch | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 kernel/patches/drivers/gpu/0034-drm-imagination-apple-Report-firmware-measured-S8003-GPU-time-in-debugfs.patch diff --git a/kernel/patches/drivers/gpu/0034-drm-imagination-apple-Report-firmware-measured-S8003-GPU-time-in-debugfs.patch b/kernel/patches/drivers/gpu/0034-drm-imagination-apple-Report-firmware-measured-S8003-GPU-time-in-debugfs.patch new file mode 100644 index 00000000..af6bbd39 --- /dev/null +++ b/kernel/patches/drivers/gpu/0034-drm-imagination-apple-Report-firmware-measured-S8003-GPU-time-in-debugfs.patch @@ -0,0 +1,275 @@ +From 3a19f9211c0ef2ae6af305c792cfc555e573f58d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Berkay=20K=C3=B6sebay?= +Date: Mon, 16 Nov 2026 17:46:27 +0100 +Subject: [PATCH] drm/imagination: apple: Report firmware-measured S8003 GPU + time in debugfs + +Host in-flight durations include queueing and firmware overhead, so they +cannot show how long the GPU geometry and fragment phases actually ran. + +Read the retired phase-time u64 at W+0x550 or W+0x8ac before the record is +cleared. Both submission paths wait for last_seq - 1 before writing the +two-slot ring's next record, so its previous occupant has retired. Order +that shared-memory read with dma_rmb(), preserve it across the fill, and +account only successful fills before the result word is cleared. + +Expose accumulated geometry and fragment time, jobs and zero samples in +apple_jobs, converting 24 MHz ticks by ticks * 125 / 3. Add only the small +chip debugfs callback needed by that line; no timing parameters, phase-gap +attribution or memory census. Submission ordering and power policy stay +unchanged. + +Affects: Apple A9 (S8003), measurement only. The A10 is unchanged. + +Assisted-by: LLM +--- + drivers/gpu/drm/imagination/pvr_apple.c | 19 +++++++ + drivers/gpu/drm/imagination/pvr_apple.h | 3 ++ + drivers/gpu/drm/imagination/pvr_apple_chip.h | 3 ++ + drivers/gpu/drm/imagination/pvr_apple_s8003.c | 53 ++++++++++++++++--- + drivers/gpu/drm/imagination/pvr_debugfs.c | 3 ++ + 5 files changed, 75 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/imagination/pvr_apple.c b/drivers/gpu/drm/imagination/pvr_apple.c +index 5a43e3f..964549a 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple.c ++++ b/drivers/gpu/drm/imagination/pvr_apple.c +@@ -31,6 +31,8 @@ + + #include + #include ++#include ++#include + #include + #include + #include +@@ -579,6 +581,23 @@ static u32 pvr_apple_engine_done(struct pvr_apple *apple, enum pvr_apple_engine + return heap_read32(apple, apple->layout.stamp[engine]); + } + ++static int pvr_apple_jobs_show(struct seq_file *s, void *unused) ++{ ++ struct pvr_apple *apple = s->private; ++ ++ apple->chip->debugfs_show(apple, s); ++ return 0; ++} ++DEFINE_SHOW_ATTRIBUTE(pvr_apple_jobs); ++ ++void pvr_apple_debugfs_init(struct pvr_device *pvr_dev, struct dentry *root) ++{ ++ struct pvr_apple *apple = to_apple(pvr_dev); ++ ++ if (apple && apple->chip->debugfs_show) ++ debugfs_create_file("apple_jobs", 0400, root, apple, &pvr_apple_jobs_fops); ++} ++ + /* For a wait: what the firmware posted meanwhile is read first */ + static u32 pvr_apple_engine_poll(struct pvr_apple *apple, enum pvr_apple_engine engine) + { +diff --git a/drivers/gpu/drm/imagination/pvr_apple.h b/drivers/gpu/drm/imagination/pvr_apple.h +index d1de0ad..24e3ec2 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple.h ++++ b/drivers/gpu/drm/imagination/pvr_apple.h +@@ -12,6 +12,7 @@ + #include "pvr_rogue_fwif_client.h" + #include "pvr_stream.h" + ++struct dentry; + struct dma_fence; + struct pvr_apple_chip; + struct pvr_context; +@@ -159,6 +160,7 @@ struct pvr_apple_g5p_cmd_compute { + }; + + #if IS_ENABLED(CONFIG_DRM_POWERVR_APPLE) ++void pvr_apple_debugfs_init(struct pvr_device *pvr_dev, struct dentry *root); + int pvr_apple_fw_init(struct pvr_device *pvr_dev); + void pvr_apple_fw_fini(struct pvr_device *pvr_dev); + struct pvr_gem_object *pvr_apple_pm_pages(struct pvr_device *pvr_dev, size_t size); +@@ -191,6 +193,7 @@ void pvr_apple_queue_destroy(struct pvr_queue *queue, bool cleanup_queue_entity) + int pvr_apple_queue_job_init(struct pvr_job *job, u64 drm_client_id); + void pvr_apple_queue_job_cleanup(struct pvr_job *job); + #else ++static inline void pvr_apple_debugfs_init(struct pvr_device *pvr_dev, struct dentry *root) {} + static inline int pvr_apple_fw_init(struct pvr_device *pvr_dev) { return -ENODEV; } + static inline void pvr_apple_fw_fini(struct pvr_device *pvr_dev) {} + static inline struct pvr_gem_object *pvr_apple_pm_pages(struct pvr_device *pvr_dev, size_t size) +diff --git a/drivers/gpu/drm/imagination/pvr_apple_chip.h b/drivers/gpu/drm/imagination/pvr_apple_chip.h +index d524415..1527248 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_chip.h ++++ b/drivers/gpu/drm/imagination/pvr_apple_chip.h +@@ -28,6 +28,7 @@ + #include + + struct devfreq; ++struct seq_file; + struct pvr_gem_object; + struct pvr_stream_cmd_defs; + +@@ -273,6 +274,8 @@ struct pvr_apple_chip { + void (*vm_fini)(struct pvr_apple *apple, struct pvr_vm_context *vm_ctx); + unsigned int (*vm_scenes)(struct pvr_apple *apple, struct pvr_vm_context *vm_ctx); + void (*mmu_flush)(struct pvr_apple *apple); ++ /* Chip-specific measurements in apple_jobs; no MMIO. */ ++ void (*debugfs_show)(struct pvr_apple *apple, struct seq_file *m); + }; + + /* The heap is coherent memory shared with the firmware, not MMIO. */ +diff --git a/drivers/gpu/drm/imagination/pvr_apple_s8003.c b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +index 40ca888..0f69c5a 100644 +--- a/drivers/gpu/drm/imagination/pvr_apple_s8003.c ++++ b/drivers/gpu/drm/imagination/pvr_apple_s8003.c +@@ -34,6 +34,9 @@ + * readings of Apple's kext and firmware. + */ + ++#include ++#include ++ + #include "pvr_apple.h" + #include "pvr_apple_chip.h" + #include "pvr_context.h" +@@ -307,6 +310,8 @@ struct pvr_apple_s8003 { + struct pvr_gem_object *spare; + bool pio_mapped; + ++ u64 gpu_ticks[2], gpu_jobs[2], gpu_zero[2]; /* retired geometry/fragment phase time */ ++ + struct s8003_idle idle; + }; + +@@ -1958,6 +1963,19 @@ static struct s8003_job_slot s8003_slot_of(u32 seq, bool frag) + }; + } + ++/* ++ * Submissions wait for last_seq - 1 before reusing either of the two records: ++ * the prior occupant of s8003_slot_of(last_seq + 1) is last_seq - 1. Preserve ++ * its result before fill_ta/fill_3d clears W. Failed fills do not count it. ++ */ ++static u64 s8003_job_ticks(u8 *p, u32 seq, bool frag) ++{ ++ struct s8003_job_slot at = s8003_slot_of(seq, frag); ++ ++ dma_rmb(); ++ return get_unaligned_le64(p + at.w + (frag ? 0x8ac : 0x550)); ++} ++ + /* What the 3D engine is waited for between a fragment job's start and finish */ + static const u32 s8003_3d_wait[] = { + 0x201, 0x138204, 0x10, 0x8388204, 0, 0x104000a, 0x1f, +@@ -1983,8 +2001,8 @@ static u8 *useq_put(u8 *out, const u32 *words, unsigned int n) + * the PM set; a fragment job's waits for the stamp at @wait_stamp to reach + * @wait_seq, its geometry job's. + */ +-static void s8003_job_write(u8 *p, u32 addr, u32 global, u32 pm, u32 pm_id, u32 slot, bool frag, +- u32 seq, u32 wait_stamp, u32 wait_seq) ++static void s8003_job_write(struct pvr_apple_s8003 *s, u8 *p, u32 addr, u32 global, u32 pm, u32 pm_id, u32 slot, bool frag, ++ u32 seq, u32 wait_stamp, u32 wait_seq, u64 gpu_ticks) + { + struct s8003_job_slot at = s8003_slot_of(seq, frag); + u32 w = addr + at.w, record = pm + S8003_PM_RECORD; +@@ -1997,6 +2015,13 @@ static void s8003_job_write(u8 *p, u32 addr, u32 global, u32 pm, u32 pm_id, u32 + const u32 time_end[] = { 0x18, result, time, time + 4, seq }; + const u32 wait_ta = 0x801, end = 0x40000017; + ++ if (gpu_ticks) { ++ s->gpu_ticks[frag] += gpu_ticks; ++ s->gpu_jobs[frag]++; ++ } else { ++ s->gpu_zero[frag]++; ++ } ++ + put32(work + (frag ? 0x8ac : 0x550), 0); + put32(work + (frag ? 0x8b0 : 0x554), 0); + put32(work + (frag ? 0x8b4 : 0x558), times); +@@ -2145,6 +2170,7 @@ static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struc + struct s8003_pm *pm = NULL; + struct s8003_rt rt; + u32 seq, blocks; ++ u64 gpu_ticks; + unsigned int i; + int err; + +@@ -2179,11 +2205,12 @@ static int s8003_submit_geom(struct pvr_apple *apple, struct s8003_vm *vm, struc + return s8003_submit_error(apple, vm, "geometry", err, "record slot wait"); + + seq = apple->ta_seq + 1; ++ gpu_ticks = s8003_job_ticks(p, seq, false); + s8003_fill_ta(p + s8003_slot_of(seq, false).w, job->cmd, job->hwrt, &rt); +- s8003_job_write(p, s8003_channel_addr(APPLE_ENGINE_GEOM), ++ s8003_job_write(s, p, s8003_channel_addr(APPLE_ENGINE_GEOM), + s8003_object_addr(&s->layout, S8003_CHANNEL), + s8003_meta_addr(s8003_pm_set_va(pm, 0)), pm->set + 1, vm->slot[0], false, +- seq, 0, 0); ++ seq, 0, 0, gpu_ticks); + pm->hwrt = job->hwrt; + pm->scene = s->gen; + pm->ta_seq = seq; +@@ -2203,6 +2230,7 @@ static int s8003_submit_frag(struct pvr_apple *apple, struct s8003_vm *vm, struc + struct s8003_rt rt; + unsigned int i; + u32 seq; ++ u64 gpu_ticks; + int err; + + /* The scene of this job's geometry job, which was submitted before it */ +@@ -2221,13 +2249,14 @@ static int s8003_submit_frag(struct pvr_apple *apple, struct s8003_vm *vm, struc + return s8003_submit_error(apple, vm, "fragment", err, "record slot wait"); + + seq = apple->frag_seq + 1; ++ gpu_ticks = s8003_job_ticks(p, seq, true); + err = s8003_fill_3d(p + s8003_slot_of(seq, true).w, job->cmd, job->hwrt, &rt); + if (err) + return s8003_submit_error(apple, vm, "fragment", err, "3D record fill"); +- s8003_job_write(p, s8003_channel_addr(APPLE_ENGINE_FRAG), ++ s8003_job_write(s, p, s8003_channel_addr(APPLE_ENGINE_FRAG), + s8003_object_addr(&s->layout, S8003_CHANNEL + 1), + s8003_meta_addr(s8003_pm_set_va(pm, 0)), pm->set + 1, vm->slot[1], true, seq, +- s8003_channel_addr(APPLE_ENGINE_GEOM) + S8003_CH_STAMP + 4, pm->ta_seq); ++ s8003_channel_addr(APPLE_ENGINE_GEOM) + S8003_CH_STAMP + 4, pm->ta_seq, gpu_ticks); + pm->td_seq = seq; + apple->frag_seq = seq; + err = s8003_publish(apple, APPLE_ENGINE_FRAG, seq, (2 * seq) % S8003_CH_ENTRIES); +@@ -2589,7 +2618,19 @@ static void pvr_apple_s8003_restore_image(struct pvr_apple *apple) + /* start() copies the image and builds the init data anew each time */ + } + ++static void pvr_apple_s8003_debugfs_show(struct pvr_apple *apple, struct seq_file *m) ++{ ++ struct pvr_apple_s8003 *s = apple->chip_data; ++ ++ seq_printf(m, "gpu_ns geometry %llu fragment %llu jobs %llu %llu zero %llu %llu\n", ++ mul_u64_u32_div(READ_ONCE(s->gpu_ticks[0]), 125, 3), ++ mul_u64_u32_div(READ_ONCE(s->gpu_ticks[1]), 125, 3), ++ READ_ONCE(s->gpu_jobs[0]), READ_ONCE(s->gpu_jobs[1]), ++ READ_ONCE(s->gpu_zero[0]), READ_ONCE(s->gpu_zero[1])); ++} ++ + const struct pvr_apple_chip pvr_apple_chip_s8003 = { ++ .debugfs_show = pvr_apple_s8003_debugfs_show, + .fw_name = "apple/gfx-s8003.bin", + .perf_state_max = S8003_PERF_STATE_MAX, + .geom_stream = &pvr_apple_g5p_cmd_geom_stream, +diff --git a/drivers/gpu/drm/imagination/pvr_debugfs.c b/drivers/gpu/drm/imagination/pvr_debugfs.c +index ebdb05d..fce6cdf 100644 +--- a/drivers/gpu/drm/imagination/pvr_debugfs.c ++++ b/drivers/gpu/drm/imagination/pvr_debugfs.c +@@ -2,6 +2,7 @@ + /* Copyright (c) 2023 Imagination Technologies Ltd. */ + + #include "pvr_debugfs.h" ++#include "pvr_apple.h" + + #include "pvr_device.h" + #include "pvr_fw_trace.h" +@@ -27,6 +28,8 @@ pvr_debugfs_init(struct drm_minor *minor) + struct pvr_device *pvr_dev = to_pvr_device(drm_dev); + struct dentry *root = minor->debugfs_root; + ++ pvr_apple_debugfs_init(pvr_dev, root); ++ + for (size_t i = 0; i < ARRAY_SIZE(pvr_debugfs_entries); ++i) { + const struct pvr_debugfs_entry *entry = &pvr_debugfs_entries[i]; + struct dentry *dir;