From 5d7189a2d618f49980eb5a2794744e1a0fea4a78 Mon Sep 17 00:00:00 2001 From: johannSo Date: Fri, 4 Dec 2026 21:37:48 +0100 Subject: [PATCH 1/6] arm64: dts: apple: t8011: Keep the DWI power state on DWI carries the voltage manager's requests to the PMIC. With its power state off, the GPU rail never comes up: the GPU firmware boots and answers on its mailbox, but the first access from the AP to the Rogue core's registers (CORE_ID) hangs the bus and the iPad reboots. iBoot and iPadOS keep DWI on; the boot chain can hand it over off. Mark it always-on. Tested on the iPad Pro 12.9" (2nd generation, J120): with DWI on, CORE_ID reads 0x011b0c02 (BVNC 13.7.12.2) and the GPU runs. Assisted-by: LLM Signed-off-by: johannSo Co-Authored-By: Claude Opus 5.5 --- arch/arm64/boot/dts/apple/t8011-pmgr.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8011-pmgr.dtsi b/arch/arm64/boot/dts/apple/t8011-pmgr.dtsi index f4ed57e5521bc3..14ad0025b43b1d 100644 --- a/arch/arm64/boot/dts/apple/t8011-pmgr.dtsi +++ b/arch/arm64/boot/dts/apple/t8011-pmgr.dtsi @@ -87,12 +87,19 @@ apple,always-on; /* Core device */ }; + /* + * DWI carries the voltage manager's requests to the PMIC: with it + * off the GPU rail never comes up and the first RGX access hangs the + * bus. iBoot and iPadOS keep it on; the boot chain can hand it over + * off, so this turns it on at probe. + */ ps_dwi: power-controller@80110 { compatible = "apple,t8010-pmgr-pwrstate", "apple,pmgr-pwrstate"; reg = <0x80110 4>; #power-domain-cells = <0>; #reset-cells = <0>; label = "dwi"; + apple,always-on; }; ps_gpio: power-controller@80118 { From e284e1862ef2857fddbb45aa3d8e71e0a53a50e6 Mon Sep 17 00:00:00 2001 From: johannSo Date: Fri, 4 Dec 2026 21:37:57 +0100 Subject: [PATCH 2/6] drm/imagination: apple: Let a chip place its firmware's runtime data The A10's G9P firmware keeps its data up to 0x8ecc4 in the firmware window, so the RTKit buffers start at PVR_APPLE_FW_RUNTIME (0x8f000). The A10X's G9G firmware's data ends at 0x8ff04 (its start-up code takes that address from the literal at 0x470); with the A10's offset the buffers the firmware asks for land on its own data, and the firmware stalls after its crashlog buffer request. Add fw_runtime to the chip data: where the image and its data end, 0 for PVR_APPLE_FW_RUNTIME. No change for the A10. Assisted-by: LLM Signed-off-by: johannSo Co-Authored-By: Claude Opus 5.5 --- drivers/gpu/drm/imagination/pvr_apple_chip.h | 2 ++ drivers/gpu/drm/imagination/pvr_apple_t8010.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_apple_chip.h b/drivers/gpu/drm/imagination/pvr_apple_chip.h index ea6a1c52f9c38d..f248551cf1c16c 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_chip.h +++ b/drivers/gpu/drm/imagination/pvr_apple_chip.h @@ -366,6 +366,8 @@ struct pvr_apple { */ struct pvr_apple_chip { const char *fw_name; + /* End of the image and its runtime data in the window; 0: PVR_APPLE_FW_RUNTIME */ + u32 fw_runtime; u32 perf_state_max; bool fixed_perf_state; u32 compute_slots; diff --git a/drivers/gpu/drm/imagination/pvr_apple_t8010.c b/drivers/gpu/drm/imagination/pvr_apple_t8010.c index 8ed13bcc57487f..603c96f6bf4e42 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_t8010.c +++ b/drivers/gpu/drm/imagination/pvr_apple_t8010.c @@ -151,6 +151,12 @@ static void pvr_apple_set_window(struct pvr_apple *apple) writel(1, t->iop + IOP_WINDOW_ENABLE); } +/* Where the RTKit buffers may start: after the image and its data */ +static u32 pvr_apple_t8010_fw_runtime(struct pvr_apple *apple) +{ + return apple->chip->fw_runtime ?: PVR_APPLE_FW_RUNTIME; +} + static int pvr_apple_t8010_init(struct pvr_apple *apple) { struct device *dev = apple_dev(apple); @@ -179,10 +185,10 @@ static int pvr_apple_t8010_init(struct pvr_apple *apple) if (!IS_ALIGNED(t->win_dma, SZ_16K)) return dev_err_probe(dev, -EINVAL, "firmware window %pad not 16 KiB aligned\n", &t->win_dma); - t->win_next = PVR_APPLE_FW_RUNTIME; + t->win_next = pvr_apple_t8010_fw_runtime(apple); /* The firmware writes into its image while it runs: the copy is for a reset */ - err = pvr_apple_fw_load(apple, PVR_APPLE_FW_RUNTIME); + err = pvr_apple_fw_load(apple, pvr_apple_t8010_fw_runtime(apple)); if (err) return err; memcpy(t->win, apple->fw_image, apple->fw_size); @@ -323,7 +329,7 @@ static void pvr_apple_t8010_restore_image(struct pvr_apple *apple) /* The window as at probe: the image, zeroes after it, RTKit buffers anew */ memset(t->win, 0, pvr_apple_layout_init_offset()); memcpy(t->win, apple->fw_image, apple->fw_size); - t->win_next = PVR_APPLE_FW_RUNTIME; + t->win_next = pvr_apple_t8010_fw_runtime(apple); wmb(); } From 728a519e5a86f88c6bbc4fe646a5cfbbe8ccf355 Mon Sep 17 00:00:00 2001 From: johannSo Date: Fri, 4 Dec 2026 21:38:04 +0100 Subject: [PATCH 3/6] drm/imagination: apple: Size the A10's job register blocks per chip StartTA and Start3D load fixed register lists from the job record: on the A10's G9P firmware, StartTA's ends with RGX 0x11030 for each of six clusters (28 words), and Start3D's has 0xfc0 for each of two pipes and 0x11020 and 0x11080 for each of six clusters (29 words). The A10X's G9G firmware is the same build for a bigger core: it loads 0xfc0 for three pipes and the cluster registers for twelve clusters (Start3D's loads at fw 0xc02c-0xc2c2, StartTA's up to fw 0xb164), so StartTA takes 34 words and every Start3D word after 0xfc0 sits one slot later, 42 words in all. With the A10's list the fragment job hangs. Build both lists from a chip's cluster and pipe counts, and let the record writers take the count they are given. The userspace extension keeps its six cluster values; the clusters are set alike, so cluster n takes value n % 6. The A10's lists are unchanged. Assisted-by: LLM Signed-off-by: johannSo Co-Authored-By: Claude Opus 5.5 --- .../gpu/drm/imagination/pvr_apple_layout.c | 7 +- .../gpu/drm/imagination/pvr_apple_layout.h | 15 +++- drivers/gpu/drm/imagination/pvr_apple_t8010.c | 70 +++++++++++++------ 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_apple_layout.c b/drivers/gpu/drm/imagination/pvr_apple_layout.c index d04cfc0ee6a427..a7de52ce310292 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_layout.c +++ b/drivers/gpu/drm/imagination/pvr_apple_layout.c @@ -27,6 +27,7 @@ #include #include +#include #include #define FW_VA_HEAP 0x00100000u /* heap descriptor 0 */ @@ -524,7 +525,8 @@ void pvr_apple_layout_write_ta_job(u8 *heap, u32 seq, const struct pvr_apple_ta_ heap[i] = 0; for (i = 0; i < 8; i++) wr32(heap, regs32 + 4 * i, job->regs32[i]); - for (i = 0; i < 28; i++) + /* At most 0x100 bytes: the cancel block follows at +0x900 */ + for (i = 0; i < min_t(u32, job->regs64_count, 0x100 / 8); i++) wr64(heap, regs64 + 8 * i, job->regs64[i]); wr32(heap, sc + TA_CANCEL, 0xffffffff); wr32(heap, sc + TA_CANCEL + 4, 0xffffffff); @@ -651,7 +653,8 @@ void pvr_apple_layout_write_3d_job(u8 *heap, u32 seq, const struct pvr_apple_3d_ heap[i] = 0; for (i = 0; i < 18; i++) wr32(heap, cmd + 0x3b0 + 4 * i, job->regs32[i]); - for (i = 0; i < 29; i++) + /* Up to 0x3b0, where the 32-bit block starts */ + for (i = 0; i < min_t(u32, job->regs64_count, (0x3b0 - 0x68) / 8); i++) wr64(heap, cmd + 0x68 + 8 * i, job->regs64[i]); wr32(heap, sc + F_CANCEL, 0xffffffff); wr32(heap, sc + F_CANCEL + 4, 0xffffffff); diff --git a/drivers/gpu/drm/imagination/pvr_apple_layout.h b/drivers/gpu/drm/imagination/pvr_apple_layout.h index 1796162cf81c8d..fad2158592baf9 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_layout.h +++ b/drivers/gpu/drm/imagination/pvr_apple_layout.h @@ -21,9 +21,18 @@ void pvr_apple_layout_build(u8 *win, u64 win_pa, u8 *heap, u64 heap_pa, u64 gpu_ #define PVR_APPLE_GPU_DATA 0x200000ull /* stream at +0, PDS HALT at +0x1000 */ void pvr_apple_layout_write_compute_job(u8 *heap, u32 seq, u64 stream, u64 ctx_state); /* A geometry (TA) job; see pvr_apple_layout_write_ta_job() */ +/* + * The register blocks' largest sizes: the A10X's G9G firmware loads its + * per-cluster registers for 12 clusters and 0xfc0 for three pipes. + */ +#define PVR_APPLE_TA_REGS64_MAX 34 +#define PVR_APPLE_3D_REGS64_MAX 42 + struct pvr_apple_ta_job { u32 regs32[8]; /* RGX 0xc78, 0xc88, 0xc98, 0xc18, 0xc08, 0xc10, 0xc20, 0xc28 */ - u64 regs64[28]; /* RGX 0xc90 ... 0x408, 0xf058 ... 0xf040, 0x11030 x 6 */ + /* RGX 0xc90 ... 0x408, 0xf058 ... 0xf040, 0x11030 per cluster (6 or 12) */ + u64 regs64[PVR_APPLE_TA_REGS64_MAX]; + u32 regs64_count; /* words StartTA loads: 28 on the A10, 34 on the A10X */ u64 free_list; /* GPU address of the free stack (u32 page numbers) */ u32 free_list_pages; u64 mlist, mtile_array, vheap_table; @@ -41,7 +50,9 @@ u32 pvr_apple_layout_ta_pm_state_offset(void); /* A fragment (3D) job; see pvr_apple_layout_write_3d_job() */ struct pvr_apple_3d_job { u32 regs32[18]; /* RGX 0xf18, 0xf80, 0xf88, -, 0x6d0, 0x618 ... 0x11f8 */ - u64 regs64[29]; /* RGX 0xfa8 ... 0xf30, 0x11020 x 6, 0x11080 x 6, 0xfd0 */ + /* RGX 0xfa8 ... 0xf30, 0x11020 and 0x11080 per cluster, 0xfd0 */ + u64 regs64[PVR_APPLE_3D_REGS64_MAX]; + u32 regs64_count; /* words Start3D loads: 29 on the A10, 42 on the A10X */ }; void pvr_apple_layout_build_3d(u8 *heap); diff --git a/drivers/gpu/drm/imagination/pvr_apple_t8010.c b/drivers/gpu/drm/imagination/pvr_apple_t8010.c index 603c96f6bf4e42..9f739afa840471 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_t8010.c +++ b/drivers/gpu/drm/imagination/pvr_apple_t8010.c @@ -347,8 +347,26 @@ static void pvr_apple_t8010_write_compute(struct pvr_apple *apple, u32 seq, u64 pvr_apple_layout_write_compute_job(apple->heap, seq, stream, ctx_state); } +/* + * The firmware's per-cluster and per-pipe register counts. The A10's G9P + * loads six clusters and 0xfc0 for two pipes; the A10X's G9G loads twelve + * clusters and three pipes (Start3D's loads at fw 0xc02c-0xc2c2, StartTA's + * clusters up to fw 0xb164), so every Start3D slot after 0xfc0 moves by one + * word. The + * userspace extension carries one value per A10 cluster; the clusters are + * set alike, so cluster n takes value n % 6. + */ +struct pvr_apple_t8010_regs { + unsigned int clusters; + unsigned int pipes; +}; + +static const struct pvr_apple_t8010_regs pvr_apple_t8010_regs = { .clusters = 6, .pipes = 2 }; + +#define APPLE_EXT_CLUSTERS 6 + static void pvr_apple_geom_job_init(struct pvr_apple_ta_job *ta, const struct pvr_apple_cmd_geom *cmd, - struct pvr_hwrt_data *hwrt) + struct pvr_hwrt_data *hwrt, const struct pvr_apple_t8010_regs *layout) { const struct pvr_hwrt_dataset *set = hwrt->hwrt_dataset; const struct rogue_fwif_hwrtdata_common *common = &set->common; @@ -378,7 +396,9 @@ static void pvr_apple_geom_job_init(struct pvr_apple_ta_job *ta, const struct pv ta->regs64[14] = apple->vdm_call_stack; /* 0x418 */ ta->regs64[15] = cmd->cmd.regs.vdm_ctrl_stream_base; /* 0x408 */ memcpy(&ta->regs64[16], apple->pds_state, sizeof(apple->pds_state)); - memcpy(&ta->regs64[22], apple->cluster, sizeof(apple->cluster)); + for (unsigned int i = 0; i < layout->clusters; i++) + ta->regs64[22 + i] = apple->cluster[i % APPLE_EXT_CLUSTERS]; /* 0x11030 */ + ta->regs64_count = 22 + layout->clusters; mutex_lock(&fl->lock); offset = (u64)(fl->max_pages - fl->current_pages) * sizeof(u32); @@ -392,10 +412,13 @@ static void pvr_apple_geom_job_init(struct pvr_apple_ta_job *ta, const struct pv /* Start3D's register blocks from the Rogue fragment command and the Apple extension */ static void pvr_apple_frag_job_init(struct pvr_apple_3d_job *frag, - const struct pvr_apple_cmd_frag *cmd, struct pvr_hwrt_data *hwrt) + const struct pvr_apple_cmd_frag *cmd, struct pvr_hwrt_data *hwrt, + const struct pvr_apple_t8010_regs *layout) { const struct rogue_fwif_frag_regs *regs = &cmd->cmd.regs; const struct pvr_apple_frag_regs *apple = &cmd->apple; + u64 *r64 = frag->regs64; + unsigned int i, n = 0; memset(frag, 0, sizeof(*frag)); frag->regs32[0] = hwrt->hwrt_dataset->common.isp_mtile_size; /* 0xf18 */ @@ -410,40 +433,44 @@ static void pvr_apple_frag_job_init(struct pvr_apple_3d_job *frag, frag->regs32[10] = apple->r_fd8; frag->regs32[11] = apple->r_4070; memcpy(&frag->regs32[12], apple->line, sizeof(apple->line)); - frag->regs64[0] = apple->isp_sample_pos; /* 0xfa8 */ - frag->regs64[1] = regs->isp_scissor_base; /* 0xfb0 */ - frag->regs64[2] = regs->isp_dbias_base; /* 0xfb8 */ - frag->regs64[3] = regs->isp_oclqry_base; /* 0xfc0, pipe 0 */ - frag->regs64[4] = regs->isp_oclqry_base; /* 0xfc0, pipe 1 */ + r64[n++] = apple->isp_sample_pos; /* 0xfa8 */ + r64[n++] = regs->isp_scissor_base; /* 0xfb0 */ + r64[n++] = regs->isp_dbias_base; /* 0xfb8 */ + for (i = 0; i < layout->pipes; i++) + r64[n++] = regs->isp_oclqry_base; /* 0xfc0, per pipe */ /* * Depth load and store bases, then stencil's (measured: the depth * store reaches memory only with the base in 0xf58) */ - frag->regs64[5] = regs->isp_zlsctl; /* 0xf48 */ - frag->regs64[6] = regs->isp_zload_store_base; /* 0xf50 Z load */ - frag->regs64[7] = regs->isp_zload_store_base; /* 0xf58 Z store */ - frag->regs64[8] = regs->isp_stencil_load_store_base; /* 0xf60 S load */ - frag->regs64[9] = regs->isp_stencil_load_store_base; /* 0xf68 S store */ - frag->regs64[10] = apple->isp_rgn; /* 0xf28 */ - memcpy(&frag->regs64[11], apple->pds_bgnd, sizeof(apple->pds_bgnd)); - frag->regs64[15] = regs->isp_aa; /* 0xf30 */ - memcpy(&frag->regs64[16], apple->cluster0, sizeof(apple->cluster0)); - memcpy(&frag->regs64[22], apple->cluster1, sizeof(apple->cluster1)); - frag->regs64[28] = apple->r_fd0; + r64[n++] = regs->isp_zlsctl; /* 0xf48 */ + r64[n++] = regs->isp_zload_store_base; /* 0xf50 Z load */ + r64[n++] = regs->isp_zload_store_base; /* 0xf58 Z store */ + r64[n++] = regs->isp_stencil_load_store_base; /* 0xf60 S load */ + r64[n++] = regs->isp_stencil_load_store_base; /* 0xf68 S store */ + r64[n++] = apple->isp_rgn; /* 0xf28 */ + for (i = 0; i < ARRAY_SIZE(apple->pds_bgnd); i++) + r64[n++] = apple->pds_bgnd[i]; /* 0x6a0 ... 0x6b8 */ + r64[n++] = regs->isp_aa; /* 0xf30 */ + for (i = 0; i < layout->clusters; i++) + r64[n++] = apple->cluster0[i % APPLE_EXT_CLUSTERS]; /* 0x11020 */ + for (i = 0; i < layout->clusters; i++) + r64[n++] = apple->cluster1[i % APPLE_EXT_CLUSTERS]; /* 0x11080 */ + r64[n++] = apple->r_fd0; /* 0xfd0 */ + frag->regs64_count = n; } static void pvr_apple_t8010_prepare_geom(void *hw, struct pvr_job *job) { union pvr_apple_t8010_render_job *render = hw; - pvr_apple_geom_job_init(&render->ta, job->cmd, job->hwrt); + pvr_apple_geom_job_init(&render->ta, job->cmd, job->hwrt, &pvr_apple_t8010_regs); } static void pvr_apple_t8010_prepare_frag(void *hw, struct pvr_job *job) { union pvr_apple_t8010_render_job *render = hw; - pvr_apple_frag_job_init(&render->frag, job->cmd, job->hwrt); + pvr_apple_frag_job_init(&render->frag, job->cmd, job->hwrt, &pvr_apple_t8010_regs); } static void pvr_apple_t8010_write_geom(struct pvr_apple *apple, u32 seq, const void *hw) @@ -495,3 +522,4 @@ const struct pvr_apple_chip pvr_apple_chip_t8010 = { .write_frag = pvr_apple_t8010_write_frag, .report_hang = pvr_apple_t8010_report_hang, }; + From b3a1f603b4d88683e4e5f9432ae2d0ea334f5957 Mon Sep 17 00:00:00 2001 From: johannSo Date: Fri, 4 Dec 2026 21:38:14 +0100 Subject: [PATCH 4/6] drm/imagination: apple: Add the A10X (T8011) GPU The A10X's GPU is the A10's PowerVR Rogue core grown to twelve clusters (CORE_ID 0x011b0c02, BVNC 13.7.12.2), behind the same Fender block and RTKit coprocessor at the same addresses, and run by Apple's G9G firmware (AGXFirmwareKextG9GRTBuddy) instead of the A10's G9P. Add it as the A10's chip with its own firmware file, the G9G's runtime data offset (0x90000), its twelve clusters and three pipes in the job records, and four performance states (the live ADT's sgx node: 426, 616, 848 and 1086 MHz). Report twelve clusters to userspace, so Mesa plans three phantoms, one per pipe, and mark the BVNC experimental. Tested on the iPad Pro 12.9" (2nd generation, J120) under Omarchy A, with Mesa's PowerVR driver taught the A10X's device info: Mesa's gpu-probe passes (Vulkan through Zink, "PowerVR Apple A10X"), labwc composites on the GPU (WLR_RENDERER=gles2) and the GPU runtime suspends and resumes. The boot still needs pd_ignore_unused and clk_ignore_unused: some power domain switched off as unused freezes the J120, separate from the GPU. Assisted-by: LLM Signed-off-by: johannSo Co-Authored-By: Claude Opus 5.5 --- drivers/gpu/drm/imagination/pvr_apple.c | 16 ++++++- drivers/gpu/drm/imagination/pvr_apple.h | 1 + drivers/gpu/drm/imagination/pvr_apple_t8010.c | 46 +++++++++++++++++++ drivers/gpu/drm/imagination/pvr_device.c | 1 + drivers/gpu/drm/imagination/pvr_drv.c | 10 ++++ 5 files changed, 72 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_apple.c b/drivers/gpu/drm/imagination/pvr_apple.c index aeb5a8278ce964..faa180874bc77d 100644 --- a/drivers/gpu/drm/imagination/pvr_apple.c +++ b/drivers/gpu/drm/imagination/pvr_apple.c @@ -2599,9 +2599,21 @@ void pvr_apple_device_info_init(struct pvr_device *pvr_dev) /* * The A7 (S5L8960X, BVNC 1.70.4.3) has 4 clusters (CORE_ID); with 6, * the GPU info reported 2 phantoms and Mesa's Rogue render path, which - * expects one on a 4-cluster core, refused to record a draw. + * expects one on a 4-cluster core, refused to record a draw. The A10X + * (T8011, 13.7.12.2) has 12: Mesa takes three phantoms from that, one + * per pipe of its G9G firmware. */ - pvr_dev->features.num_clusters = pvr_dev->gpu_id.b == 1 ? 4 : 6; + switch (pvr_gpu_id_to_packed_bvnc(&pvr_dev->gpu_id)) { + case PVR_PACKED_BVNC(1, 70, 4, 3): /* A7 */ + pvr_dev->features.num_clusters = 4; + break; + case PVR_PACKED_BVNC(13, 7, 12, 2): /* A10X */ + pvr_dev->features.num_clusters = 12; + break; + default: + pvr_dev->features.num_clusters = 6; + break; + } pvr_dev->features.has_phys_bus_width = true; pvr_dev->features.phys_bus_width = 40; pvr_dev->features.has_virtual_address_space_bits = true; diff --git a/drivers/gpu/drm/imagination/pvr_apple.h b/drivers/gpu/drm/imagination/pvr_apple.h index 38ab492dd8389f..9aeb0523248f53 100644 --- a/drivers/gpu/drm/imagination/pvr_apple.h +++ b/drivers/gpu/drm/imagination/pvr_apple.h @@ -30,6 +30,7 @@ extern const struct pvr_apple_chip pvr_apple_chip_s5l8960x; extern const struct pvr_apple_chip pvr_apple_chip_s8003; extern const struct pvr_apple_chip pvr_apple_chip_t7000; extern const struct pvr_apple_chip pvr_apple_chip_t8010; +extern const struct pvr_apple_chip pvr_apple_chip_t8011; extern const struct pvr_apple_chip pvr_apple_chip_t8015; /* diff --git a/drivers/gpu/drm/imagination/pvr_apple_t8010.c b/drivers/gpu/drm/imagination/pvr_apple_t8010.c index 9f739afa840471..fdb4021efbd6ea 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_t8010.c +++ b/drivers/gpu/drm/imagination/pvr_apple_t8010.c @@ -362,6 +362,7 @@ struct pvr_apple_t8010_regs { }; static const struct pvr_apple_t8010_regs pvr_apple_t8010_regs = { .clusters = 6, .pipes = 2 }; +static const struct pvr_apple_t8010_regs pvr_apple_t8011_regs = { .clusters = 12, .pipes = 3 }; #define APPLE_EXT_CLUSTERS 6 @@ -466,6 +467,13 @@ static void pvr_apple_t8010_prepare_geom(void *hw, struct pvr_job *job) pvr_apple_geom_job_init(&render->ta, job->cmd, job->hwrt, &pvr_apple_t8010_regs); } +static void pvr_apple_t8011_prepare_geom(void *hw, struct pvr_job *job) +{ + union pvr_apple_t8010_render_job *render = hw; + + pvr_apple_geom_job_init(&render->ta, job->cmd, job->hwrt, &pvr_apple_t8011_regs); +} + static void pvr_apple_t8010_prepare_frag(void *hw, struct pvr_job *job) { union pvr_apple_t8010_render_job *render = hw; @@ -473,6 +481,13 @@ static void pvr_apple_t8010_prepare_frag(void *hw, struct pvr_job *job) pvr_apple_frag_job_init(&render->frag, job->cmd, job->hwrt, &pvr_apple_t8010_regs); } +static void pvr_apple_t8011_prepare_frag(void *hw, struct pvr_job *job) +{ + union pvr_apple_t8010_render_job *render = hw; + + pvr_apple_frag_job_init(&render->frag, job->cmd, job->hwrt, &pvr_apple_t8011_regs); +} + static void pvr_apple_t8010_write_geom(struct pvr_apple *apple, u32 seq, const void *hw) { pvr_apple_layout_write_ta_job(apple->heap, seq, hw); @@ -523,3 +538,34 @@ const struct pvr_apple_chip pvr_apple_chip_t8010 = { .report_hang = pvr_apple_t8010_report_hang, }; +/* + * The A10X (T8011): the A10's register windows and RTKit build, with its own + * G9G firmware (AGXFirmwareKextG9GRTBuddy). + */ +const struct pvr_apple_chip pvr_apple_chip_t8011 = { + .fw_name = "apple/gfx-t8011.bin", + /* Its data ends at 0x8ff04 (start-up literal at 0x470), 0x1000 past the A10's */ + .fw_runtime = 0x90000, + .perf_state_max = 4, /* live ADT sgx: 426, 616, 848 and 1086 MHz */ + .compute_slots = APPLE_JOB_SLOTS, + .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, + .stop = pvr_apple_t8010_stop, + .idle = pvr_apple_t8010_idle, + .restore_image = pvr_apple_t8010_restore_image, + .kick = pvr_apple_t8010_kick, + .write_compute = pvr_apple_t8010_write_compute, + .prepare_geom = pvr_apple_t8011_prepare_geom, + .prepare_frag = pvr_apple_t8011_prepare_frag, + .write_geom = pvr_apple_t8010_write_geom, + .write_frag = pvr_apple_t8010_write_frag, + .report_hang = pvr_apple_t8010_report_hang, +}; diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c index 580e76e7d91e3e..e1271ad81c819b 100644 --- a/drivers/gpu/drm/imagination/pvr_device.c +++ b/drivers/gpu/drm/imagination/pvr_device.c @@ -547,6 +547,7 @@ pvr_gpu_support_level(const struct pvr_gpu_id *gpu_id) return PVR_GPU_SUPPORTED; case PVR_PACKED_BVNC(1, 70, 4, 3): /* Apple A7 (S5L8960X), the J71's */ + case PVR_PACKED_BVNC(13, 7, 12, 2): /* Apple A10X (T8011) */ return PVR_GPU_EXPERIMENTAL; default: diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imagination/pvr_drv.c index f84b607c829966..61ebab16192231 100644 --- a/drivers/gpu/drm/imagination/pvr_drv.c +++ b/drivers/gpu/drm/imagination/pvr_drv.c @@ -1554,6 +1554,12 @@ static const struct pvr_device_data pvr_device_data_apple = { .apple_chip = &pvr_apple_chip_t8010, }; +static const struct pvr_device_data pvr_device_data_apple_t8011 = { + .pwr_ops = &pvr_power_sequence_ops_apple, + .apple_fw = true, + .apple_chip = &pvr_apple_chip_t8011, +}; + static const struct pvr_device_data pvr_device_data_apple_t8015 = { .pwr_ops = &pvr_power_sequence_ops_apple, .apple_fw = true, @@ -1589,6 +1595,10 @@ static const struct of_device_id dt_match[] = { .compatible = "apple,t8010-gpu", .data = &pvr_device_data_apple, }, + { + .compatible = "apple,t8011-gpu", + .data = &pvr_device_data_apple_t8011, + }, { .compatible = "apple,t8015-gpu", .data = &pvr_device_data_apple_t8015, From 76d312a5fb6f70b6f3d3ce4323cbd547f56afc89 Mon Sep 17 00:00:00 2001 From: johannSo Date: Fri, 4 Dec 2026 21:38:28 +0100 Subject: [PATCH 5/6] arm64: dts: apple: t8011: Add the GPU Describe the A10X's GPU as the A10's: the Rogue core, Fender and the GPU coprocessor's IOP at the A10's addresses (the ADT's sgx and gfx-kf nodes), the coprocessor's mailbox, the GFX power domain and an empty OPP table the bootloader fills from the ADT's sgx node. The mailbox interrupts are gfx-kf's 185-188, the A10's minus four. The firmware is the A10X's own G9G build, apple/gfx-t8011.bin. Assisted-by: LLM Signed-off-by: johannSo Co-Authored-By: Claude Opus 5.5 --- arch/arm64/boot/dts/apple/t8011.dtsi | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8011.dtsi b/arch/arm64/boot/dts/apple/t8011.dtsi index 86c81e2bf53077..05c77a0fd9bce3 100644 --- a/arch/arm64/boot/dts/apple/t8011.dtsi +++ b/arch/arm64/boot/dts/apple/t8011.dtsi @@ -18,6 +18,10 @@ #address-cells = <2>; #size-cells = <2>; + aliases { + gpu = &gpu; /* the bootloader fills its OPP table */ + }; + nco_clkref: clock-ref-nco { compatible = "fixed-clock"; #clock-cells = <0>; @@ -149,6 +153,16 @@ #endif }; + /* + * The GPU's performance states. The bootloader (m1n1) fills one entry + * per powered state from the Apple device tree's sgx node: opp-hz, + * opp-microvolt and opp-level, the state number the GPU's power + * controller takes. The table stays empty without it. + */ + gpu_opp: opp-table-gpu { + compatible = "operating-points-v2"; + }; + soc { compatible = "simple-bus"; #address-cells = <2>; @@ -337,6 +351,38 @@ status = "disabled"; }; + /* + * The A10X GPU (G9G): the A10's register windows (ADT sgx and + * gfx-kf: rgx, Fender, IOP at the same addresses); its own + * firmware (AGXFirmwareKextG9GRTBuddy, not the A10's G9P). + */ + gpu: gpu@201000000 { + compatible = "apple,t8011-gpu"; + reg = <0x2 0x01000000 0x0 0x100000>, + <0x2 0x01d00000 0x0 0x5000>, + <0x2 0x01d20000 0x0 0x4000>; + reg-names = "rgx", "fender", "iop"; + mboxes = <&gpu_mbox>; + power-domains = <&ps_gfx>; + operating-points-v2 = <&gpu_opp>; + firmware-name = "apple/gfx-t8011.bin"; + }; + + /* ADT gfx-kf interrupts 186, 185, 188, 187: the A10's minus 4 */ + gpu_mbox: mbox@201d24000 { + compatible = "apple,t8010-a7iop-mailbox"; + reg = <0x2 0x01d24000 0x0 0x1000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_gfx>; + }; + /* * The H9G display pipe. Only its registers are described: the * boot framebuffer names it so that the boot scanout cadence From c656ae4d8e904d4faa633d6effb730debfed4de8 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Sat, 5 Dec 2026 09:28:13 +0800 Subject: [PATCH 6/6] drm/imagination: apple: Give the A10X's geometry registers their room The A10X's StartTA loads 34 64-bit registers, but the geometry job record had room for 32 at +0x800, before the scratch words at +0x900, and the writer stopped there. The firmware then read the last two words from TA_SKIP and its neighbour, so two of the twelve clusters got 0 in their 0x11030 instead of the userspace value; writing all 34 would have set TA_SKIP and skipped every job. The firmware takes the block by pointer, so give its place to the match data: the A10 keeps +0x800, the A10X's block goes to +0x780, which leaves room for 48 words before +0x900. All 34 words are written, and the A10's job record is unchanged. Assisted-by: LLM Signed-off-by: Henrik Klee --- drivers/gpu/drm/imagination/pvr_apple_layout.c | 11 +++++++---- drivers/gpu/drm/imagination/pvr_apple_layout.h | 1 + drivers/gpu/drm/imagination/pvr_apple_t8010.c | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_apple_layout.c b/drivers/gpu/drm/imagination/pvr_apple_layout.c index a7de52ce310292..c6aa440adeeda0 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_layout.c +++ b/drivers/gpu/drm/imagination/pvr_apple_layout.c @@ -514,10 +514,10 @@ void pvr_apple_layout_write_ta_job(u8 *heap, u32 seq, const struct pvr_apple_ta_ { u32 base = HEAP_TA_JOBS + ((seq - 1) % JOBS_TA) * JOB_TA_STRIDE; u32 cmd = base, useq = base + 0x600, sc = base + 0x900, ctx = base + 0xa00; - u32 regs32 = base + 0x700, regs64 = base + 0x800; + u32 regs32 = base + 0x700, regs64 = base + job->regs64_offset; u32 fl = HEAP_TA_FREE_LIST, slot = HEAP_TA_PM_SLOT; u32 work = HEAP_TA_RING + ((seq - 1) % RING_ENTRIES) * WORK_ENTRY_SIZE; - u32 i; + u32 i, n; for (i = base; i < base + JOB_TA_STRIDE; i++) heap[i] = 0; @@ -525,8 +525,11 @@ void pvr_apple_layout_write_ta_job(u8 *heap, u32 seq, const struct pvr_apple_ta_ heap[i] = 0; for (i = 0; i < 8; i++) wr32(heap, regs32 + 4 * i, job->regs32[i]); - /* At most 0x100 bytes: the cancel block follows at +0x900 */ - for (i = 0; i < min_t(u32, job->regs64_count, 0x100 / 8); i++) + /* The 64-bit block sits after the 32-bit one and ends before +0x900 */ + n = job->regs64_count; + if (WARN_ON_ONCE(job->regs64_offset < 0x720 || job->regs64_offset + 8 * n > 0x900)) + n = 0; + for (i = 0; i < n; i++) wr64(heap, regs64 + 8 * i, job->regs64[i]); wr32(heap, sc + TA_CANCEL, 0xffffffff); wr32(heap, sc + TA_CANCEL + 4, 0xffffffff); diff --git a/drivers/gpu/drm/imagination/pvr_apple_layout.h b/drivers/gpu/drm/imagination/pvr_apple_layout.h index fad2158592baf9..8473d26da47de6 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_layout.h +++ b/drivers/gpu/drm/imagination/pvr_apple_layout.h @@ -33,6 +33,7 @@ struct pvr_apple_ta_job { /* RGX 0xc90 ... 0x408, 0xf058 ... 0xf040, 0x11030 per cluster (6 or 12) */ u64 regs64[PVR_APPLE_TA_REGS64_MAX]; u32 regs64_count; /* words StartTA loads: 28 on the A10, 34 on the A10X */ + u32 regs64_offset; /* the 64-bit block's place in the job record */ u64 free_list; /* GPU address of the free stack (u32 page numbers) */ u32 free_list_pages; u64 mlist, mtile_array, vheap_table; diff --git a/drivers/gpu/drm/imagination/pvr_apple_t8010.c b/drivers/gpu/drm/imagination/pvr_apple_t8010.c index fdb4021efbd6ea..d52359c7911247 100644 --- a/drivers/gpu/drm/imagination/pvr_apple_t8010.c +++ b/drivers/gpu/drm/imagination/pvr_apple_t8010.c @@ -359,10 +359,20 @@ static void pvr_apple_t8010_write_compute(struct pvr_apple *apple, u32 seq, u64 struct pvr_apple_t8010_regs { unsigned int clusters; unsigned int pipes; + /* + * StartTA's 64-bit block in the geometry job record, which the + * firmware takes by pointer: the A10's 28 words fit at +0x800, before + * the scratch words at +0x900; the A10X's 34 do not, and go to +0x780. + */ + u32 ta_regs64; }; -static const struct pvr_apple_t8010_regs pvr_apple_t8010_regs = { .clusters = 6, .pipes = 2 }; -static const struct pvr_apple_t8010_regs pvr_apple_t8011_regs = { .clusters = 12, .pipes = 3 }; +static const struct pvr_apple_t8010_regs pvr_apple_t8010_regs = { + .clusters = 6, .pipes = 2, .ta_regs64 = 0x800, +}; +static const struct pvr_apple_t8010_regs pvr_apple_t8011_regs = { + .clusters = 12, .pipes = 3, .ta_regs64 = 0x780, +}; #define APPLE_EXT_CLUSTERS 6 @@ -400,6 +410,7 @@ static void pvr_apple_geom_job_init(struct pvr_apple_ta_job *ta, const struct pv for (unsigned int i = 0; i < layout->clusters; i++) ta->regs64[22 + i] = apple->cluster[i % APPLE_EXT_CLUSTERS]; /* 0x11030 */ ta->regs64_count = 22 + layout->clusters; + ta->regs64_offset = layout->ta_regs64; mutex_lock(&fl->lock); offset = (u64)(fl->max_pages - fl->current_pages) * sizeof(u32);