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, 04 Jun 2026 16:57:33 +1000 Message-ID: In-Reply-To: <20260529-nova-unload-v7-2-678f39209e00@nvidia.com> References: <20260529-nova-unload-v7-0-678f39209e00@nvidia.com> <20260529-nova-unload-v7-2-678f39209e00@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 patch makes `Gpu` implement `PinnedDrop` to send the `UNLOADING_GUEST_= DRIVER` RPC to the GSP when the driver unbinds. **Observations:** 1. The `Gpu` struct gains a `device` field to retain the device reference f= or the drop path: ```rust #[pin_data(PinnedDrop)] pub(crate) struct Gpu<'gpu> { device: &'gpu device::Device, ... ``` This is necessary since `PinnedDrop::drop` doesn't receive the device as a = parameter. Note the upstream base already has `bar: &'gpu Bar0` so this is = consistent with the existing pattern. 2. The `PinnedDrop` implementation: ```rust fn drop(self: Pin<&mut Self>) { let this =3D self.project(); let device =3D *this.device; let bar =3D *this.bar; let _ =3D this .gsp .as_ref() .get_ref() .unload(device, bar, &*this.gsp_falcon) .inspect_err(|e| dev_err!(device, "failed to unload GSP: {:?}\n", e= )); } ``` The `let _ =3D` properly discards the error after logging it =E2=80=94 corr= ect for a drop path where there's nothing more to do. The `.as_ref().get_re= f()` chain on the pin projection is the standard way to get `&Gsp` from a p= inned field. 3. The `shutdown_gsp` method correctly polls mailbox0 for the `LIBOS_INTERR= UPT_PROCESSOR_SUSPENDED` bit: ```rust const LIBOS_INTERRUPT_PROCESSOR_SUSPENDED: u32 =3D bits::bit_u32(31); read_poll_timeout( || Ok(gsp_falcon.read_mailbox0(bar)), |&mb0| mb0 & LIBOS_INTERRUPT_PROCESSOR_SUSPENDED !=3D 0, Delta::from_millis(10), Delta::from_secs(5), ) ``` 5-second timeout with 10ms polling interval is reasonable for firmware shut= down. 4. The `PowerStateLevel` enum uses `#[expect(unused)]` which correctly anti= cipates that `Level3` and `Level7` are not used yet but will be needed for = suspend/hibernate support. Only `Level0` (full unload) is used currently. 5. The `UnloadingGuestDriver` command implementation follows the existing p= attern for `SetRegistry` and `SetGuestSystemInfo` commands =E2=80=94 consis= tent and correct. 6. The `SAFETY` comments on `AsBytes` and `FromBytes` impls for `UnloadingG= uestDriver` look correct =E2=80=94 the struct is `#[repr(transparent)]` wra= pping a C struct with explicit padding (`__bindgen_padding_0: [u8; 2usize]`= ), so no uninitialized padding. 7. `is_power_transition` method: ```rust pub(crate) fn is_power_transition(self) -> bool { self !=3D PowerStateLevel::Level0 } ``` This is clean and semantically clear. **No issues.** Well-implemented. --- --- Generated by Claude Code Patch Reviewer