From nobody Mon Apr 6 09:14:32 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A4C093ACA6B; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858340; cv=none; b=FV+QOZEnIhaIYUPet5kEx9vh4KvKHCkxydsh3SmIQ23OGSeMuuiEXL6uB6GXFg9znlRlXuLRsqLQm67t3YHhkPRvlhHNct6UpaiREAh2BIwsY6ZGnZHHtHPo50ImCZ75ENFWua3VIztDzsYTVWSxFkhrT2WICrJwI4yQiJNddO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858340; c=relaxed/simple; bh=wKjXJFqWeTAgI5IR63yIm5CTJ4kzsbDkfI4R87cC/mc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=sxcgiPR+BeUYkahfrkTso0uNKpO40n8s3CzsPZy1+t6sN2t8Bp6lSHICsu/py82U3D2Bw+/ZFDo7WymQCN+2TTzGY649jjUg2z/dQQTO7UpUmStFSboBtaGWVSoFOXoNBjLKXPibPJfjRnBiQycqdtEZK+YNJ1RIYsAH5tmItu0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=fD+vwSqu; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="fD+vwSqu" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTi174202; Mon, 30 Mar 2026 08:57:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=3 wZDnaH+feEDKlSy0EuW3u44hA4Mz71lJfa0cw+XKSc=; b=fD+vwSquK7hE2uxhl cRZ5rO/4BkNMFVbtkRMpK1B5ZONq1xAQLZb3ab9G6RtFGLfy+mcDtw7KgxpJ37CH zLvmGNKkbCcZ2ZDCcsanzA3y5G1pzfXxj04pkZyQ04pRqK+O0///WvTWMHmDggug LMFWwIL4vuoM30b2rmauxgqR6+V/+/o+9nuoj3jBN5/U/Y7nZP2BS/wRzvvg6ney uUH4zGXDd2lAy/r51tmsjwRGBkwKNCsIqNA0z8XbSZwvIRh/EKGFcHMMJH9sHJsj wMdQxSJlORG1uqXmJ/CoeQxVH2owg5EVi8xzSpE04qjc4QZfOV+5gpnLzuo5dE9A 96zIw== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:00 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:56:59 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:36 +0100 Subject: [PATCH 1/8] drm/imagination: Count paired job fence as dependency in prepare_job() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-1-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" , X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=5861; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=wKjXJFqWeTAgI5IR63yIm5CTJ4kzsbDkfI4R87cC/mc=; b=c0bP4kLXTzDwLuUDEj9PIZ3HXIUNOz05Jr2kq9sSW76g8lEh8Yui/uE//fJJDweaPrKrze2my CcWvmiEqE6ZCzU/Y5k7vrUQND53sYci+YMupgQJfN+5PU3Gn+xDK7MG X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfX/N7qpW4/2LB1 eae7z9vuC8F0ddChcs6a0Wf1x17yvi9N7r651jLqe1cXz4/ceHXlcFodL7GFjXFteAGSZ3lPws0 X1XoxDz2yizzvcNFSqUhAy98YjUzAlxaPOiOVfm3MDf6WNYqJ9yKRgWSvCodkWCp+GS42wa5QL8 JI/jrHRmWw4GWMz0GhyWJV9WGg/f13QTMcerKpkVRRX7HCmstSmJC4If7FbU01Azfryazk3tjDu nA13eKOmsuv5Ne9oCgE7u+d9rDshs1jdtrG1PfSiVYrTuIxLGXJzO6/a3t0EOwjW4mAOniF3RlF 64dQJI6ABvc78+zQ1JGWz6kKC687DXPtNJ7kk1U7XHUQHGUw43oIkgek0CC8KfRb5fuk7RVSA3z ey7TjhcIaifZRUVxjf0VAeuZXXYiB7bhHD/pOL17mvcDnUVZEeteRzliGFTrOrBZxvMQ1vyjvhp uZPp/TOCzj2d6cRIVdA== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2ccc cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=VwQbUJbxAAAA:8 a=r_1tXGB3AAAA:8 a=TaBFbORYhpiWZ8GSrjAA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: G79BI5Zqk6h1XdZcmjflEqYcXrG6dwHH X-Proofpoint-ORIG-GUID: G79BI5Zqk6h1XdZcmjflEqYcXrG6dwHH The DRM scheduler's prepare_job() callback counts the remaining non-signaled native dependencies for a job, preventing job submission until those (plus job data and fence update) can fit in the job queue's CCCB. This means checking which dependencies can be waited upon in the firmware, i.e. whether they are backed by a UFO object, i.e. whether their drm_sched_fence::parent has been assigned to a pvr_queue_fence::base fence. That happens when the job owning the fence is submitted to the firmware. Paired geometry and fragment jobs are submitted at the same time, which means the dependency between them can't be checked this way before submission. Update job_count_remaining_native_deps() to take into account the dependency between paired jobs. This fixes cases where prepare_job() underestimated the space left in an almost full fragment CCCB, wrongly unblocking run_job(), which then returned early without writing the full sequence of commands to the CCCB. The above lead to kernel warnings such as the following and potentially job timeouts (depending on waiters on the missing commands): [ 375.702979] WARNING: drivers/gpu/drm/imagination/pvr_cccb.c:178 at pvr= _cccb_write_command_with_header+0x2c4/0x330 [powervr], CPU#1: kworker/u16:3= /47 [ 375.703160] Modules linked in: [ 375.703571] CPU: 1 UID: 0 PID: 47 Comm: kworker/u16:3 Tainted: G = W 7.0.0-rc2-g817eb6b11ad5 #40 PREEMPT [ 375.703613] Tainted: [W]=3DWARN [ 375.703627] Hardware name: Texas Instruments AM625 SK (DT) [ 375.703645] Workqueue: powervr-sched drm_sched_run_job_work [gpu_sched] [ 375.703741] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYP= E=3D--) [ 375.703764] pc : pvr_cccb_write_command_with_header+0x2c4/0x330 [power= vr] [ 375.703847] lr : pvr_queue_submit_job_to_cccb+0x578/0xa70 [powervr] [ 375.703921] sp : ffff800084a97650 [ 375.703934] x29: ffff800084a97740 x28: 0000000000000958 x27: ffff80008= 565d000 [ 375.703979] x26: 0000000000000030 x25: ffff800084a97680 x24: 000000000= 0001000 [ 375.704017] x23: ffff800084a97820 x22: 1ffff00010952ecc x21: 000000000= 0000008 [ 375.704056] x20: 00000000000006a8 x19: ffff00002ff7da88 x18: 000000000= 0000000 [ 375.704093] x17: 0000000020020000 x16: 0000000000020000 x15: 000000000= 0000000 [ 375.704132] x14: 0000000000000000 x13: 0000000000000000 x12: 000000000= 0000000 [ 375.704168] x11: 000000000000f2f2 x10: 00000000f3000000 x9 : 00000000f= 3f3f3f3 [ 375.704206] x8 : 00000000f2f2f200 x7 : ffff700010952ecc x6 : 000000000= 0000008 [ 375.704243] x5 : 0000000000000000 x4 : 1ffff00010acba00 x3 : 000000000= 0000000 [ 375.704279] x2 : 0000000000000007 x1 : 0000000000000fff x0 : 000000000= 000002f [ 375.704317] Call trace: [ 375.704331] pvr_cccb_write_command_with_header+0x2c4/0x330 [powervr] = (P) [ 375.704411] pvr_queue_submit_job_to_cccb+0x578/0xa70 [powervr] [ 375.704487] pvr_queue_run_job+0x3a4/0x990 [powervr] [ 375.704562] drm_sched_run_job_work+0x580/0xd48 [gpu_sched] [ 375.704623] process_one_work+0x520/0x1288 [ 375.704658] worker_thread+0x3f0/0xb3c [ 375.704680] kthread+0x334/0x3d8 [ 375.704706] ret_from_fork+0x10/0x20 [ 375.704736] ---[ end trace 0000000000000000 ]--- Fixes: eaf01ee5ba28 ("drm/imagination: Implement job submission and schedul= ing") Cc: stable@vger.kernel.org Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index dd88949f6194..836feaa0b295 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -179,7 +179,7 @@ static const struct dma_fence_ops pvr_queue_job_fence_o= ps =3D { =20 /** * to_pvr_queue_job_fence() - Return a pvr_queue_fence object if the fence= is - * backed by a UFO. + * already backed by a UFO. * @f: The dma_fence to turn into a pvr_queue_fence. * * Return: @@ -356,6 +356,15 @@ static u32 job_cmds_size(struct pvr_job *job, u32 ufo_= wait_count) pvr_cccb_get_size_of_cmd_with_hdr(job->cmd_len); } =20 +static bool +is_paired_job_fence(struct dma_fence *fence, struct pvr_job *job) +{ + /* This assumes "fence" is one of "job"'s drm_sched_job::dependencies */ + return job->type =3D=3D DRM_PVR_JOB_TYPE_FRAGMENT && + job->paired_job && + &job->paired_job->base.s_fence->scheduled =3D=3D fence; +} + /** * job_count_remaining_native_deps() - Count the number of non-signaled na= tive dependencies. * @job: Job to operate on. @@ -371,6 +380,17 @@ static unsigned long job_count_remaining_native_deps(s= truct pvr_job *job) xa_for_each(&job->base.dependencies, index, fence) { struct pvr_queue_fence *jfence; =20 + if (is_paired_job_fence(fence, job)) { + /* + * A fence between paired jobs won't resolve to a pvr_queue_fence (i.e. + * be backed by a UFO) until the jobs have been submitted, together. + * The submitting code will insert a partial render fence command for t= his. + */ + WARN_ON(dma_fence_is_signaled(fence)); + remaining_count++; + continue; + } + jfence =3D to_pvr_queue_job_fence(fence); if (!jfence) continue; @@ -630,9 +650,8 @@ static void pvr_queue_submit_job_to_cccb(struct pvr_job= *job) if (!jfence) continue; =20 - /* Skip the partial render fence, we will place it at the end. */ - if (job->type =3D=3D DRM_PVR_JOB_TYPE_FRAGMENT && job->paired_job && - &job->paired_job->base.s_fence->scheduled =3D=3D fence) + /* This fence will be placed last, as partial render fence. */ + if (is_paired_job_fence(fence, job)) continue; =20 if (dma_fence_is_signaled(&jfence->base)) --=20 2.43.0 From nobody Mon Apr 6 09:14:32 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A49303ACA4C; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; cv=none; b=Rr8D9zN06msENE2J/xBtu32Rk2qVUlsylXRTvZ6qY0Wte5aUrLNLgTjZRaRLkcpnW8QPQBCORCd7c/GrA/iFGBH/L/Pw3BbmWkgzba1RLNsVe3xmhc1Y5Tql2wRdlmscjYHmGCoEN1293KR/31PMguH+pnKZUOmUIbJq67fdi+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; c=relaxed/simple; bh=Vt9rOXVB86+YkZB8q2mFlAfVz6lvZRqkwWqglbkw5dY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ccKK0DlPHMtwA9PjMbpT24prym81tjl/jR2AqgHzMNfI4prB98SZMLv2VLucbKLe/sLjwW85n9uOgrR0ri+Ts36wQQLSvq1Etj/dmhyYbvLQJEvyT065iMZ24Sdl3BRVWet9zJrpF+COhLfK7n2WG4GGLs0troqM9sAvN3oO3H0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=UuJxpzjS; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="UuJxpzjS" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTj174202; Mon, 30 Mar 2026 08:57:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=q ejdoNCNFywlFiCDSneRuoAYHrORMXz0cJXIt13Na/I=; b=UuJxpzjSO1Xq+bM24 xIozSQHzNhYhNHVkn2FcJvn6gTbMOj7ZgcJHxQKatiJx/NNf49Npo9mM+jAPt1+d I9MDPOybwr8KV8xuA5Rn5/kmUHj3a+w+/EsST/yTovSqzLTiahn9esEnt002i/+E cqo2g1bVvfFsorhuiA+yiWEumIISPGaznfST2XDPW4/bR5FQSH8mr3hFStFntHMY OtkSkHblfvAVkUA5Di/R4M7lLA6WORbbtwsH/6NnZdsh6nydedH/U9gnqm+MuFY5 1mc8Az2WyfWVJ1IUcvR0Zq6O4o2rto3R7oa7lrmxSaRzyzM1RbTCO0NFAHUB0Hya wnh6A== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:00 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:56:59 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:37 +0100 Subject: [PATCH 2/8] drm/imagination: Fit paired fragment job in the correct CCCB Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-2-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" , X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=7023; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=Vt9rOXVB86+YkZB8q2mFlAfVz6lvZRqkwWqglbkw5dY=; b=CBjen60I2AGSU+xH3JvmaR2YAsCFobGFvOeC6SmM7XCUiLkI5vmv5evZjyOwvAa3P4cjOJVWL z12lwSjnsWmA7aF11rZ1Ryd6uaXgK8wNDCfOUwOZy5DUmWy2pkzHzNB X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfX2I0bMxkF/Teu /ySiTbnC5EcIsVvZMxxosRqRQnSevy4m9CC4kOtmO4CHUSTntb3LZe7tyygqrUuqxeg9cc4E81u TXdXspPcNss9fbkJvjOc/dx0A6TgnO6T/oB2lpo5m0wHTJnYc8osD5Ft8BaKEthljV2HAzAZmFG AjAszJYPiHUC54h2emhDn1pogIdUouVfQ/yZR/7KxTXdYBKlDhR4aZDeMbXGsHnAftMK3QnpNpg OvKdQDfSb0KJgVKwoIcxeEJSAd6BAd9pspEO1r/tIxMUVrIpVnPJOVpbo9VIDgtIMVGrGpRRhnV p5ke4h/SpkjbcYv/en5WJgDyaL3uKXIS1uHFuXzesnRz9AeWV6Tl12DUmSxN7COoztGsg3hLVVm XvP0gTjKhy0nKdm29z/PplhJNAb8CcL3kRand152VDOnlFGuYGPF1WzlfiIjjE9EVXBz2fPdR4e Jil/qNq48GvBTf/sgtw== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2ccc cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=VwQbUJbxAAAA:8 a=r_1tXGB3AAAA:8 a=TlYXyb1RBqvdDQlp59oA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: fnLGrxZ8qoXfarF7PMyEDN5P3FxINxls X-Proofpoint-ORIG-GUID: fnLGrxZ8qoXfarF7PMyEDN5P3FxINxls For geometry jobs with a paired fragment job, at the moment, the DRM scheduler's prepare_job() callback: - checks for internal (driver) dependencies for the geometry job; - calls into pvr_queue_get_paired_frag_job_dep() to check for external dependencies for the fragment job (the two jobs are submitted together but the common scheduler code doesn't know about it, so this needs to be done at this point in time); - calls into the prepare_job() callback again, but for the fragment job, to check its internal dependencies as well, passing the fragment job's drm_sched_job and the geometry job's drm_sched_entity / pvr_queue. The problem with the last step is that pvr_queue_prepare_job() doesn't always take the mismatched fragment job and geometry queue into account, in particular when checking whether there is space for the fragment command to be submitted, so the code ends up checking for space in the geometry (i.e. wrong) CCCB. The rest of the nested prepare_job() callback happens to work fine at the moment as the other internal dependencies are not relevant for a paired fragment job. Move the initialisation of a paired fragment job's done fence and CCCB fence to pvr_queue_get_paired_frag_job_dep(), inferring the correct queue from the fragment job itself. This fixes cases where prepare_job() wrongly assumed that there was enough space for a paired fragment job in its own CCCB, unblocking run_job(), which then returned early without writing the full sequence of commands to the CCCB. The above lead to kernel warnings such as the following and potentially job timeouts (depending on waiters on the missing commands): [ 552.421075] WARNING: drivers/gpu/drm/imagination/pvr_cccb.c:178 at pvr= _cccb_write_command_with_header+0x2c4/0x330 [powervr], CPU#2: kworker/u16:5= /63 [ 552.421230] Modules linked in: [ 552.421592] CPU: 2 UID: 0 PID: 63 Comm: kworker/u16:5 Tainted: G = W 7.0.0-rc2-gc5d053e4dccb #39 PREEMPT [ 552.421625] Tainted: [W]=3DWARN [ 552.421637] Hardware name: Texas Instruments AM625 SK (DT) [ 552.421655] Workqueue: powervr-sched drm_sched_run_job_work [gpu_sched] [ 552.421744] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYP= E=3D--) [ 552.421766] pc : pvr_cccb_write_command_with_header+0x2c4/0x330 [power= vr] [ 552.421850] lr : pvr_queue_submit_job_to_cccb+0x57c/0xa74 [powervr] [ 552.421923] sp : ffff800084c47650 [ 552.421936] x29: ffff800084c47740 x28: 0000000000000df8 x27: ffff80008= 8a77000 [ 552.421979] x26: 0000000000000030 x25: ffff800084c47680 x24: 000000000= 0001000 [ 552.422017] x23: ffff800084c47820 x22: 1ffff00010988ecc x21: 000000000= 0000008 [ 552.422055] x20: 0000000000000208 x19: ffff000006ad5a88 x18: 000000000= 0000000 [ 552.422093] x17: 0000000020020000 x16: 0000000000020000 x15: 000000000= 0000000 [ 552.422130] x14: 0000000000000000 x13: 0000000000000000 x12: 000000000= 0000000 [ 552.422167] x11: 000000000000f2f2 x10: 00000000f3000000 x9 : 00000000f= 3f3f3f3 [ 552.422204] x8 : 00000000f2f2f200 x7 : ffff700010988ecc x6 : 000000000= 0000008 [ 552.422241] x5 : 0000000000000000 x4 : 1ffff0001114ee00 x3 : 000000000= 0000000 [ 552.422278] x2 : 0000000000000007 x1 : 0000000000000fff x0 : 000000000= 000002f [ 552.422316] Call trace: [ 552.422330] pvr_cccb_write_command_with_header+0x2c4/0x330 [powervr] = (P) [ 552.422411] pvr_queue_submit_job_to_cccb+0x57c/0xa74 [powervr] [ 552.422486] pvr_queue_run_job+0x3a4/0x990 [powervr] [ 552.422562] drm_sched_run_job_work+0x580/0xd48 [gpu_sched] [ 552.422623] process_one_work+0x520/0x1288 [ 552.422657] worker_thread+0x3f0/0xb3c [ 552.422679] kthread+0x334/0x3d8 [ 552.422706] ret_from_fork+0x10/0x20 Fixes: eaf01ee5ba28 ("drm/imagination: Implement job submission and schedul= ing") Cc: stable@vger.kernel.org Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 32 ++++++++++++++---------------= --- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index 836feaa0b295..f1e54e6d940d 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -488,10 +488,11 @@ pvr_queue_get_job_kccb_fence(struct pvr_queue *queue,= struct pvr_job *job) } =20 static struct dma_fence * -pvr_queue_get_paired_frag_job_dep(struct pvr_queue *queue, struct pvr_job = *job) +pvr_queue_get_paired_frag_job_dep(struct pvr_job *job) { struct pvr_job *frag_job =3D job->type =3D=3D DRM_PVR_JOB_TYPE_GEOMETRY ? job->paired_job : NULL; + struct pvr_queue *frag_queue =3D frag_job ? frag_job->ctx->queues.fragmen= t : NULL; struct dma_fence *f; unsigned long index; =20 @@ -510,7 +511,10 @@ pvr_queue_get_paired_frag_job_dep(struct pvr_queue *qu= eue, struct pvr_job *job) return dma_fence_get(f); } =20 - return frag_job->base.sched->ops->prepare_job(&frag_job->base, &queue->en= tity); + /* Initialize the paired fragment job's done_fence, so we can signal it. = */ + pvr_queue_job_fence_init(frag_job->done_fence, frag_queue); + + return pvr_queue_get_job_cccb_fence(frag_queue, frag_job); } =20 /** @@ -529,11 +533,6 @@ pvr_queue_prepare_job(struct drm_sched_job *sched_job, struct pvr_queue *queue =3D container_of(s_entity, struct pvr_queue, enti= ty); struct dma_fence *internal_dep =3D NULL; =20 - /* - * Initialize the done_fence, so we can signal it. This must be done - * here because otherwise by the time of run_job() the job will end up - * in the pending list without a valid fence. - */ if (job->type =3D=3D DRM_PVR_JOB_TYPE_FRAGMENT && job->paired_job) { /* * This will be called on a paired fragment job after being @@ -543,18 +542,15 @@ pvr_queue_prepare_job(struct drm_sched_job *sched_job, */ if (job->paired_job->has_pm_ref) return NULL; - - /* - * In this case we need to use the job's own ctx to initialise - * the done_fence. The other steps are done in the ctx of the - * paired geometry job. - */ - pvr_queue_job_fence_init(job->done_fence, - job->ctx->queues.fragment); - } else { - pvr_queue_job_fence_init(job->done_fence, queue); } =20 + /* + * Initialize the done_fence, so we can signal it. This must be done + * here because otherwise by the time of run_job() the job will end up + * in the pending list without a valid fence. + */ + pvr_queue_job_fence_init(job->done_fence, queue); + /* CCCB fence is used to make sure we have enough space in the CCCB to * submit our commands. */ @@ -575,7 +571,7 @@ pvr_queue_prepare_job(struct drm_sched_job *sched_job, =20 /* The paired job fence should come last, when everything else is ready. = */ if (!internal_dep) - internal_dep =3D pvr_queue_get_paired_frag_job_dep(queue, job); + internal_dep =3D pvr_queue_get_paired_frag_job_dep(job); =20 return internal_dep; } --=20 2.43.0 From nobody Mon Apr 6 09:14:32 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A489C3A1A28; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; cv=none; b=JgRBkp+NrNRKRhv52nA6DgZ2iZNOq5y+1Y9tZKXpprBt2XJVAcVYAgQw/yF9mUWYP0fPh5uuG2nKgrfLfDMJwWNC4qs1kjmdwlahKP19xlNllnB2+7BzJLMarxswSxImgwEDbg6CPBtBb7u+cRhiqRrmvqK65N64O5YqMNmPu2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; c=relaxed/simple; bh=1ruZS5mWr1hpnoKHvH8FYZr7dg1gu8aYTEEk7UMdO64=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=jYobIpIKBBAHB3EN0IerJqYiNX5UjUlAZHkP+rAGTkFaxUw0kLe3L5SzqcNEB83/HLoz0keokC0fu+AKkkJzG5lkYrbOy5UWYXTOSJesC1ZAdY7JNuShedggwuzDORTwkVvaNkIbbLI9pdlN4uMmmUnvSbeEI8mSpfwzCGlg4Vc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=Jc8mdmrR; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="Jc8mdmrR" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTk174202; Mon, 30 Mar 2026 08:57:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=W Ss4R+WJLlaRlbUhl44LAW/kP57HIL0JMAq4hjBcz4I=; b=Jc8mdmrRwGmCRzZUu CIyvDl7b0ayy5gUk3vZsghlDn3DfsBO/hrbVmiJc6XlFiW+5mZb/Cr4IOrUoVTDs 5xoZ19mi3IbD3thYMc8ShQBdGnQ6t6szkV0I/sArLsXxBHqYJf7jTDne6cDUdjV/ 4b3XN7O+7ZsK8bsfT7ZlmN/7FdLkaJdEd55SdQBbNaOBQYje8IB8rXD445c1iT44 MFh9YQcbxUWxS8+ZS280tlrIGrICnwSC411DJGgTxZaRupP/ljaabxejY3USaWz8 JktqsJEWry3kKRpO/+4D2ajTP+AjT5pJK3CuhWLrr1g+4eP6A6U+TXmuz/Mbyw1P WJu5Q== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:01 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:56:59 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:38 +0100 Subject: [PATCH 3/8] drm/imagination: Skip check on paired job fence during job submission Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-3-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=1762; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=1ruZS5mWr1hpnoKHvH8FYZr7dg1gu8aYTEEk7UMdO64=; b=Hr15ss6AMBUbiy+fmwm5/Y3mpSmrLZJ8SOZMNz5jrX5xTuhQHJgJc6D+iMsZ4YpGmy5qWog6s kwh7wmusx9DAjxsMfMBrg5HWjTQPLi6ArKu3CeLK7ZeBw31shpK4bih X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfX3NNUR7xCuwGU nvZp334Sq2koxY8z6tHxyR8FVAHb7MMfQTWLLxfrbzJXLuD3duLp3Fx/62GxDQ57bI1bkB6Qh4T KY8tjyPGvPvTnKnq8rqh4s4+wKI286pQlUbqCyT3ph9jSy8JNhUnddYAI9EVtIZOV3jLTDX5ZZm p5d5Unp+sD0F+M5LrI7m7tYaoruTrQWQMUuCbHe6tphqPyeMbSXTCEk3cHnLCbak1ESy7jk0Y0y FUHO11npqYdGGGN/uMPCHsNNHvQVNx6jY4v5At5CTLeFtFBChWXk8LHWcyIvDbMI0oEi8ujmfj4 zKS8zvD5fyHEoo677mgnld8+7KQ90/FWJJo0QKEGIsmf2iEsMEOUjEc121TJ0cTIPAXqEYdvdvC WSITs4vo1dD83qkSWWRU60ejQHDLIUGKSa5SGOJrxRt/9Hp1eoh6L8w1mtTejHkfhYUPUbIPpjC okVE356rlu/swrH7wxQ== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2ccd cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=_Y7jKtEYzl7tsisHUWkA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: MoVJ07EmUFPgzr_k86aZsHFyRHmJytHT X-Proofpoint-ORIG-GUID: MoVJ07EmUFPgzr_k86aZsHFyRHmJytHT While submitting a paired fragment job, there is no need to manually look for, and skip, the paired job fence, as the existing logic to resolve dependencies to pvr_queue_fence objects will have failed to resolve it already and continued with the next one. Point this out where the fence is actually accessed and drop the related check. Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index f1e54e6d940d..527eae1309d8 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -646,10 +646,6 @@ static void pvr_queue_submit_job_to_cccb(struct pvr_jo= b *job) if (!jfence) continue; =20 - /* This fence will be placed last, as partial render fence. */ - if (is_paired_job_fence(fence, job)) - continue; - if (dma_fence_is_signaled(&jfence->base)) continue; =20 @@ -664,8 +660,13 @@ static void pvr_queue_submit_job_to_cccb(struct pvr_jo= b *job) } } =20 - /* Partial render fence goes last. */ if (job->type =3D=3D DRM_PVR_JOB_TYPE_FRAGMENT && job->paired_job) { + /* + * The loop above will only process dependencies backed by a UFO i.e. wi= th + * a valid parent fence assigned, but the paired job dependency won't ha= ve + * one until both jobs have been submitted. Access the parent fence dire= ctly + * here instead, submitting it last as partial render fence. + */ jfence =3D to_pvr_queue_job_fence(job->paired_job->done_fence); if (!WARN_ON(!jfence)) { pvr_fw_object_get_fw_addr(jfence->queue->timeline_ufo.fw_obj, --=20 2.43.0 From nobody Mon Apr 6 09:14:32 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A4CCD3ACA6C; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; cv=none; b=jbXiFDnbGuiLvirPGzx0GJpOmlI3VWyEjOV6fAnv4KHyKM23ZD8UNGMDWuLUqiHJt89Sn19xWftCGMByZBXyJkH9s2aHO6rgbk2BwlSR3oYKKRn16unCCyIzJ6/wlXcWHfrquu8Lx+HTIzASczURZR4CaklFu0mSPf0F/OH2/bw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; c=relaxed/simple; bh=aOXr9l0FFmTL/LnafMxft6puEJEDoSxUR5y77Mzx8s8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=T1Jel6tNRJhS+IL5N/23reha2j00CkifdyCHlqfmH7ZXNHWVlKBIbP36n2o3WPvrqtmtsRsr478Wn/EvDIBiS5690xKyxHyEKhvjdEdgxZgCEeBDfMyUeMSHo41Gundu1CtT3HTefsZHYtvzfp4emdO23NeJQFP5zrEMxy2pjpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=GAhqJ2df; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="GAhqJ2df" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTo174202; Mon, 30 Mar 2026 08:57:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=s eLcPBEcAsaYN6ay45rwCaaiKgAxHGqW+q1E15iAdgU=; b=GAhqJ2df2B61ce8ss QKzv/zYQBPG2ldQyqeDhYhxnhxXbvSI7bQ8F5Btl4WwPakqvys9s0clGjmOoZ0hy ZTr6iehsCLtpIX6mXeZ1BCc+W4xLHNfnbj5XZ+2CAhaFMSR2VJbdeZfMKTB1nPA8 D2+O74uC/pw71xwoH7fWlyMvIG/aGPF8Kvpl/lyEtCMRyl1OInjKJN6HcjptukaU jdCg3WaiBN/CdXE0YOArC/uOcT/aT3SpZOonxaJbQ3Uxsci3+zZMqNlDhWHqsiGD akjGwUE/XtDz7ZUswvZ2nzY5Ca4LMeet983Vv9UztxDFy89DrWjUqyFOZCTwSwEY /l2Tw== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:02 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:57:00 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:39 +0100 Subject: [PATCH 4/8] drm/imagination: Rename pvr_queue_fence_is_ufo_backed() to reflect usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-4-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=3271; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=aOXr9l0FFmTL/LnafMxft6puEJEDoSxUR5y77Mzx8s8=; b=jPTx7qR6OzCRucaHhLcYT3Dw8wFzkDxv+qzNiUFU4TCxWaGz7LSF2jWIeEoRlkuaVBMYVXJ9f B4LQyL0J/WnDcxqdxUn3y5LJOZI/mEaqjeqFYG6USjGh2bmhg2JuMdw X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfX8RiojEjqnNLp ujESR9x9nOyk+KnnMi9dG9on1bIK8IpbWuPlWm7CmC+odHbB76vkYDeCBbFpP0x8iuubAMgfm6X TeovI9i6g/ZO8/Sv8n9eKqDxxDh1xb7NYJeOBl5Hn1PGnl6FEbPXZnThc7yjO0lGdpnw8FJTBEA fWQ4dHo5Vr5bIuZ8LQQhh6P4/FSqF6/464FX3C5Qzrz68T51d5iomG4KOeOphSQVUxf6FJUA0u6 oMq+w0DcbeA08rsVleBAJpFYQuyotrjJGTr1CGrBXoh57CdrfrBLCu1hlOj6PhPL2fU7vT67ccR I/ickFYFET4Y67gAgUNZWChcPj7efnkhuIp4Ni06ChoopJ/5G51kbndsTOZBWbNFymshK/CxGT/ F55zXz05w/sy7IkvJ+YdtcJi8NDwip7mmbdEwCwREgzTBqlJAwgzKfOc2tS/QQh27s85ujGYj7c v+Lcv4zn8Bu/VyFOXqw== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2cce cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=BXHwQC_6lmVYEJqqvYEA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: dDHRjWMPgsG4VMMMCfFiVfPyiBFejy9E X-Proofpoint-ORIG-GUID: dDHRjWMPgsG4VMMMCfFiVfPyiBFejy9E This function is only used by the synchronization code to figure out if a fence belongs to this driver. Rename it to pvr_queue_fence_is_native() and update its documentation to reflect its current purpose. Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 14 +++++++------- drivers/gpu/drm/imagination/pvr_queue.h | 2 +- drivers/gpu/drm/imagination/pvr_sync.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index 527eae1309d8..df0a110ed96f 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -898,16 +898,16 @@ static const struct drm_sched_backend_ops pvr_queue_s= ched_ops =3D { }; =20 /** - * pvr_queue_fence_is_ufo_backed() - Check if a dma_fence is backed by a U= FO object + * pvr_queue_fence_is_native() - Check if a dma_fence is native to this dr= iver. * @f: Fence to test. * - * A UFO-backed fence is a fence that can be signaled or waited upon FW-si= de. - * pvr_job::done_fence objects are backed by the timeline UFO attached to = the queue - * they are pushed to, but those fences are not directly exposed to the ou= tside - * world, so we also need to check if the fence we're being passed is a - * drm_sched_fence that was coming from our driver. + * Check if the fence we're being passed is a drm_sched_fence that is comi= ng from this driver. + * + * It may be a UFO-backed fence i.e. a fence that can be signaled or waite= d upon FW-side, + * such as pvr_job::done_fence objects that are backed by the timeline UFO= attached to the queue + * they are pushed to. */ -bool pvr_queue_fence_is_ufo_backed(struct dma_fence *f) +bool pvr_queue_fence_is_native(struct dma_fence *f) { struct drm_sched_fence *sched_fence =3D f ? to_drm_sched_fence(f) : NULL; =20 diff --git a/drivers/gpu/drm/imagination/pvr_queue.h b/drivers/gpu/drm/imag= ination/pvr_queue.h index fc1986d73fc8..4aa72665ce25 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.h +++ b/drivers/gpu/drm/imagination/pvr_queue.h @@ -141,7 +141,7 @@ struct pvr_queue { u64 callstack_addr; }; =20 -bool pvr_queue_fence_is_ufo_backed(struct dma_fence *f); +bool pvr_queue_fence_is_native(struct dma_fence *f); =20 int pvr_queue_job_init(struct pvr_job *job, u64 drm_client_id); =20 diff --git a/drivers/gpu/drm/imagination/pvr_sync.c b/drivers/gpu/drm/imagi= nation/pvr_sync.c index 3582616ff722..757a18b1ab8f 100644 --- a/drivers/gpu/drm/imagination/pvr_sync.c +++ b/drivers/gpu/drm/imagination/pvr_sync.c @@ -211,7 +211,7 @@ pvr_sync_add_dep_to_job(struct drm_sched_job *job, stru= ct dma_fence *f) int err =3D 0; =20 dma_fence_unwrap_for_each(uf, &iter, f) { - if (pvr_queue_fence_is_ufo_backed(uf)) + if (pvr_queue_fence_is_native(uf)) native_fence_count++; } =20 @@ -227,7 +227,7 @@ pvr_sync_add_dep_to_job(struct drm_sched_job *job, stru= ct dma_fence *f) if (err) continue; =20 - if (pvr_queue_fence_is_ufo_backed(uf)) { + if (pvr_queue_fence_is_native(uf)) { struct drm_sched_fence *s_fence =3D to_drm_sched_fence(uf); =20 /* If this is a native dependency, we wait for the scheduled fence, --=20 2.43.0 From nobody Mon Apr 6 09:14:32 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 37B623AD53F; Mon, 30 Mar 2026 08:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858342; cv=none; b=EqZmEk/t3b1jOAaaDzk6c2vlOnyFy7xNCs0sNiZFyd1ImAZJc92IHOpYaYpy2jakyliN/h41U0xSWJdeUrXVaqOJWCqmetHO6owjLIDQ/DyZSr2Arg8uNxJjholu4jVEmv2pDAqWLy/PtShOuJdHervTF7lHlRa7qjrmhpO8HVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858342; c=relaxed/simple; bh=kdk/oC7sY4R+WxO1hIAkVwVRZkcXYFspZAuC3d55vOM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=lDKaLOy+Fs+WTs/XtPa4istJe+e/UklmM/7S5K0QRlfkkJhlaiKrDRPVEggfv+Y7g1qHo+cob4f7NJJLPF/ooM1QVVb0d5Uif9qYbs/q75eEQTsbDoMU2eFnWb7qFrtolZj7uamDSFMt8LJ+38FfWbwsQVDrj9/9jhEUdcjWJD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=PrqUUOvV; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="PrqUUOvV" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTl174202; Mon, 30 Mar 2026 08:57:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=h 1sJSKMVxHc+3A5Iix0o1+ziE+itBfbRCmdfz7cB1kA=; b=PrqUUOvV3hsZliwYr vN/yhwxwhqrGs8+PPrBEduFaad90XiZYNylnl17+H/AjPkugo4E4zZCdZd8cTfzq dh+Z0+bsVd4yi6i7sZP3G3F4R2IWjmSTiFRjdtMp/FblUR85TObD+pVHigqm9GSy Sgpfjf30jT4e4SUu7OveahIsXwuJ3mF/jSv98dQnG/DxBbLQa4Th2VEoyVYIB8mG qbOkNLKd+LfYy9Hrm2iQKL+Zr1I4s1ZSNjeoLJuntp54TaR3sVRoDTRPNE7j/NkW CRZFxU2C9QnQHL59faIFNeBOyAK6UwZjTTwyg1btpRDx6lQua/rPn0Rq2LHfTXvH K2V+g== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:01 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:57:00 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:40 +0100 Subject: [PATCH 5/8] drm/imagination: Rename fence returned by pvr_queue_job_arm() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-5-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=2991; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=kdk/oC7sY4R+WxO1hIAkVwVRZkcXYFspZAuC3d55vOM=; b=VcUZVMk6a20FtQkGaKtDTkfhbKCkark8UL0R3e7epwd5wdGvTjTfFpUu/X9fKqe1ICbId9ZcD JxDHfv19+5ZBakvox4JkQUqONnn51vxpRPU3GD2pxqmUIxpHrXic5Qz X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfX032EfnSrGDqD AlQDA/W4dMKGIx2nMc3+glLUEFq8TwM789XPIu1ULwjgsZ2wRg8hq7f1WuRJsEq+MjRCdv/xHit DKHEnUOY5TD6uqiiUIFnZ2ECdGcDGeTAN6EdLKVDMlqEnyIEPIdCV2uyTDxOhon3Ia+gfr6/9l2 RruBWI+2b65Wz5SKopHaflnWSEIMunxtSrRsXrLH0GO7MIWoHTK/lzYxzxJ87juUV6g7UQ4Fh0V 6pgY86SoqIQjct3V6IEXjFfQVXDaE52GXLlF/O8hnOplR91mzUGg6KfLhQNi7oN6Rrs440Tq17Z IiA8fLB4RLA3kCwg5mdQcoMZNDS/PRY9YEWKNM0Th4YFYRgA4M2lQcFhxc0ChBpqN6yAESVDM78 8cprBawsD4z8N+YnQxCOeYAW1a0S4aUY0QDx6Spo7tVYdailY4dovmJNEaVmZwt23HoIMGoQ9BS cPF9cHYdAAxTZTYQBsA== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2ccd cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=t4At8a9FtDHClisqYPoA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: abByBp9JlzIzgcVJF8B4tV6QyzPaiTP2 X-Proofpoint-ORIG-GUID: abByBp9JlzIzgcVJF8B4tV6QyzPaiTP2 Rename from done_fence to finished_fence, both because the function returns a drm_sched_fence's finished fence, and to avoid confusion with the job fence, which is called the same but has a different purpose. Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_job.c | 8 ++++---- drivers/gpu/drm/imagination/pvr_sync.c | 4 ++-- drivers/gpu/drm/imagination/pvr_sync.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_job.c b/drivers/gpu/drm/imagin= ation/pvr_job.c index 0c2f511a6178..dd9f5df01e08 100644 --- a/drivers/gpu/drm/imagination/pvr_job.c +++ b/drivers/gpu/drm/imagination/pvr_job.c @@ -326,7 +326,7 @@ prepare_job_syncs(struct pvr_file *pvr_file, struct pvr_job_data *job_data, struct xarray *signal_array) { - struct dma_fence *done_fence; + struct dma_fence *finished_fence; int err =3D pvr_sync_signal_array_collect_ops(signal_array, from_pvr_file(pvr_file), job_data->sync_op_count, @@ -359,13 +359,13 @@ prepare_job_syncs(struct pvr_file *pvr_file, return err; } =20 - /* We need to arm the job to get the job done fence. */ - done_fence =3D pvr_queue_job_arm(job_data->job); + /* We need to arm the job to get the job finished fence. */ + finished_fence =3D pvr_queue_job_arm(job_data->job); =20 err =3D pvr_sync_signal_array_update_fences(signal_array, job_data->sync_op_count, job_data->sync_ops, - done_fence); + finished_fence); return err; } =20 diff --git a/drivers/gpu/drm/imagination/pvr_sync.c b/drivers/gpu/drm/imagi= nation/pvr_sync.c index 757a18b1ab8f..936f840a5221 100644 --- a/drivers/gpu/drm/imagination/pvr_sync.c +++ b/drivers/gpu/drm/imagination/pvr_sync.c @@ -160,7 +160,7 @@ int pvr_sync_signal_array_update_fences(struct xarray *array, u32 sync_op_count, const struct drm_pvr_sync_op *sync_ops, - struct dma_fence *done_fence) + struct dma_fence *finished_fence) { for (u32 i =3D 0; i < sync_op_count; i++) { struct dma_fence *old_fence; @@ -175,7 +175,7 @@ pvr_sync_signal_array_update_fences(struct xarray *arra= y, return -EINVAL; =20 old_fence =3D sig_sync->fence; - sig_sync->fence =3D dma_fence_get(done_fence); + sig_sync->fence =3D dma_fence_get(finished_fence); dma_fence_put(old_fence); =20 if (WARN_ON(!sig_sync->fence)) diff --git a/drivers/gpu/drm/imagination/pvr_sync.h b/drivers/gpu/drm/imagi= nation/pvr_sync.h index db6ccfda104a..48501ad27794 100644 --- a/drivers/gpu/drm/imagination/pvr_sync.h +++ b/drivers/gpu/drm/imagination/pvr_sync.h @@ -70,7 +70,7 @@ int pvr_sync_signal_array_update_fences(struct xarray *array, u32 sync_op_count, const struct drm_pvr_sync_op *sync_ops, - struct dma_fence *done_fence); + struct dma_fence *finished_fence); =20 void pvr_sync_signal_array_push_fences(struct xarray *array); --=20 2.43.0 From nobody Mon Apr 6 09:14:33 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A4B6D3ACA66; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; cv=none; b=iZQCFrYPk41jMXd8Kyu3B+lcaeOlQgqAq0s4hprFnuR5Sl3TwgXgioMfnkrIaToHDO6CH3c6aPCpa3lhbOX7Tm41BbxN0ApbldHRbRnEA7QLPguUagbKc6dz7uCpelmU6zwCCe/TF8i+8C0IKlBt4HZhDyHYXy+bbK6hak0Zk7Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; c=relaxed/simple; bh=Jud123WWRsFViT++lGJXkizulPVbeyW2ltbMqISSRbY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gRSSdaxmxwJ4cMpa7oNU3KWA0aHX4T9h54a3NPHCFg7KKYsGnEkdXASgOdy8HdoDZh81iV5sfu6tYIBFmDXTv+t1BuhIbSHYiznNiw96/uLgnE7OBTvgJL7b/hoR8Geln2V6vd/y5WEOm7VYBd7U6ThoOAUfUN+G3EQkykVdWOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=qcRyE5kF; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="qcRyE5kF" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTm174202; Mon, 30 Mar 2026 08:57:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=/ 8FiZRrrQ/O+Rf5kOsCDAWuTUsDDkKsfFbvZz4NC9po=; b=qcRyE5kF9iQ1avMmt nH1fDHUusK7FSJ5LO/93IJHb2M2LeuFB67un+nJ0ETmVdeqChRl8nDHoqXEJ5LbX N+8mxjSCtIrn1ow2RAfUMTtueZty7ifFO1BfIgYo/5PTFdIsDTqmN/eITA73araw 2i8WWJhuhu/gsWuVEIRITS9IsSbpR+uaM1CV5pGud22S261NyGo72nlAxoMZvqKS sEd7hpKRkmhjyLxJz3zzcv4lzOl7qk+tii8XL1SIpyezmDywLAdLRjXCE3seOzX/ CDXgkjlPh6dnlAU2A3dtgr47KnB60XFN9VSA37IkNA24wZaKuXHudjIKZcbnh+6Z dF9LQ== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:02 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:57:00 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:41 +0100 Subject: [PATCH 6/8] drm/imagination: Move repeated job fence check to its own function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-6-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=1816; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=Jud123WWRsFViT++lGJXkizulPVbeyW2ltbMqISSRbY=; b=Us8Uqg2bcIei5LQeqV5+A3+PeVxiODs7azGrw4HFJvCPdodnoBN9XaRjosJv9U3EBmzjuJWrE wMTYRH4ofcNDWIcj5jOmJfWGTAyXXhqmoQ8Y11jl8NSM3fRo8OlmIy1 X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfX3LbZ7G18Zoin YFA4KSKSmaBVaJMwkomSPR16kvSZcBU9TKLTl9KWzSE03/iHGkLDlvN6y2YSgz+jlzZD4u8mB2T lOMD8YdBoKCfnwQ0PiNYXuMKm2gXRrnPRTTskFkxfTDQg5t54fqcHYKSXu9YX+iDzTVDqka3kqS saWPiWuYWvVZzzyxiHj25XPlZaiWTo6XeS3LpSDtR/Kx2I+VJdecJ8hCn6AL8p44OTBfjZVqwTJ 93Ue1u+sL6A3rD6UJ6raAPIkdNaMF6JFd9dhpGYP+vzVlhztK/B+s8uSZ34EZeyouUI6I8163xt MQbOr2U30RYP5v7E6KNFvdo1ISjs5gK42ZnhuizRnmkjmJ/3VDtmJ4+pJlPP+/AZlQcu+ip8rq7 JU5SypaLRZEs02emRGnilz7WkpDMqOXC/Pmig1n6MLqzd1fQ3LOkjlnfUIpNuwdFjkLgiXd31kA r7YRCbf/OePJozP631w== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2cce cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=qN8rWf0lohQvQRdMElYA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: tYoNvPJFFQmVQXx88G-m8Pt_uuTJnAhj X-Proofpoint-ORIG-GUID: tYoNvPJFFQmVQXx88G-m8Pt_uuTJnAhj This should make the code slightly clearer. Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index df0a110ed96f..4a49d954562e 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -177,6 +177,24 @@ static const struct dma_fence_ops pvr_queue_job_fence_= ops =3D { .release =3D pvr_queue_fence_release, }; =20 +/** + * pvr_queue_fence_is_ufo_backed() - Check if a dma_fence is backed by a U= FO. + * @f: The dma_fence to check. + * + * Return: + * * true if the dma_fence is backed by a UFO, or + * * false otherwise. + */ +static inline bool +pvr_queue_fence_is_ufo_backed(struct dma_fence *f) +{ + /* + * Currently the only dma_fence backed by a UFO object is the job fence, + * e.g. pvr_job::done_fence, wrapped by a pvr_queue_fence object. + */ + return f && f->ops =3D=3D &pvr_queue_job_fence_ops; +} + /** * to_pvr_queue_job_fence() - Return a pvr_queue_fence object if the fence= is * already backed by a UFO. @@ -194,7 +212,7 @@ to_pvr_queue_job_fence(struct dma_fence *f) if (sched_fence) f =3D sched_fence->parent; =20 - if (f && f->ops =3D=3D &pvr_queue_job_fence_ops) + if (pvr_queue_fence_is_ufo_backed(f)) return container_of(f, struct pvr_queue_fence, base); =20 return NULL; @@ -915,10 +933,7 @@ bool pvr_queue_fence_is_native(struct dma_fence *f) sched_fence->sched->ops =3D=3D &pvr_queue_sched_ops) return true; =20 - if (f && f->ops =3D=3D &pvr_queue_job_fence_ops) - return true; - - return false; + return pvr_queue_fence_is_ufo_backed(f); } =20 /** --=20 2.43.0 From nobody Mon Apr 6 09:14:33 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A47F33A0B26; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858340; cv=none; b=ukaTQlutCcVxqjHY9xijGo8YIk7YsO5r1HersL0iCB77YlXzKdh2/Z4kXYedPSIbFwjyiGZb2v5mSP9gM3P37+1eOhO+vQQhgZsFFm949EEq8KeUHvyUQGkayIRLJ5yxvj/NIo4AGY2sg3IY708PmrHj+k/lqNO+dqkZSXDP/+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858340; c=relaxed/simple; bh=l8WjdA/LGnLSJKWiMRcqXRkDj2NB9fc74Y1QB17lwrs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PkP5vKPp6pq58mXNmcprWjXWekNrFgh2fEmmF8+V6DJBT3GtaOylODJbyzJDen9s+A8NT2bg+KydWdERK8eZY3cckAt98VbAVBTnLiYq4dO9/tXZigoZtUoRBvlGhQZ7DHnfB1PcfuQdGdedds7IJ5b76XEj7sIFpqlFZHTBnVw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=LwQWJ/n9; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="LwQWJ/n9" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTn174202; Mon, 30 Mar 2026 08:57:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=2 iOJxisi8Kb1EN20/4D6xSszCHtx00WNhzt1fooEsTU=; b=LwQWJ/n9SLLWIo9UX UfPes8s3oOgLP/g/35Nr9Vv8PHXoo0sI0kGu5mAFJs0FWlh6X/lJmgxr4hLkEtlp u+JEZpUPmj2SAO7kvVPsLqqOLCeJYImY7DO74bJ2cLe4MvJAD+GpxsREUsigxcA0 QwbFTruVtDYUZ55IMRiiOpiLMx4nYJTGx/PeyXGneEYT3hMa0tnTPtWXI/SlSEIF KnkLp9P3gfCVDOxZUHJHNBT2/170VAwBsofmrk2beIp+TyXki/VcysjpD9VLGMCa e68rPwlctLE4M6zebju/UGrquGIPtJD8Me74s7nhj0bsOrlCuBU3iz9NYTESVT1K MWVCw== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:02 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:57:01 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:42 +0100 Subject: [PATCH 7/8] drm/imagination: Update check to skip prepare_job() for fragment jobs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-7-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=1511; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=l8WjdA/LGnLSJKWiMRcqXRkDj2NB9fc74Y1QB17lwrs=; b=z8djzyO2G4zfTYC3QPntznFWlddGiMJvj7Wn9vyopXk/AvvZu3sjrhL4x23TbTi8hmphy7MFK /izIcrDrmF3Bb7coenSG16XePHxjvtCGlRGSJ8ufb2OzsW/lf979rZu X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfXycd6f8OX4TvN u4mnd+3JLq/+bLyXD6S5eEJlQCe+rhIdyOC+ofK1HBhuFtHrzldzzpZF6D5fArJI6rW8ZF9Skr5 yc0lFNJGGs766JE1sG0aXGy3k5NxoY9GnJosoQwqfg2jDJLaKGA4xxO3arKgpBlzmwYO5fbkbMI 5TCR9DTBxMiuvQ2VAw4BWp44z4tGiGTPGft30fa0KGMMfJDF4eb2IoOZ0MUIbEw+UQHlQTA57B5 z73D/2P8tXOlLQ0zFr+04y3/pV9w4Aum5tuGH8EzXoVqtLw8lndciJaAbKoRFAMPqCj0+y74aPl DqOOHJ1ve3D4bdhIFb8HHNX7HxbjikklW7z5eyJGLLcbyiiKGTnSLCRdL/ChbUN2P1/KxxFxYHt RNPBOs1cCzfIW9S8VkdVbIP1kKGJSVE1N2aD2AbubmSFrus2Yl37DJ/Z0p+zplp7A3SfQCKaIho 5fpxJ7QZL1xw+u+nuTQ== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2cce cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=_Y7jKtEYzl7tsisHUWkA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: _AGAVqfJjxcLoA0Ds9QP2_y0SDZU1YsH X-Proofpoint-ORIG-GUID: _AGAVqfJjxcLoA0Ds9QP2_y0SDZU1YsH By the time prepare_job() is called on a paired fragment job, the paired geometry job might already be finished and its PM reference dropped. Check the fragment job's PM reference instead which is a bit more likely to be still set. This is a very minor optimization. Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index 4a49d954562e..303f4d6cc09e 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -553,12 +553,13 @@ pvr_queue_prepare_job(struct drm_sched_job *sched_job, =20 if (job->type =3D=3D DRM_PVR_JOB_TYPE_FRAGMENT && job->paired_job) { /* - * This will be called on a paired fragment job after being - * submitted to firmware. We can tell if this is the case and - * bail early from whether run_job() has been called on the - * geometry job, which would issue a pm ref. + * This will be called on a paired fragment job after being submitted + * to the firmware as part of the paired geometry job's submission. + * We can tell if this is the case and bail early from whether run_job() + * has been called on the geometry job, which would issue a pm ref on + * this job as well. */ - if (job->paired_job->has_pm_ref) + if (job->has_pm_ref) return NULL; } =20 --=20 2.43.0 From nobody Mon Apr 6 09:14:33 2026 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 A49C43ACA51; Mon, 30 Mar 2026 08:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.180.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; cv=none; b=tpBJvdS5Kk71xv7dOv8/yRkekz+2bao8LyNHG9Av4mW/+qJnl7wNVqSvM2CdzpRsl3Hpa3UjvNwyrhp+lLDMRGwbDBo/IZb6WVCrTXSS2YLBvV0A7wz6iL7VNR6baiYnQO5587SOOMgQbK/VPyssLZNGDp1hqSObix1NDdNg1eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774858339; c=relaxed/simple; bh=/yF7BgXFlPY5bgvNPfE6BIw+//D50tMFfBnZCd0SRJg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=aUfGjvWDNZwwFHsbIPB/135Ehp/+rJVnnnoovBmprqLWO4s2X4X8IbKks5auSaFspz0lpQXWWpNy5757gDdEMoNCrNMpwuGo3NaM+XF/0s8lobgGFh5L/nQJLOF3lQIqTXAph0a2usNmqBd4P8bdxl1Ugz6hILMrpHzDGvpYY5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=smMB3OvY; arc=none smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="smMB3OvY" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62U5HJTp174202; Mon, 30 Mar 2026 08:57:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=dk201812; bh=j hCCpkEt+BkB84N1zMr4Vl04qUsVX6qxkMXkjdr3+Xg=; b=smMB3OvY7SY0HkV1k 7bkGL23Yc9LMGcLqO7mJvkL4fP/hEYA/prpNDfmU4I1okFZB+APeoJpyLKHgzoJd BzbnVYp//WENvpChim7jTe+AKWFCZMfb/AEogJ520PSPMCAp5veUiytPwiU7F2NG RN/p/TpB29n+65SMFanMWylU5PTmNAssaCYRRe6QBYIjg/Aras49whi/0K1UaAsG YVhem+UgO46pW0uuSChbb6vzJxqRBfE8w+TF28T1EzATZAIbrxxEcmjS93QpR167 s1ueOo7kmbQla6659hT7ZkyCFziz/qp2kaxcZWY9yp2aMnHMtKyIwfC694WBNoB1 ISFdA== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 4d67xusfkv-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2026 08:57:03 +0100 (BST) Received: from NP-A-BELLE.kl.imgtec.org (172.25.6.106) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 30 Mar 2026 08:57:01 +0100 From: Alessio Belle Date: Mon, 30 Mar 2026 08:56:43 +0100 Subject: [PATCH 8/8] drm/imagination: Minor improvements to job submission code documentation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260330-job-submission-fixes-cleanup-v1-8-7de8c09cef8c@imgtec.com> References: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> In-Reply-To: <20260330-job-submission-fixes-cleanup-v1-0-7de8c09cef8c@imgtec.com> To: Frank Binns , Matt Coster , Brajesh Gupta , "Alexandru Dadu" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Boris Brezillon CC: , , , , "Alessio Belle" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774857418; l=5384; i=alessio.belle@imgtec.com; s=20251208; h=from:subject:message-id; bh=/yF7BgXFlPY5bgvNPfE6BIw+//D50tMFfBnZCd0SRJg=; b=vzkL/Rb9EvRS8z1K3VHubqV2TS66bAjYhwngM7cK+U0Y1w9kTtqr4cL/EPYutBLkvx9VKkx1f hiQ280MZ06ZBnpOBZpcqgG5aGIpKEO681AwfTjxUzYO6qyZ6MSotSUi X-Developer-Key: i=alessio.belle@imgtec.com; a=ed25519; pk=2Vtuk+GKBRjwMqIHpKk+Gx6zl7cgtq0joszcOc0zF4g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMwMDA2MSBTYWx0ZWRfXzfQ1IDE1g9IL DtTr64FZbO4eQUEIc48jvCjh9kHOf02NQfmlo58hbt0LC9X345+aLuoSzG/uwZjdU+gDjEZzWw/ pZ4/Un439IC4Mrt/aOmDv3Y0fn1G8ETGh+v+hg3vlcjjRQCgwyS3bCxUqbAGKTaQmzS0ldOUNzb 4aI+dD80jSXOJXxdbr4GV/dftdq/HnZc1UuPdNfQto8yC56mbLNHVgNWmfBRdjQLRbTOLPJ7zja 1PhddJ+szUBJEuL0g2IMQXtGznY+eiTAHs4V42NzugL/U4XcShXiS2mkuz6PcebhgpjYlWBrfSb Dg6zOkV+swOPVYXz7veHELpVcKqCjdaozM15H3ClClY/9o1UAMhtjW9EB4rU7gwwPebMxpjDQXy O1aC4Wx1K+banTkgeCoy/XAqV0TU4Ob/CMet7FOihOr+AeXqqu4JmB5RZz2yl/IwyS37ESJQXEO T97JAQDhlwPbenqByUA== X-Authority-Analysis: v=2.4 cv=QO9lhwLL c=1 sm=1 tr=0 ts=69ca2ccf cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=txNhvCuK94MA:10 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=KCFfvmjXgMu-EKTFBUoA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: hqAUf5kEAgU4PDF-85MHTxc2iYqDLrnB X-Proofpoint-ORIG-GUID: hqAUf5kEAgU4PDF-85MHTxc2iYqDLrnB Mixed list of clarifications and typo fixes. Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_queue.c | 38 ++++++++++++++----= ---- .../gpu/drm/imagination/pvr_rogue_fwif_shared.h | 10 +----- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index 303f4d6cc09e..b5bec656d13c 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -200,6 +200,13 @@ pvr_queue_fence_is_ufo_backed(struct dma_fence *f) * already backed by a UFO. * @f: The dma_fence to turn into a pvr_queue_fence. * + * This could be called on: + * - a job fence directly, in which case it simply returns the containing = pvr_queue_fence; + * - a drm_sched_fence's scheduled or finished fence, in which case it wil= l first try to follow + * the parent pointer to find the job fence (note that the parent pointe= r is initialized + * only after the run_job() callback is called on the drm_sched_fence's = owning job); + * - any other dma_fence, in which case it will return NULL. + * * Return: * * A non-NULL pvr_queue_fence object if the dma_fence is backed by a UF= O, or * * NULL otherwise. @@ -367,11 +374,14 @@ static u32 ufo_cmds_size(u32 elem_count) =20 static u32 job_cmds_size(struct pvr_job *job, u32 ufo_wait_count) { - /* One UFO cmd for the fence signaling, one UFO cmd per native fence nati= ve, - * and a command for the job itself. + /* + * One UFO command per native fence this job will be waiting on (unless a= ny are + * signaled by the time the job is submitted), plus a command for the job= itself, + * plus one UFO command for the fence signaling. */ - return ufo_cmds_size(1) + ufo_cmds_size(ufo_wait_count) + - pvr_cccb_get_size_of_cmd_with_hdr(job->cmd_len); + return ufo_cmds_size(ufo_wait_count) + + pvr_cccb_get_size_of_cmd_with_hdr(job->cmd_len) + + ufo_cmds_size(1); } =20 static bool @@ -517,12 +527,16 @@ pvr_queue_get_paired_frag_job_dep(struct pvr_job *job) if (!frag_job) return NULL; =20 + /* Have the geometry job wait on the paired fragment job's dependencies a= s well. */ xa_for_each(&frag_job->base.dependencies, index, f) { /* Skip already signaled fences. */ if (dma_fence_is_signaled(f)) continue; =20 - /* Skip our own fence. */ + /* + * The paired job fence won't be signaled until both jobs have + * been submitted, so we can't wait on it to schedule them. + */ if (f =3D=3D &job->base.s_fence->scheduled) continue; =20 @@ -665,6 +679,7 @@ static void pvr_queue_submit_job_to_cccb(struct pvr_job= *job) if (!jfence) continue; =20 + /* Some dependencies might have been signaled since prepare_job() */ if (dma_fence_is_signaled(&jfence->base)) continue; =20 @@ -714,7 +729,7 @@ static void pvr_queue_submit_job_to_cccb(struct pvr_job= *job) pvr_cccb_write_command_with_header(cccb, job->fw_ccb_cmd_type, job->cmd_l= en, job->cmd, job->id, job->id); =20 - /* Signal the job fence. */ + /* Update command to signal the job fence. */ pvr_fw_object_get_fw_addr(queue->timeline_ufo.fw_obj, &ufos[0].addr); ufos[0].value =3D job->done_fence->seqno; pvr_cccb_write_command_with_header(cccb, ROGUE_FWIF_CCB_CMD_TYPE_UPDATE, @@ -744,10 +759,8 @@ static struct dma_fence *pvr_queue_run_job(struct drm_= sched_job *sched_job) } =20 /* The only kind of jobs that can be paired are geometry and fragment, and - * we bail out early if we see a fragment job that's paired with a geomtry - * job. - * Paired jobs must also target the same context and point to the same - * HWRT. + * we bail out early if we see a fragment job that's paired with a geomet= ry job. + * Paired jobs must also target the same context and point to the same HW= RT. */ if (WARN_ON(job->paired_job && (job->type !=3D DRM_PVR_JOB_TYPE_GEOMETRY || @@ -966,9 +979,8 @@ pvr_queue_signal_done_fences(struct pvr_queue *queue) } =20 /** - * pvr_queue_check_job_waiting_for_cccb_space() - Check if the job waiting= for CCCB space - * can be unblocked - * pushed to the CCCB + * pvr_queue_check_job_waiting_for_cccb_space() - Check if a job waiting f= or CCCB space + * can be unblocked and pushed to the CCCB. * @queue: Queue to check * * If we have a job waiting for CCCB, and this job now fits in the CCCB, w= e signal diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h b/drivers/= gpu/drm/imagination/pvr_rogue_fwif_shared.h index 869d904e3649..fe54c1cad7a9 100644 --- a/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h +++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h @@ -14,15 +14,7 @@ =20 #define ROGUE_NUM_GEOM_CORES_SIZE 2U =20 -/* - * Maximum number of UFOs in a CCB command. - * The number is based on having 32 sync prims (as originally), plus 32 sy= nc - * checkpoints. - * Once the use of sync prims is no longer supported, we will retain - * the same total (64) as the number of sync checkpoints which may be - * supporting a fence is not visible to the client driver and has to - * allow for the number of different timelines involved in fence merges. - */ +/* Maximum number of UFOs in a CCB command. */ #define ROGUE_FWIF_CCB_CMD_MAX_UFOS (32U + 32U) =20 /* --=20 2.43.0