[PATCH 00/16] gpu: nova-core: GPU page table, vmm, and bar1 mapping

Eliot Courtney posted 16 patches 2 weeks, 2 days ago
drivers/gpu/nova-core/Kconfig              |   1 +
drivers/gpu/nova-core/driver.rs            |  45 ++-
drivers/gpu/nova-core/gpu.rs               |  68 ++++-
drivers/gpu/nova-core/gsp/commands.rs      |   3 +
drivers/gpu/nova-core/gsp/fw/commands.rs   |   8 +
drivers/gpu/nova-core/mm.rs                | 177 +++++++++++-
drivers/gpu/nova-core/mm/bar_user.rs       | 422 +++++++++++++++++++++++++++++
drivers/gpu/nova-core/mm/pagetable.rs      | 422 +++++++++++++++++++++++++++++
drivers/gpu/nova-core/mm/pagetable/map.rs  | 342 +++++++++++++++++++++++
drivers/gpu/nova-core/mm/pagetable/ver2.rs | 271 ++++++++++++++++++
drivers/gpu/nova-core/mm/pagetable/ver3.rs | 417 ++++++++++++++++++++++++++++
drivers/gpu/nova-core/mm/pagetable/walk.rs | 244 +++++++++++++++++
drivers/gpu/nova-core/mm/tlb.rs            | 120 ++++++++
drivers/gpu/nova-core/mm/vmm.rs            | 346 +++++++++++++++++++++++
drivers/gpu/nova-core/regs.rs              |  68 +++++
15 files changed, 2937 insertions(+), 17 deletions(-)
[PATCH 00/16] gpu: nova-core: GPU page table, vmm, and bar1 mapping
Posted by Eliot Courtney 2 weeks, 2 days ago
I am reposting Joel Fernandes's original series [1]. The rebase adapts
the patches to recent changes in the rust infra, like HRT lifetimes. It
also adapts to the changes I posted in [2]. It keeps Joel's design and
patch split.

From Joel's original cover letter:

  This series introduces page-table types and a Virtual Memory Manager (VMM)
  for the nova-core driver, plus a BAR1 user (with selftests) layered on top.
  The page-table layer uses trait-based generics (PteOps, PdeOps, DualPdeOps,
  MmuConfig) to dispatch between MMU v2 and v3 formats. The Vmm tracks
  virtual-address ranges with a maple tree, and the BAR1 user exposes mapped
  CPU access to VRAM through a small allocation API exercised by the selftests.

This series depends on Joel's maple tree Send and Sync patch [3] and his
PCI resource_flags() accessor [4], which I am reposting separately.

This series is based on drm-rust-next.

[1] https://lore.kernel.org/all/20260518181126.2493572-1-joelagnelf@nvidia.com/
[2] https://lore.kernel.org/all/20260827-pramin-split-v3-0-24b24d7afc52@nvidia.com/
[3] https://lore.kernel.org/all/20260511143604.3848176-1-joelagnelf@nvidia.com/
[4] https://lore.kernel.org/all/20260518180342.2387845-2-joelagnelf@nvidia.com/

Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
Joel Fernandes (16):
      gpu: nova-core: mm: Add common types for virtual memory management
      gpu: nova-core: mm: Add buddy allocator and TLB to GpuMm
      gpu: nova-core: mm: Add common types for all page table formats
      gpu: nova-core: mm: pagetable: Add PteOps trait
      gpu: nova-core: mm: pagetable: Add PdeOps trait
      gpu: nova-core: mm: pagetable: Add DualPdeOps trait
      gpu: nova-core: mm: Add MMU v2 page table types
      gpu: nova-core: mm: Add MMU v3 page table types
      gpu: nova-core: mm: pagetable: Add MmuConfig trait
      gpu: nova-core: mm: Add page table walker for MMU v2/v3
      gpu: nova-core: mm: Add Virtual Memory Manager
      gpu: nova-core: mm: Add virtual address range tracking to VMM
      gpu: nova-core: mm: Add multi-page mapping API to VMM
      gpu: nova-core: Add BAR1 aperture type and size constant
      gpu: nova-core: mm: Add BAR1 user interface
      gpu: nova-core: mm: Add BAR1 memory management self-tests

 drivers/gpu/nova-core/Kconfig              |   1 +
 drivers/gpu/nova-core/driver.rs            |  45 ++-
 drivers/gpu/nova-core/gpu.rs               |  68 ++++-
 drivers/gpu/nova-core/gsp/commands.rs      |   3 +
 drivers/gpu/nova-core/gsp/fw/commands.rs   |   8 +
 drivers/gpu/nova-core/mm.rs                | 177 +++++++++++-
 drivers/gpu/nova-core/mm/bar_user.rs       | 422 +++++++++++++++++++++++++++++
 drivers/gpu/nova-core/mm/pagetable.rs      | 422 +++++++++++++++++++++++++++++
 drivers/gpu/nova-core/mm/pagetable/map.rs  | 342 +++++++++++++++++++++++
 drivers/gpu/nova-core/mm/pagetable/ver2.rs | 271 ++++++++++++++++++
 drivers/gpu/nova-core/mm/pagetable/ver3.rs | 417 ++++++++++++++++++++++++++++
 drivers/gpu/nova-core/mm/pagetable/walk.rs | 244 +++++++++++++++++
 drivers/gpu/nova-core/mm/tlb.rs            | 120 ++++++++
 drivers/gpu/nova-core/mm/vmm.rs            | 346 +++++++++++++++++++++++
 drivers/gpu/nova-core/regs.rs              |  68 +++++
 15 files changed, 2937 insertions(+), 17 deletions(-)
---
base-commit: e6a2c988ed96a5a3af51ed97ecba980521bf2fc0
change-id: 20260805-mmrebase-113582afb003
prerequisite-change-id: 20260907-maple-tree-send-sync-a1479d1ab302:v2
prerequisite-patch-id: 81d532949891e2dd846cca5c420e4ba32e9161a7
prerequisite-change-id: 20260907-pci-resource-flags-b7addba0b34f:v1
prerequisite-patch-id: bdd1c2eb4adbedf1c53f1be61ea958743d2a2660

Best regards,
--  
Eliot Courtney <ecourtney@nvidia.com>
Re: [PATCH 00/16] gpu: nova-core: GPU page table, vmm, and bar1 mapping
Posted by Danilo Krummrich 2 weeks, 1 day ago
On Wed Sep 9, 2026 at 5:59 AM CEST, Eliot Courtney wrote:
> I am reposting Joel Fernandes's original series [1]. The rebase adapts
> the patches to recent changes in the rust infra, like HRT lifetimes. It
> also adapts to the changes I posted in [2]. It keeps Joel's design and
> patch split.

I left a few comments that we really need to address. However, I'm fine if we do
that with subsequent patches. Thus, a bit hesitantly:

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

Also note that eventually we want per-PT-page reference counts, so VM_BIND
ioctls can reserve for the whole range requested by userspace. We only know at
job execution time which parts of the requested range are mapped already (either
already with or without the correct contents) and which page size is used. I.e.
we need quite some flexibility in the API to take the optimal decision at job
execution time. So, this together with a reclaim approach will probably be a
huge rework anyway.

Eliot, when you apply this, can you please fix up the nits, e.g. make the
imports use the correct kernel vertical style, etc.?

Thanks,
Danilo
Re: [PATCH 00/16] gpu: nova-core: GPU page table, vmm, and bar1 mapping
Posted by Alexandre Courbot 2 weeks ago
On Wed, 09 Sep 2026 12:59:38 +0900, Eliot Courtney wrote:
> I am reposting Joel Fernandes's original series [1]. The rebase adapts
> the patches to recent changes in the rust infra, like HRT lifetimes. It
> also adapts to the changes I posted in [2]. It keeps Joel's design and
> patch split.
> 
> From Joel's original cover letter:
> 
> [...]

Applied to drm-rust-next, thanks!

... a bit hesitantly like Danilo, but we are in a state where the issues are
easier to address through follow-ups than by reworking this base. This is also
not used yet outside of self-tests, so we have some runway to fix it before it
goes live.

Thanks Eliot for driving this series all the way to merge.

[01/16] gpu: nova-core: mm: Add common types for virtual memory management
[acourbot: drop repeated "memory" in commit message.]
        commit: b8ca2d0b7fcf5b8ff0ec174b092f732a9d3d27a3
[02/16] gpu: nova-core: mm: Add buddy allocator and TLB to GpuMm
        commit: 33be8f687bd8204965c137a5600822a1959033b8
[03/16] gpu: nova-core: mm: Add common types for all page table formats
        commit: a5dfe5955c6beff8403ce966efde6822700a6634
[04/16] gpu: nova-core: mm: pagetable: Add PteOps trait
[acourbot: use vertical import style.]
        commit: 239bb057a81dca1623857102cfd963e1305aadc1
[05/16] gpu: nova-core: mm: pagetable: Add PdeOps trait
        commit: 85a7542510cdff8bbeef9fb016e98a2f8bcd1171
[06/16] gpu: nova-core: mm: pagetable: Add DualPdeOps trait
        commit: 71e99998a6559d71e5d6eff85afcc0f7f99ece25
[07/16] gpu: nova-core: mm: Add MMU v2 page table types
[acourbot: use vertical import style.]
        commit: 98b7273f5de149b2c6ff0d98bc2b3fa55b749b74
[08/16] gpu: nova-core: mm: Add MMU v3 page table types
[acourbot: use vertical import style.]
        commit: 103fb3a4b2b85ebf30f11a433df17df708f85689
[09/16] gpu: nova-core: mm: pagetable: Add MmuConfig trait
        commit: a9eabe320b60e5af72ff10551be1b2d67ca614af
[10/16] gpu: nova-core: mm: Add page table walker for MMU v2/v3
        commit: 1123774f3610c45a7acf055b8c9841883ed4bf75
[11/16] gpu: nova-core: mm: Add Virtual Memory Manager
[acourbot: use vertical import style.]
        commit: 3c7561e194d573a3926702d1e051a8c8fbc187ea
[12/16] gpu: nova-core: mm: Add virtual address range tracking to VMM
[acourbot: use vertical import style.]
        commit: 16f573374fd6ff8ff4ab54abceb5d093869de9d2
[13/16] gpu: nova-core: mm: Add multi-page mapping API to VMM
[acourbot: use vertical import style.]
        commit: 4e4182282d4e8d81bfe62ed8ff634526fdd5e238
[14/16] gpu: nova-core: Add BAR1 aperture type and size constant
        commit: 75ad43886a20e17aa5fad9ae71ebb413cadd8d64
[15/16] gpu: nova-core: mm: Add BAR1 user interface
        commit: 159427b213524a90853ef24d0a0c2ed1aec1dbf9
[16/16] gpu: nova-core: mm: Add BAR1 memory management self-tests
[acourbot: use vertical import style.]
        commit: d669686f8170c234edf12212fac9180ea18b1448