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: send UNLOADING_GUEST_DRIVER GSP command upon unloading Date: Thu, 23 Apr 2026 08:52:55 +1000 Message-ID: In-Reply-To: <20260421-nova-unload-v2-4-2fe54963af8b@nvidia.com> References: <20260421-nova-unload-v2-0-2fe54963af8b@nvidia.com> <20260421-nova-unload-v2-4-2fe54963af8b@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 patch. It adds: 1. **Bindings** (`gsp/fw/r570_144/bindings.rs`): Adds `rpc_unloading_guest_= driver_v1F_07` struct. 2. **Firmware command wrapper** (`gsp/fw/commands.rs`): ```rust +pub(crate) struct UnloadingGuestDriver(bindings::rpc_unloading_guest_drive= r_v1F_07); + +impl UnloadingGuestDriver { + pub(crate) fn new(suspend: bool) -> Self { + Self(bindings::rpc_unloading_guest_driver_v1F_07 { + bInPMTransition: u8::from(suspend), + bGc6Entering: 0, + newLevel: if suspend { 3 } else { 0 }, + ..Zeroable::zeroed() + }) + } +} ``` The magic number `3` for `newLevel` when suspending appears to correspond t= o a D3 power state. This matches what OpenRM does (`NV2080_CTRL_GPU_SET_POW= ER_STATE_GPU_LEVEL_3`). A named constant would be nice but not critical sin= ce this is matching hardware/firmware protocol values. 3. **GSP command** (`gsp/commands.rs`): Implements `CommandToGsp` and `Mess= ageFromGsp` for the new command. The reply type `UnloadingGuestDriverReply`= has `type Message =3D ()` =E2=80=94 the reply payload is empty/ignored, wh= ich is correct for this RPC. 4. **Shutdown logic** (`gsp/boot.rs`): ```rust + fn shutdown_gsp( + cmdq: &Cmdq, + bar: &Bar0, + gsp_falcon: &Falcon, + suspend: bool, + ) -> Result<()> { + cmdq.send_command(bar, commands::UnloadingGuestDriver::new(suspend= ))?; + + const LIBOS_INTERRUPT_PROCESSOR_SUSPENDED: u32 =3D 0x8000_0000; + read_poll_timeout( + || Ok(gsp_falcon.read_mailbox0(bar)), + |&mb0| mb0 =3D=3D LIBOS_INTERRUPT_PROCESSOR_SUSPENDED, + Delta::from_millis(10), + Delta::from_secs(5), + ) + .map(|_| ()) + } ``` The 5-second timeout with 10ms polling interval seems reasonable. The `LIBO= S_INTERRUPT_PROCESSOR_SUSPENDED` constant matches what OpenRM uses (`NV_LIB= OS_INTERRUPT_PROCESSOR_SUSPENDED`). 5. **Integration** (`gpu.rs`): ```rust + let _ =3D kernel::warn_on_err!(self.gsp.unload(dev, bar, &self.gsp= _falcon)); ``` The `let _ =3D` discard after `warn_on_err!` means if unload fails, we cont= inue with `sysmem_flush.unregister()`. This is the right approach for an un= bind path =E2=80=94 best-effort teardown. **Minor observation:** `shutdown_gsp` is a static method (`&Cmdq` parameter= instead of `&self`) while `unload` takes `&self`. This is fine since `shut= down_gsp` is a private helper, but worth noting that `cmdq` comes from `sel= f.cmdq` in the caller. No blocking issues. --- Generated by Claude Code Patch Reviewer