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 F33F1379C44 for ; Fri, 22 May 2026 17:35:06 +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=1779471309; cv=none; b=VBHosTmv1I6lRN+UgKMFeaaFrbzwdVYmtw/NO6hvFRYksd0HKCUeIMQKkVNUEpohUPzfWLoGRbMAatl5cbLDyI/qcss0XON1gVfdrh9ljHI1FPVoam1ZN5WEhpzuDYFUzv0e6w5eTP+VVNDai3csMuc/QKNM9H4foNdAHvy++AY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779471309; c=relaxed/simple; bh=QDxGdJcOm7v2xhLyXx98tkrDyQD4MKz8WoNrPdRznaA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JDvRUqa2w0NfJP3kau+S8JAETVhETWHawQ67gsAoywxtxIHtAmPp7s273lPfyo5lRVlXOuLZy7AHi1qrLi/yqy16V88Sk2WSwUayqGIJQTynCJJp7b1omqSLh94nuT52g13/Mq17bHBhEVKbw7J4Gpeq5j1mqnZfV96IPf0FRvo= 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=emQzGiIa; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BezLCCAd; 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="emQzGiIa"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BezLCCAd" 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 64MH552M1800727 for ; Fri, 22 May 2026 17:35:06 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=Deid5R3Lmtq Z0P+RFoa9IB3pG13iRkpjEqosdnVWrfw=; b=emQzGiIaIwUSh3vZFwhRt7U5tum NLbask7oToJUR7ULN4HKSoohBeBdHxzYkodxz4o9aF79zYzWU+bEwGR3Eho9YPyE L/adbM+XVf+Q1bR1k/DF5608W+0MGLl5rv/lv4HE4um/RAWoGlBjT5qWqZnUa+Y+ aCCflJdFi10DxSWGRhoSFgUd3s0f6MEVkNsdDFKEq8NOeHv9bKWZuv4ht5YFNCcx 5p7agD/a6KaOIp2g/om4a63GqLTlhPJ0EWkQvR00G2ac98SPk1jWgU3GdkgWBPM4 2gi+9Rb5RXb8K7A7B6WlTCFWAz7o2XOiaU9UFFh8b3G/W+ohWf/5dclrcxw== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ean9g1q84-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 22 May 2026 17:35:06 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b4530a90fdso136524145ad.1 for ; Fri, 22 May 2026 10:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779471305; x=1780076105; 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=Deid5R3LmtqZ0P+RFoa9IB3pG13iRkpjEqosdnVWrfw=; b=BezLCCAdiHFKUhXo9n5jHf3fgr7CgQJ40TIQ7Y4svV0q5Hqn+M75dScaO6gCR18J5l TGLIoRIXDVx3kPxj4H+tsm+0SehwUzzBmkoehRCCc6Oti2sEl4sXQ+6Ap/4cGfc0RR5D tLVykVDkIlILDi9papDyU1BRDev0okxVzCrObFyuJ+vLpyFTYeO5Tt0XUnjBSkQLNibG GrGNu8y2AVJywNM1Shic5wtP79166f/HFbygVGe1g6L6YN1h2/DGaiRUITrz1advkSQW DpoQlIGY2h1PTNDMTMMDYyQTxgoocj/wbSVdmTC5fQF/1HFRiMruPxyHrUpLdbYmrcfZ fa4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779471305; x=1780076105; 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=Deid5R3LmtqZ0P+RFoa9IB3pG13iRkpjEqosdnVWrfw=; b=Uir5y+5qFxeeutWt76bk0+RquaxBLRqKt71TG5zB0lTPj6Nj7ALFkdqHAhd2EThF// N1TJP2r7Oo9G6sUxkTH9q0MQ48YJwdnEEYZ2f803kq0aNc+BsWfbG43prEQa8DL4qpvg mawhp9lmrkv4iNELzmvHM+exZEffu4qTCJeREaPrDnubYyJNq7GI0xPpO285zJPfJeUL jCFn0VcqMaooXLiZ0eAyQ7ltKThMzC9cEBHkxCAecpHPFNSTcB4ozty/tlPQb41izjTc hTxlg0S2gOpxKvgISJw99zmBkCCwiT1F6mMehU3tahVIQcPacMLDc0X6dE2sWNPjFAKM 1iJw== X-Forwarded-Encrypted: i=1; AFNElJ9ACYcJPTDXULuDqo5KFNsu333nw4dvquFQe8iptkRHvrtyHeNNwSdYAY+Zk+jydfp1556MoTI1cGb3UKM=@vger.kernel.org X-Gm-Message-State: AOJu0YygUO7VPiEMQ84plFuE1mE22yJN+wWZuazsl4uBKHBPXCbQbPfg Q2pHZPHX+RJwS3DJ/YHl3MMyngub4C40dG1mdKCxGaoDxoH25Ft2kT5lEsGkYS1aw6ETrT29Go3 uOUQEJuFMMxXTM9ilQbYBRdcLmrhfU9ouH9w0N+7lmzdtvxw3/5HP9F+wWjjzG9fYbAs= X-Gm-Gg: Acq92OG3zp7XLH912X38Xv8tIIj0tU7/06vN74m50zAGgfg2seNsuvF9VH9mJrW4k/q f9jvnKvUVkYklCjIKM72iZnK0ztWm1Bno69BNuUzgznrUZ2hMsa7j4eUgXYP4ilnTlGDTXjCOen nypeGOT/Wb5/UvhjXnptzC+bWB0dhWxKvc6jnTT+2XHSOk9nMR//nGpkHA8BpbCrLoN5ONt1S/j R4V375vkdzrR1eDmM/O0v+izpcuJeQxSEl7JdjVvbl6zQldXSOtaebzLee7Y8FP06gJIGjo4lsP +sACqYE1ut8J5UobKbvjq5re3jMIDkfpk3Dve6UwYPsfuchVj3dANpls5CXg/rgBSpgc70OXpoI uYdNVkI01+nRZdg2giaSLDAn0Yb+y3XKB X-Received: by 2002:a17:902:f650:b0:2ae:55eb:f82d with SMTP id d9443c01a7336-2beb038f177mr55487135ad.1.1779471305475; Fri, 22 May 2026 10:35:05 -0700 (PDT) X-Received: by 2002:a17:902:f650:b0:2ae:55eb:f82d with SMTP id d9443c01a7336-2beb038f177mr55486635ad.1.1779471304953; Fri, 22 May 2026 10:35:04 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:4ec8:83f5:8254:6891]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2beb58b2e8csm20708725ad.41.2026.05.22.10.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 10:35:04 -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 16/16] drm/msm/a6xx: Allow IFPC with perfcntr stream Date: Fri, 22 May 2026 10:33:02 -0700 Message-ID: <20260522173349.55491-17-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: gjHZn82VU4alXYgsvwVTHwVPh5QQjJ08 X-Authority-Analysis: v=2.4 cv=B/qJFutM c=1 sm=1 tr=0 ts=6a1093ca cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==: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=5obZvuzjGUYrwyXX1KsA:9 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-ORIG-GUID: gjHZn82VU4alXYgsvwVTHwVPh5QQjJ08 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIyMDE3NSBTYWx0ZWRfX4wX+yRH6lNtj EnP8go4OPJGzyqPFxSes0BEjqVzMhO8tX7aHL62AVdUMSjEDgNTwFIC7wVAAfQIh8za3jcWitbw yHc41MefYw5TxK5RQi0MOdV4dhlFDogrL0vgDWI3D/H8BnG10Ge82izkpBaSb0cnZRe0cDFpDIC enPg/6sZbL2y+Pzwt1HF6dvVSRV3dH30K1laATmVaCZtwZcBMQcKcdkbX2oJY54Idf6TKfgzyC8 lUISEgLZrq7fkcfnoue1boz7EztVQxWAXgdLC0BzIps3+QlVQgbUf0GEadikJLZkdf6gfuhbCH1 t6v1uqZyy5llrvdMH8kAppRlsOttCvCH/VrDpl5f/ykYOsoEIW74/I0mersR2VHaKyjEIQb909/ R7fz9SS/lVDs86ipoav2JRLjjqp4e4QKv0GqLFnW22GEUvwNEJeLyOjKX2v5baI1ARZpKWDnRb4 TUqZZiGR1FKFFXixr/g== 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 Now that the dynamic pwrup reglist has SEL reg values to restore appended, so that SEL regs are restored on IFPC exit, we can stop completely disabling IFPC while global counter sampling is active. To accomplish this, we re-use sysprof_setup() with a force_on param to inhibit IFPC specifically while the counter regs are being read, while leaving IFPC enabled the rest of the time. Signed-off-by: Rob Clark Reviewed-by: Anna Maniscalco Reviewed-by: Akhil P Oommen --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 ++-- drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 2 +- drivers/gpu/drm/msm/msm_gpu.h | 10 ++-------- drivers/gpu/drm/msm/msm_perfcntr.c | 8 ++++++++ drivers/gpu/drm/msm/msm_submitqueue.c | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index aba08fb76249..0a7d49a2c877 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -2034,9 +2034,9 @@ static int a6xx_gmu_get_irq(struct a6xx_gmu *gmu, struct platform_device *pdev, return irq; } -void a6xx_gmu_sysprof_setup(struct msm_gpu *gpu) +void a6xx_gmu_sysprof_setup(struct msm_gpu *gpu, bool force_on) { - bool sysprof = msm_gpu_sysprof_no_ifpc(gpu); + bool sysprof = msm_gpu_sysprof_no_ifpc(gpu) || force_on; struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); struct a6xx_gmu *gmu = &a6xx_gpu->gmu; diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h index b72fb58bf223..f60a0801a62d 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h @@ -281,7 +281,7 @@ void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state); int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node); int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node); void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu); -void a6xx_gmu_sysprof_setup(struct msm_gpu *gpu); +void a6xx_gmu_sysprof_setup(struct msm_gpu *gpu, bool force_on); void a6xx_preempt_init(struct msm_gpu *gpu); void a6xx_preempt_hw_init(struct msm_gpu *gpu); diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 22cbafe75a07..3d8f1ea5335b 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -93,7 +93,7 @@ struct msm_gpu_funcs { * for cmdstream that is buffered in this FIFO upstream of the CP fw. */ bool (*progress)(struct msm_gpu *gpu, struct msm_ringbuffer *ring); - void (*sysprof_setup)(struct msm_gpu *gpu); + void (*sysprof_setup)(struct msm_gpu *gpu, bool force_on); /* Configure perfcntr SELect regs: */ void (*perfcntr_configure)(struct msm_gpu *gpu, struct msm_ringbuffer *ring, @@ -378,13 +378,7 @@ msm_gpu_sysprof_no_perfcntr_zap(struct msm_gpu *gpu) static inline bool msm_gpu_sysprof_no_ifpc(struct msm_gpu *gpu) { - /* - * For now, this is the same condition as disabling perfcntr clears - * on context switch. But once kernel perfcntr IFPC support is in - * place, we will only need to disable IFPC for legacy userspace - * setting SYSPROF param. - */ - return msm_gpu_sysprof_no_perfcntr_zap(gpu); + return refcount_read(&gpu->sysprof_active) > 1; } /* diff --git a/drivers/gpu/drm/msm/msm_perfcntr.c b/drivers/gpu/drm/msm/msm_perfcntr.c index 419e797478e8..fbcf8822ce61 100644 --- a/drivers/gpu/drm/msm/msm_perfcntr.c +++ b/drivers/gpu/drm/msm/msm_perfcntr.c @@ -256,6 +256,10 @@ sample_worker(struct kthread_work *work) return; } + /* Inhibit IFPC while accessing registers: */ + if (gpu->funcs->sysprof_setup) + gpu->funcs->sysprof_setup(gpu, true); + if (gpu->funcs->perfcntr_flush) gpu->funcs->perfcntr_flush(gpu); @@ -290,6 +294,10 @@ sample_worker(struct kthread_work *work) } } + /* Re-enable IFPC: */ + if (gpu->funcs->sysprof_setup) + gpu->funcs->sysprof_setup(gpu, false); + smp_store_release(&stream->fifo.head, head); wake_up_all(&stream->poll_wq); } diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c index a58fe41602c6..1a5a77b28016 100644 --- a/drivers/gpu/drm/msm/msm_submitqueue.c +++ b/drivers/gpu/drm/msm/msm_submitqueue.c @@ -42,7 +42,7 @@ int msm_context_set_sysprof(struct msm_context *ctx, struct msm_gpu *gpu, int sy /* Some gpu families require additional setup for sysprof */ if (gpu->funcs->sysprof_setup) - gpu->funcs->sysprof_setup(gpu); + gpu->funcs->sysprof_setup(gpu, false); ctx->sysprof = sysprof; -- 2.54.0