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 A847F3F44CD for ; Wed, 20 May 2026 16:25:49 +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=1779294351; cv=none; b=eBFrL80QgfKi5kIiPQez7QR04Os7/nr8vi1nKZprgNqjmqvsecUfCeLqOnpydMrrWOLmibMzN/4SwsmmU+P9zbdIhD0vXhuOJ5aTCpObVzoY2HpOnu8Vb5/Fs3ef/3qhDNBvxFYggGj4yJHeF0eq/AFU/8LMIi5JtpZPQfXil8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779294351; c=relaxed/simple; bh=9lDWiZT/eHTNZhIK/UJqCefbeN4CEfYGMd8YYIt07+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AeCl9WkJQY2QTV2soHhaLxQDHd7hMp6Q+4LNqwI3xccmsbndBMdXmXC/MTtJdgMeVI7PkFfEATpeOCYfwgczWBidj2d+Dz7i5UeCznb0xBNUZFbIiWQQegInYBURbqB3l1YtO++TA84UUi3OFQzQOeHpe+RjbDnPqbj6VunQsR4= 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=K6fyIZQ5; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TuqGX6kp; 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="K6fyIZQ5"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TuqGX6kp" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64KCe7kc316969 for ; Wed, 20 May 2026 16:25:48 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=yZLNbGmv9aQ +0juIl0AWS3cctse1A5Ppe502SPgUtuc=; b=K6fyIZQ59J76PXtESrdfPWV3XF0 biSDX3DuyH7qMW9fJDc2U9bWkvc9XIc5UgvPzd6L1ecNZyxf5W3AxjxuxxOT5+Lo 5Dk9HSSDjm3HRcLjO9U2LMZHYTLayQMI0fKKyT0QGgvcGScupPO2UeCQeIQaPa3M SSVzq4VZBk5jyrgLrq1FXeHv3MsniO0uzQt/Cu//dhfAa5MUHIZJ4lVbKZwPH0Rg 9aIv1tvTI5/q9QxqVWKSIRjZUvgB1LR2FmITvORZOoFY7jnzkevRAt6DZugUcuHR 2UNTpjsEkfgj5c9iAl+rOF1YIORjEEbIc9nUGEiyteLpx+sq8c2uAo5DPwg== 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 4e9d5qrxv5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 20 May 2026 16:25:48 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2baf7748d0aso48773905ad.1 for ; Wed, 20 May 2026 09:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779294347; x=1779899147; 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=yZLNbGmv9aQ+0juIl0AWS3cctse1A5Ppe502SPgUtuc=; b=TuqGX6kpON1ItGUd3dkDzlQorxtjdgRxy3xkMOgVfROvFUlLn9w1/nRhoSnspTHwvf buQFmKRKowUZHt5+ikQKT+aCKq+ozkhGkv1VAKuOqldLkP5kqMYwINl655+0zS9gnIKm 4x56ZMA/2GcGgTlFUY/Uz8DOC7qLlmpAgwMIDip6RI3xnO0fx66rLkc7UzfiZ6Fq+lIh vYOPR/oAH6BNBKsiWwynZaIeBRSmSuntYI0Bh1u8dUrAFSAmpgW+SiEeJyYJgSjOCegL 8CCu4IjPIl5TPY+bJO5GqBaGjRP+7Q+/IJWrc0l1Irkd9HZUPOZx1eEGR1hocpJyqFlB JnaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779294347; x=1779899147; 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=yZLNbGmv9aQ+0juIl0AWS3cctse1A5Ppe502SPgUtuc=; b=nyHVVwtI63yeSu+kFESHOpVEWaitwEvxNaTCGgaJJKY0hqBavJllP0ivDlx67womfn tKcUPTuTtqzxeXFfNXId8rMXlGWr2S0pEgCI3fOvBZkgSO/qMwIL1B4rzGKyyYJ+eDne oHdKd8A1pq5eiBZgjlpucHu2//DbmROcDImHhv05/0sJ7hLmVXdqYWyXiYJhGAYyu4Fv Ciek190SS16l/pMlWttQ2EiwlQ5o73Tpv7/DliAcP/WZUcYABn15Yoym1YBVz0cQlenQ igccaosO+Qc7tuOwcQkbe5xD6IfC1AwAt7c5ybbB4OcEt4r07OXzoabI0KokQXtpRlaP O28g== X-Forwarded-Encrypted: i=1; AFNElJ9pGQXfogqQ+gfXi35gojT9zw+i0VDCbTj40vsOpl7LDQwzpphxfRBbQhMvzyl9q2bbUtVjjtmorrxcEoA=@vger.kernel.org X-Gm-Message-State: AOJu0YztwrkFHWHfvDvBFSeDz8W43U99J/YsFfMp5CDAsvGCQoLJgGk6 odhNkG/Jt8tBsABkhI8TWGqTIHp8pY/86mSkbaxo0UEkVdkq2UKmiBw8VOeKbdjNqQUYnlsRTio p/UQ0kcGuhn06T6Gi5WIdh54x9MEhyMXVlIpZHF2VbwaEAsoz86nBtRZJU2x3XqYOqRgR+4sesJ 4= X-Gm-Gg: Acq92OGnZL+5ugcwT3635C3UZiTHfQt5VuV0JhkgrD9MdN+9ruM4O26JtsvAigLSpnU v50r5P9RQ66daJQfThaUKZ4f2pJvhHiX4usJzzzyAmbT6sSar8C95gG6KxSDOAB6exnKYpJZESo kZdCi5voEI0GITqiihKDP7ONEOPJ2+D5ctHf/4k7himMjXHgizoA2CuuegWRcNepo4+I+Jzzvrm tpKqOl4fNh+xoVuPUqPIqNOBWW308J+BET8doNegcY6ZtT27aoXxq1bWaSjme/ingketSlZllav KtYoliSr4S9twUmhk7hlVikdfar624ky4BaAKZymDyyRtGXQVVhrEOAwHhilG2IcIBbqi8t7P+Y X9mvsUYfsf9MMZuWgXkry8so3eoOHIzJL X-Received: by 2002:a17:903:2ec5:b0:2bd:9061:d544 with SMTP id d9443c01a7336-2bd9061d6bbmr254826065ad.34.1779294347168; Wed, 20 May 2026 09:25:47 -0700 (PDT) X-Received: by 2002:a17:903:2ec5:b0:2bd:9061:d544 with SMTP id d9443c01a7336-2bd9061d6bbmr254825715ad.34.1779294346670; Wed, 20 May 2026 09:25:46 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:4ec8:83f5:8254:6891]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5c26355csm226190895ad.35.2026.05.20.09.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 09:25:46 -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 v8 16/16] drm/msm/a6xx: Allow IFPC with perfcntr stream Date: Wed, 20 May 2026 09:24:03 -0700 Message-ID: <20260520162454.18391-17-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162454.18391-1-robin.clark@oss.qualcomm.com> References: <20260520162454.18391-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: AW1haW4tMjYwNTIwMDE1OSBTYWx0ZWRfXyfXxVRz6mcgD yyr0jJAXTJbeqFXTpjXjosI4obiQEAJUVOUq3qvlKdUCOBLkmjJLpMTDi2jm6Izyz6L4HCb1oQh 4GxPYABX2IqMXU1GI6z5zqq3R9SX+RBwuP8DWM1rxwu9tshYVwoLI7315z8AJ8Lrrjvit0pQHtD I8naNyKyEN4aLWTxQ6q33gPA7TadvkV+h/gOd7z/RQicpY/hQ67QG5OF2NjSjmoWIxUodZA8I9Z cUp02L2NE2yu7AFleTFf570Pa4QiDau+1MtbtBhj0IUj0nQyb0VL3WtRD8tzJ9d6vvk8OeFX0yk /CfVPO4Il6X4nPC3296lEDHeKxVe6wC47KQ4wnuBCR4Q6/U4J8vTpZu/nnRBa5La8Pgoi9b3fdS em/PaH2y+5xCdJO5/xlPRCneneaHYea9F7K8I0gm79QkydzM7fZSyefCgpjDmm8OehWiK+JCf2i XMoOmpCJkQqGzJD+6Mw== X-Authority-Analysis: v=2.4 cv=QshuG1yd c=1 sm=1 tr=0 ts=6a0de08c 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=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=5obZvuzjGUYrwyXX1KsA:9 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-GUID: A57O2ssitpfvG67Slm_NAfzJlwecQbiV X-Proofpoint-ORIG-GUID: A57O2ssitpfvG67Slm_NAfzJlwecQbiV 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-20_03,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605200159 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 f3cc9478b079..eecc71843bed 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h @@ -280,7 +280,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 cb74b7606987..e3b5fab6f68f 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 85ee784e3851..b29f4664db87 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