From fec7f01b0bf7116c435103068ff33b9fc9cd4d3d Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Thu, 3 Dec 2026 06:31:52 +0800 Subject: [PATCH] drm/agx: Leave the RGX registers alone after a job times out On the iPhone XR a job timed out on the GPU desktop, and the timeout handler's read of the MMU fault status (RGX 0x17040) took an SError on the same CPU and reset the phone into iOS. Only the firmware may touch the RGX block (it may be powered down when the host looks). Drop the read and the mapping; the handler still marks the GPU wedged, fails the job and logs the stamps and the firmware trace from shared memory. Assisted-by: LLM Signed-off-by: Henrik Klee --- drivers/gpu/drm/agx/agx.h | 1 - drivers/gpu/drm/agx/agx_drv.c | 4 ---- drivers/gpu/drm/agx/agx_fw.c | 14 +++++++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/agx/agx.h b/drivers/gpu/drm/agx/agx.h index 0e27ef58826531..5abb22712231a1 100644 --- a/drivers/gpu/drm/agx/agx.h +++ b/drivers/gpu/drm/agx/agx.h @@ -55,7 +55,6 @@ struct agx_device { const struct asc_segment *segs; int nsegs; phys_addr_t sgx, fender; - void __iomem *rgx; /* read only, for the MMU fault status */ /* Firmware structures, see agx_fw.c. */ void *buf; diff --git a/drivers/gpu/drm/agx/agx_drv.c b/drivers/gpu/drm/agx/agx_drv.c index 13f7a5718cf64b..aa455db070fdd5 100644 --- a/drivers/gpu/drm/agx/agx_drv.c +++ b/drivers/gpu/drm/agx/agx_drv.c @@ -874,10 +874,6 @@ static int agx_probe(struct platform_device *pdev) if (!res) return dev_err_probe(dev, -EINVAL, "no sgx registers\n"); agx->sgx = res->start; - /* The firmware owns these; only read the fault status after a hang. */ - agx->rgx = devm_ioremap(dev, res->start, resource_size(res)); - if (!agx->rgx) - return -ENOMEM; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fender"); if (!res) return dev_err_probe(dev, -EINVAL, "no fender registers\n"); diff --git a/drivers/gpu/drm/agx/agx_fw.c b/drivers/gpu/drm/agx/agx_fw.c index dcd65eba1b9302..67743f4d4c3f80 100644 --- a/drivers/gpu/drm/agx/agx_fw.c +++ b/drivers/gpu/drm/agx/agx_fw.c @@ -56,7 +56,6 @@ MODULE_PARM_DESC(max_pstate, "highest GPU pstate, 1 (316 MHz) to 6 (1098 MHz)"); #define EV 3 #define EV_TA 4 #define EV_3D 7 -#define RGX_MMU_FAULT_STATUS 0x17040 #define DONE_STAMP 0xcafe0003 /* * Render stamps count up by 0x100 per job, as Apple's do: bits 14:8 are the @@ -1220,7 +1219,7 @@ static void agx_dump_trace(struct agx_device *agx) void agx_fw_timeout(struct agx_device *agx) { struct dma_fence *fence; - u64 st; + if (agx->ipad_memory) { agx->wedged = true; dev_err(agx->dev, "J171 firmware job timeout; reboot required\n"); @@ -1231,11 +1230,12 @@ void agx_fw_timeout(struct agx_device *agx) dev_warn(agx->dev, "job finished without an event\n"); return; } - st = readq(agx->rgx + RGX_MMU_FAULT_STATUS); - dev_err(agx->dev, - "job timed out, GPU wedged; MMU fault %#llx: VA %#llx ctx %llu requester %llu %s type %llu\n", - st, (st >> 24) & ~0x3fULL, (st >> 16) & 0x3f, (st >> 8) & 0xff, - st & BIT(4) ? "read" : "write", (st >> 1) & 7); + /* + * Only the firmware may touch the RGX registers: reading the MMU fault + * status here took an SError on the iPhone XR (the block was off) and + * reset the phone. Report what shared memory holds instead. + */ + dev_err(agx->dev, "job timed out, GPU wedged; reboot required\n"); if (agx->active_stamp == agx->rn.scratch + 0x40 && READ_ONCE(*(u32 *)(agx->buf + agx->rn.scratch)) != agx->rn.ta_stamp) dev_err(agx->dev, "render stuck in its TA job\n");