Re: [PATCH] gpu: nova-core: use pin-init self-referential support

From: Eliot Courtney

Date: Wed Nov 11 2026 - 00:00:50 EST


On Wed Nov 11, 2026 at 12:27 AM JST, Danilo Krummrich wrote:
> Express all self-referential borrows through pin-init's self-referential
> support [1], replacing unsafely derived references.
>
> Cc: Gary Guo <gary@xxxxxxxxxxx>
> Link: https://lore.kernel.org/all/20261008-dev-selfref-v2-0-e280b3c8fba5@xxxxxxxxxxx/ [1]
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> drivers/gpu/nova-core/api.rs | 24 ++++++++++++---
> drivers/gpu/nova-core/driver.rs | 53 +++++++++++---------------------
> drivers/gpu/nova-core/gpu.rs | 32 ++++++++-----------
> drivers/gpu/nova-core/irq/gsp.rs | 17 +++++-----
> 4 files changed, 59 insertions(+), 67 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/api.rs b/drivers/gpu/nova-core/api.rs
> index eec69aace3b2..94808af3886d 100644
> --- a/drivers/gpu/nova-core/api.rs
> +++ b/drivers/gpu/nova-core/api.rs
> @@ -22,11 +22,27 @@
> };
>
> /// API handle for the auxiliary bus child drivers to interact with nova-core.
> -pub struct NovaCoreApi<'bound> {
> - pub(crate) gpu: Pin<&'bound Gpu<'bound>>,
> +#[pin_data]
> +pub struct NovaCoreApi<'bound>
> +where
> + // `Gpu` is invariant in its resource lifetime, which outlives this API borrow.
> + exists<'gpu_resources>: 'bound,
> +{
> + #[uses('gpu_resources: invariant)]
> + gpu: Pin<&'bound Gpu<'gpu_resources>>,
> pub(crate) pdev: &'bound pci::Device<Bound>,

nit: should we remove pub(crate) for `pdev` from here too?

Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>