From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 4730E37206D for ; Fri, 22 May 2026 17:35:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471302; cv=none; b=f3qJ6DEhHR3hBX364nJ4Nc6yC/tPTfvFx8k7mSRxIa2gzR75RH1pcYIjI+u7SZjHa+hqLXgFyX+33ATPw9/QPBRJiSVtehTaY8CYA51abiHzmxPp0AtXZxh6cehc5JEHinVJw3MXm4X+8bCyvCieEUUWTIG60s5LkMuIH6oVjB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471302; c=relaxed/simple; bh=J21gY2Oa0Lq/I3m/376HfnUTl1mHOuBcWrkSSc/IPj4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tvego9I+1gpaKVRw6ooeS6sGHBv9G2OEhBZlcG6ZQWhQtsX933C3+YuMoyOVggWlUroxu75kXD9s6sp5+e3ZCL73YCDhi6F3f/XWZFSjRzWeduxDiwcFUIurExx3x7BgCoRfyiIy/7GKurLD4tH34Hh2RLO2WRV2jivLzVk8AaQ= 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=m4+/v4X/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=KzUtlqKX; arc=none smtp.client-ip=205.220.168.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="m4+/v4X/"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="KzUtlqKX" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64MGtj7c1800960 for ; Fri, 22 May 2026 17:34:59 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=ScHhidnB094 qXmqcj2I9GQS4JCvqHfks8d61PZbHe84=; b=m4+/v4X/o4BW7Ls1MeaOXECwwcV i6E2CAavaSQVwn6N8aS7PORfO/GELoeUzsLV6dI+MQgfeI1Yg/fI5P+NyaH0/T13 IfUpkd/Od4Xe98YE2x0ZbW2ph8RBwiC5j+R6ddDnlAtUEUsFxMz83o8ougFi/Qpt FfO+VLNHiVSUj1Dy51oo3MKHqiOodvATeL9UtiDyL0epGW62pybCASUh+NIyVmvC 9SXqwFa6ePyTKZJB/H46KDf2b7yJCYBMnReVH93RgoSo5ctGr0OmuHOYbOf6M3du CXvKfV1fCuQ7b1bPcaSuIMZLFN4OQWPVmrJR1WH6XsQRmfOvQDvuJnmXAkg== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ean9g1q7c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 22 May 2026 17:34:59 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c8514f8ed5dso1476843a12.3 for ; Fri, 22 May 2026 10:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779471298; x=1780076098; 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=ScHhidnB094qXmqcj2I9GQS4JCvqHfks8d61PZbHe84=; b=KzUtlqKX4b4uLdXwvEPL50c5dHOPtNEMJWDL7hVuplHGYh85InWSL92Ltabwamu6jS YMF9hZ2YejYA005ridt1RJ1x3ZtJ6O0PeJd1Hk0MJuI4ulG7r4HkT3xhnJES3udJRU24 /G0Z3eitmyTxveAR55xCfEfzhdbNtcmtBIAJ51VioGfJC3fm3BPLwtFRSAVHMLjgt/dS T3iT48VPX0ZyPsV5LgJV2SoFryzgnO56agq9n4mVMInGTVW5RWRyAIRTNMmE1s2JVFEI YJThBFVZ+qvswq7F/Sw94+F+edfKnruAwafvXgRO/BgQyv/ttId+dZc146T0eXg3v6J0 noMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779471298; x=1780076098; 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=ScHhidnB094qXmqcj2I9GQS4JCvqHfks8d61PZbHe84=; b=XtrAyMtZBJeQ+Kgp8Cm5cJjv1bBcYgyOF/25FBQpS38AdjNkUt+Zqv7Et+enfhE9mZ aNU6gKOgDupknKFoXcUTUcL4tYZ85KuLYMU1UFcUiSOC1QXsGU7z8Vw051uyatjtWZ94 g3aC70uJ3PKQbu5/Zb9+jisgIaXarip9h3jc0MLbOKtrgSQHRdzA22qftEk4PHH+0ZnR AKyLCIxPnIFtQICLacJ77g3bn2uTgENflSTBpwsylCwhFd4gSZTAL8hRkFbRk4dR0aV2 gjc358N2mRPhE3m5VmZDbPSDklntBGHBW/WUw50zlQtYdjE4KhZJcFoiSeTKga0tUqac BkVw== X-Forwarded-Encrypted: i=1; AFNElJ84JPcu2ToyGbf3jYD5atlDlbRbaxexQbN/WwUzeaNj64XXKFdMPZOgrOhV4LoZw38BzuqJ4wMNwIOluoU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8Nq/TwtidLY6TTaT2J1DTilgk+IPS3CYD2PmrujdV0jxEij4q hOB6qwwowq/YbF1XLh73KdSrRycBB8orDoD0DbI05qSCUgrEOkTNLU/ApDHMF+vgb5zJuqtP7JW 2F39HkI3HOLjr5GFsXMu/MdEurhD12Nm3bePsM8dCueRXN520jtUk56YksWlYyp8jMbs= X-Gm-Gg: Acq92OG+XPZEN9hgL06qRYIRjtHkkIXs8jP+J15S607szCnNJYVY91vABgc5ooup4hv Xs7VlLNPU6wxgwMw5KOXMVt+l446UtaYX8nj8BoB9zEIapyor7ToRNi78M3JjrvvoW9EmZs5x5H voRIFK+3RfssDPi0vuqyiZszz0ZmaVxDKr694hFfzfqyOqdEb0OxX5Bb4v+TghFiao8hAe5ed2n Ko9Uu26Jr3MfsVeCq02XCkoB8Y2NwhlM+lwcng2FQmYc6+APluOyBV7xCByWUGi+RwRjLV4XQc2 bq7DDBJLxb/NXhJqNO3JQQKZnEWpZDliXFwt021qCD9/EV207K9Ps2QV0WiGoTd+zSx99nbbaxN DVays2cIdbr20/OG2HeRAWsOip0LOe9AR X-Received: by 2002:a05:6a00:4b4f:b0:829:8cfb:df45 with SMTP id d2e1a72fcca58-8415f323ebdmr4617818b3a.15.1779471298533; Fri, 22 May 2026 10:34:58 -0700 (PDT) X-Received: by 2002:a05:6a00:4b4f:b0:829:8cfb:df45 with SMTP id d2e1a72fcca58-8415f323ebdmr4617789b3a.15.1779471298050; Fri, 22 May 2026 10:34:58 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:4ec8:83f5:8254:6891]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84164ff3e00sm2981361b3a.54.2026.05.22.10.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 10:34:57 -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 , Anna Maniscalco , 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 v9 12/16] drm/msm/a8xx: Add perfcntr flush sequence Date: Fri, 22 May 2026 10:32:58 -0700 Message-ID: <20260522173349.55491-13-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260522173349.55491-1-robin.clark@oss.qualcomm.com> References: <20260522173349.55491-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-GUID: a5lp4FTrUIBfKFYOQLDlNTrrNlDOoq3T X-Authority-Analysis: v=2.4 cv=B/qJFutM c=1 sm=1 tr=0 ts=6a1093c3 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=xqWC_Br6kY4A:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=W-43u8CF5Pkpiqpb4b0A:9 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-ORIG-GUID: a5lp4FTrUIBfKFYOQLDlNTrrNlDOoq3T X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIyMDE3NSBTYWx0ZWRfX/c75FR4qLxjX JP5BLa3uOZinL9xZV7MbNhPwXBQimbEmyIqPtaO/YyVyr1e2YJFSEWt9s9PMab7JK6E2UuwbO0q XhXUiqryp/24+TcAukygihF3vBwhEK9jxrpMH1ACJEm0BnWKwdtAtGaWwk9BOoI94OuRoBCzfgb eewbO2Zr2K66Fy0zR0XpgcW0juqdwoma2pfQEG63+kPPtu/8Vpc4OP7Jxmt0QMBzasdxqrS7prO jdYFLpfd+dkhgHw1g0DxW4n+U4fEdrOUIWBO6nKAqDbe26TQRs1jBKCBStR1wAfPWnu7rnn5YfX 20fv2E1OHNPA4zlhCp6yuARsACOkzIxUFlSfSo3EHkVGA9qinKsnrEDbz7UuMdteKv9Q/qwPpjX JFLJo6Chi92VFYcHl7Ome680jTYf2nW6k4tsmR/wSrGrNzzwxyimYMQlZk1nW+ws1rF9fUReC4n uvM/KzMKO/9RBSGQR/A== 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-22_04,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 priorityscore=1501 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605220175 With the slice architecture, we need to flush the slice and unslice counters to perf RAM before reading counters. Signed-off-by: Rob Clark Reviewed-by: Anna Maniscalco Reviewed-by: Akhil P Oommen --- 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