Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795018759; b=FBMY+/5GkylSQGrtiQCAbTDQATUCA2+TFA14wkqZ8OnmpNPxiTOXc68aA/0I2Pbkjlvg BWWiMrAA8gEzU7DS4CWATmf96PkrvIo6UdkB/UmWCqzEPVpWv/7PsnTRL6Apmt6ioGCVR aLMaSROoRRgKQ2zpQJCKJzjuJHsjkMVJUmAO+iD5mXEJLjK2Oo4QK9DzN1e+ndBekclgE bWExsVBP99FBkzLpvToLw4kh+DeK/g/t+HzTY4F0SBq+jsF5E9KRHVLyr2565b55QNevE P+SbDpqRiw+OwQFjCY9MYyLlSLPicCB+e4KE+xoSbKkhdbD0f5iWq4UHrUIHSdJaFHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795018759; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=e6Dw3mmkNPkB/2ZHPaLnBw7TSSC731lfoPG3HG7xfDQ=; b=dJtZ3jdN/f9oC6ffePH2h1uf9mt/pfm4POLnCu+afKT65zN1lLgNHpJgOKEGyjdY8UFP UnSjWkDTXqyQWFOl96emTU9GrUvq/j3PZCIplJ/fBN2+9ULzYtMSRiMmlzfjSl1IUWRCH 9JuqDaMwOVbnZjQD0IWJz6krTmx3oWiWrZTqgZGYefNCAT7fKo7DvFKIgKEI46D1DZkFA NEAQkmSjHp0ofDhiBwPtNkS3pX50nEHCDOnUaYLnFOh+u2oaTSYVztbriolfo9HU+o/ZO 6QroE6nglY49FCldtHvFDBpAWjfUWvwX9tYfF1O4ypMkERpCJ8hVPODkxqLtw+PrQmQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SpCujIsz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99F3E606A320; Wed, 18 Nov 2026 16:19:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SpCujIsz Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBFDF1F000C4; Wed, 18 Nov 2026 16:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795018759; bh=e6Dw3mmkNPkB/2ZHPaLnBw7TSSC731lfoPG3HG7xfDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SpCujIszgWbdo6hF3LgnBCtQ4pCLi2a+YyPA8aWwTRS4ov9sL6Q5shro+yoNI6f7x QkLEusg8odarGl446ghJpny/Qg6+CJVPALCphqdYtOGb44R/VZ3Sgtqaprqf/epXDB +3pmVRY5AOIUVPQgCLWO0Ik8lySicgUD3PZaSbFw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Baryshkov , Konrad Dybcio , Rob Clark , Sasha Levin Subject: [PATCH 7.3 1313/2651] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Date: Wed, 18 Nov 2026 15:42:33 +0100 Message-ID: <20261118150335.237619061@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Baryshkov [ Upstream commit 77e3ffcf69065c4ce92c725540e0b4db14f43ad7 ] Only a530/a540 have a GPMU. On the other a5xx parts, reading the 0xa800-0xac60 GPMU aperture during a crashdump resets the board -- on sda660 (a512) a GPU hang thus reboots the SoC instead of recovering. Split the GPMU block into its own array and collect it only when a GPMU is present. Fixes: e20c9284c8f2 ("drm/msm/adreno: Add support for Adreno 510 GPU") Assisted-by: LLM Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio Patchwork: https://patchwork.freedesktop.org/patch/754867/ Message-ID: <20260920-a5xx-no-gpmu-v1-1-714200254f76@oss.qualcomm.com> Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 49 +++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c index 5d96b8f631564..3974aaf6fd33f 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -1337,9 +1337,14 @@ static const u32 a5xx_registers[] = { 0xE800, 0xE806, 0xE810, 0xE89A, 0xE8A0, 0xE8A4, 0xE8AA, 0xE8EB, 0xE900, 0xE905, 0xEB80, 0xEB8F, 0xEBB0, 0xEBB0, 0xEC00, 0xEC05, 0xEC08, 0xECE9, 0xECF0, 0xECF0, 0xEA80, 0xEA80, 0xEA82, 0xEAA3, - 0xEAA5, 0xEAC2, 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D, - 0XA880, 0xA88D, 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5, - 0xAC60, 0xAC60, ~0, + 0xEAA5, 0xEAC2, ~0, +}; + +/* GPMU registers, only valid on parts with a GPMU (a530/a540) */ +static const u32 a5xx_gpmu_registers[] = { + 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D, 0xA880, 0xA88D, + 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5, 0xAC60, 0xAC60, + ~0, }; static void a5xx_dump(struct msm_gpu *gpu) @@ -1448,6 +1453,7 @@ struct a5xx_crashdumper { struct a5xx_gpu_state { struct msm_gpu_state base; u32 *hlsqregs; + u32 *gpmuregs; }; static int a5xx_crashdumper_init(struct msm_gpu *gpu, @@ -1565,8 +1571,30 @@ static void a5xx_gpu_state_get_hlsq_regs(struct msm_gpu *gpu, msm_gem_kernel_put(dumper.bo, gpu->vm); } +static void a5xx_gpu_state_get_gpmu_regs(struct msm_gpu *gpu, + struct a5xx_gpu_state *a5xx_state) +{ + u32 count = 0, pos = 0; + int i; + + for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2) + count += a5xx_gpmu_registers[i + 1] - a5xx_gpmu_registers[i] + 1; + + a5xx_state->gpmuregs = kcalloc(count, sizeof(u32), GFP_KERNEL); + if (!a5xx_state->gpmuregs) + return; + + for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2) { + u32 addr; + + for (addr = a5xx_gpmu_registers[i]; addr <= a5xx_gpmu_registers[i + 1]; addr++) + a5xx_state->gpmuregs[pos++] = gpu_read(gpu, addr); + } +} + static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu) { + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu_state *a5xx_state = kzalloc_obj(*a5xx_state); bool stalled = !!(gpu_read(gpu, REG_A5XX_RBBM_STATUS3) & BIT(24)); @@ -1581,6 +1609,9 @@ static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu) a5xx_state->base.rbbm_status = gpu_read(gpu, REG_A5XX_RBBM_STATUS); + if (adreno_is_a530(adreno_gpu) || adreno_is_a540(adreno_gpu)) + a5xx_gpu_state_get_gpmu_regs(gpu, a5xx_state); + /* * Get the HLSQ regs with the help of the crashdumper, but only if * we are not stalled in an iommu fault (in which case the crashdumper @@ -1602,6 +1633,7 @@ static void a5xx_gpu_state_destroy(struct kref *kref) struct a5xx_gpu_state, base); kfree(a5xx_state->hlsqregs); + kfree(a5xx_state->gpmuregs); adreno_gpu_state_destroy(state); kfree(a5xx_state); @@ -1630,6 +1662,17 @@ static void a5xx_show(struct msm_gpu *gpu, struct msm_gpu_state *state, adreno_show(gpu, state, p); + if (a5xx_state->gpmuregs) { + u32 o, pos = 0; + + drm_printf(p, "registers-gpmu:\n"); + + for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2) + for (o = a5xx_gpmu_registers[i]; o <= a5xx_gpmu_registers[i + 1]; o++) + drm_printf(p, " - { offset: 0x%04x, value: 0x%08x }\n", + o << 2, a5xx_state->gpmuregs[pos++]); + } + /* Dump the additional a5xx HLSQ registers */ if (!a5xx_state->hlsqregs) return; -- 2.53.0