From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: gpu: nova-core: gsp: add sync and async command queue API to `Cmdq` Date: Fri, 27 Feb 2026 13:18:04 +1000 Message-ID: In-Reply-To: <20260225-cmdq-locking-v1-2-bbf6b4156706@nvidia.com> References: <20260225-cmdq-locking-v1-0-bbf6b4156706@nvidia.com> <20260225-cmdq-locking-v1-2-bbf6b4156706@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review This is the core type infrastructure patch. Key observations: **The `NoReply` marker type is well-designed:** ```rust pub(crate) struct NoReply; ``` Not implementing `MessageFromGsp` means `send_sync_command` can't be called= with async commands =E2=80=94 the compiler enforces it via `M::Reply: Mess= ageFromGsp`. **Associated type on `CommandToGsp`:** ```rust type Reply; ``` Clean addition. The cover letter discusses the alternative of separate `Syn= cCommand`/`AsyncCommand` traits, and I agree the associated type approach i= s more composable. **`send_sync_command` implementation:** ```rust pub(crate) fn send_sync_command(&mut self, bar: &Bar0, command: M) -> Re= sult { self.send_command(bar, command)?; loop { match self.receive_msg::(Delta::from_secs(10)) { Ok(reply) =3D> break Ok(reply), Err(ERANGE) =3D> continue, Err(e) =3D> break Err(e), } } } ``` This correctly extracts the existing pattern from `get_gsp_info`. Note the = timeout change from 5s to 10s as mentioned above =E2=80=94 this is fine but= worth acknowledging. **`send_async_command` is a thin wrapper:** ```rust pub(crate) fn send_async_command(&mut self, bar: &Bar0, command: M) -> R= esult where M: CommandToGsp, { self.send_command(bar, command) } ``` The `Reply =3D NoReply` constraint is the enforcement mechanism. Clean. **Making `send_command` private (`fn` instead of `pub(crate) fn`):** ```rust - pub(crate) fn send_command(&mut self, bar: &Bar0, command: M) -> Re= sult + fn send_command(&mut self, bar: &Bar0, command: M) -> Result ``` Good =E2=80=94 callers should now go through the sync/async API. **`SplitCommand` propagates `Reply`:** ```rust + type Reply =3D C::Reply; ``` Correct =E2=80=94 a split command should have the same reply type as the un= derlying command. **Caller updates in boot.rs:** ```rust - .send_command(bar, commands::SetSystemInfo::new(pdev))?; + .send_async_command(bar, commands::SetSystemInfo::new(pdev))?; ``` Correct =E2=80=94 these pre-boot commands are fire-and-forget. **Refactoring of `get_gsp_info`:** ```rust - cmdq.send_command(bar, GetGspStaticInfo)?; - loop { - match cmdq.receive_msg::(Delta::from_secs(5= )) { - Ok(info) =3D> return Ok(info), - Err(ERANGE) =3D> continue, - Err(e) =3D> return Err(e), - } - } + cmdq.send_sync_command(bar, GetGspStaticInfo) ``` Nice simplification. No issues. **Reviewed-by worthy.** --- --- Generated by Claude Code Patch Reviewer