From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35DC8105D990 for ; Wed, 8 Apr 2026 01:46:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8602910E503; Wed, 8 Apr 2026 01:46:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=pm.me header.i=@pm.me header.b="mqqb9Div"; dkim-atps=neutral Received: from mail-43100.protonmail.ch (mail-43100.protonmail.ch [185.70.43.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id DAA8D10E502 for ; Wed, 8 Apr 2026 01:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1775612759; x=1775871959; bh=LSzvcm8YnsBqe1Uv1kKDbnRqVCPKtCzvC/ssD1+WngI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=mqqb9DivsE0dpBSxeyQlSI9xeVXu0zOS7tsSStrIPJ9quCVBHXi7Utqj6WfyRUGES Pc4m2XnAp50q6NeTZpqJJGaSN5TgzkZneIiY0TrKMbJZAJR3ifT7Ny/G/aKdAjl11+ B1qVSna0vZKAiZ4+khFiTCGnVTwqiP533/DaxlJFt/wTV4ZSLrmliUMLFqCLhxCoOd 6LukNU3amGWIQOLW1gJvTXgm1HXqY2mT7/FjN7Z9eNnQiDqTXXNEUBvIm4R5Rx6OwH DQ4eF5rHGmbXhGfU98SlDRHvfSXvzMuTdVDZj+O+i9rfQR/aCgsntnDdbd99YztbCl Fx/7usaCayDIg== Date: Wed, 08 Apr 2026 01:45:53 +0000 To: Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , Akhil P Oommen , Bjorn Andersson From: Alexander Koskovich Cc: Luca Weiss , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Koskovich , Konrad Dybcio Subject: [PATCH RFC v3 4/7] drm/msm/adreno: set cx_misc_mmio regardless of if platform has LLCC Message-ID: <20260407-adreno-810-v3-4-30cb7f196ed4@pm.me> In-Reply-To: <20260407-adreno-810-v3-0-30cb7f196ed4@pm.me> References: <20260407-adreno-810-v3-0-30cb7f196ed4@pm.me> Feedback-ID: 37836894:user:proton X-Pm-Message-ID: f678fda9a322eb11c041ccaf7d8f403bf5957d08 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Platforms without a LLCC (e.g. milos) still need to be able to read and write to the cx_mem region. Previously if LLCC slices were unavailable the cx_misc_mmio mapping was overwritten with ERR_PTR, causing a crash when the GMU later accessed cx_mem. Move the cx_misc_mmio mapping out of a6xx_llc_slices_init() into a6xx_gpu_init() so that cx_mem mapping is independent of LLCC. Reviewed-by: Konrad Dybcio Reviewed-by: Akhil P Oommen Signed-off-by: Alexander Koskovich --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 38 ++++++++++++++++---------------= ---- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/ad= reno/a6xx_gpu.c index 9847f83b92af..d691ad1f88b3 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2039,7 +2039,7 @@ static void a6xx_llc_activate(struct a6xx_gpu *a6xx_g= pu) =09struct msm_gpu *gpu =3D &adreno_gpu->base; =09u32 cntl1_regval =3D 0; =20 -=09if (IS_ERR(a6xx_gpu->cx_misc_mmio)) +=09if (IS_ERR_OR_NULL(a6xx_gpu->llc_slice) && IS_ERR_OR_NULL(a6xx_gpu->htw= _llc_slice)) =09=09return; =20 =09if (!llcc_slice_activate(a6xx_gpu->llc_slice)) { @@ -2098,7 +2098,7 @@ static void a7xx_llc_activate(struct a6xx_gpu *a6xx_g= pu) =09struct adreno_gpu *adreno_gpu =3D &a6xx_gpu->base; =09struct msm_gpu *gpu =3D &adreno_gpu->base; =20 -=09if (IS_ERR(a6xx_gpu->cx_misc_mmio)) +=09if (IS_ERR_OR_NULL(a6xx_gpu->llc_slice) && IS_ERR_OR_NULL(a6xx_gpu->htw= _llc_slice)) =09=09return; =20 =09if (!llcc_slice_activate(a6xx_gpu->llc_slice)) { @@ -2135,31 +2135,12 @@ static void a6xx_llc_slices_destroy(struct a6xx_gpu= *a6xx_gpu) static void a6xx_llc_slices_init(struct platform_device *pdev, =09=09struct a6xx_gpu *a6xx_gpu, bool is_a7xx) { -=09struct device_node *phandle; - =09/* No LLCC on non-RPMh (and by extension, non-GMU) SoCs */ =09if (adreno_has_gmu_wrapper(&a6xx_gpu->base)) =09=09return; =20 -=09/* -=09 * There is a different programming path for A6xx targets with an -=09 * mmu500 attached, so detect if that is the case -=09 */ -=09phandle =3D of_parse_phandle(pdev->dev.of_node, "iommus", 0); -=09a6xx_gpu->have_mmu500 =3D (phandle && -=09=09of_device_is_compatible(phandle, "arm,mmu-500")); -=09of_node_put(phandle); - -=09if (is_a7xx || !a6xx_gpu->have_mmu500) -=09=09a6xx_gpu->cx_misc_mmio =3D msm_ioremap(pdev, "cx_mem"); -=09else -=09=09a6xx_gpu->cx_misc_mmio =3D NULL; - =09a6xx_gpu->llc_slice =3D llcc_slice_getd(LLCC_GPU); =09a6xx_gpu->htw_llc_slice =3D llcc_slice_getd(LLCC_GPUHTW); - -=09if (IS_ERR_OR_NULL(a6xx_gpu->llc_slice) && IS_ERR_OR_NULL(a6xx_gpu->htw= _llc_slice)) -=09=09a6xx_gpu->cx_misc_mmio =3D ERR_PTR(-EINVAL); } =20 #define GBIF_CLIENT_HALT_MASK=09=09BIT(0) @@ -2621,6 +2602,7 @@ static struct msm_gpu *a6xx_gpu_init(struct drm_devic= e *dev) =09struct platform_device *pdev =3D priv->gpu_pdev; =09struct adreno_platform_config *config =3D pdev->dev.platform_data; =09const struct adreno_info *info =3D config->info; +=09struct device_node *phandle; =09struct device_node *node; =09struct a6xx_gpu *a6xx_gpu; =09struct adreno_gpu *adreno_gpu; @@ -2656,6 +2638,20 @@ static struct msm_gpu *a6xx_gpu_init(struct drm_devi= ce *dev) =20 =09a6xx_llc_slices_init(pdev, a6xx_gpu, is_a7xx); =20 +=09/* +=09 * There is a different programming path for A6xx targets with an +=09 * mmu500 attached, so detect if that is the case +=09 */ +=09phandle =3D of_parse_phandle(pdev->dev.of_node, "iommus", 0); +=09a6xx_gpu->have_mmu500 =3D (phandle && +=09=09of_device_is_compatible(phandle, "arm,mmu-500")); +=09of_node_put(phandle); + +=09if (is_a7xx || !a6xx_gpu->have_mmu500) +=09=09a6xx_gpu->cx_misc_mmio =3D msm_ioremap(pdev, "cx_mem"); +=09else +=09=09a6xx_gpu->cx_misc_mmio =3D NULL; + =09ret =3D a6xx_set_supported_hw(&pdev->dev, a6xx_gpu, info); =09if (ret) { =09=09a6xx_llc_slices_destroy(a6xx_gpu); --=20 2.53.0