From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE74437B00C for ; Mon, 20 Apr 2026 22:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776724040; cv=none; b=W9UsFwVonTFnXbLTLCFXFZqDdeqE0JriZiDCxYeJGiCZEdXpOHLivd7JpkkzAIfKFtvPPGl44gtJYjY14aLQgKHRgqY/XPIWpoWT/h8njQuPOhbilROeB3F/CKxDUDvRxk5zfHCmEbZNXc38akqrkfD8M7xKDzkV39YeinMK0ow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776724040; c=relaxed/simple; bh=TovQNSZqjCEshCVvfyvXUtlIbRz8ZEIrT8kec7Go7n4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nDWp5hUhtTBC9jyJP99xhrfE0Q/UKhhZfWeDw9vEeY8mm19qbJ+LivNDOC5tD59ExruKWzwaCxSk3fn9EY/80TaKHkRaL6+8n2hbqm6H5IGOpK9AXG9ZOrnUv0lHqt0tBtE2RbiSOCKbncby1aPgTwNgBL4lU2VrCa2Pu3dr21E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=OCA7oha0; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=b+t4oQZo; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="OCA7oha0"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="b+t4oQZo" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63KGpefd3212158 for ; Mon, 20 Apr 2026 22:27:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=r+OvOunmdBc 9THaENORBIW5PHKBLtBVoo569H18ircs=; b=OCA7oha0Aj/9YG2D6ryGq7JDErz GGqw+1sEwN9wthnAeyyeElfv8Kti2EYCdgfFK9CUbjOdDnat3UYZxfvauzjzPnK1 X/I1+vIg8wj+aHV1Lg7aDco2SoALYwdGTh6kT1kv1cStan+Nq8450FoOjmsrlAQ+ cttRrVCPKYEQqrzfvsiQHASqXi4FAcyo0uTMx081qqW1Wy53N6w/u/i59JfH6wrM BvqWs1BXA8MWJa9eDN8ykW4WB6DhgmON0ME985UI0RZ0UKWkuGmVyYamwwCkVgel uUBb2800BZoj1PvUJV2s1D7n1v90UCmYncKQg9OFkDoCU20UMvCOTvRtXcQ== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dnfcfkenq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Apr 2026 22:27:17 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2b250d3699aso71810715ad.2 for ; Mon, 20 Apr 2026 15:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776724037; x=1777328837; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r+OvOunmdBc9THaENORBIW5PHKBLtBVoo569H18ircs=; b=b+t4oQZoJ9fEXvlY1kQMfkCUWuXRcO6T04nVucV/33evMKVRMkuGJ+ll+d/i5WbzYb sLbcY0pmrlMVuCZi/vcgitIExNnkFvi1Fp0gYOLc204Ff+dBh1wANMZe8bDfQ6pckyci BNk3MYL4qNpfKXSUu6VcMYxqIUXT1snaNXKg/W6lNpZlvrRbpRz8s7qrade+7HPAByvF sn2OvhvF7CP3z3Xx6U7PkVmQ2lW6T2mQW3toQ3OhC6Q0BWvCHq7HC5YGdd5SIKZN6vRE jY858UYmOTenQBIUWnoS+dPek1fjTA/ZxnB5ImdsYu/AmGVRpwzFqKLOlsg//WXe7DuT Hn3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776724037; x=1777328837; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=r+OvOunmdBc9THaENORBIW5PHKBLtBVoo569H18ircs=; b=eB6h5RVDEdRKRW0wzaHAqtJTSwzSfNV/jwxBAhLgofJ0JGSbydrqzHA4L3et33o69t veUitZd6yKwHajxeeWIJFX1lVdIsF3377AfFZ78kVasZz5nVfk94vHqxKmlfKojP1PBn iiXfQT1ChZKp8DQC+2q3eQlDnsZSONu/7NtFPI7VqGmx/Gz/IweIwYVOkK+/6ufiogxB xltZdLRx9YZl5OlWpQodPDUIfmTluAQ9PJKgfxa1jWEXz4WnWQL3IvYVk82ibwvfGhMR A3sIeRXpFjvUa3lMirqT2mzHUpUPjHDfcDrSmapz04B3fNuHAZ1LlK1Xxrnw3zKtO1l0 nbQg== X-Forwarded-Encrypted: i=1; AFNElJ9VWVAwKC+fpIgoAqe6p5tgPXuDuQDprF6WT0Qc+8GUtK6rfPIGb4ua2dOETildGh4IvwKBiDkvpFvgR5k=@vger.kernel.org X-Gm-Message-State: AOJu0YzuRmjor11xZKEsROXyFY4ACwBmycZ7MGvQG9SfxJsodF/quxuU KUfIZ/SWsqqxV4/eYoP+MRbs+SVDi5Qz7soAcUqUgiujvM2tJDU5aq6EJ1JXC87Im1gD9iB5YCL /PWnVrzR3tdtyrY2AslYIbuo+VDZkrqI6N3kepO4Q6EtMHx/TxNMQSNd85pbOCiUCdd4= X-Gm-Gg: AeBDieuoxSXegXx7S0vAXsiSPD/db1gncXlWLbf+VvZNJoofRsKhgUJBAPyQT7FISLL tUxHlviw1m6CnKmlorOJWa8VI1WILvdU3m7DnU0HQ/grtKYe7xqHGt1Rk/5zDihf6gjzeFZisqe ObkNcf6uADma3l1wH0XOn3VKXmJmoJe1NC3RJUndMqu9ogH8Uk8YeuO87kDhDW7k89wq+B03M0g thNRQieNFXyC+uIDoljHJjaLxmb8hJIF4K63oRIrIP4275dx51XobinLV4OUtgW5oAhtfKqgJam kkq99gcpXUmZTn611Up/cyLRwFghU5H+hPoSoroMGIE5ugEr1HseOpXDL1hRA2ttj0A1IEmSlyk T7o/To6HoSh4szAXii4e2bfcsCUSJJ7dfKc8E0gNc8Go= X-Received: by 2002:a17:903:3e02:b0:2b4:5a2e:98d9 with SMTP id d9443c01a7336-2b5f9f7abd6mr116583465ad.37.1776724036871; Mon, 20 Apr 2026 15:27:16 -0700 (PDT) X-Received: by 2002:a17:903:3e02:b0:2b4:5a2e:98d9 with SMTP id d9443c01a7336-2b5f9f7abd6mr116583215ad.37.1776724036384; Mon, 20 Apr 2026 15:27:16 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:4ec8:83f5:8254:6891]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5fab20c4fsm142124185ad.59.2026.04.20.15.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 15:27:16 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Akhil P Oommen , Rob Clark , Sean Paul , Konrad Dybcio , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Marijn Suijten , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 06/13] drm/msm: Add a6xx+ perfcntr tables Date: Mon, 20 Apr 2026 15:25:28 -0700 Message-ID: <20260420222621.417276-7-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420222621.417276-1-robin.clark@oss.qualcomm.com> References: <20260420222621.417276-1-robin.clark@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIwMDIyMCBTYWx0ZWRfXxWyNEsbnrnXu 9duS1XsA/S9ifmxx/PTW4FlivySFUSgvz9QSu1azI4n2dHcb4mP1DkBEjqOFx5XM7DsE+42OZ1t VuSEwVjTzuTEqiX2c1LcYZD/CvgREWxYMJ6pdihHcbJBMmmw8asepJUY0B4S4cHDS5S37ect648 JzDBs4OaAb0pQfjs5g/VqlYolq12z85CX9JmymmKU8uy/ZETxtyOElNv41PbC2wLF9zpabQehgv KARmtWsXeVZyGctzzK5BPR9Hd+ZC3XhmTOjO1sRda8h/qfrKql3npi8Sh7WpBHwmLKsm74sG5lz vaun5UpP3bAd39mvD3pd9Ke5S4hQiB/+KjTKGW1W5J+VkWCtSyOL/wROpOdQ0IMDP+XnXrH7MLv rK6vFE1JeUr2xcbVPDTJvQoqitxIU8l1usRWfd/8//vQPkp0yUnU6xEDgBvOZ7B3dpRvqxjXFa2 D9d/0npnLbjqOAO882A== X-Proofpoint-ORIG-GUID: HXa-_MosxfklPQQuFsRbIRCH5o7Sbasa X-Proofpoint-GUID: HXa-_MosxfklPQQuFsRbIRCH5o7Sbasa X-Authority-Analysis: v=2.4 cv=L+ItheT8 c=1 sm=1 tr=0 ts=69e6a845 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=4FiFnV2saKvSNFYXgKsA:9 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-20_04,2026-04-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 impostorscore=0 malwarescore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604200220 Wire up the generated perfcntr tables for a6xx+. The PERFCNTR_CONFIG ioctl will use this information to assign counters. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 15 +++++++ drivers/gpu/drm/msm/msm_gpu.h | 4 ++ drivers/gpu/drm/msm/msm_perfcntr.h | 57 +++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 drivers/gpu/drm/msm/msm_perfcntr.h diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index e578417a4949..727281fbef36 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -5,6 +5,7 @@ #include "msm_gem.h" #include "msm_mmu.h" #include "msm_gpu_trace.h" +#include "msm_perfcntr.h" #include "a6xx_gpu.h" #include "a6xx_gmu.xml.h" @@ -2637,6 +2638,20 @@ static struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) adreno_gpu = &a6xx_gpu->base; gpu = &adreno_gpu->base; + if ((ADRENO_6XX_GEN1 <= config->info->family) && + (config->info->family <= ADRENO_6XX_GEN4)) { + gpu->perfcntr_groups = a6xx_perfcntr_groups; + gpu->num_perfcntr_groups = a6xx_num_perfcntr_groups; + } else if ((ADRENO_7XX_GEN1 <= config->info->family) && + (config->info->family <= ADRENO_7XX_GEN3)) { + gpu->perfcntr_groups = a7xx_perfcntr_groups; + gpu->num_perfcntr_groups = a7xx_num_perfcntr_groups; + } else if ((ADRENO_8XX_GEN1 <= config->info->family) && + (config->info->family <= ADRENO_8XX_GEN2)) { + gpu->perfcntr_groups = a8xx_perfcntr_groups; + gpu->num_perfcntr_groups = a8xx_num_perfcntr_groups; + } + mutex_init(&a6xx_gpu->gmu.lock); spin_lock_init(&a6xx_gpu->aperture_lock); diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 78e1478669be..8c08dc065372 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -24,6 +24,7 @@ struct msm_gem_submit; struct msm_gem_vm_log_entry; struct msm_gpu_state; struct msm_context; +struct msm_perfcntr_group; struct msm_gpu_config { const char *ioname; @@ -262,6 +263,9 @@ struct msm_gpu { bool allow_relocs; struct thermal_cooling_device *cooling; + + const struct msm_perfcntr_group *perfcntr_groups; + unsigned num_perfcntr_groups; }; static inline struct msm_gpu *dev_to_gpu(struct device *dev) diff --git a/drivers/gpu/drm/msm/msm_perfcntr.h b/drivers/gpu/drm/msm/msm_perfcntr.h new file mode 100644 index 000000000000..64a5d29feba1 --- /dev/null +++ b/drivers/gpu/drm/msm/msm_perfcntr.h @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#ifndef __MSM_PERFCNTR_H__ +#define __MSM_PERFCNTR_H__ + +#include "linux/array_size.h" + +#include "adreno_common.xml.h" + +/* + * This is a subset of the tables used by mesa. We don't need to + * enumerate the countables on the kernel side. + */ + +/* Describes a single counter: */ +struct msm_perfcntr_counter { + /* offset of the SELect register to choose what to count: */ + unsigned select_reg; + /* additional SEL regs to enable slice counters (gen8+) */ + unsigned slice_select_regs[2]; + /* offset of the lo/hi 32b to read current counter value: */ + unsigned counter_reg_lo; + unsigned counter_reg_hi; + /* TODO some counters have enable/clear registers */ +}; + +/* Describes an entire counter group: */ +struct msm_perfcntr_group { + const char *name; + enum adreno_pipe pipe; + unsigned num_counters; + const struct msm_perfcntr_counter *counters; +}; + +extern const struct msm_perfcntr_group a6xx_perfcntr_groups[]; +extern const unsigned a6xx_num_perfcntr_groups; + +extern const struct msm_perfcntr_group a7xx_perfcntr_groups[]; +extern const unsigned a7xx_num_perfcntr_groups; + +extern const struct msm_perfcntr_group a8xx_perfcntr_groups[]; +extern const unsigned a8xx_num_perfcntr_groups; + +#define GROUP(_name, _pipe, _counters, _countables) { \ + .name = _name, \ + .pipe = _pipe, \ + .num_counters = ARRAY_SIZE(_counters), \ + .counters = _counters, \ + } + +#define fd_perfcntr_counter msm_perfcntr_counter +#define fd_perfcntr_group msm_perfcntr_group + +#endif /* __MSM_PERFCNTR_H__ */ -- 2.53.0