Received: from mail-pz2-f37.google.com (mail-pz2-f37.google.com [74.125.228.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5591B4C10DD for ; Wed, 30 Sep 2026 18:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790793532; cv=none; b=L7/jQQwZK1kIgBm0syOosvTYka2HvhSjTGZMO0sOZFr24WNgaiievLiJ80ju2rJk+5EnmCI3E5W0kYQVv/JvstX8fOayD7RpjpKlBBP6YWN/5Pp0TXXgpPK25LC8BA5dp13Ygbo9gby4aQ+cn5r0bw3DRFQ5ftGtylgSyrxojB8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790793532; c=relaxed/simple; bh=gwB6d9Z3k0CW/Oqy+i7I0rfrOnAAIB0oSBCF2qad6Ws=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JSZlYv5s+ZDm3qUGueKVAO8MabAqx40IrspfAahiwSSdqmufWzIoAKCP9an8cByjgKQs//wDnzrYaPgdzbP2/+9SYVoPQ7S+gcZmsDjvWkXXs0vykrq0VGF3vstlDRC5IY40ru4dTttIl/KnfY06uKsh+kthv8G3XEyNpvWX77Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gaNbWlLm; arc=none smtp.client-ip=74.125.228.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gaNbWlLm" Received: by mail-pz2-f37.google.com with SMTP id d2e1a72fcca58-88732460a36so625506b3a.2 for ; Wed, 30 Sep 2026 11:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790793531; x=1791398331; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=tcLxcO8uIEkG6hV4cv0W1hvR/CfXs/3hY5D6RxZfqyQ=; b=gaNbWlLmbCHahLBE/8kn2wmZo3jtZXwIArNRajRoMWjHOb/lSx8WomEhiHTpgVE7sA f40AW1w5lCdYnuZWrP7WYySUq3upntvmSTaKoX+BM4lIFNdZ8DmgAiQ10Ejsxg3ZcTCa 8FFwD8LMQWrxmgq1FOBmCd31qm4UJdBvT9zvfATMExSKBT6j2jR926bDruGvuxhGpOTy Z1Hv2kSSFNZ68BGSk0hzqP8Subl85bQoR6bDRCUP5poIdk0qAo5LaRz483XnaEhHY8Dl ojzqLuIV4YAyYdvpZpBluL56MWMJq4o3cZ+MTCOKNl/8T4l92jPsfjAxi0Tnfq/asRqF VBhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790793531; x=1791398331; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tcLxcO8uIEkG6hV4cv0W1hvR/CfXs/3hY5D6RxZfqyQ=; b=Os6kWu6BZ+QyRo+wWqR4oWhtt6Vnmnq4BheX/smeG1qct+nH1zSbpzhz5r7Vg3/szR 9L2M/7Pp8mQ4fxj6C46cqx3lHompuLbBry+I/23O0seqVlqGil04Z3PCrk/cW/fwPKqR DwNKaZmeQneQmaks6cyaHjjrR9yd9o6jlV6pN/0CWyWaamlugQOERP2zLmy60P0AkF74 EQj/vHqZL8Hk1wo4pxj8HVEAK4QJo/HeFRAaabZVELl+WrLSGIF6wDwz2PFIUsqL0QRF KXKiU/WfuW+oeoik659gAShZKGnYKxSmivP2twIUz5Eu5gS5Z00G9Pf61x2uur/hiou8 AQmg== X-Forwarded-Encrypted: i=1; AKwUvBzDBJRvhFwK6HzVvpKyD6SrISs/QiBTmG5JEG/RstxCRxdE4MdEkr/4uIOqh86Rlg0kT5t7NkJWT1HKrmsr@vger.kernel.org X-Gm-Message-State: AFuF++kRKDRJYv9Jek5cAhFpxSS3URCtewH6GwAyCdeDVh0a9nus3Ulz fDAoQ7W46OYlR4p/bvKY7WpwP8oBQtiUP9RsfrTmSp4gRAzi+lNR04n+ X-Gm-Gg: AYBFou0V8M5Nt+VM9t/+hK1POdV2ancMrEbHhT5xIZ0FXOV7XT26mG8xm6vHUT4BdsU 6kxZqHEjMhy2762NJ1QUQCBQiWqW4OTzew1USjabQJVL95yaLQf9N3Lf7sd2pNnRipefQv5Nixk y+Q2BThN1U2frIX4GUAzxdihYEaTT2kWPw+6Pi3nkiZYn1CMrE0lXuOZgrWsI4X1m7O/67F944o kQ+L5flX5ei33CEw/UrIWvUtLAOgbhSLGAFOoLBOTvBmxd5ZI0sUwKKxXjFFcT8gje2k2zMgAx0 m2dDaez+OBVv7krcIUMYMJMAa/8GgD4Oe62hexHBTBaxukNYu3NbUkqgvnYc+/eIcwJrVgYKlfZ +PLMpzsh1GSKft0G9jmylO9IY0mihtdiX2YlnOLYsqg59skN5AMw1RXdCyCCmaaryVWLSl6Nwed LJW/oJ5e4itYGoetQHExnYvoE5TNMtVAJSS8dGkIvPsxKfDMTXSI2To3d1V4s8A3kiomtOw+JCQ W7LVoDbbo6l6aTFMVvi60QiqxoZDCrpXFH8To8sAX1BYe5NKmU8SfrM2umFopZMgTvW051J3nnZ gib/afftm9Vi8TSI1fdHEEUmbYFR6W3wEL/D X-Received: by 2002:a05:6a21:7001:b0:3d3:aec2:4dcd with SMTP id adf61e73a8af0-3de9e6dc7a9mr2517958637.25.1790793530634; Wed, 30 Sep 2026 11:38:50 -0700 (PDT) Received: from rahuls-x2elite ([157.51.37.69]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cc7e539e30esm347997a12.3.2026.09.30.11.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2026 11:38:49 -0700 (PDT) From: Rahul Pon To: Rob Clark , Dmitry Baryshkov Cc: Akhil P Oommen , Konrad Dybcio , Sean Paul , Abhinav Kumar , Jessica Zhang , Marijn Suijten , David Airlie , Simona Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH msm-next v2] drm/msm/a8xx: report the GMEM size of the active slices Date: Thu, 1 Oct 2026 00:08:39 +0530 Message-ID: <20260930183840.1171-1-theflyingrahul@gmail.com> X-Mailer: git-send-email 2.55.0.windows.5 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A8xx GPUs split GMEM evenly between their slices, and parts can have slices fused off: a8xx_gpu_get_slice_info() reads the active slice mask and folds the slice count into the chip ID. The GMEM size reported to userspace (MSM_PARAM_GMEM_SIZE) is still the catalog value for all slices, so on a part with fused-off slices userspace would size its tiles and place its CCU caches past the end of the GMEM that exists. Qualcomm's downstream driver reports GMEM for the active slices: gen8_get_gmem_size() in KGSL divides the GMEM size by the number of physical slices and multiplies it by the number of active ones. Do the same when reading the slice mask. The GMEM protection and UCHE setup still cover the full range, as in KGSL. Fixes: 288a93200892 ("drm/msm/adreno: Introduce A8x GPU Support") Signed-off-by: Rahul Pon --- Changes in v2: - Reword the commit message without the device it was found on - Parenthesize the GMEM expression and keep it on one line - Link to v1: https://lore.kernel.org/r/20260930111711.1160-1-theflyingrahul@gmail.com drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 3 +++ drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 ++- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c index add93c1fa0..2f6f36fb8b 100644 --- a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c @@ -112,6 +112,9 @@ void a8xx_gpu_get_slice_info(struct msm_gpu *gpu) /* Chip ID depends on the number of slices available. So update it */ adreno_gpu->chip_id |= FIELD_PREP(GENMASK(7, 4), hweight32(slice_mask)); + /* GMEM is split evenly between slices: report the active share */ + adreno_gpu->gmem = (adreno_gpu->info->gmem / info->max_slices) * hweight32(slice_mask); + /* Update the gpu-name to reflect the slice config: */ const char *name = devm_kasprintf(dev, GFP_KERNEL, "%"ADRENO_CHIPID_FMT, diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 5832dc25d6..dadfe4c694 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -379,7 +379,7 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_context *ctx, *value = adreno_gpu->info->revn; return 0; case MSM_PARAM_GMEM_SIZE: - *value = adreno_gpu->info->gmem; + *value = adreno_gpu->gmem; return 0; case MSM_PARAM_GMEM_BASE: if (adreno_gpu->info->family >= ADRENO_6XX_GEN3) @@ -1205,6 +1205,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, adreno_gpu->funcs = funcs; adreno_gpu->info = config->info; adreno_gpu->chip_id = config->chip_id; + adreno_gpu->gmem = config->info->gmem; gpu->allow_relocs = config->info->family < ADRENO_6XX_GEN1; gpu->pdev = pdev; diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index 114a40f79e..8e6a881036 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -204,6 +204,8 @@ struct adreno_gpu { struct msm_gpu base; const struct adreno_info *info; uint32_t chip_id; + /* GMEM size available to userspace, see a8xx_gpu_get_slice_info(): */ + uint32_t gmem; uint16_t speedbin; const struct adreno_gpu_funcs *funcs; base-commit: d33622598496c8994c35ba0a8a913de064dfc1a4 -- 2.53.0