From nobody Thu Sep 24 12:53:21 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 9A7FD3AE190 for ; Thu, 24 Sep 2026 06:20:48 +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=1790230850; cv=none; b=J5MzipFxA55iX59k53A65pnaiSujAzRTYbr05o0wDYu/zrY2TXnLE+C52U8t3yxpVPwQI30agaof9zXkJfP8Mvf7v/KSyGhtuBH/QqWkVLtkAlTz5fzEI5wBQaIW6Lz2XlyZxVZzHrxOhP1wkSTuAp+a7fffh9wxcwLj0OW75s4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790230850; c=relaxed/simple; bh=XQZaE5K7wELBkVpj5cyeE1NqTTZjP6LdzHGCCTMEDUs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=R1zk0Prv53W41KH0R0WPzh61TTjrQWJYPSr1Ao6CPc6iwH0MzKnP2ihFFLjIXoIKCe9/np/O2ql+AVxUQRwz9oDvVnWSbKDIbDzS42oFNLH/pO/dvvCevDddihRJuJv3sVlo2htxZs6YJ6ETci+JpkTamFKhz+4R+eqxxjA1fTA= 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=sBdMOkvp; 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="sBdMOkvp" 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 68O5dimJ4070823; Thu, 24 Sep 2026 07:20:17 +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=sBdMOkvp3exmvpOEX uc+K0XMIBYsRgJeCmG8n0I0DsdTkaUg5ze5607SAFOf1CbDVQTULCqxjmGpMS53i FuAfoMaLASNtOFwnKadxMUtapP9QwHebngI6a+KHSeZtKkyo2sgkJkhZfZXgKDPw RVtyOKGpPy0vefrC+lqEBhaZdydLQkEDnFCRR/iryhsvAqRZNQMOXSQl7MRxLDDD 5txxhFl9J1XPZkbLlqve/bqT0vNvEXOfrE4nGRlf7fd9aoSdLKhWdvbyjpwfNFhf wgKgO0wHNOrK9o1EaQ7bdSFUXqUGvfEdzBBc3cYXtMMm17LK6V7Za8w9zzU9gpu5 1uJJA== 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 4gsjftm9vu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2026 07:20:17 +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 07:20:16 +0100 From: Alexandru Dadu Date: Thu, 24 Sep 2026 09:19:49 +0300 Subject: [PATCH v6 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-v6-1-d9d5375665ed@imgtec.com> References: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v6-0-d9d5375665ed@imgtec.com> In-Reply-To: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v6-0-d9d5375665ed@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=1790230815; l=1648; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=XQZaE5K7wELBkVpj5cyeE1NqTTZjP6LdzHGCCTMEDUs=; b=shE/zWGPcrnoIDFE9MSsfCR37/XopfrcHac9Uv1XepMbxA7bEBhrvYxkWBqjIJu3c4+sBIBmi t0izDfazDCoB02HVvMfOc9kMIpvmxrFTYfZfbLYpdO2pS/dDEO+CrR3 X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Authority-Analysis: v=2.4 cv=GPKdgeNK c=1 sm=1 tr=0 ts=6ab4c121 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=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=zXiuvu5RTUsjFMotISsA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI0MDAyNiBTYWx0ZWRfX0tJF4zHt+kZT 9e0HSrHoba0+QSEEY5YPxtKxpvXbLvDBsUzXYOJ2r5dzFV/hwfrGPmcJOK8GMCnhY9U0yQlpJz+ rK4RPi9sXm59cXoPb2p81r2q6LwkTelg96VvUMklJgvnj2g5sIzWp+lWAsSoBRKN1dd8+fNz6RI wEI+3OpuDr8OenSFW+84PR4shKCAZ2RSxM5oNPwPZV28/sx2Zjasfr9w0hVnbWXzZG+7rLQ+NAL XSNlRFAMRFsXNc/sgAMTnFc/iiSq5S66AfWsv2XzCfbpRqM/kGGPQgEcYYdBHo6uoUX70tGMBIf n0AyzaPIrCBs7eVI4Wgkpzyn2dqLMvrbCfl8LraJtmnWhxI7XNpjWiNlo9e7DUXVj53rMXXS4du WuC8zFsw0rt63d1Kd9ZbXQr54kGIhTnxfrTrY/RSkw1RHBR0A+SfzmLFTgjKKRLSZ9cGmHcVpRw MytVne5jty/Ap3ak/ag== X-Proofpoint-ORIG-GUID: bnuIFKFMlRT0OIb-_E-z-quNZVpX9VNG X-Proofpoint-GUID: bnuIFKFMlRT0OIb-_E-z-quNZVpX9VNG X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI0MDAyNiBTYWx0ZWRfX8PUNSvyavG4g hFXdLinN/ESaD97p7/u7YKxZ8aP4Vh9P8REH3hbY0O5di2dsnRKjxfdSNCtC+BgLa5XIhvdjiXu JXEoiDGA3eRmPQ1LtBaRqwmvneOu3Pc= 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 06DBB4052B5 for ; Thu, 24 Sep 2026 06:20:50 +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=1790230854; cv=none; b=mq9P6aQIEeq05JqKMZ0Ceyr3Ne1NtHAY10n2nvr8RKHA9CjcWrypvQoSeBA23y3l06pJ2k5CVVcvyBMA5CXpGTsskt14vE/OAO8tNPvO49QpKQ48uzXEAT6va1OSSx2fLnl5CvY3yXXd21oxt+hbRaj4bL5ZFDBAmdmZ74rgDAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790230854; c=relaxed/simple; bh=1xVHNq+TKyV250xc0nxzo3+SJI7DjFGpeq54SO0cQsM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Ry/aT0l/lVbI5KTDZsOyYuEL93wl0RLxOltVJTvfer1X7rWJI4BKsHZ4owlFDu4bowW3Z8uyIjxcxRoF5N/kiDbzWZBuNNwUpu2o4/vs0kqmOtX1QXB5PoMnstM535wPx1szxWRIKIpGcwGTxOdITK+k5cPmNdsZW+UHIWm7zfc= 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=kU1CW7Mt; 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="kU1CW7Mt" 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 68O5e21f1074552; Thu, 24 Sep 2026 07:20:18 +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=kU1CW7MtpR/t5Yv6J mDrk0RoO+DngHh9UnrhMLH3Id0XbSEK79gi6rLszsx5uZIH4lL66iiv5qtvEx3jd EO1qleWUeptpk1OaG0Ei1h88+SwbBBtVnLuwqMdHqiRfs598HnKeZ82+2uRoLGWb 6ucxax9oyUC3jllp2o4eSVc5lSyU82KpDAFkOOusEoW02X37iBkOBJbep3szITHa 5nEze3tM0jeniCJVrO041WiqxDD6ehkiyIopWGZ4Lm5sCg0VFcGIueeaXzlujTCG PONraMpHQUTLuJynlDZIM9hSdVSZIWpzYtMFvyNLrLcMQlAFKp5WdfEuPARs/4WB Y1PPA== 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 4gsgnq3upm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2026 07:20:18 +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 07:20:17 +0100 From: Alexandru Dadu Date: Thu, 24 Sep 2026 09:19:50 +0300 Subject: [PATCH v6 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-v6-2-d9d5375665ed@imgtec.com> References: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v6-0-d9d5375665ed@imgtec.com> In-Reply-To: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v6-0-d9d5375665ed@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=1790230815; l=9250; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=5Ql3OVcHLkZ9VHWPfvZ4KKEbvE5uPaVprIcf7QNVmkE=; b=dF4RUx71rTBNgJhLf4dqFvAsiP85DEO9arVnscX+H470G9UZQUEp4eiW3LemkaeSCW3n5SnIp vtNyzejC9AABGaknKtz9Izvo0+wplT/TM8osGLaM3UyFsEQ+U/v3ynY X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI0MDAyNiBTYWx0ZWRfX7uUyxTQii8bn B86y0geZlH6fV4QbGpJy2PIURyIVEXQwEgIymEuptZHPTCDXgStmFdYfxuLBDCqzO5iMjutzJId vM/wxft/eVbp0ekABzIFJUoip09+/4kw/hjMrca9oD/13xzlA8Yq+z4N334IWEUUzJCYEmz9y/S nnhhi1WVfmWV/ILSfDpfw0EhvgQw/KJzZc+2Ag+qRmSLzpqvlHxb38olb6tn1Baf2cMTSVlND3b eL46lCvDtnkJ+lB8bjf8TfIlr/H8Ia5ezrvYOYCj64ARCvIXJ0qaZLLfhV1B2S3QnmiSwaBnaPr 4i60VfgdszLCuPAN1K4Ez4d9VcpqGWfJtpYFIy/Kohi25m/ByN8JjH55qhj4CUDuvMz2nMioxtE HKORU2/xQgJhhoTuHuOqgKoS9Iz9HuYNUS5F3oNOQRIj3tyodJsoZ35Yav09N+gGU3OMXjUmeay E69KUuuyavfDD0slswA== X-Proofpoint-ORIG-GUID: th5J-t3pvA2vzz_-72Q438aFE-L-QnXI X-Authority-Analysis: v=2.4 cv=fYs4WEQF c=1 sm=1 tr=0 ts=6ab4c122 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: th5J-t3pvA2vzz_-72Q438aFE-L-QnXI X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI0MDAyNiBTYWx0ZWRfX7Zz5tnrYvcJr dqAtTNVyGfa9sAHJhyeqG9idDaC0AVTqvWx1/3bvIJSEpTIyCQCsFHsbbBD1HpiPToPLmkDimjX 8xDvuXENrxZdWa4JyvB/UFynFs9Gclk= 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 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 9A76338B7CD for ; Thu, 24 Sep 2026 06:20:48 +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=1790230851; cv=none; b=WCclzlHHzMPSREpTnnhabxJuxyiwq9Z11EqkjzzQ1Q58gERBN3W7RonhVJan3UpR4G/vCmVjslgGP+jGwDJ0yEBgnTPJOvI0BwHRJToAdFV/EbgDYsjFZ0Wqgam/RQTkGZ5QNW7BgX+stC68vY7VyNrpEgia2xv2kbZnS6hWg8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790230851; c=relaxed/simple; bh=cByg57c+ZiNGGtOS/HfykUAf4O4HN7h9mKZN2uVWCm4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=kNnZrOf7w03v1a2RuZgylMikOx7+k7EaoOIKnpylOrWFTlOH9wKs6oMRq8oydv8nSpcrxBsghHFxFteIDn+O4xFxB5ryeLSho1QNetF9O2lJdzH3DSy+Z8nzc9XCqj78nAG7SNfv8my5bCsXx8ltGY/Yx5mNiuvd3peQdoZbbhA= 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=ZLSz/DNe; 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="ZLSz/DNe" 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 68O5d9Mk4069889; Thu, 24 Sep 2026 07:20:19 +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=a gFmwEAolzDylk3GNfaXivFSzDaf95+XuykgMI0qkC4=; b=ZLSz/DNe4W48kRnxB XRRfuqHTym8bNIMbkqwrKfinToC4Dx1peGoFBaxzqxJ7izPAFibYoifWIcmI4CEG xBfkok904xR0bzJXrfpjymd5dPliSsF/fTf7VF7uRU/fQzn1oM3odCm2y9ABxipR H9sEm9h122nlO594j7/x27QzHOWB34A5afIV5uVyMwW1qa8eUNjFXKXoNVA5qbXW jfhL4uhm0ZS4YrPwqC1KdTEmMtVzC0xGnSQL//S4UN8DzVBvS9OuTl0wBttGg5cv lIWtq04vEVZ8GpS48GCDqEl9CnAe2ZXa5PcbT5TJjq6xZvyKPGiYQ4FDXCKPl/PX Ucw5w== 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 4gsjftm9vx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2026 07:20:19 +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 07:20:18 +0100 From: Alexandru Dadu Date: Thu, 24 Sep 2026 09:19:51 +0300 Subject: [PATCH v6 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-v6-3-d9d5375665ed@imgtec.com> References: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v6-0-d9d5375665ed@imgtec.com> In-Reply-To: <20260924-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v6-0-d9d5375665ed@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=1790230815; l=920; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=cByg57c+ZiNGGtOS/HfykUAf4O4HN7h9mKZN2uVWCm4=; b=/n2CvSQds80cz0e6GwYVj+CfqHQ/R21RjKsBkCILrwr6zjpo3hMLZaSZ0hHgNlYcPkVi34j1u h8nG5MWNOgUD+ugUVEVi62DN1FFVrTxoD/bZ0dyDollcYQEu4OBNgC1 X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Authority-Analysis: v=2.4 cv=GPKdgeNK c=1 sm=1 tr=0 ts=6ab4c123 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=7RYWX5rxfSByPNLylY2M:22 a=r_1tXGB3AAAA:8 a=MguH0ROApdJ8RnWAcOUA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI0MDAyNiBTYWx0ZWRfX7GkZ1klCHctS QZv773aCBJJyYp/ANJStm+YAIrRo3kOJHvqNYMmHljSqLUX9EyT1gV/LSPfvsMwRsOiMILdHlrf aSw418FNQFFoGuROgbDYNJjImMPAWYJQwTaoTZaRq/UVWn744+WlBpaN5D9AikfUpg9WLG74W5v P34HeY7Dx04YgnfuTNL+cn+ZST61AU4D4Ee+sVH09AEYJiIaIAnxhPvrIRhlwmmVAdrlHSCdhrH x0OSEp7DATcRdU4f1XdwWIWTwv3G+opGchbWLVBhiQbSAxjCtmOQUOzlvyiwGIFs1wdekT5ayai acF5DQE3Wnjo7PcQOeFqvFTSEx9nx73hBiD6MCLF7i+r+l9xtlqeHm1caRhT9nOjc3UgP9fBSsD vxPgsy6gY4eUCAuPRZgQupOJZ7sqsWDtFYSubVx0ycX50gqz++xKr0IeMzvOByg2ZYqPE3DJvDy kbrEb5wRJgUdqzAuY0g== X-Proofpoint-ORIG-GUID: USgOZ1Iij81aEMFYT94nxSK1vrMxt71H X-Proofpoint-GUID: USgOZ1Iij81aEMFYT94nxSK1vrMxt71H X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI0MDAyNiBTYWx0ZWRfXwLhNr7fCCREI 1iVDq5AhPZQ11cQGycN8JDfQBwaEPLVu6lYPogKUaFO03CdfJSC++yahs2sL2S6EPUpVd9nCVPS 6pPG4zKKGIOWKeJW1PT8oZjSc7lz8cw= Add early release of the power references in case of errors. Signed-off-by: Alexandru Dadu --- drivers/gpu/drm/imagination/pvr_queue.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imag= ination/pvr_queue.c index b58c0887cafe..1b013791897d 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -817,9 +817,19 @@ static struct dma_fence *pvr_queue_run_job(struct drm_= sched_job *sched_job) trace_pvr_job_submit_fw(job); } =20 + err =3D pvr_job_get_pm_ref(job); + if (WARN_ON(err)) goto err_release; =20 + 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