From nobody Thu Sep 24 12:53:21 2026 Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) (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 4BFA8433BD4 for ; Thu, 24 Sep 2026 07:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790235026; cv=none; b=tFy3EnOCzyrLeKae7MRgih1rjKwiVm2QuM4B+B4a9JJo84TLeYliwi2pTYSnsbmN1dUekoUtqdDJdO3Pw+AGwPvVtaq1pSu8blphf0l2fUUA9UFrNhn22FyHVCbjjwuf7PUVwbi3hQ6u88dh9YFoypr9iipHBOCuCl3VMXQg5vY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790235026; c=relaxed/simple; bh=XQZaE5K7wELBkVpj5cyeE1NqTTZjP6LdzHGCCTMEDUs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TpGCpcLqcPW4RhYuYf7OFMme+WKPOfcOLVVKVswl8f0uHPak1W9IHnqFW1bxK74NgD9McLbLU1jqM0cTTVZuAmNi8MT3wcnSnGRyXZKJtWxbvwwFaNQiR0M8osT9Rp9KH3D1smhq7PWhsQczbmruIl/FK1CwQTwgIvznTNiCrB8= 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=vSgVBxHi; arc=none smtp.client-ip=91.207.212.86 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="vSgVBxHi" Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68O5e24H1074552; Thu, 24 Sep 2026 08:30: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=w Y5QBrESUN0/XfKKkTM0Mt7rDLxNZiQqJ2r/kOUUbl0=; b=vSgVBxHin5NMDIxDL xeyaJXQUwkrPpIZ0LeJYsrAG11VTsdWijCq0T0bS7jcVPuCLo1yGguCaImemo7ad tuG04Bop+wVOInB3oZSsdWvvpHYnSJMNJbm7ly5koMbztnlG/CV3vvDwbWo0VUu1 7B2YWGUrBNna4P23n+Q9rIXfPUHqKpJSMm9GpKKfuUeAtJ4OsoMCUJ/Ucxc9ECfV UN6nYMUbYbzBEPkGLhhp4JU0TXTHtTT5njHtI7OGHBJm8rhWYS3/T8sJ1IQyoz7B Zd2/g/66zuUQc/5YMb+EvfCV4zZTx7jlcgSL0uK6VlQ1UfOJeS5NBtpF+qxj/cqd 21HLA== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 4gsgnq3w1f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2026 08:30:02 +0100 (BST) Received: from [127.0.1.1] (172.25.5.18) 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.46; Thu, 24 Sep 2026 08:30:00 +0100 From: Alexandru Dadu Date: Thu, 24 Sep 2026 10:29:43 +0300 Subject: [PATCH v7 1/3] drm/imagination: Release KCCB slot on error path in pvr_queue_run_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: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-1-584796cb599d@imgtec.com> References: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-0-584796cb599d@imgtec.com> In-Reply-To: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-0-584796cb599d@imgtec.com> To: Alessio Belle , Luigi Santivetti , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter CC: , , , Alexandru Dadu X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790234999; l=1648; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=XQZaE5K7wELBkVpj5cyeE1NqTTZjP6LdzHGCCTMEDUs=; b=3HX2lf2OzTEsE75nrz8icr29gO5jQzARD4vpnqtKo63BhsdxOug4NOaQgIRxvca1RaSvNCbsS xOAUZRBWNE1C86KNfv8mgjWKRYZkRDqQBRqL5xE1Cq/qF+bkW2bOUCi X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI0MDAzMSBTYWx0ZWRfXxUo1Ok/X3MGX C6cmJrivraaoobvj7k+09uMnn6l2KHElCFUwjmopg2WlVk0mqpMpnGKrQ6+ttU67gYGKpwbtqLS EPuYAspwchXmQv8Vg2M8h7mppW2fXtPYRIDLtHZrQI/kLQBtep0LGLdhtOi/Ocj4nBkcdtTie3K dhhQhOIxXWgTjDoSXQiL1G7poidYqhyXGabFDQW9kUB0rMXbZaf8WIO4qXxXoVKI1WnM9DTObn+ P0ihlQH/hlzcnzkop92GtmVz8hd5Q+MchibuA0EJwJwJUXa66pdorqNHIulF+nuznYqjg/3t/Vq zHORiCROtrfv4JI+LoUuV9Ub2/JT+5XfOQvnDlXecbARxM6gkiXXCyaKF3dtIkj1PCEDdwQl7Ul nUtCI3aKilF50hNSiGvPJx5xCEW2jgDzCHCrHelR0HzPbmfxmaeX5PQ+s4J43EDu8y0bl+VrDIS qc5pzfdBkqbe0/SLlgw== X-Proofpoint-ORIG-GUID: 9OaJ0EH4VptLFBUtk8jbDgvl8H1xpRiT X-Authority-Analysis: v=2.4 cv=fYs4WEQF c=1 sm=1 tr=0 ts=6ab4d17a cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=sVS2Dey4ZWMA:10 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=qZQ2PDNLMSdLoqI-hfl9:22 a=r_1tXGB3AAAA:8 a=zXiuvu5RTUsjFMotISsA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: 9OaJ0EH4VptLFBUtk8jbDgvl8H1xpRiT X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI0MDAzMSBTYWx0ZWRfX6x3JhQpqf4z6 QW+yX2dlnZznDAMCk50uybNIZZozAV3qcj8zQtKWpa8U4xn+fKsCzvGuqeNEkH6auxpb59v7ivU dzb7jo6l5syZUje8Iqb0avGaXXZHGEc= Add an error path to pvr_queue_run_job() instead of just a warning and release the KCCB in that path. Signed-off-by: Alexandru Dadu --- drivers/gpu/drm/imagination/pvr_queue.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index 24a8645aa913..8dd87192fabc 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -767,17 +767,19 @@ static struct dma_fence *pvr_queue_run_job(struct drm= _sched_job *sched_job) (job->type !=3D DRM_PVR_JOB_TYPE_GEOMETRY || job->paired_job->type !=3D DRM_PVR_JOB_TYPE_FRAGMENT || job->hwrt !=3D job->paired_job->hwrt || - job->ctx !=3D job->paired_job->ctx))) - return ERR_PTR(-EINVAL); + job->ctx !=3D job->paired_job->ctx))) { + err =3D -EINVAL; + goto err_release; + } =20 err =3D pvr_job_get_pm_ref(job); if (WARN_ON(err)) - return ERR_PTR(err); + goto err_release; =20 if (job->paired_job) { err =3D pvr_job_get_pm_ref(job->paired_job); if (WARN_ON(err)) - return ERR_PTR(err); + goto err_release; } =20 /* Submit our job to the CCCB */ @@ -814,7 +816,14 @@ static struct dma_fence *pvr_queue_run_job(struct drm_= sched_job *sched_job) trace_pvr_job_submit_fw(job); } =20 + if (WARN_ON(err)) + goto err_release; + return dma_fence_get(job->done_fence); + +err_release: + pvr_kccb_release_slot(pvr_dev); + return ERR_PTR(err); } =20 static void pvr_queue_stop(struct pvr_queue *queue, struct pvr_job *bad_jo= b) --=20 2.43.0 From nobody Thu Sep 24 12:53:21 2026 Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) (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 4C03C433E7C for ; Thu, 24 Sep 2026 07:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790235026; cv=none; b=mEJzRrFvOKiknzCF4j43la5URPP3AFYIzgJyt9ckTkNWjYoO1FKMgCTChnT0muClLo5Dn6ZKqWVhff92vRk9SUWUw+QJSFReB7RN7d4asE2eKC3ozI/+tG0F99+hyii9dfhvR8bCO7ZQABSl5wLf1rmQ/WhMIfkhvXzgwKfHqVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790235026; c=relaxed/simple; bh=1xVHNq+TKyV250xc0nxzo3+SJI7DjFGpeq54SO0cQsM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=dB+fgzHzyBbwGglASffCX4BlBP+T3TgST1CaUIN00nNQUwtqpPlL2qOEmkmcSmE0iC7HkLoeoqx5hWoyU874p9+6jkfD0A4L5VU46yWS8k/aiDHemQ73durs+kWIiv17/YFbxPnZpSmTGszDw4BoyWHXBxsmbdkGI3ZKdQKB7tU= 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=pikZqSH0; arc=none smtp.client-ip=91.207.212.86 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="pikZqSH0" Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68O5e24I1074552; Thu, 24 Sep 2026 08:30: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=T GItrDhoO+5pPBhuhDC6SPpjuAv3wA8TVpPKmsAGa3k=; b=pikZqSH0E34BWHbNh vCxpW3tSkWdohWF+i45kGjJhTmNhLrQ7UKUlAHlosRVIA7RAgyXzQFc3/H71ghB0 ENiTeMva1kOwTtTcGighr/yzpC9/i52YWp66WEqPB5Y/Q+r72pyU3Gf1WpL5DMvZ jreR+t09rTns1UWulnFdDIuvSwhYH4YM0UF251KZLSNSbh89qTkWTKyZX0jayUqf WkldXTV5mlEqE6x4TnjUNUfB3UfjfqWezGuaBa4KM2AREzns4V2ni0JZmDlf1ZTS lyu0LPyJjg8/RlK94JlYjl5ms/5sQK+IFGqybiRbQ27hYJO9ILA1Ya5L6ByI3fR7 eo0ew== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 4gsgnq3w1g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2026 08:30:03 +0100 (BST) Received: from [127.0.1.1] (172.25.5.18) 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.46; Thu, 24 Sep 2026 08:30:02 +0100 From: Alexandru Dadu Date: Thu, 24 Sep 2026 10:29:44 +0300 Subject: [PATCH v7 2/3] drm/imagination: Propagate all errors from KCCB command submission code 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: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-2-584796cb599d@imgtec.com> References: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-0-584796cb599d@imgtec.com> In-Reply-To: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-0-584796cb599d@imgtec.com> To: Alessio Belle , Luigi Santivetti , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter CC: , , , Alexandru Dadu X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790234999; l=9250; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=5Ql3OVcHLkZ9VHWPfvZ4KKEbvE5uPaVprIcf7QNVmkE=; b=EWCIjy+fcPV+V1/clnBlLzpiQz4FInCMyw+6p30UtJXq6GrtJf5UaPT8xly+tqNuOBiPxSBE8 REy1nw6Yi/UDSAkjVaCX17QIFqybGp78r6MvkeKCnd5pFHyl7zmM19E X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI0MDAzMSBTYWx0ZWRfX0nQGYb5wro5x lWU5QBR4JcuwwZvuV4ILcQuOS+gxSd6URR2r25dnT80OQzBakzAYxc8Sp+Dx7EGFN343rP2NHEz gOhqry6J34YTYA0r08cwnMPDgokR2YXCXVrejg8XTVFWbtGxha5v8GbSb+O8lPf/84+8xc5oehb V7kypgBYxU7Qlpv0Ota25T0E4IwLfY0zZDbTiOREbBPOfFOdKiiYsAJk3pv2H+Fy90s8AkTle4Q zx4TylZX8+Mgx7xecHkV5BILFlioCj92sXbFeGvd1CZAElPkR3bpr5kZp8DYe5sfYeQBjIroC1c xogR5w3dyPN0xDg0XeDV4qZ1DEgyPKQuE8MskR2J+149gV2SaINgZQeCMXh2XPDUzt9A+RAl2RT Ce4/8cJZL8nLgqE5X5c1XH/3E/L9ihKDliEzo6lzn6pbcvGHylMIxvjHPruGMB3DUt0RI52qTN+ rer64NHwpByY96tjs6w== X-Proofpoint-ORIG-GUID: f-loZv5FJuqpkHvCiVDN1WYEI-_57_Qk X-Authority-Analysis: v=2.4 cv=fYs4WEQF c=1 sm=1 tr=0 ts=6ab4d17b cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=sVS2Dey4ZWMA:10 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=qZQ2PDNLMSdLoqI-hfl9:22 a=r_1tXGB3AAAA:8 a=WhBBAM252t03QMwC9x0A:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: f-loZv5FJuqpkHvCiVDN1WYEI-_57_Qk X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI0MDAzMSBTYWx0ZWRfX30/POf5r3kby Sd7ERIQHQjsMidBOvsZ+P/0JqOYOi3zlP5I7klVULIJrXov8wDnaxfhQibdkZ17h9GZGUaGT5qZ 9+69lbjQceemTe0akL77v/aIWF2hX0I= From: Alessio Belle pvr_kccb_send_cmd_reserved_powered() returned void while the other two variants of pvr_kccb_send_cmd*() returned int. The error is now propagated all the way to the DRM scheduler's run_job() callback, which is the only user of pvr_kccb_send_cmd_reserved_powered() outside of the other variants of pvr_kccb_send_cmd*(). Signed-off-by: Alessio Belle Signed-off-by: Alexandru Dadu --- drivers/gpu/drm/imagination/pvr_ccb.c | 33 +++++++++++++++++++++++++----= ---- drivers/gpu/drm/imagination/pvr_ccb.h | 6 +++--- drivers/gpu/drm/imagination/pvr_cccb.c | 12 ++++++++---- drivers/gpu/drm/imagination/pvr_cccb.h | 20 ++++++++++---------- drivers/gpu/drm/imagination/pvr_queue.c | 25 +++++++++++++------------ 5 files changed, 59 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_ccb.c b/drivers/gpu/drm/imagin= ation/pvr_ccb.c index e408df74853d..2b3dfbe725dd 100644 --- a/drivers/gpu/drm/imagination/pvr_ccb.c +++ b/drivers/gpu/drm/imagination/pvr_ccb.c @@ -253,8 +253,13 @@ pvr_kccb_used_slot_count_locked(struct pvr_device *pvr= _dev) * @pvr_dev: Device pointer. * @cmd: Command to send. * @kccb_slot: Address to store the KCCB slot for this command. May be %NU= LL. + * + * Returns: + * * Zero on success, + * * -EIO if the device is lost, or + * * -EINVAL if a KCCB slot was not reserved or is not available. */ -void +int pvr_kccb_send_cmd_reserved_powered(struct pvr_device *pvr_dev, struct rogue_fwif_kccb_cmd *cmd, u32 *kccb_slot) @@ -264,19 +269,25 @@ pvr_kccb_send_cmd_reserved_powered(struct pvr_device = *pvr_dev, struct rogue_fwif_ccb_ctl *ctrl =3D pvr_ccb->ctrl; u32 old_write_offset; u32 new_write_offset; + int err; =20 - WARN_ON(pvr_dev->lost); + if (pvr_dev->lost) + return -EIO; =20 mutex_lock(&pvr_ccb->lock); =20 - if (WARN_ON(!pvr_dev->kccb.reserved_count)) + if (WARN_ON(!pvr_dev->kccb.reserved_count)) { + err =3D -EINVAL; goto out_unlock; + } =20 old_write_offset =3D READ_ONCE(ctrl->write_offset); =20 /* We reserved the slot, we should have one available. */ - if (WARN_ON(!pvr_ccb_slot_available_locked(pvr_ccb, &new_write_offset))) + if (WARN_ON(!pvr_ccb_slot_available_locked(pvr_ccb, &new_write_offset))) { + err =3D -EINVAL; goto out_unlock; + } =20 memcpy(&kccb[old_write_offset], cmd, sizeof(struct rogue_fwif_kccb_cmd)); @@ -294,8 +305,14 @@ pvr_kccb_send_cmd_reserved_powered(struct pvr_device *= pvr_dev, pvr_fw_mts_schedule(pvr_dev, PVR_FWIF_DM_GP & ~ROGUE_CR_MTS_SCHEDULE_DM_CLRMSK); =20 + mutex_unlock(&pvr_ccb->lock); + + return 0; + out_unlock: mutex_unlock(&pvr_ccb->lock); + + return err; } =20 /** @@ -361,8 +378,9 @@ static int pvr_kccb_reserve_slot_sync(struct pvr_device= *pvr_dev) * @kccb_slot: Address to store the KCCB slot for this command. May be %NU= LL. * * Returns: - * * Zero on success, or - * * -EBUSY if timeout while waiting for a free KCCB slot. + * * Zero on success, + * * Any error returned by pvr_kccb_reserve_slot_sync(), or + * * Any error returned by pvr_kccb_send_cmd_reserved_powered(). */ int pvr_kccb_send_cmd_powered(struct pvr_device *pvr_dev, struct rogue_fwif_kc= cb_cmd *cmd, @@ -374,8 +392,7 @@ pvr_kccb_send_cmd_powered(struct pvr_device *pvr_dev, s= truct rogue_fwif_kccb_cmd if (err) return err; =20 - pvr_kccb_send_cmd_reserved_powered(pvr_dev, cmd, kccb_slot); - return 0; + return pvr_kccb_send_cmd_reserved_powered(pvr_dev, cmd, kccb_slot); } =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_ccb.h b/drivers/gpu/drm/imagin= ation/pvr_ccb.h index 4c8aef31eeb0..8b698206c68b 100644 --- a/drivers/gpu/drm/imagination/pvr_ccb.h +++ b/drivers/gpu/drm/imagination/pvr_ccb.h @@ -60,9 +60,9 @@ int pvr_kccb_send_cmd(struct pvr_device *pvr_dev, int pvr_kccb_send_cmd_powered(struct pvr_device *pvr_dev, struct rogue_fwif_kccb_cmd *cmd, u32 *kccb_slot); -void pvr_kccb_send_cmd_reserved_powered(struct pvr_device *pvr_dev, - struct rogue_fwif_kccb_cmd *cmd, - u32 *kccb_slot); +int pvr_kccb_send_cmd_reserved_powered(struct pvr_device *pvr_dev, + struct rogue_fwif_kccb_cmd *cmd, + u32 *kccb_slot); int pvr_kccb_wait_for_completion(struct pvr_device *pvr_dev, u32 slot_nr, = u32 timeout, u32 *rtn_out); bool pvr_kccb_is_idle(struct pvr_device *pvr_dev); diff --git a/drivers/gpu/drm/imagination/pvr_cccb.c b/drivers/gpu/drm/imagi= nation/pvr_cccb.c index 4fabab41bea7..da6e6d94e29f 100644 --- a/drivers/gpu/drm/imagination/pvr_cccb.c +++ b/drivers/gpu/drm/imagination/pvr_cccb.c @@ -220,8 +220,12 @@ static void fill_cmd_kick_data(struct pvr_cccb *cccb, = u32 ctx_fw_addr, * You must call pvr_kccb_reserve_slot() and wait for the returned fence to * signal (if this function didn't return NULL) before calling * pvr_cccb_send_kccb_kick(). + * + * Returns: + * * Zero on success, or + * * Any error returned by pvr_kccb_send_cmd_reserved_powered(). */ -void +int pvr_cccb_send_kccb_kick(struct pvr_device *pvr_dev, struct pvr_cccb *pvr_cccb, u32 cctx_fw_addr, struct pvr_hwrt_data *hwrt) @@ -235,10 +239,10 @@ pvr_cccb_send_kccb_kick(struct pvr_device *pvr_dev, /* Make sure the writes to the CCCB are flushed before sending the KICK. = */ wmb(); =20 - pvr_kccb_send_cmd_reserved_powered(pvr_dev, &cmd_kick, NULL); + return pvr_kccb_send_cmd_reserved_powered(pvr_dev, &cmd_kick, NULL); } =20 -void +int pvr_cccb_send_kccb_combined_kick(struct pvr_device *pvr_dev, struct pvr_cccb *geom_cccb, struct pvr_cccb *frag_cccb, @@ -263,5 +267,5 @@ pvr_cccb_send_kccb_combined_kick(struct pvr_device *pvr= _dev, /* Make sure the writes to the CCCB are flushed before sending the KICK. = */ wmb(); =20 - pvr_kccb_send_cmd_reserved_powered(pvr_dev, &cmd_kick, NULL); + return pvr_kccb_send_cmd_reserved_powered(pvr_dev, &cmd_kick, NULL); } diff --git a/drivers/gpu/drm/imagination/pvr_cccb.h b/drivers/gpu/drm/imagi= nation/pvr_cccb.h index 943fe8f2c963..a2155f732bf1 100644 --- a/drivers/gpu/drm/imagination/pvr_cccb.h +++ b/drivers/gpu/drm/imagination/pvr_cccb.h @@ -59,16 +59,16 @@ void pvr_cccb_fini(struct pvr_cccb *cccb); void pvr_cccb_write_command_with_header(struct pvr_cccb *pvr_cccb, u32 cmd_type, u32 cmd_size, void *cmd_data, u32 ext_job_ref, u32 int_job_ref); -void pvr_cccb_send_kccb_kick(struct pvr_device *pvr_dev, - struct pvr_cccb *pvr_cccb, u32 cctx_fw_addr, - struct pvr_hwrt_data *hwrt); -void pvr_cccb_send_kccb_combined_kick(struct pvr_device *pvr_dev, - struct pvr_cccb *geom_cccb, - struct pvr_cccb *frag_cccb, - u32 geom_ctx_fw_addr, - u32 frag_ctx_fw_addr, - struct pvr_hwrt_data *hwrt, - bool frag_is_pr); +int pvr_cccb_send_kccb_kick(struct pvr_device *pvr_dev, + struct pvr_cccb *pvr_cccb, u32 cctx_fw_addr, + struct pvr_hwrt_data *hwrt); +int pvr_cccb_send_kccb_combined_kick(struct pvr_device *pvr_dev, + struct pvr_cccb *geom_cccb, + struct pvr_cccb *frag_cccb, + u32 geom_ctx_fw_addr, + u32 frag_ctx_fw_addr, + struct pvr_hwrt_data *hwrt, + bool frag_is_pr); bool pvr_cccb_cmdseq_fits(struct pvr_cccb *pvr_cccb, size_t size); =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index 8dd87192fabc..b58c0887cafe 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -793,15 +793,15 @@ static struct dma_fence *pvr_queue_run_job(struct drm= _sched_job *sched_job) =20 /* Submit the fragment job along the geometry job and send a combined ki= ck. */ pvr_queue_submit_job_to_cccb(frag_job); - pvr_cccb_send_kccb_combined_kick(pvr_dev, - &geom_queue->cccb, &frag_queue->cccb, - pvr_context_get_fw_addr(geom_job->ctx) + - geom_queue->ctx_offset, - pvr_context_get_fw_addr(frag_job->ctx) + - frag_queue->ctx_offset, - job->hwrt, - frag_job->fw_ccb_cmd_type =3D=3D - ROGUE_FWIF_CCB_CMD_TYPE_FRAG_PR); + err =3D pvr_cccb_send_kccb_combined_kick(pvr_dev, + &geom_queue->cccb, &frag_queue->cccb, + pvr_context_get_fw_addr(geom_job->ctx) + + geom_queue->ctx_offset, + pvr_context_get_fw_addr(frag_job->ctx) + + frag_queue->ctx_offset, + job->hwrt, + frag_job->fw_ccb_cmd_type =3D=3D + ROGUE_FWIF_CCB_CMD_TYPE_FRAG_PR); =20 trace_pvr_job_submit_fw(geom_job); trace_pvr_job_submit_fw(frag_job); @@ -809,9 +809,10 @@ static struct dma_fence *pvr_queue_run_job(struct drm_= sched_job *sched_job) struct pvr_queue *queue =3D container_of(job->base.sched, struct pvr_queue, scheduler); =20 - pvr_cccb_send_kccb_kick(pvr_dev, &queue->cccb, - pvr_context_get_fw_addr(job->ctx) + queue->ctx_offset, - job->hwrt); + err =3D pvr_cccb_send_kccb_kick(pvr_dev, &queue->cccb, + pvr_context_get_fw_addr(job->ctx) + + queue->ctx_offset, + job->hwrt); =20 trace_pvr_job_submit_fw(job); } --=20 2.43.0 From nobody Thu Sep 24 12:53:21 2026 Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) (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 4BE84433BAC for ; Thu, 24 Sep 2026 07:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790235026; cv=none; b=MgoSqpdcIdfKjsOlHECPITw6LxOh7VCc/223QjJGDplZJI+W8CbKq8M//CJzW5GXpm+AeOcXhtMQwS38ZyGQciuf7ijcNsfnj6Mhrv2neKJ7qhUiBiE83jHTXER3tIwQfZ7Pw45hiZLzYILwW1E2hBIe6/U6q2otReD7H8QIQAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790235026; c=relaxed/simple; bh=Tydr9mGwHtPEldWoz4cV1uuED8vM23Fb8MaGn1f3PxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=uO9xbBIJyKKNwsSgJlTpA9rbD8QPZuBMrlcs9dYSEKRNCQcTl7ZBT30TQETVdFpmsf40mgDK+dY6WWiQMSzl6+CuASV53NxIdias2iMp0KoYuVWvfi2Ok0I8ymKX+JFQhe7/7wnnCQa9eFk4A4ZRWfaox6zYe7bvsU067qpdsGw= 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=Ep8xTlEc; arc=none smtp.client-ip=91.207.212.86 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="Ep8xTlEc" Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68O5dsQB1074426; Thu, 24 Sep 2026 08:30:04 +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=l d6iMESVzmCunC64MEHW51O/ZBRb5xMBpkZMKA8HQ/o=; b=Ep8xTlEcVNnNHh6XD XlkU77M84DdGmpduM0LtCW2Sa0I7wXGbBLlYofnJtpkRkFwATLDwdYSFa/9gXw6p hWnQGVzZNpugCNPmbf263t3G4tjvwNGqC8Einry4gAk4UI2HB/cYuQTsrwCSt+vI 9vX6ityEsD4c3x3TrQLSERrLXhacNyEcObBT4teeLYS19mVWyLuYlWpdQTxSpKQq fWMsGt+W4g35jCsHSNY5kW2Qs9vbmYpQ0UGmQ2x2vW4rQmsmeZ3gm6Ck2w2tBUfo KY/DGdT/WJ/ywlAwiYo9MiXLFtv6Zm1754Z0GofXWPrgKwZ6ebrSEQLGrjNR2wn7 VipbQ== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 4gsgnq3w1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2026 08:30:04 +0100 (BST) Received: from [127.0.1.1] (172.25.5.18) 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.46; Thu, 24 Sep 2026 08:30:03 +0100 From: Alexandru Dadu Date: Thu, 24 Sep 2026 10:29:45 +0300 Subject: [PATCH v7 3/3] drm/imagination: Release pm references in case of error 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: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-3-584796cb599d@imgtec.com> References: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-0-584796cb599d@imgtec.com> In-Reply-To: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v7-0-584796cb599d@imgtec.com> To: Alessio Belle , Luigi Santivetti , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter CC: , , , Alexandru Dadu X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790234999; l=927; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=Tydr9mGwHtPEldWoz4cV1uuED8vM23Fb8MaGn1f3PxM=; b=sfIYYsQir2vcmf9Ic5sJyW6BGhE75JU2pPLg1IK5EspeG36d971bLYO6el7z2wNDWUX6kFVM2 2n/dvyjdjqDDvL57uGrcgySOBRo7OPLgEE8e8VTf8hU10cDJl4DIIl2 X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI0MDAzMSBTYWx0ZWRfX0PoLh3h05GCn EIWA0y/aDvqkHGrAbvSWkfzrxDqNxBeJLk/AFDKgFgO4MX3ERRUI1WGA+1aDtVGZ2yMANnHFeCX mCOCQCxfVLlwiZ2Z9QtuYy4x5bdkZOYwjlvxg1kextrkiwIDAg/1U3TcMfs5g2gP7fPtg3m2WkY eGjKS7lmXCHiauJkgb0rWLRmnx7Dp1coxJSawJqmhOSSqgIRWug20kEs/YHZpEi7Lq+BjhJiTjT 80NVmAjBfl8jafBsSQ3QDJF0CmbTmBQZmB2h2KnDrPfbVQ5CWWWTKtYMp21P47aKHAK6tL4DVzk JUs/2rJinDVpx+dJ3LCJMizq+3blA5HabknIWB75oOm15DWOxUJ+G81Dq/TaeyZRvxCxnQ9BvzZ bVWuCski9YXmJDM9JS6IlxDNnvT3EKXH7OxF1KB87s98NmtYLe3lerHXiJsZW0ryoSc+IQvxksP 52Ef6wrawKVC0539BPA== X-Proofpoint-ORIG-GUID: tuB7dhp3-BDbyucFZZmi6SwttUSiBTrt X-Authority-Analysis: v=2.4 cv=fYs4WEQF c=1 sm=1 tr=0 ts=6ab4d17c cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=sVS2Dey4ZWMA:10 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=kQ-hrUj2-E3RCbRHssb7:22 a=qZQ2PDNLMSdLoqI-hfl9:22 a=r_1tXGB3AAAA:8 a=jKIV6DwP1_vLq_mzJWMA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-GUID: tuB7dhp3-BDbyucFZZmi6SwttUSiBTrt X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI0MDAzMSBTYWx0ZWRfX204LDFFaZqZl GWCQFg3rpFLvDKThP5bh2FbXm6lL7qpKuK04qKMw0f0/xJ3fPIyJiQ8zuQK+igO/MkJs0oLtHQ3 ww8pXX3w8jnqSO1pIRfj2kaqxjrZrSA= Add early release of the power references in case of errors. Signed-off-by: Alexandru Dadu --- drivers/gpu/drm/imagination/pvr_queue.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index b58c0887cafe..c72f1d0b8bc0 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -820,6 +820,19 @@ static struct dma_fence *pvr_queue_run_job(struct drm_= sched_job *sched_job) if (WARN_ON(err)) goto err_release; =20 + err =3D pvr_job_get_pm_ref(job); + + if (WARN_ON(err)) + goto err_release; + + if (job->paired_job) { + err =3D pvr_job_get_pm_ref(job->paired_job); + if (WARN_ON(err)) { + pvr_job_release_pm_ref(job); + goto err_release; + } + } + return dma_fence_get(job->done_fence); =20 err_release: --=20 2.43.0