On Tue Mar 3, 2026 at 2:33 AM JST, Gary Guo wrote:
> On Thu Feb 26, 2026 at 2:50 PM GMT, Eliot Courtney wrote:
>> Make `Cmdq` a pinned type. This is needed to use Mutex, which is needed
>> to add locking to `Cmdq`.
>>
>> Reviewed-by: Zhi Wang <[email protected]>
>> Signed-off-by: Eliot Courtney <[email protected]>
>> ---
>>  drivers/gpu/nova-core/gsp.rs      | 5 +++--
>>  drivers/gpu/nova-core/gsp/cmdq.rs | 9 ++++-----
>>  2 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
>> index 174feaca0a6b..a6f3918c20b1 100644
>> --- a/drivers/gpu/nova-core/gsp.rs
>> +++ b/drivers/gpu/nova-core/gsp.rs
>> @@ -112,6 +112,7 @@ pub(crate) struct Gsp {
>>      /// RM log buffer.
>>      logrm: LogBuffer,
>>      /// Command queue.
>> +    #[pin]
>>      pub(crate) cmdq: Cmdq,
>>      /// RM arguments.
>>      rmargs: CoherentAllocation<GspArgumentsPadded>,
>> @@ -132,7 +133,7 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> 
>> impl PinInit<Self, Error
>>                  loginit: LogBuffer::new(dev)?,
>>                  logintr: LogBuffer::new(dev)?,
>>                  logrm: LogBuffer::new(dev)?,
>> -                cmdq: Cmdq::new(dev)?,
>> +                cmdq <- Cmdq::new(dev),
>>                  rmargs: 
>> CoherentAllocation::<GspArgumentsPadded>::alloc_coherent(
>>                      dev,
>>                      1,
>> @@ -149,7 +150,7 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> 
>> impl PinInit<Self, Error
>>                          libos[1] = 
>> LibosMemoryRegionInitArgument::new("LOGINTR", &logintr.0)
>>                      )?;
>>                      dma_write!(libos[2] = 
>> LibosMemoryRegionInitArgument::new("LOGRM", &logrm.0))?;
>> -                    dma_write!(rmargs[0].inner = 
>> fw::GspArgumentsCached::new(cmdq))?;
>> +                    dma_write!(rmargs[0].inner = 
>> fw::GspArgumentsCached::new(&cmdq))?;
>
> Hmm, I don't think the `&` here is needed?

It seems this is needed, and here is the compile error, if you are
interested:

```
error[E0308]: mismatched types
   --> drivers/gpu/nova-core/gsp.rs:153:78
    |
153 |                     dma_write!(rmargs[0].inner = 
fw::GspArgumentsCached::new(cmdq))?;
    |                                                  
--------------------------- ^^^^ expected `&Cmdq`, found `Pin<&mut Cmdq>`
    |                                                  |
    |                                                  arguments to this 
function are incorrect
    |
    = note: expected reference `&Cmdq`
                  found struct `core::pin::Pin<&mut Cmdq>`
```

Reply via email to