From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796387653; b=eZhTEciofLwoX/HU63G+lZYRaHQmzx2AEUaym7cXlycs1ZtJtiCZ3FVGZIuN1tLn5NA2 cwuYJIt0woC078NsRGosauOkcrCBQKhyE/J/yH9E8wfkJBXbTGmXvR9w7TkfQwplEvfvX Y7Vuy9abppOWdze/YZCAb+Ho329T9CzpbCpcp7MEc7wsFt5c/U5Z2yU9fKxAz1GHU0Qg1 0LyJ9se6W0L5BC9lM42vwGMnrsgItEdYyWmT3Pg2BWzBFz5Ux5NbbDvBJRUN5hW9n1gUI fHgvef8B7PyujUdZzNmnZJyrqvjuDmp2eAtVObCQ33nOh05pSpi1xhGAQzZDTmH4jIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387653; 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=ZifKMladpgRwsY2wcznSGfHzcTUBrLrvtJiCj/4iYU4=; b=ezrE+Cf3oXDxrJgiDFtXD/Prc1MlUlT/kOq0Yz55/tV5UG3mREZD1Gb+DLS55QbK5fQ3 Kx+kYj5RpYRButpKKBegZbiDKywgZIzkn/bfPxBfnFwkDAldVh/fioD/tzO5QqsICsaIp 8TARO6c+Xl9C8ha+lUw6jjFgujBUYFeQevID1xQGlc8mBUMEh44jd7XqSMT1vQMKf6qJF w2RewVwUVI3Pgye43vh7jdkTTu/ZTjzXf1opD+u4Q/cnQ5SSURLGHLE9jNMO4xNRzcri+ zTjThhmu44+sIJyICo+7HvsRuGfsopz0o0mwxvAMnXGCqHUGGesDWcQVbg6NeskRMHw== 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=TF9W8Y1o; 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 B7850606A334; Fri, 4 Dec 2026 12:34:13 +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=TF9W8Y1o Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E3C51F000C2; Fri, 4 Dec 2026 12:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387653; bh=ZifKMladpgRwsY2wcznSGfHzcTUBrLrvtJiCj/4iYU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TF9W8Y1o2z9TAiWKh4QXBKsl9wLiXh1q03Ek81haqIekNsofR97cW9s+qRPwineh0 uKKaYjSDRcJDwJunAbkSkhhUPbEwf14sI3pO4L6Lx7mQrIRBTR05GOnCl93fQLlw/b arG865ZZNeRKmFLh8zJwx/9QvgD9pJj7jrx1/Veo= 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 6.1 0335/1059] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Date: Fri, 4 Dec 2026 18:57:46 +0900 Message-ID: <20261204100652.948311570@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 [ sashal: Kept the tree's kzalloc(sizeof(*a5xx_state), GFP_KERNEL) instead of kzalloc_obj() and added the new adreno_gpu declaration above it. ] 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 5a10628934bc6..e01bc8200f78f 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -1332,9 +1332,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) @@ -1445,6 +1450,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, @@ -1562,8 +1568,30 @@ static void a5xx_gpu_state_get_hlsq_regs(struct msm_gpu *gpu, msm_gem_kernel_put(dumper.bo, gpu->aspace); } +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(sizeof(*a5xx_state), GFP_KERNEL); bool stalled = !!(gpu_read(gpu, REG_A5XX_RBBM_STATUS3) & BIT(24)); @@ -1579,6 +1607,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 @@ -1600,6 +1631,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); @@ -1628,6 +1660,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