[PATCH v2 0/7] rust: dma: add from-slice constructors and use them in nova-core

Alexandre Courbot posted 7 patches 1 week ago
drivers/gpu/nova-core/dma.rs                       |  53 ----------
drivers/gpu/nova-core/falcon.rs                    |   6 +-
drivers/gpu/nova-core/fb.rs                        |   6 +-
drivers/gpu/nova-core/firmware/fwsec/bootloader.rs |   6 +-
drivers/gpu/nova-core/firmware/gsp.rs              |  27 +++---
drivers/gpu/nova-core/firmware/riscv.rs            |   6 +-
drivers/gpu/nova-core/nova_core.rs                 |   1 -
rust/kernel/dma.rs                                 | 107 +++++++++++++++++++++
8 files changed, 134 insertions(+), 78 deletions(-)
[PATCH v2 0/7] rust: dma: add from-slice constructors and use them in nova-core
Posted by Alexandre Courbot 1 week ago
nova-core's `DmaObject` type has been created to serve the same purpose
as `dma::Coherent`, with the addition of a handy constructor to create
an object from a slice of bytes, but without the flexibility of
`dma::Coherent` since `DmaObject` is limited to slices of bytes.

This series adds new constructors to `Coherent` and `CoherentBox` to
cover this (arguably common) use-case, and updates the nova-core code to
use them. This results in more consistent code overall, and allows us to
retire `DmaObject` and nova-core's `dma` module.

Based on drm-rust-next, with [1] as extra dependency.

[1] https://lore.kernel.org/all/20260321172749.592387-2-dakr@kernel.org/

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes in v2:
- Don't use `map` in `CoherentBox::from_slice_with_attrs`.
- Make `Coherent::from_slice_with_attrs` inline.
- Use `CoherentHandle` for the sysmem flush memory page as it doesn't
  need to be accessed by the CPU.
- Link to v1: https://patch.msgid.link/20260321-b4-nova-dma-removal-v1-0-5cf18a75ff64@nvidia.com

---
Alexandre Courbot (7):
      rust: dma: add from-slice constructors for Coherent and CoherentBox
      gpu: nova-core: firmware: riscv: use dma::Coherent
      gpu: nova-core: firmware: fwsec: use dma::Coherent
      gpu: nova-core: falcon: use dma::Coherent
      gpu: nova-core: fb: use dma::CoherentHandle
      gpu: nova-core: firmware: gsp: use dma::Coherent for signatures
      gpu: nova-core: firmware: gsp: use dma::Coherent for level0 table

 drivers/gpu/nova-core/dma.rs                       |  53 ----------
 drivers/gpu/nova-core/falcon.rs                    |   6 +-
 drivers/gpu/nova-core/fb.rs                        |   6 +-
 drivers/gpu/nova-core/firmware/fwsec/bootloader.rs |   6 +-
 drivers/gpu/nova-core/firmware/gsp.rs              |  27 +++---
 drivers/gpu/nova-core/firmware/riscv.rs            |   6 +-
 drivers/gpu/nova-core/nova_core.rs                 |   1 -
 rust/kernel/dma.rs                                 | 107 +++++++++++++++++++++
 8 files changed, 134 insertions(+), 78 deletions(-)
---
base-commit: 1998e6be8239cd37817e05bdc21439de17b904df
change-id: 20260321-b4-nova-dma-removal-a7e88d4a6790
prerequisite-message-id: 20260321172749.592387-1-dakr@kernel.org
prerequisite-patch-id: ad10dfe64c9aedc9c68cba2c66101cd78d2d7345
prerequisite-patch-id: 110ca2f40bf7599083845eab43861331fe94faad

Best regards,
--  
Alexandre Courbot <acourbot@nvidia.com>
Re: [PATCH v2 0/7] rust: dma: add from-slice constructors and use them in nova-core
Posted by Danilo Krummrich 1 week ago
On 3/26/26 4:22 PM, Alexandre Courbot wrote:
> Based on drm-rust-next, with [1] as extra dependency.
> 
> [1] https://lore.kernel.org/all/20260321172749.592387-2-dakr@kernel.org/

[...]

> Alexandre Courbot (7):
>       rust: dma: add from-slice constructors for Coherent and CoherentBox
>       gpu: nova-core: firmware: riscv: use dma::Coherent
>       gpu: nova-core: firmware: fwsec: use dma::Coherent
>       gpu: nova-core: falcon: use dma::Coherent
>       gpu: nova-core: fb: use dma::CoherentHandle
>       gpu: nova-core: firmware: gsp: use dma::Coherent for signatures
>       gpu: nova-core: firmware: gsp: use dma::Coherent for level0 table

Reviewed-by: Danilo Krummrich <dakr@kernel.org>

Feel free to also take the two DMA patches.

Thanks,
Danilo
Re: [PATCH v2 0/7] rust: dma: add from-slice constructors and use them in nova-core
Posted by Alexandre Courbot 6 days, 12 hours ago
On Fri Mar 27, 2026 at 2:24 AM JST, Danilo Krummrich wrote:
> On 3/26/26 4:22 PM, Alexandre Courbot wrote:
>> Based on drm-rust-next, with [1] as extra dependency.
>> 
>> [1] https://lore.kernel.org/all/20260321172749.592387-2-dakr@kernel.org/
>
> [...]
>
>> Alexandre Courbot (7):
>>       rust: dma: add from-slice constructors for Coherent and CoherentBox
>>       gpu: nova-core: firmware: riscv: use dma::Coherent
>>       gpu: nova-core: firmware: fwsec: use dma::Coherent
>>       gpu: nova-core: falcon: use dma::Coherent
>>       gpu: nova-core: fb: use dma::CoherentHandle
>>       gpu: nova-core: firmware: gsp: use dma::Coherent for signatures
>>       gpu: nova-core: firmware: gsp: use dma::Coherent for level0 table
>
> Reviewed-by: Danilo Krummrich <dakr@kernel.org>
>
> Feel free to also take the two DMA patches.

Thanks Danilo! I will leave it ~1 more day for reviews and will push
both unless someone screams.
Re: [PATCH v2 0/7] rust: dma: add from-slice constructors and use them in nova-core
Posted by Alexandre Courbot 5 days, 4 hours ago
On Fri Mar 27, 2026 at 3:57 PM JST, Alexandre Courbot wrote:
> On Fri Mar 27, 2026 at 2:24 AM JST, Danilo Krummrich wrote:
>> On 3/26/26 4:22 PM, Alexandre Courbot wrote:
>>> Based on drm-rust-next, with [1] as extra dependency.
>>> 
>>> [1] https://lore.kernel.org/all/20260321172749.592387-2-dakr@kernel.org/
>>
>> [...]
>>
>>> Alexandre Courbot (7):
>>>       rust: dma: add from-slice constructors for Coherent and CoherentBox
>>>       gpu: nova-core: firmware: riscv: use dma::Coherent
>>>       gpu: nova-core: firmware: fwsec: use dma::Coherent
>>>       gpu: nova-core: falcon: use dma::Coherent
>>>       gpu: nova-core: fb: use dma::CoherentHandle
>>>       gpu: nova-core: firmware: gsp: use dma::Coherent for signatures
>>>       gpu: nova-core: firmware: gsp: use dma::Coherent for level0 table
>>
>> Reviewed-by: Danilo Krummrich <dakr@kernel.org>
>>
>> Feel free to also take the two DMA patches.
>
> Thanks Danilo! I will leave it ~1 more day for reviews and will push
> both unless someone screams.

Pushed to drm-rust-next, thanks everyone!