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 574A73F0A94 for ; Mon, 4 May 2026 19:08:45 +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=1777921727; cv=none; b=A6eacFAx2bHFA+jX3P0rrNiL7plZRN9GNbpEQ4cj04WJ0ddO5IByoI944Fs8BRidhvXbUTWCQE2j3tBOfCtP8LAWxaUDLC9M+3ZAY5irriLwqgg4ZId/tt/1IFGnRK/8AyQOQxQLbSkdMM05fQeWzFlTqfr2R1wcKHUsgRCRWkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777921727; c=relaxed/simple; bh=CjOeIMd7KHhgBlYgalqgDMr3CrElSHV/LHeYqaaaD9g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hjl7rBBX0HrKZ+vqyn/RGF/yz8B0xpFE9DVGqoLHND+qSf8jRQfPPl61R8/c0EkK8pJsOL4EnTsJ0E0It71Wf7dSf4+bdbIMVEWlg98zTt5t0oMcXL2ZxzjdTBxbxbOuk2nM2Hwpf7FW2d7oB76PgGGI7SXred+LXqRpSZltVBU= 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=VS92g3on; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=KTTi5yIb; 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="VS92g3on"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="KTTi5yIb" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 644FIVZo3409256 for ; Mon, 4 May 2026 19:08:44 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=zVhhihIWGcW DVKhVXioxlxo4w1o6vj94DNJvO2XJTbI=; b=VS92g3onfef2nfVAYVBljos5ZSe X+uND9pTg4qVUdPXXP9ZQaKQzZgKdEhoj0IYG1kWx5JcW2KKdnV3DoLU3oJnIDo+ D54RY+hvxrrfe3kc8dwVTigLN/oQ/LFloR/kyqFqgnMZrwIHVPPy/kIsgJuql0fc 4QaErOamzKIaV47WQndRnZIOoWL/yKUBw9/+t4OrTXFZ+jYe6vClypzFKvBgt9MF yz8mfx3fPZaL3k6oTpy1WVyuGRgnUJfxA3IFoFe3sPw/bBJp+BoswdkGklgz0jdY zYPw6T6R2LIolDSh9Yv1clC8M1WR5PMBbur9alzShPFaBbzCgW4FWAesY2w== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dxx00rwu0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 04 May 2026 19:08:44 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-364f007d1f3so1841439a91.1 for ; Mon, 04 May 2026 12:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1777921723; x=1778526523; 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=zVhhihIWGcWDVKhVXioxlxo4w1o6vj94DNJvO2XJTbI=; b=KTTi5yIbLHwbsd9KYjmsF+tPyxumj7dIsVEVPehbFIIybF+T/iRZW7u/J5idxNid09 HZDjMqhFt6BPYD9TWkFoElPapaI+qVILd5FXPaxbTgdRNlhfu00N3+pIlnncLjXXmFp/ A39EjcKcC/+GkJE9I3zLLW4D9amDm0UsCXsq142Fe8lf+NRYhHGg45HadvLnYRactb3o Tg6QUSY9QS6fe644UIW4Iu8jZLHX+xFDBpaY4SRjzY5OzVL+6Qvf8gvaIMOxouFBS0Xn wk2aHT/LGZxmC3ej2Fj8rJTTJoOS1xS8XChiPqmxMlGwhJ4wG+qtXOP+kv5UwOTuXntP bFnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777921723; x=1778526523; 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=zVhhihIWGcWDVKhVXioxlxo4w1o6vj94DNJvO2XJTbI=; b=UA35gouwP1BO1CblKtDD0ODzMV5L3RmY8pMlf9wI8lxGRueyPTiMAFvged0hDdWh1m niqRBn6pfANP9FYE7usQclJNOhe83qehxH/FBjF4ceigIlJd10WnHFk1eYox7NyTAjtW WReaiHAPmU472Hg0qOQK5nH6yxSXpKAW632/PSR608XuZcZPklKL4+hW68iDrc1GlP66 ZU36w/W3Zvt/YR88Ke0otGjM9fk2iew+qy7eP9CH+0/XPQ91qxhEqa4Zq1I7S3JJTfKG 2kblTEqs98eHI0iC2vTteK3qwyMLkYMVXcJjVpTuQ6YMditqjoa87YeSGs6aaiYJONyl 3c2g== X-Forwarded-Encrypted: i=1; AFNElJ8bU5AryTTDrCvLylYwQ+Rn6qYA0emNSCYJtLBD2Rz08ZV40ifAK5C523CmX18I05ZrNFLlWeXuXJKd7T8=@vger.kernel.org X-Gm-Message-State: AOJu0YxthmU5V6KvXS1xD5dEnx7bsguVIudDO6lXuI08ZcZ9cPkH6MnB 11F1dbdBdfXjldGf7J8jd5GQU3ZKuPocB4sIRihNhO+OAV+2jPGKXWUPh6ozDqQFjyrKc2M83w4 JHOIn+8afc2db6UNEKMhRzLBMNN4bvGsjBqWxefRUmPt/WptlvzNncHnUHN4T2/oDLOs= X-Gm-Gg: AeBDieuq6zj1g6Sy/ZwUTy4chMLqi2CRznjsgCYIomWiv/gdoCsuZab0Hc9Hw5LETF2 m0+44vPSTHVnXSSp0G1iN6B4VnPXzgAOum4APCgK1vwlOogRw16+eY3AkrCpkW+aHNqUT8j16JO gGutccm66yTxzmBkoTu8E2TRg0npHixtWwl+HzhGkbHQVgrfCi7RjfYsKmXiVuj5zOhD9viyEZK mOgS95Qlx5h3rtUyjn12u/OarBb7e632H8AZxbiAwZMstUTAc8ks81HjOZ01cKqt1sQAfjTC7hF 5EvgT0KbQeNxKiyA4eHxNysi4lHmAP7bgOnssoc6zTWxv7HMqVf8N0H/1tAG0Fidd0MjzQbtQGQ PE4mapGYfFjib1ds2GV6MNiZX7eVxsjnK/zBN/eLjpRg= X-Received: by 2002:a17:90a:d005:b0:35f:c1cc:fee0 with SMTP id 98e67ed59e1d1-365724c1a6emr559029a91.8.1777921723114; Mon, 04 May 2026 12:08:43 -0700 (PDT) X-Received: by 2002:a17:90a:d005:b0:35f:c1cc:fee0 with SMTP id 98e67ed59e1d1-365724c1a6emr558997a91.8.1777921722572; Mon, 04 May 2026 12:08:42 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:4ec8:83f5:8254:6891]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-364ec00ad4dsm15850171a91.11.2026.05.04.12.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2026 12:08:42 -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 v3 12/16] drm/msm/a8xx: Add perfcntr flush sequence Date: Mon, 4 May 2026 12:06:55 -0700 Message-ID: <20260504190751.61052-13-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504190751.61052-1-robin.clark@oss.qualcomm.com> References: <20260504190751.61052-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-Authority-Analysis: v=2.4 cv=APflyhIR c=1 sm=1 tr=0 ts=69f8eebc cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=xqWC_Br6kY4A:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=W-43u8CF5Pkpiqpb4b0A:9 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA0MDE3NSBTYWx0ZWRfX+MQLi6rDCwPl OxXRK1Ec+u7yJKEtGvQ71LoV0jdE0eI0J4lD4yCXukonWXSp9nhX+UOsXYCWW+HpFY/gP0I6xP+ +uQfW1zs2s+PYsHURM5+waBznaiTTF8VZAN6/IKnSlTZgO07yNT8jtgTR4UED0sWzLe7cRRkO4H +qM3DFPGLhQQArikv4dO9TvUCutcLS4MfOsUC+xLBwN1DTb/eLCszr83X/qtqPsMOTPtsRB8SVW JReuaZkEqsQHaUKRnN0YTiZOWkhKSCgTEK8hcuMlCAQurfpK1iDkkMUyAamSmVhzx9QzQAZFhl3 +Qhhj1DHW+QEkeJ3awfDvakBFxlRdNu28la9Xoasgfo+8kWSFX2Hv57f1pk3X6yre6yo2Hfhr9M wghpM3NKMVmMqKeQYKj6Q+X/G52wJce0FY03RotjBTrvLJYvbLnRJ6MArp7VTyZZ6rLsTBU8gSQ UXpuu+ip9ej7rWGG3Jw== X-Proofpoint-GUID: R3FbBE586jUMKcWFLni_EAWUhBu23ZXq X-Proofpoint-ORIG-GUID: R3FbBE586jUMKcWFLni_EAWUhBu23ZXq 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-05-04_05,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 impostorscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605040175 With the slice architecture, we need to flush the slice and unslice counters to perf RAM before reading counters. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 1 + drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 + drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 30df9bfa9ef8..a329d20033d7 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2921,6 +2921,7 @@ const struct adreno_gpu_funcs a8xx_gpu_funcs = { .progress = a8xx_progress, .sysprof_setup = a6xx_gmu_sysprof_setup, .perfcntr_configure = a6xx_perfcntr_configure, + .perfcntr_flush = a8xx_perfcntr_flush, }, .init = a6xx_gpu_init, .get_timestamp = a8xx_gmu_get_timestamp, diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h index 99c3e55f5ca8..3491a24a9320 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h @@ -334,5 +334,6 @@ void a8xx_preempt_hw_init(struct msm_gpu *gpu); void a8xx_preempt_trigger(struct msm_gpu *gpu); void a8xx_preempt_irq(struct msm_gpu *gpu); bool a8xx_progress(struct msm_gpu *gpu, struct msm_ringbuffer *ring); +void a8xx_perfcntr_flush(struct msm_gpu *gpu); void a8xx_recover(struct msm_gpu *gpu); #endif /* __A6XX_GPU_H__ */ diff --git a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c index 124d315b2469..6c040f718176 100644 --- a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c @@ -1345,3 +1345,23 @@ bool a8xx_progress(struct msm_gpu *gpu, struct msm_ringbuffer *ring) { return true; } + +void a8xx_perfcntr_flush(struct msm_gpu *gpu) +{ + u32 val; + + /* + * Flush delta counters (both perf counters and pipe stats) present in + * RBBM_S and RBBM_US to perf RAM logic to get the latest data. + */ + gpu_write(gpu, REG_A8XX_RBBM_PERFCTR_FLUSH_HOST_CMD, BIT(0)); + gpu_write(gpu, REG_A8XX_RBBM_SLICE_PERFCTR_FLUSH_HOST_CMD, BIT(0)); + + /* Ensure all writes are posted before polling status register */ + wmb(); + + if (gpu_poll_timeout(gpu, REG_A8XX_RBBM_PERFCTR_FLUSH_HOST_STATUS, val, + val & BIT(0), 100, 100 * 1000)) { + dev_err(&gpu->pdev->dev, "Perfcounter flush timed out: status=0x%08x\n", val); + } +} -- 2.54.0