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 B6B383DEAF9 for ; Fri, 24 Apr 2026 15:12:21 +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=1777043543; cv=none; b=miizDTCtDd7IrvuCMS56HTqEoTXtfA4q91kMGOymT6HSWWmd1Qx2wjkma2of58MN4JXYL9z0mXQW5g6iz0DKUcGuaaMekWMGNlMoO8GOjxfqmXgabMHbImC324uJ5SEOiD0SG+0ssJOio4DSN+1s7SQYUQHBN9KZwFC9Y11DiUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777043543; c=relaxed/simple; bh=Hqdosxn2gqR1QwnvKc8ZMveHrCnVn+VGyhBa0TF4nNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sw15ruld/HgfACv23W31eQjZCZWL5Gwye1Rzd1+tHCKkCRdlrDggDi+MnPytBkqGp8nkAmWPkTSHcPbUK+kMFpJZizM22xGbBZl7i6HF7KWdBtos0ibmBgkm7wabADSIlDo4zIg/M1M539PvFfLVixNEFenKANcLiIN1gL8Xfx8= 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=Z58PEK1x; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CvPdxiCA; 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="Z58PEK1x"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CvPdxiCA" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63O9Dim9756701 for ; Fri, 24 Apr 2026 15:12:20 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=GWYw+eRhUpl ftgFXTQLL3PdOcEwv5KNZZwwyE3cFoUk=; b=Z58PEK1xvg23g4xh7+k/b0Hqbfh lY04erevh8XD1vtoSvLsP1SHQuxtc7wBcdhN1H6kTS55RCzs6ZxkOHGUvusaM5BF MKxoljmZPnfd/4eLS+wRJMcqXNw9T6O4Vk7a3v3HbTUg6qtD//0RmRBv4b2tLu0/ m9FwYGE3CHK9Gn62As/aX1MRcMHMTXDDS7w1fgOezub8G2EyvggK+07WqZ98AJAv dsnB5rfOcUsAZUySRBUo9OUoj5sa9lvX3MkZVCg4dgXUz5JthFNDoCqTsUhdZr+J cB2wjyC7qiX+7wrFhlNlH9Pq9keyjjDkNs7Fbv2n87B8ige5+NHpCv3rx2Q== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dqr4bmn4e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Apr 2026 15:12:20 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-82f6a5b4f88so10763966b3a.2 for ; Fri, 24 Apr 2026 08:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1777043540; x=1777648340; 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=GWYw+eRhUplftgFXTQLL3PdOcEwv5KNZZwwyE3cFoUk=; b=CvPdxiCAr+kkfWEZ0wIxD1GP9Nc686AEYQ01aUh5t0DZqtLu/aasqRU+HUPB+i4BEE 3Qj0j0PwBQp23Fg0qx1xoKXD1/aA4wNzITI48Vg+o+mukKUKi2aHKQaKavAtK7zZY8n7 OxSlp/rCeMnq5zaj1fxTKCKfsQrgysRRljzkA9dODrN05A2iLtx9g11onC2r2+uaAOYp +uAsRNg2XLQzT7S58bcX+siWiuulFmKzhvlBZ8d5BB+OpSs2Nvlb4UEs3H7KL6IzzPGH RkVBY9bO0sASGkPgfsYcAYkFruxK/CRN7kDl/gD3IIbN4N4ITaXxDi3sQ7KzVrBqJtXC aXRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777043540; x=1777648340; 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=GWYw+eRhUplftgFXTQLL3PdOcEwv5KNZZwwyE3cFoUk=; b=e4Qxa+zMhfk0iKOiNQ64fbwIcdg/dX6GgM5d+9JRTVbMxOZbuHPslKZJSjtJ6qR4em F4xt0sNNMubC0O4g31roZTLuLL7oTEnxIUBzrzo8uXmWXSLYe2N1cYhE5AYbmyS4FMb0 s7oEiLAmlN99PKcUBDcWdw453YYNsmeK3am1+w3+Ch7gRpJC/0Xu6009UzdKQTSeWkBC kcNMKZo7YFlt6t/h6YM5HmQCpOBHZNQIgE10a2demloOu4Z43M8dhlXky86f5GJtKp9k 1g/+z7IuX19FH7ZmXGRw+GGbOvaeePk/bIfsdeypd+xJclkvPmkbxnoONhDwqR2RTJLR vz+A== X-Forwarded-Encrypted: i=1; AFNElJ/39k7iUqymlwNxXK+Z3ydcFbFPfesa5YIlrK6mKU3uWccj1i0qPRVQSVhSiNiwCpkzitsV78GAvu1sddM=@vger.kernel.org X-Gm-Message-State: AOJu0YxTu8zAzLw6YD7JJ4xOy829fQd8ep6Qh4Yc6mtyG4CCDDItHJDD auJDwQSpqGtYIdv1UZ0SpKqNYHWq/pNAchNX8E4U62Y/Wf3zxgjEqjsrsz6BGTFr5qNpaOBsTGp sm2VG2V91BQbdkRSUBF9+978QDXrVH4H6uHAg4G4Y+9Ahb+rgYu+NxD8rd/V6l8RESQc= X-Gm-Gg: AeBDiev6MojmHlcljhyGBf4xnCCMa4jwjvwtqTFJ0IeuVzrRu0VcQJLW9lnB4enrw+V 1eKXswvcNj+/YPZoK1sZ8/gSYDH4ad3EfpRlavho0WFONl684SxZK4w+vEveSOO5DNxHTCARyFS jyvsL2JCrzoBHwt5vXC9IWI5Te+SwxCM9ulWi+TKbxtz+GFvmSMJD9kK8a9X1haShiBhbWKRvH4 GuSX2dtIFL2s+45b97IXsHpuEpzp1xHg2z2omPu9p0kFSkLB9+ChZxgRp9OchR+vWyyV6QUlDWL OsqmOhytXxcPILHGxRdE/cmEyQi/hX5dY0L2XNItRZsYIPT3ezke0nvNDKbwSTK91s3mZKWhgEh C6+BVCPGPGXkJrCxiJk5BypcuhgdYpB1j/z75CtvfWOg= X-Received: by 2002:a05:6a00:116:b0:82f:9d21:d352 with SMTP id d2e1a72fcca58-82f9d21d516mr22394124b3a.9.1777043539496; Fri, 24 Apr 2026 08:12:19 -0700 (PDT) X-Received: by 2002:a05:6a00:116:b0:82f:9d21:d352 with SMTP id d2e1a72fcca58-82f9d21d516mr22394074b3a.9.1777043538897; Fri, 24 Apr 2026 08:12:18 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:4ec8:83f5:8254:6891]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8ebe68ebsm26965701b3a.47.2026.04.24.08.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2026 08:12:18 -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 v2 12/16] drm/msm/a8xx: Add perfcntr flush sequence Date: Fri, 24 Apr 2026 08:10:47 -0700 Message-ID: <20260424151140.104093-13-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424151140.104093-1-robin.clark@oss.qualcomm.com> References: <20260424151140.104093-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: AW1haW4tMjYwNDI0MDE0NyBTYWx0ZWRfX4DeTl9YAPl5Y 8pWxrycI8JeWb+/dpMqIfHyO4DRBTu0r3LphpoFW8tdjb9mcuUVMAZgbJ0ESvE3v3qoV/DHSwpQ ZGXAZCHMvFBiNuJa2HHOqSDcNVY53RdD0K67OGnXbmysTibAE43AlkGIFfV+SHGMLlQVZAUf6RY s/R8ptBsRKn72SArz4vDKDlT38nljkWuY2rpdJxTfoPwZQcGYFLvUwNJfUX+xxsXoP7x2tqDPL5 NqUbWeoqKHztJVQzSnaKETG1ynbujb0oBpMU5HgtMbIApLlsh3bdICxqWjOu1LUdAT4g1WrDe/R yXRdS2uP/aCt/A6fxct4vj/30OEa6MlyKvJDl1bvY3/99xAfchcogoPE/4VIX7HUQ7euYlgIUuq xLA88jlSuvyQ/P2lDQiOo0pSJNobZp1Knu7tS421+q1dwbeq7Rw5JI24rN8vC1BBL7ihOa95tZl X/fIrk/ONhL/8jITpVA== X-Authority-Analysis: v=2.4 cv=TtnWQjXh c=1 sm=1 tr=0 ts=69eb8854 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=W-43u8CF5Pkpiqpb4b0A:9 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-ORIG-GUID: -OddVHODQKolJGjOW4zhbuBwh1Vdvtzl X-Proofpoint-GUID: -OddVHODQKolJGjOW4zhbuBwh1Vdvtzl 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-24_01,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604240147 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 8b9dcca8e051..6d0f8dcbe9b4 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.53.0