Re: [PATCH v5 01/11] gpu: nova-core: Add public driver API to nova-core

From: Alistair Popple

Date: Tue Sep 01 2026 - 03:09:01 EST


On 2026-09-01 at 06:42 +1000, Gary Guo <gary@xxxxxxxxxxx> wrote...
> On Mon Aug 31, 2026 at 9:08 PM BST, Danilo Krummrich wrote:
> > On Fri Aug 28, 2026 at 5:35 AM CEST, Alistair Popple wrote:
> >> +/// API handle for the auxiliary bus child drivers to interact with nova-core.
> >> +pub struct NovaCoreApi<'bound> {
> >> + #[expect(unused)]
> >> + pub(crate) gpu: Pin<&'bound Gpu<'bound>>,
> >> +}
> >> +
> >> +impl NovaCoreApi<'_> {
> >> + /// Obtain a [`NovaCoreApi`] handle from an auxiliary device registered
> >> + /// by nova-core.
> >> + pub fn of(adev: &auxiliary::Device<Bound>) -> Result<Pin<&NovaCoreApi<'_>>> {
> >> + adev.registration_data::<CovariantForLt!(NovaCoreApi<'_>)>()
> >> + }
> >> +}
> >
> > CovariantForLt does not hold anymore on latest drm-rust-next, as Cmdq has a
> > Mutex. So, this needs ForLt now and therefore the approach that I shared in [1]
> > a while ago. I applied the changes in [2] to fix it up.

I can see why the mutex means covariance no longer holds, but I would kind
of also expect it to not compile given it surely can't be safe here to treat
an invariant type as covariant. Is this just a limitation of the current
CovariantForLt implementation not being able to prove covariance or am I missing
something else? Thanks.

- Alistair