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: Sat, 16 May 2026 09:54:08 +1000 Message-ID: In-Reply-To: <20260515-nova-unload-v5-3-c4d6250ad160@nvidia.com> References: <20260515-nova-unload-v5-0-c4d6250ad160@nvidia.com> <20260515-nova-unload-v5-3-c4d6250ad160@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This is the key functional patch. The design is clean: `driver::unbind` -> `gpu::unbind` -> `gsp::unload` -> `shutdown_gsp`. The `PowerStateLevel` enum with `#[expect(unused)]` is appropriate for Level3/Level7 since only Level0 (full unload) is used currently: ```rust +#[expect(unused)] +pub(crate) enum PowerStateLevel { + Level0 = bindings::NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0, + Level3 = bindings::NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3, + Level7 = bindings::NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_7, +} ``` The `shutdown_gsp` function polls for the LIBOS_INTERRUPT_PROCESSOR_SUSPENDED bit: ```rust +const LIBOS_INTERRUPT_PROCESSOR_SUSPENDED: u32 = bits::bit_u32(31); +read_poll_timeout( + || Ok(gsp_falcon.read_mailbox0(bar)), + |&mb0| mb0 & LIBOS_INTERRUPT_PROCESSOR_SUSPENDED != 0, + Delta::from_millis(10), + Delta::from_secs(5), +) ``` Minor: `LIBOS_INTERRUPT_PROCESSOR_SUSPENDED` is defined as a local const. For consistency with other register constants in this driver, consider whether this belongs in `regs.rs` or in the bindings, though the current placement is fine for a single use site. The `UnloadingGuestDriverReply` reads `type Message = ()` and the `read()` method ignores its arguments, which is correct for a command that has no meaningful reply payload. The `unsafe impl AsBytes` and `unsafe impl FromBytes` on `UnloadingGuestDriver` are justified by the SAFETY comments referencing the struct's contents (integer types + explicit padding). No blocking issues. --- --- Generated by Claude Code Patch Reviewer