[PATCH v10 0/8] Preparatory patches for nova-core memory management

Joel Fernandes posted 8 patches 1 month, 1 week ago
Documentation/gpu/drm-mm.rst                  |   10 +-
MAINTAINERS                                   |   15 +-
drivers/gpu/Kconfig                           |   13 +
drivers/gpu/Makefile                          |    3 +-
drivers/gpu/buddy.c                           | 1322 +++++++++++++++++
drivers/gpu/drm/Kconfig                       |    5 +-
drivers/gpu/drm/Kconfig.debug                 |    1 -
drivers/gpu/drm/Makefile                      |    1 -
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       |    2 +-
.../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h    |   12 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c  |   79 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h  |   20 +-
drivers/gpu/drm/drm_buddy.c                   | 1277 +---------------
drivers/gpu/drm/i915/gem/i915_gem_ttm.c       |    2 +-
drivers/gpu/drm/i915/i915_scatterlist.c       |   10 +-
drivers/gpu/drm/i915/i915_ttm_buddy_manager.c |   55 +-
drivers/gpu/drm/i915/i915_ttm_buddy_manager.h |    4 +-
.../drm/i915/selftests/intel_memory_region.c  |   20 +-
drivers/gpu/drm/tests/Makefile                |    1 -
drivers/gpu/drm/tests/drm_exec_test.c         |    2 -
drivers/gpu/drm/tests/drm_mm_test.c           |    2 -
.../gpu/drm/ttm/tests/ttm_bo_validate_test.c  |    4 +-
drivers/gpu/drm/ttm/tests/ttm_mock_manager.c  |   18 +-
drivers/gpu/drm/ttm/tests/ttm_mock_manager.h  |    4 +-
drivers/gpu/drm/xe/xe_res_cursor.h            |   34 +-
drivers/gpu/drm/xe/xe_svm.c                   |   12 +-
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c          |   71 +-
drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h    |    4 +-
drivers/gpu/nova-core/Kconfig                 |    3 +-
drivers/gpu/tests/Makefile                    |    4 +
.../gpu_buddy_test.c}                         |  416 +++---
.../lib/drm_random.c => tests/gpu_random.c}   |   18 +-
.../lib/drm_random.h => tests/gpu_random.h}   |   18 +-
drivers/video/Kconfig                         |    1 +
include/drm/drm_buddy.h                       |  163 +-
include/linux/gpu_buddy.h                     |  177 +++
rust/bindings/bindings_helper.h               |   11 +
rust/helpers/gpu.c                            |   23 +
rust/helpers/helpers.c                        |    2 +
rust/helpers/list.c                           |   17 +
rust/kernel/ffi/clist.rs                      |  327 ++++
rust/kernel/ffi/mod.rs                        |    9 +
rust/kernel/gpu/buddy.rs                      |  537 +++++++
rust/kernel/gpu/mod.rs                        |    5 +
rust/kernel/lib.rs                            |    5 +-
45 files changed, 2893 insertions(+), 1846 deletions(-)
create mode 100644 drivers/gpu/Kconfig
create mode 100644 drivers/gpu/buddy.c
create mode 100644 drivers/gpu/tests/Makefile
rename drivers/gpu/{drm/tests/drm_buddy_test.c => tests/gpu_buddy_test.c} (67%)
rename drivers/gpu/{drm/lib/drm_random.c => tests/gpu_random.c} (59%)
rename drivers/gpu/{drm/lib/drm_random.h => tests/gpu_random.h} (53%)
create mode 100644 include/linux/gpu_buddy.h
create mode 100644 rust/helpers/gpu.c
create mode 100644 rust/helpers/list.c
create mode 100644 rust/kernel/ffi/clist.rs
create mode 100644 rust/kernel/ffi/mod.rs
create mode 100644 rust/kernel/gpu/buddy.rs
create mode 100644 rust/kernel/gpu/mod.rs
[PATCH v10 0/8] Preparatory patches for nova-core memory management
Posted by Joel Fernandes 1 month, 1 week ago
These are initial preparatory patches needed for nova-core memory management
support. The series moves the DRM buddy allocator one level up so it can be
shared across GPU subsystems, adds Rust FFI and clist bindings, and creates
Rust GPU buddy allocator bindings.

The clist/ffi patches are ready, reviewed by Gary and Danilo. Miguel, can you
pull those via the rust tree?

The non-Rust DRM buddy related patches are already being pulled into upstream
by Dave Airlie but I have included them here as they are needed for the rest of
the patches (thanks to Dave for reworking them so they applied).

I will post the nova-core memory management patches as a separate follow-up
series just after this one.

The git tree with all these patches can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git (tag: nova/mm)

Joel Fernandes (7):
  gpu: Move DRM buddy allocator one level up (part one)
  gpu: Move DRM buddy allocator one level up (part two)
  rust: ffi: Convert pub use to pub mod and create ffi module
  rust: clist: Add support to interface with C linked lists
  rust: gpu: Add GPU buddy allocator bindings
  nova-core: mm: Select GPU_BUDDY for VRAM allocation
  nova-core: Kconfig: Sort select statements alphabetically

Koen Koning (1):
  gpu: Fix uninitialized buddy for built-in drivers

 Documentation/gpu/drm-mm.rst                  |   10 +-
 MAINTAINERS                                   |   15 +-
 drivers/gpu/Kconfig                           |   13 +
 drivers/gpu/Makefile                          |    3 +-
 drivers/gpu/buddy.c                           | 1322 +++++++++++++++++
 drivers/gpu/drm/Kconfig                       |    5 +-
 drivers/gpu/drm/Kconfig.debug                 |    1 -
 drivers/gpu/drm/Makefile                      |    1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       |    2 +-
 .../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h    |   12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c  |   79 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h  |   20 +-
 drivers/gpu/drm/drm_buddy.c                   | 1277 +---------------
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c       |    2 +-
 drivers/gpu/drm/i915/i915_scatterlist.c       |   10 +-
 drivers/gpu/drm/i915/i915_ttm_buddy_manager.c |   55 +-
 drivers/gpu/drm/i915/i915_ttm_buddy_manager.h |    4 +-
 .../drm/i915/selftests/intel_memory_region.c  |   20 +-
 drivers/gpu/drm/tests/Makefile                |    1 -
 drivers/gpu/drm/tests/drm_exec_test.c         |    2 -
 drivers/gpu/drm/tests/drm_mm_test.c           |    2 -
 .../gpu/drm/ttm/tests/ttm_bo_validate_test.c  |    4 +-
 drivers/gpu/drm/ttm/tests/ttm_mock_manager.c  |   18 +-
 drivers/gpu/drm/ttm/tests/ttm_mock_manager.h  |    4 +-
 drivers/gpu/drm/xe/xe_res_cursor.h            |   34 +-
 drivers/gpu/drm/xe/xe_svm.c                   |   12 +-
 drivers/gpu/drm/xe/xe_ttm_vram_mgr.c          |   71 +-
 drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h    |    4 +-
 drivers/gpu/nova-core/Kconfig                 |    3 +-
 drivers/gpu/tests/Makefile                    |    4 +
 .../gpu_buddy_test.c}                         |  416 +++---
 .../lib/drm_random.c => tests/gpu_random.c}   |   18 +-
 .../lib/drm_random.h => tests/gpu_random.h}   |   18 +-
 drivers/video/Kconfig                         |    1 +
 include/drm/drm_buddy.h                       |  163 +-
 include/linux/gpu_buddy.h                     |  177 +++
 rust/bindings/bindings_helper.h               |   11 +
 rust/helpers/gpu.c                            |   23 +
 rust/helpers/helpers.c                        |    2 +
 rust/helpers/list.c                           |   17 +
 rust/kernel/ffi/clist.rs                      |  327 ++++
 rust/kernel/ffi/mod.rs                        |    9 +
 rust/kernel/gpu/buddy.rs                      |  537 +++++++
 rust/kernel/gpu/mod.rs                        |    5 +
 rust/kernel/lib.rs                            |    5 +-
 45 files changed, 2893 insertions(+), 1846 deletions(-)
 create mode 100644 drivers/gpu/Kconfig
 create mode 100644 drivers/gpu/buddy.c
 create mode 100644 drivers/gpu/tests/Makefile
 rename drivers/gpu/{drm/tests/drm_buddy_test.c => tests/gpu_buddy_test.c} (67%)
 rename drivers/gpu/{drm/lib/drm_random.c => tests/gpu_random.c} (59%)
 rename drivers/gpu/{drm/lib/drm_random.h => tests/gpu_random.h} (53%)
 create mode 100644 include/linux/gpu_buddy.h
 create mode 100644 rust/helpers/gpu.c
 create mode 100644 rust/helpers/list.c
 create mode 100644 rust/kernel/ffi/clist.rs
 create mode 100644 rust/kernel/ffi/mod.rs
 create mode 100644 rust/kernel/gpu/buddy.rs
 create mode 100644 rust/kernel/gpu/mod.rs

Cc: Nikola Djukic <ndjukic@nvidia.com>
base-commit: 2961f841b025fb234860bac26dfb7fa7cb0fb122
-- 
2.34.1
Re: [PATCH v10 0/8] Preparatory patches for nova-core memory management
Posted by Joel Fernandes 1 month, 1 week ago
My CC list missed a lot of folks, sorry about that. Adding more CC's to this
email to make people aware of the posting. Thankfully it got posted to the
archives so for those on rust-for-linux, dri-devel and nouveau lore lists, they
would get it.

Thanks,

--
Joel Fernandes

On 2/18/2026 3:54 PM, Joel Fernandes wrote:
> These are initial preparatory patches needed for nova-core memory management
> support. The series moves the DRM buddy allocator one level up so it can be
> shared across GPU subsystems, adds Rust FFI and clist bindings, and creates
> Rust GPU buddy allocator bindings.
> 
> The clist/ffi patches are ready, reviewed by Gary and Danilo. Miguel, can you
> pull those via the rust tree?
> 
> The non-Rust DRM buddy related patches are already being pulled into upstream
> by Dave Airlie but I have included them here as they are needed for the rest of
> the patches (thanks to Dave for reworking them so they applied).
> 
> I will post the nova-core memory management patches as a separate follow-up
> series just after this one.
> 
> The git tree with all these patches can be found at:
> git://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git (tag: nova/mm)
> 
> Joel Fernandes (7):
>   gpu: Move DRM buddy allocator one level up (part one)
>   gpu: Move DRM buddy allocator one level up (part two)
>   rust: ffi: Convert pub use to pub mod and create ffi module
>   rust: clist: Add support to interface with C linked lists
>   rust: gpu: Add GPU buddy allocator bindings
>   nova-core: mm: Select GPU_BUDDY for VRAM allocation
>   nova-core: Kconfig: Sort select statements alphabetically
> 
> Koen Koning (1):
>   gpu: Fix uninitialized buddy for built-in drivers
> 
>  Documentation/gpu/drm-mm.rst                  |   10 +-
>  MAINTAINERS                                   |   15 +-
>  drivers/gpu/Kconfig                           |   13 +
>  drivers/gpu/Makefile                          |    3 +-
>  drivers/gpu/buddy.c                           | 1322 +++++++++++++++++
>  drivers/gpu/drm/Kconfig                       |    5 +-
>  drivers/gpu/drm/Kconfig.debug                 |    1 -
>  drivers/gpu/drm/Makefile                      |    1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c       |    2 +-
>  .../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h    |   12 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c  |   79 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h  |   20 +-
>  drivers/gpu/drm/drm_buddy.c                   | 1277 +---------------
>  drivers/gpu/drm/i915/gem/i915_gem_ttm.c       |    2 +-
>  drivers/gpu/drm/i915/i915_scatterlist.c       |   10 +-
>  drivers/gpu/drm/i915/i915_ttm_buddy_manager.c |   55 +-
>  drivers/gpu/drm/i915/i915_ttm_buddy_manager.h |    4 +-
>  .../drm/i915/selftests/intel_memory_region.c  |   20 +-
>  drivers/gpu/drm/tests/Makefile                |    1 -
>  drivers/gpu/drm/tests/drm_exec_test.c         |    2 -
>  drivers/gpu/drm/tests/drm_mm_test.c           |    2 -
>  .../gpu/drm/ttm/tests/ttm_bo_validate_test.c  |    4 +-
>  drivers/gpu/drm/ttm/tests/ttm_mock_manager.c  |   18 +-
>  drivers/gpu/drm/ttm/tests/ttm_mock_manager.h  |    4 +-
>  drivers/gpu/drm/xe/xe_res_cursor.h            |   34 +-
>  drivers/gpu/drm/xe/xe_svm.c                   |   12 +-
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr.c          |   71 +-
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h    |    4 +-
>  drivers/gpu/nova-core/Kconfig                 |    3 +-
>  drivers/gpu/tests/Makefile                    |    4 +
>  .../gpu_buddy_test.c}                         |  416 +++---
>  .../lib/drm_random.c => tests/gpu_random.c}   |   18 +-
>  .../lib/drm_random.h => tests/gpu_random.h}   |   18 +-
>  drivers/video/Kconfig                         |    1 +
>  include/drm/drm_buddy.h                       |  163 +-
>  include/linux/gpu_buddy.h                     |  177 +++
>  rust/bindings/bindings_helper.h               |   11 +
>  rust/helpers/gpu.c                            |   23 +
>  rust/helpers/helpers.c                        |    2 +
>  rust/helpers/list.c                           |   17 +
>  rust/kernel/ffi/clist.rs                      |  327 ++++
>  rust/kernel/ffi/mod.rs                        |    9 +
>  rust/kernel/gpu/buddy.rs                      |  537 +++++++
>  rust/kernel/gpu/mod.rs                        |    5 +
>  rust/kernel/lib.rs                            |    5 +-
>  45 files changed, 2893 insertions(+), 1846 deletions(-)
>  create mode 100644 drivers/gpu/Kconfig
>  create mode 100644 drivers/gpu/buddy.c
>  create mode 100644 drivers/gpu/tests/Makefile
>  rename drivers/gpu/{drm/tests/drm_buddy_test.c => tests/gpu_buddy_test.c} (67%)
>  rename drivers/gpu/{drm/lib/drm_random.c => tests/gpu_random.c} (59%)
>  rename drivers/gpu/{drm/lib/drm_random.h => tests/gpu_random.h} (53%)
>  create mode 100644 include/linux/gpu_buddy.h
>  create mode 100644 rust/helpers/gpu.c
>  create mode 100644 rust/helpers/list.c
>  create mode 100644 rust/kernel/ffi/clist.rs
>  create mode 100644 rust/kernel/ffi/mod.rs
>  create mode 100644 rust/kernel/gpu/buddy.rs
>  create mode 100644 rust/kernel/gpu/mod.rs
> 
> Cc: Nikola Djukic <ndjukic@nvidia.com>
> base-commit: 2961f841b025fb234860bac26dfb7fa7cb0fb122

-- 
Joel Fernandes
Re: [PATCH v10 0/8] Preparatory patches for nova-core memory management
Posted by Danilo Krummrich 1 month, 1 week ago
On Wed Feb 18, 2026 at 9:54 PM CET, Joel Fernandes wrote:
> The clist/ffi patches are ready, reviewed by Gary and Danilo. Miguel, can you
> pull those via the rust tree?

I requested changes in the last version and have yet to go through this one. I
also think that Alex still has some comments (Cc'd him).

Please note that if this goes through the Rust tree, we have to wait for the
full upcoming cycle before we can land the GPU buddy abstractions.

Alternatively, if it goes through the Rust tree, Miguel can provide a signed tag
for me to merge or we can simply take it through the drm-rust tree in the first
place, if Miguel agrees with that.

> The non-Rust DRM buddy related patches are already being pulled into upstream

They are in drm-misc-next, I will merge into drm-rust-next once they hit
drm-next and -rc1 is out.

> I will post the nova-core memory management patches as a separate follow-up
> series just after this one.
>
> The git tree with all these patches can be found at:
> git://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git (tag: nova/mm)

This is now (at least) the third time I have to ask for a patch changelog.

	"When sending a next version, add a patch changelog to the cover letter
	or to individual patches explaining difference against previous
	submission (see The canonical patch format)." [1, 2]

Please, add a patch changelog.

(This also goes for the nova-core MM series, which is flagged as v7 despite
actually being v2).

[1] https://docs.kernel.org/process/submitting-patches.html#respond-to-review-comments
[2] https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format
Re: [PATCH v10 0/8] Preparatory patches for nova-core memory management
Posted by Joel Fernandes 1 month, 1 week ago
Hi, Danilo,

> On Feb 18, 2026, at 5:24 PM, Danilo Krummrich <dakr@kernel.org> wrote:
> 
> On Wed Feb 18, 2026 at 9:54 PM CET, Joel Fernandes wrote:
>> The clist/ffi patches are ready, reviewed by Gary and Danilo. Miguel, can you
>> pull those via the rust tree?
> 
> I requested changes in the last version and have yet to go through this one. I
> also think that Alex still has some comments (Cc'd him).

Sure.

> 
> Please note that if this goes through the Rust tree, we have to wait for the
> full upcoming cycle before we can land the GPU buddy abstractions.
> 
> Alternatively, if it goes through the Rust tree, Miguel can provide a signed tag
> for me to merge or we can simply take it through the drm-rust tree in the first
> place, if Miguel agrees with that.

Ok.

> 
>> The non-Rust DRM buddy related patches are already being pulled into upstream
> 
> They are in drm-misc-next, I will merge into drm-rust-next once they hit
> drm-next and -rc1 is out.

Ok.

> 
>> I will post the nova-core memory management patches as a separate follow-up
>> series just after this one.
>> 
>> The git tree with all these patches can be found at:
>> git://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git (tag: nova/mm)
> 
> This is now (at least) the third time I have to ask for a patch changelog.
> 
>    "When sending a next version, add a patch changelog to the cover letter
>    or to individual patches explaining difference against previous
>    submission (see The canonical patch format)." [1, 2]
> 
> Please, add a patch changelog.

Ah, I think I did not understand what you meant because of my different
interpretation of the words changelog. I have used this term interchangeable in
the past to summarize what a set of patches do in the cover letter, not what
changed since the last revision.

Anyway here is a changelog:

1. Moving of the clist code to rust ffi
2. Some comment changes in clist and gpu buddy bindings
3. Inclusion of the movement of code on C drm buddy.

For the other series:
- the main change is only for DRM fence signaling related stuff and some test
related changes.

If you want I could provide a range diff if it makes it easier. But yeah I
did drop the ball a bit on the changelog stuff here. Perhaps buying you a
beer the next LPC could be penance?

> 
> (This also goes for the nova-core MM series, which is flagged as v7 despite
> actually being v2).

No, it was RFC v6, that is when I had included the full stack of these patches.
See:
https://lore.kernel.org/all/20260120204303.3229303-1-joelagnelf@nvidia.com/

I split it this way based on your request. I wanted to keep it all in one series
to reduce version number confusion.

Let me know if there’s something else I need to do to make it easier, I can
include a proper changelog in future respins.

Best,

-- 
Joel Fernandes

Re: [PATCH v10 0/8] Preparatory patches for nova-core memory management
Posted by Joel Fernandes 1 month, 1 week ago

> On Feb 18, 2026, at 6:46 PM, Joel Fernandes <joelagnelf@nvidia.com> wrote:
> 
> Hi, Danilo,
> 
>> On Feb 18, 2026, at 5:24 PM, Danilo Krummrich <dakr@kernel.org> wrote:
>> 
>>> On Wed Feb 18, 2026 at 9:54 PM CET, Joel Fernandes wrote:
>>> The clist/ffi patches are ready, reviewed by Gary and Danilo. Miguel, can you
>>> pull those via the rust tree?
>> 
>> I requested changes in the last version and have yet to go through this one. I
>> also think that Alex still has some comments (Cc'd him).
> 
> Sure.
> 
>> 
>> Please note that if this goes through the Rust tree, we have to wait for the
>> full upcoming cycle before we can land the GPU buddy abstractions.
>> 
>> Alternatively, if it goes through the Rust tree, Miguel can provide a signed tag
>> for me to merge or we can simply take it through the drm-rust tree in the first
>> place, if Miguel agrees with that.
> 
> Ok.
> 
>> 
>>> The non-Rust DRM buddy related patches are already being pulled into upstream
>> 
>> They are in drm-misc-next, I will merge into drm-rust-next once they hit
>> drm-next and -rc1 is out.
> 
> Ok.
> 
>> 
>>> I will post the nova-core memory management patches as a separate follow-up
>>> series just after this one.
>>> 
>>> The git tree with all these patches can be found at:
>>> git://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git (tag: nova/mm)
>> 
>> This is now (at least) the third time I have to ask for a patch changelog.
>> 
>>   "When sending a next version, add a patch changelog to the cover letter
>>   or to individual patches explaining difference against previous
>>   submission (see The canonical patch format)." [1, 2]
>> 
>> Please, add a patch changelog.
> 
> Ah, I think I did not understand what you meant because of my different
> interpretation of the words changelog. I have used this term interchangeable in
> the past to summarize what a set of patches do in the cover letter, not what
> changed since the last revision.
> 
> Anyway here is a changelog:
> 
> 1. Moving of the clist code to rust ffi
> 2. Some comment changes in clist and gpu buddy bindings
> 3. Inclusion of the movement of code on C drm buddy.

And to clarify, I’ll go try to include this on a patch by patch basis hence forth in the cover letter as suggested by the documentation. Not just what changed since last time summary.

- Joel