From nobody Tue Sep 29 06:59:03 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 E05CD3C1974 for ; Tue, 11 Aug 2026 06:12:33 +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=1786428756; cv=none; b=cdVj/OSSffLExQ6qu9o0/+8Bu+vjLcQ6O6QaMU4ED9LLka7cX2Q+gR4mZ95MxIyUW/ulKG5GaeWamwo1kVsRKJ8OXckM5BteCN9AZBwnLQQ1xB+Yr2Id1AhBbXhMI35Wb7kjAASqh8dz3HogrnvZPETyk5uiDEleOeePNz2TJfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786428756; c=relaxed/simple; bh=A7Bo12WNQrAl4Esk6y2LmlePuSL5jtS+Q2lNxyqsOJg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:To:CC; b=DZcBsuKcMLHLOHGm8JWT/Ri9n1XpT3jmKJ7w1OYiYLsEeP9MPp8B/wbv9pZOdyMV7CUctSezHgoZXOmweETI1rY6IOq6c5DHtsnP16HIuGqEFtJZ1VKuKswFfMF987nG3wVUS9rZhPSimGG3yj6+Zqjq0GWWYUPa88k2bcWgHeo= 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=D7rA6T/R; 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="D7rA6T/R" 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 67B4ovFA1196858; Tue, 11 Aug 2026 07:12:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=dk201812; bh=062FekdOCmABLNFdsGtDPla i6QllVwqAYSGKAED3WhM=; b=D7rA6T/R/C99gchARPXurVNMZJTSAyPATJVnp25 f8qvzykUe7/PvxVRSFXVN+CvJjMhFkYXtM+gYnBs33gUQtSPZ6rEsWS22O4e63co QsJlViWybAxfsDY9QrQTjmHwWk3QY6F1S9tss9Czo6CRMWzb2yo0PyRBzHBoiZa4 sdGj3iS92mPv0t/hKWBM/5aHCd5sT1bBYYbf8qeF2V8mewpBwz5/Rm6V7TO5Gp+Z 5VhQrCg15zaBgV5J43JLywjqSPX+4MiwCw122nq7MRkaIDKv5QcDWCdUrXVGrVof Nz/Fb78hM9P7rLa5iL5AUrKmJWTbdcd8dgUiVkb4VTgiEtw== 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 4fysma051d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Aug 2026 07:12:11 +0100 (BST) Received: from [127.0.1.1] (172.25.5.88) 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.45; Tue, 11 Aug 2026 07:12:10 +0100 From: Alexandru Dadu Date: Tue, 11 Aug 2026 09:11:54 +0300 Subject: [PATCH] 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: <20260811-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-v1-1-ffd55254d6d2@imgtec.com> X-B4-Tracking: v=1; b=H4sIACm9emoC/yWOQQ6CMBBFr0Jm7SSFgDFexbhop1OsUtrMgDEh3 N2iy7d4//0NlCWywrXZQPgdNea5QntqgB52Hhmjrwyd6c7m0hp0Pa5FF2GbsEgudrQLo50mZJE sikFywheRQ0oedXUp6rGKlD2j8Zb7YIZAboAaKcIhfn4Hbvc/V+XJtBxV2PcvWk2mm6IAAAA= X-Change-ID: 20260810-b4-upstream-propagate-all-errors-from-kccb-cmd-submission-code-0dae4f05fcb5 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=1786428730; l=9366; i=alexandru.dadu@imgtec.com; s=20260304; h=from:subject:message-id; bh=K+AKp7oBWFHnU8LxolG6MA8coB5zCGfLOMCMYd8wHPk=; b=rOBERDSIXGKQv2qfvZ4PEqcon6gJ1xcSDAgltP9TOkFbFThvbXP6I3sA42YRjAKjB6reZehey Jv4M12Vq5+RBhYGJ5QI9q7Q6hQV15yEulO5jkz+xOjCa+E+MOyPPN6/ X-Developer-Key: i=alexandru.dadu@imgtec.com; a=ed25519; pk=FU07SyNrYGwhahqSxbWEuzyXlUh47xBXvLvOR7UA6+U= X-Authority-Analysis: v=2.4 cv=BO+DalQG c=1 sm=1 tr=0 ts=6a7abd3b cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=YP7Kpn5otooA:10 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA: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: I_v_E8RgUfInTfWjIo7kjDVVGYSdZi0D X-Proofpoint-ORIG-GUID: I_v_E8RgUfInTfWjIo7kjDVVGYSdZi0D X-Proofpoint-Spam-Info: AW1haW4tMjYwODExMDA1MCBTYWx0ZWRfX93PjlE4d89g9 OBV0ZW3KTkKyLY8FV14aWNIVwfX/OZ2MSyVpF/rxxPpACi2MsR94HIedB0H3Y9kCr7kEvJp6uD2 mq6t3L49HY0llvb75mIzV9gcO7JocYA= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODExMDA1MCBTYWx0ZWRfX68vJcT95LX3P O+CqtkTKgbIguEPUxaxuQABlrZlPQOLikSDUV0y+c9KU9B6dFhpRhVoDJuB2RO8gZxUq6jOZwv/ BaQRWWi09JoxxoyzdnUE31LGXSFMQJl36UjlqeBq8Jacb9plx0Da48+uEmriNAj/y0sPWFx4sy9 wDpICHbSoVJdOsJpAj/M2AGO39UVZDXI1AWg8dCrErRjfCIAUQH1/r7nNDoK6BKbhcdeOQJB4Of eqe7mXP04wTpHgtJZN2RcPOQr9an/VT+G2fnw3uf7HImCdYiBhOiYlvCqW5vQ3O3pcOp02Hl3fT MbxD2GTqisdbNS3+gTx4brmaLQU3LlHnvgDcXJPdaNEGKm0pqFay+NftQqgBB6DIIbCwCmtbgic nzDVg71xdtwAZafiMLMCUOsRD+4r8sjX1ItR1vDUgnqnFZc1l1+r+MmgyCA08NSBN2gPP6ejnum JNQ13lfkYBxIgvfXmww== 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 | 28 ++++++++++++++++------------ 5 files changed, 62 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_ccb.c b/drivers/gpu/drm/imagin= ation/pvr_ccb.c index 4accf18e2341..8182babd8ad8 100644 --- a/drivers/gpu/drm/imagination/pvr_ccb.c +++ b/drivers/gpu/drm/imagination/pvr_ccb.c @@ -257,8 +257,13 @@ pvr_kccb_used_slot_count_locked(struct pvr_device *pvr= _dev) * @pvr_dev: Device pointer. * @cmd: Command to sent. * @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) @@ -268,19 +273,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)); @@ -298,8 +309,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 /** @@ -365,8 +382,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, @@ -378,8 +396,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 54e88b4208d7..0f46bbfb9886 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -792,24 +792,28 @@ 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); } else { 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 + if (WARN_ON(err)) + return ERR_PTR(err); + return dma_fence_get(job->done_fence); } =20 --- base-commit: e55fead22ff9ee047ab9f1903860c4b43043514e change-id: 20260810-b4-upstream-propagate-all-errors-from-kccb-cmd-submissi= on-code-0dae4f05fcb5 Best regards, -- =20 Alexandru Dadu