Re: [PATCH v5 1/8] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-09-03 Thread Matthew Auld
On 02/09/2025 10:10, Francois Dugast wrote: On Mon, Aug 18, 2025 at 10:39:10AM -0700, Matthew Brost wrote: On Mon, Aug 18, 2025 at 04:21:54PM +0100, Matthew Auld wrote: Handle the case where the hmm range partially covers a huge page (like 2M), otherwise we can potentially end up doing

[PATCH v6 3/8] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-08-28 Thread Matthew Auld
struct (Matt B) v3: - Small kernel-doc fixes Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 67 +++- drivers/gpu/drm/xe/xe_pt.c | 2 +- drivers/gpu/drm/xe/xe_svm.c

[PATCH v6 7/8] drm/xe/userptr: replace xe_hmm with gpusvm

2025-08-28 Thread Matthew Auld
sing conversion with CONFIG_DRM_XE_USERPTR_INVAL_INJECT v6: - Convert the new user in xe_vm_madise. Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström Cc: Dafna Hirschfeld Cc: Matthew Brost Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/Kconfig | 2 +- drivers

[PATCH v6 8/8] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-08-28 Thread Matthew Auld
we lack DRM_GPUSVM, since we also need them for userptr. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pt.c | 123 --- drivers/gpu/drm/xe

[PATCH v6 6/8] drm/xe/vm: split userptr bits into separate file

2025-08-28 Thread Matthew Auld
ld be no functional change here. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_pt.c | 1 + drivers/gpu/drm/xe/xe_userptr.c | 305 +++ driver

[PATCH v6 4/8] drm/gpusvm: refactor core API to use pages struct

2025-08-28 Thread Matthew Auld
Refactor the core API of get/unmap/free pages to all operate on drm_gpusvm_pages. In the next patch we want to export a simplified core API without needing fully blown svm range etc. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost

[PATCH v6 5/8] drm/gpusvm: export drm_gpusvm_pages API

2025-08-28 Thread Matthew Auld
Export get/unmap/free pages API. We also need to tweak the SVM init to allow skipping much of the unneeded parts. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 include

[PATCH v6 2/8] drm/gpusvm: use more selective dma dir in get_pages()

2025-08-28 Thread Matthew Auld
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost

[PATCH v6 1/8] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-08-28 Thread Matthew Auld
gpusvm, so needs alignment here. v2: - Add kernel-doc (Matt B) - s/fls/ilog2/ (Thomas) Reported-by: Thomas Hellström Signed-off-by: Matthew Auld Cc: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 33 +++-- 1 file changed, 31

[PATCH v6 0/8] Replace xe_hmm with gpusvm

2025-08-28 Thread Matthew Auld
As a first step to moving userptr handling over to drm, replace the hmm usage in xe over to gpusvm, which already offers similar functionality. As some prep steps we also align on some of the missing pieces that were already handled in xe_hmm. v2: - Rework the gpusvm API based on feedback. - U

Re: [PATCH v3 2/2] drm/buddy: Separate clear and dirty free block trees

2025-08-26 Thread Matthew Auld
On 25/08/2025 12:31, Arunpravin Paneer Selvam wrote: On 8/22/2025 5:32 PM, Matthew Auld wrote: On 21/08/2025 16:06, Arunpravin Paneer Selvam wrote: Maintain two separate RB trees per order - one for clear (zeroed) blocks and another for dirty (uncleared) blocks. This separation improves code

Re: [PATCH v3 1/2] drm/buddy: Optimize free block management with RB tree

2025-08-22 Thread Matthew Auld
On 22/08/2025 09:37, Matthew Auld wrote: On 21/08/2025 16:06, Arunpravin Paneer Selvam wrote: Replace the freelist (O(n)) used for free block management with a red-black tree, providing more efficient O(log n) search, insert, and delete operations. This improves scalability and performance when

Re: [PATCH v3 2/2] drm/buddy: Separate clear and dirty free block trees

2025-08-22 Thread Matthew Auld
tree macro. - Use the existing dirty/free bit instead of new tree field. - Make free_trees[] instead of clear_tree and dirty_tree for more cleaner approach. Signed-off-by: Arunpravin Paneer Selvam Suggested-by: Matthew Auld Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4260

Re: [PATCH v3 1/2] drm/buddy: Optimize free block management with RB tree

2025-08-22 Thread Matthew Auld
On 21/08/2025 16:06, Arunpravin Paneer Selvam wrote: Replace the freelist (O(n)) used for free block management with a red-black tree, providing more efficient O(log n) search, insert, and delete operations. This improves scalability and performance when managing large numbers of free blocks per

Re: [PATCH v2 1/2] drm/buddy: Optimize free block management with RB tree

2025-08-20 Thread Matthew Auld
On 20/08/2025 08:56, Arunpravin Paneer Selvam wrote: Hi Matthew, On 8/14/2025 4:15 PM, Matthew Auld wrote: On 24/07/2025 11:46, Arunpravin Paneer Selvam wrote: Replace the freelist (O(n)) used for free block management with a red-black tree, providing more efficient O(log n) search, insert

[PATCH v2] drm/gpusvm: some kernel-doc fixes

2025-08-19 Thread Matthew Auld
This should be enough to get scripts/kernel-doc passing for drm_gpusvm.[ch], so we can then add them to our CI build infra. v2: - Also drop misplaced range_evict() Link: https://gitlab.freedesktop.org/drm/xe/ci/-/merge_requests/86 Signed-off-by: Matthew Auld Cc: Matthew Brost --- drivers/gpu

[PATCH] drm/gpusvm: some kernel-doc fixes

2025-08-19 Thread Matthew Auld
This should be enough to get scripts/kernel-doc passing for drm_gpusvm.[ch], so we can then add them to our CI build infra. Link: https://gitlab.freedesktop.org/drm/xe/ci/-/merge_requests/86 Signed-off-by: Matthew Auld Cc: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 4 ++-- 1 file changed

[PATCH v5 0/8] Replace xe_hmm with gpusvm

2025-08-18 Thread Matthew Auld
As a first step to moving userptr handling over to drm, replace the hmm usage in xe over to gpusvm, which already offers similar functionality. As some prep steps we also align on some of the missing pieces that were already handled in xe_hmm. v2: - Rework the gpusvm API based on feedback. - U

[PATCH v5 8/8] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-08-18 Thread Matthew Auld
Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pt.c | 123 +++ drivers/gpu/drm/xe/xe_pt_types.h | 2 - 2 files changed, 44 insertions(+), 81 deletions(-) diff --git a/drivers

[PATCH v5 7/8] drm/xe/userptr: replace xe_hmm with gpusvm

2025-08-18 Thread Matthew Auld
full SVM, that way we can use the same lock (Matt B & Himal) v3: - Re-use svm_init/fini for userptr. v4: - Allow building xe without userptr if we are missing DRM_GPUSVM config. (Matt B) - Always make .read_only match xe_vma_read_only() for the ctx. (Dafna) Signed-off-by: Matthew

[PATCH v5 6/8] drm/xe/vm: split userptr bits into separate file

2025-08-18 Thread Matthew Auld
ld be no functional change here. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_pt.c | 1 + drivers/gpu/drm/xe/xe_userptr.c | 305 +++ driver

[PATCH v5 5/8] drm/gpusvm: export drm_gpusvm_pages API

2025-08-18 Thread Matthew Auld
Export get/unmap/free pages API. We also need to tweak the SVM init to allow skipping much of the unneeded parts. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 include

[PATCH v5 3/8] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-08-18 Thread Matthew Auld
struct (Matt B) Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 69 +++- drivers/gpu/drm/xe/xe_pt.c | 2 +- drivers/gpu/drm/xe/xe_svm.c | 16 - drivers/gpu/drm

[PATCH v5 4/8] drm/gpusvm: refactor core API to use pages struct

2025-08-18 Thread Matthew Auld
Refactor the core API of get/unmap/free pages to all operate on drm_gpusvm_pages. In the next patch we want to export a simplified core API without needing fully blown svm range etc. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost

[PATCH v5 2/8] drm/gpusvm: use more selective dma dir in get_pages()

2025-08-18 Thread Matthew Auld
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost

[PATCH v5 1/8] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-08-18 Thread Matthew Auld
gpusvm, so needs alignment here. v2: - Add kernel-doc (Matt B) - s/fls/ilog2/ (Thomas) Reported-by: Thomas Hellström Signed-off-by: Matthew Auld Cc: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 33 +++-- 1 file changed, 31

Re: [PATCH v2 2/2] drm/buddy: Separate clear and dirty free block trees

2025-08-14 Thread Matthew Auld
correctness and avoid regressions. v2: Missed adding the suggested-by tag. Added it in v2. Signed-off-by: Arunpravin Paneer Selvam Suggested-by: Matthew Auld --- drivers/gpu/drm/drm_buddy.c | 316 ++-- include/drm/drm_buddy.h | 15 +- 2 files changed, 204

Re: [PATCH v2 1/2] drm/buddy: Optimize free block management with RB tree

2025-08-14 Thread Matthew Auld
On 24/07/2025 11:46, Arunpravin Paneer Selvam wrote: Replace the freelist (O(n)) used for free block management with a red-black tree, providing more efficient O(log n) search, insert, and delete operations. This improves scalability and performance when managing large numbers of free blocks per

Re: [PATCH] drm/ttm: WIP limit the TTM pool to 32bit CPUs

2025-08-12 Thread Matthew Auld
On 06/08/2025 14:28, Christian König wrote: On some old x86 systems we had the problem that changing the caching flags of system memory requires changing the global MTRR/PAT tables. But on any modern x86 system (CPUs introduced rughly after 2004) we actually don't need that any more and can upda

Re: [PATCH v3 2/3] drm/amdgpu: Reset the clear flag in buddy during resume

2025-07-10 Thread Matthew Auld
On 10/07/2025 08:14, Arunpravin Paneer Selvam wrote: On 7/8/2025 2:30 PM, Matthew Auld wrote: On 08/07/2025 07:54, Arunpravin Paneer Selvam wrote: - Added a handler in DRM buddy manager to reset the cleared    flag for the blocks in the freelist. - This is necessary because, upon resuming

Re: [PATCH v3 2/3] drm/amdgpu: Reset the clear flag in buddy during resume

2025-07-08 Thread Matthew Auld
everything has been cleared. v2: - Add lock before accessing drm_buddy_clear_reset_blocks()(Matthew Auld) - Force merge the two dirty blocks.(Matthew Auld) - Add a new unit test case for this issue.(Matthew Auld) - Having this function being able to flip the state either way would be

Re: [PATCH v2 2/3] drm/amdgpu: Reset the clear flag in buddy during resume

2025-07-04 Thread Matthew Auld
everything has been cleared. v2: - Add lock before accessing drm_buddy_clear_reset_blocks()(Matthew Auld) - Force merge the two dirty blocks.(Matthew Auld) - Add a new unit test case for this issue.(Matthew Auld) - Having this function being able to flip the state either way would be

Re: [PATCH 2/2] drm/amdgpu: Reset the clear flag in buddy during resume

2025-06-23 Thread Matthew Auld
+Matt B who is adding clear-on-free support in xe. I'm not sure if we might also see something like this. On 23/06/2025 06:52, Arunpravin Paneer Selvam wrote: - Added a handler in DRM buddy manager to reset the cleared flag for the blocks in the freelist. - This is necessary because, upon r

[PATCH v4 7/8] drm/xe/userptr: replace xe_hmm with gpusvm

2025-05-12 Thread Matthew Auld
full SVM, that way we can use the same lock (Matt B & Himal) v3: - Re-use svm_init/fini for userptr. v4: - Allow building xe without userptr if we are missing DRM_GPUSVM config. (Matt B) - Always make .read_only match xe_vma_read_only() for the ctx. (Dafna) Signed-off-by: Matthew

[PATCH v4 8/8] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-05-12 Thread Matthew Auld
Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pt.c | 90 ++-- drivers/gpu/drm/xe/xe_pt_types.h | 2 - 2 files changed, 29 insertions(+), 63 deletions(-) diff --git a/drivers

[PATCH v4 6/8] drm/xe/vm: split userptr bits into separate file

2025-05-12 Thread Matthew Auld
ld be no functional change here. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_pt.c | 1 + drivers/gpu/drm/xe/xe_userptr.c | 303 +++ drivers/gpu/drm/xe/xe_userptr.h

[PATCH v4 5/8] drm/gpusvm: export drm_gpusvm_pages API

2025-05-12 Thread Matthew Auld
Export get/unmap/free pages API. We also need to tweak the SVM init to allow skipping much of the unneeded parts. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 include

[PATCH v4 4/8] drm/gpusvm: refactor core API to use pages struct

2025-05-12 Thread Matthew Auld
Refactor the core API of get/unmap/free pages to all operate on drm_gpusvm_pages. In the next patch we want to export a simplified core API without needing fully blown svm range etc. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost

[PATCH v4 3/8] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-05-12 Thread Matthew Auld
struct (Matt B) Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 drivers/gpu/drm/xe/xe_pt.c | 2 +- drivers/gpu/drm/xe/xe_svm.c | 8 ++--- drivers/gpu/drm/xe

[PATCH v4 2/8] drm/gpusvm: use more selective dma dir in get_pages()

2025-05-12 Thread Matthew Auld
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost

[PATCH v4 1/8] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-05-12 Thread Matthew Auld
gpusvm, so needs alignment here. v2: - Add kernel-doc (Matt B) - s/fls/ilog2/ (Thomas) Reported-by: Thomas Hellström Signed-off-by: Matthew Auld Cc: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 33 +++-- 1 file changed, 31

[PATCH v4 0/8] Replace xe_hmm with gpusvm

2025-05-12 Thread Matthew Auld
As a first step to moving userptr handling over to drm, replace the hmm usage in xe over to gpusvm, which already offers similar functionality. As some prep steps we also align on some of the missing pieces that were already handled in xe_hmm. v2: - Rework the gpusvm API based on feedback. - U

[PATCH v3 3/7] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-04-24 Thread Matthew Auld
struct (Matt B) Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 drivers/gpu/drm/xe/xe_pt.c | 2 +- drivers/gpu/drm/xe/xe_svm.c | 8 ++--- drivers/gpu/drm/xe

[PATCH v3 7/7] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-04-24 Thread Matthew Auld
Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström --- drivers/gpu/drm/xe/xe_pt.c | 90 ++-- drivers/gpu/drm/xe/xe_pt_types.h | 2 - drivers/gpu/drm/xe/xe_svm.h | 19 +++ 3 files changed, 39 insertions(+), 72 deletions

[PATCH v3 4/7] drm/gpusvm: refactor core API to use pages struct

2025-04-24 Thread Matthew Auld
Refactor the core API of get/unmap/free pages to all operate on drm_gpusvm_pages. In the next patch we want to export a simplified core API without needing fully blown svm range etc. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c

[PATCH v3 2/7] drm/gpusvm: use more selective dma dir in get_pages()

2025-04-24 Thread Matthew Auld
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost

[PATCH v3 0/7] Replace xe_hmm with gpusvm

2025-04-24 Thread Matthew Auld
As a first step to moving userptr handling over to drm, replace the hmm usage in xe over to gpusvm, which already offers similar functionality. As some prep steps we also align on some of the missing pieces that were already handled in xe_hmm. v2: - Rework the gpusvm API based on feedback. - U

[PATCH v3 6/7] drm/xe/userptr: replace xe_hmm with gpusvm

2025-04-24 Thread Matthew Auld
full SVM, that way we can use the same lock (Matt B & Himal) v3: - Re-use svm_init/fini for userptr. Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/xe/Kconfig | 3 +- drivers/gpu/drm/xe/Makefile |

[PATCH v3 5/7] drm/gpusvm: export drm_gpusvm_pages API

2025-04-24 Thread Matthew Auld
Export get/unmap/free pages API. We also need to tweak the SVM init to allow skipping much of the unneeded parts. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 include/drm/drm_gpusvm.h | 16

[PATCH v3 1/7] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-04-24 Thread Matthew Auld
gpusvm, so needs alignment here. v2: - Add kernel-doc (Matt B) - s/fls/ilog2/ (Thomas) Reported-by: Thomas Hellström Signed-off-by: Matthew Auld Cc: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 33 +++-- 1 file changed, 31

Re: [PATCH v2] drm/panthor: Don't create a file offset for NO_MMAP BOs

2025-04-17 Thread Matthew Auld
On 17/04/2025 10:32, Boris Brezillon wrote: Right now the DRM_PANTHOR_BO_NO_MMAP flag is ignored by panthor_ioctl_bo_mmap_offset(), meaning BOs with this flag set can have a file offset but can't be mapped anyway, because panthor_gem_mmap() will filter them out. If we error out at mmap_offset cr

Re: [PATCH v18 4/5] drm/xe/xe_vm: Add per VM fault info

2025-04-15 Thread Matthew Auld
On 14/04/2025 22:40, Jonathan Cavitt wrote: Add additional information to each VM so they can report up to the first 50 seen faults. Only pagefaults are saved this way currently, though in the future, all faults should be tracked by the VM for future reporting. Additionally, of the pagefaults r

Re: [PATCH v2 7/7] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-04-07 Thread Matthew Auld
On 04/04/2025 18:02, Matthew Brost wrote: On Fri, Apr 04, 2025 at 09:19:34AM +0100, Matthew Auld wrote: On 03/04/2025 22:25, Matthew Brost wrote: On Fri, Mar 28, 2025 at 06:10:36PM +, Matthew Auld wrote: We now use the same notifier lock for SVM and userptr, with that we can combine

[PATCH 6/7] drm/gpusvm: support basic_range

2025-04-05 Thread Matthew Auld
this change makes sense. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 138 +-- include/drm/drm_gpusvm.h | 23 ++ 2 files changed, 137 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm

[PATCH 4/7] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-04-05 Thread Matthew Auld
like get_pages(), but not all the other more complex svm stuff. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 95 +++- drivers/gpu/drm/xe/xe_pt.c | 2 +- drivers/gpu/drm/xe/xe_svm.c | 6

[PATCH 7/7] drm/xe/userptr: replace xe_hmm with gpusvm

2025-04-05 Thread Matthew Auld
Goal here is cut over to gpusvm and remove xe_hmm, relying instead on common code. The core facilities we need are get_pages(), unmap_pages() and free_pages() for a given useptr range, plus a vm level notifier lock, which is now provided by gpusvm. Signed-off-by: Matthew Auld Cc: Thomas

[PATCH v2 2/7] drm/gpusvm: use more selective dma dir in get_pages()

2025-04-05 Thread Matthew Auld
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost

Re: [PATCH 4/7] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-04-04 Thread Matthew Auld
On 20/03/2025 20:43, Matthew Brost wrote: On Thu, Mar 20, 2025 at 05:30:01PM +, Matthew Auld wrote: Pull the pages stuff from the svm range into its own substructure, with the idea of having the main pages related routines, like get_pages(), unmap_pages() and free_pages() all operating on

Re: [PATCH v2 7/7] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-04-04 Thread Matthew Auld
On 03/04/2025 22:25, Matthew Brost wrote: On Fri, Mar 28, 2025 at 06:10:36PM +, Matthew Auld wrote: We now use the same notifier lock for SVM and userptr, with that we can combine xe_pt_userptr_pre_commit and xe_pt_svm_pre_commit. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld

Re: [PATCH v2 7/7] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-04-04 Thread Matthew Auld
On 03/04/2025 22:23, Matthew Brost wrote: On Fri, Mar 28, 2025 at 06:10:36PM +, Matthew Auld wrote: We now use the same notifier lock for SVM and userptr, with that we can combine xe_pt_userptr_pre_commit and xe_pt_svm_pre_commit. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld

Re: [PATCH] drm/format-helper: fix build

2025-04-02 Thread Matthew Auld
Hi, On 02/04/2025 11:53, Thomas Zimmermann wrote: Hi Am 02.04.25 um 12:44 schrieb Matthew Auld: Build fails with: error: multiple unsequenced modifications to 'sbuf32' [-Werror,-Wunsequenced]    264 | le32_to_c

[PATCH] drm/format-helper: fix build

2025-04-02 Thread Matthew Auld
version") Fixes: 3f31a017ddbc ("drm/format-helper: Optimize 32-to-16-bpp conversion") Fixes: 65931bbc5177 ("drm/format-helper: Optimize 32-to-8-bpp conversion") Signed-off-by: Matthew Auld Cc: Thomas Zimmermann Cc: Jocelyn Falempe --- drivers/gpu/drm/drm_format_helper

[PATCH v2 4/7] drm/gpusvm: refactor core API to use pages struct

2025-03-28 Thread Matthew Auld
Refactor the core API of get/unmap/free pages to all operate on drm_gpusvm_pages. In the next patch we want to export a simplified core API without needing fully blown svm range etc. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c

[PATCH v2 3/7] drm/gpusvm: pull out drm_gpusvm_pages substructure

2025-03-28 Thread Matthew Auld
struct (Matt B) Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 66 drivers/gpu/drm/xe/xe_pt.c | 2 +- drivers/gpu/drm/xe/xe_svm.c | 8 ++--- drivers/gpu/drm/xe/xe_svm.h | 6 ++-- include

[PATCH v2 5/7] drm/gpusvm: export drm_gpusvm_pages API

2025-03-28 Thread Matthew Auld
Export get/unmap/free pages API. We also need to tweak the SVM init to allow skipping much of the unneeded parts. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 66 include/drm/drm_gpusvm.h | 16

[PATCH v2 6/7] drm/xe/userptr: replace xe_hmm with gpusvm

2025-03-28 Thread Matthew Auld
full SVM, that way we can use the same lock (Matt B & Himal) Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/xe/Kconfig | 3 +- drivers/gpu/drm/xe/Makefile | 1 - drivers/gpu/drm/xe/xe_exec.c |

[PATCH v2 7/7] drm/xe/pt: unify xe_pt_svm_pre_commit with userptr

2025-03-28 Thread Matthew Auld
We now use the same notifier lock for SVM and userptr, with that we can combine xe_pt_userptr_pre_commit and xe_pt_svm_pre_commit. Suggested-by: Matthew Brost Signed-off-by: Matthew Auld Cc: Himal Prasad Ghimiray Cc: Thomas Hellström --- drivers/gpu/drm/xe/xe_pt.c | 95

[PATCH v2 1/7] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-03-28 Thread Matthew Auld
gpusvm, so needs alignment here. v2: - Add kernel-doc (Matt B) - s/fls/ilog2/ (Thomas) Reported-by: Thomas Hellström Signed-off-by: Matthew Auld Cc: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/drm_gpusvm.c | 33 +++-- 1 file changed, 31

[PATCH v2 0/7] Replace xe_hmm with gpusvm

2025-03-28 Thread Matthew Auld
As a first step to moving userptr handling over to drm, replace the hmm usage in xe over to gpusvm, which already offers similar functionality. As some prep steps we also align on some of the missing pieces that were already handled in xe_hmm. v2: - Rework the gpusvm API based on feedback. - U

[PATCH 0/7] Replace xe_hmm with gpusvm

2025-03-24 Thread Matthew Auld
As a first step to moving userptr handling over to drm, replace the hmm usage in xe over to gpusvm, which already offers similar functionality. As some prep steps we also align on some of the missing pieces that were already handled in xe_hmm. -- 2.48.1

Re: [PATCH 1/7] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-03-21 Thread Matthew Auld
On 20/03/2025 20:40, Matthew Brost wrote: On Thu, Mar 20, 2025 at 05:29:58PM +, Matthew Auld wrote: Handle the case where the hmm range partially covers a huge page (like 2M), otherwise we can potentially end up doing something nasty like mapping memory which potentially is outside the

Re: [PATCH 3/7] drm/gpusvm: mark pages as dirty

2025-03-21 Thread Matthew Auld
On 20/03/2025 19:33, Matthew Brost wrote: On Thu, Mar 20, 2025 at 08:29:42PM +0100, Thomas Hellström wrote: On Thu, 2025-03-20 at 17:30 +, Matthew Auld wrote: If the memory is going to be accessed by the device, make sure we mark the pages accordingly such that the kernel knows this. This

[PATCH 3/7] drm/gpusvm: mark pages as dirty

2025-03-20 Thread Matthew Auld
If the memory is going to be accessed by the device, make sure we mark the pages accordingly such that the kernel knows this. This aligns with the xe-userptr code. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 9 + 1 file changed

[PATCH 1/7] drm/gpusvm: fix hmm_pfn_to_map_order() usage

2025-03-20 Thread Matthew Auld
directly use gpusvm, so needs alignment here. Reported-by: Thomas Hellström Signed-off-by: Matthew Auld Cc: Matthew Brost --- drivers/gpu/drm/drm_gpusvm.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm

[PATCH 5/7] drm/gpusvm: lower get/unmap pages

2025-03-20 Thread Matthew Auld
Lower get/unmap pages to facilitate operating on the lowest level pieces, without needing a full drm_gpusvm_range structure. In the next patch we want to extract get/unmap/free to operate on a different range type. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost --- drivers

[PATCH 2/7] drm/gpusvm: use more selective dma dir in get_pages()

2025-03-20 Thread Matthew Auld
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Matthew Brost

Re: [PATCH 1/5] drm/xe/bo: fix alignment with non-4K kernel page sizes

2025-03-05 Thread Matthew Auld
On 05/03/2025 18:44, Matthew Brost wrote: On Wed, Feb 26, 2025 at 06:05:55PM +, Matthew Auld wrote: On 26/02/2025 15:12, Matthew Brost wrote: On Wed, Feb 26, 2025 at 10:38:40AM +, Matthew Auld wrote: On 26/02/2025 04:18, Matthew Brost wrote: On Tue, Feb 25, 2025 at 09:13:09PM -0600

Re: [PATCH 1/5] drm/xe/bo: fix alignment with non-4K kernel page sizes

2025-02-26 Thread Matthew Auld
On 26/02/2025 15:12, Matthew Brost wrote: On Wed, Feb 26, 2025 at 10:38:40AM +, Matthew Auld wrote: On 26/02/2025 04:18, Matthew Brost wrote: On Tue, Feb 25, 2025 at 09:13:09PM -0600, Lucas De Marchi wrote: On Wed, Feb 26, 2025 at 10:00:18AM +0800, Mingcong Bai via B4 Relay wrote: From

Re: [PATCH 1/5] drm/xe/bo: fix alignment with non-4K kernel page sizes

2025-02-26 Thread Matthew Auld
On 26/02/2025 04:18, Matthew Brost wrote: On Tue, Feb 25, 2025 at 09:13:09PM -0600, Lucas De Marchi wrote: On Wed, Feb 26, 2025 at 10:00:18AM +0800, Mingcong Bai via B4 Relay wrote: From: Mingcong Bai The bo/ttm interfaces with kernel memory mapping from dedicated GPU memory. It is not correc

Re: [PATCH v6 11/32] drm/xe: Nuke VM's mapping upon close

2025-02-25 Thread Matthew Auld
On 25/02/2025 04:42, Matthew Brost wrote: Clear root PT entry and invalidate entire VM's address space when closing the VM. Will prevent the GPU from accessing any of the VM's memory after closing. v2: - s/vma/vm in kernel doc (CI) - Don't nuke migration VM as this occur at driver unload (CI

Re: [PATCH v6 06/32] drm/gpusvm: Add support for GPU Shared Virtual Memory

2025-02-25 Thread Matthew Auld
On 25/02/2025 04:42, Matthew Brost wrote: This patch introduces support for GPU Shared Virtual Memory (SVM) in the Direct Rendering Manager (DRM) subsystem. SVM allows for seamless sharing of memory between the CPU and GPU, enhancing performance and flexibility in GPU computing tasks. The patch

Re: [PATCH v6 04/32] drm/pagemap: Add DRM pagemap

2025-02-25 Thread Matthew Auld
On 25/02/2025 04:42, Matthew Brost wrote: From: Thomas Hellström Introduce drm_pagemap ops to map and unmap dma to VRAM resources. In the local memory case it's a matter of merely providing an offset into the device's physical address. For future p2p the map and unmap functions may encode as ne

Re: [PATCH v5 27/32] drm/xe: Add SVM VRAM migration

2025-02-21 Thread Matthew Auld
On 20/02/2025 19:55, Matthew Brost wrote: On Thu, Feb 20, 2025 at 04:59:29PM +0100, Thomas Hellström wrote: On Thu, 2025-02-20 at 15:53 +, Matthew Auld wrote: On 13/02/2025 02:11, Matthew Brost wrote: Migration is implemented with range granularity, with VRAM backing being a VM private

Re: [PATCH v5 27/32] drm/xe: Add SVM VRAM migration

2025-02-20 Thread Matthew Auld
On 13/02/2025 02:11, Matthew Brost wrote: Migration is implemented with range granularity, with VRAM backing being a VM private TTM BO (i.e., shares dma-resv with VM). The lifetime of the TTM BO is limited to when the SVM range is in VRAM (i.e., when a VRAM SVM range is migrated to SRAM, the TTM

Re: [PATCH v3 23/25] drm/xe: Compute dumb-buffer sizes with drm_mode_size_dumb()

2025-02-20 Thread Matthew Auld
m" Cc: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_bo.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index 78d09c5ed26d..b34f446ad57d 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++

Re: [PATCH] MAINTAINERS: Add TTM reviewers

2025-02-06 Thread Matthew Auld
On 06/02/2025 10:35, Thomas Hellström wrote: Add Matthew Auld and Matthew Brost as TTM reviewers Cc: Matthew Auld Cc: Matthew Brost Cc: Christian König Cc: Dave Airlie Cc: Simona Vetter Cc: dri-devel@lists.freedesktop.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Thomas Hellström

Re: [PATCH 0/4] drm/gpuvm: Add support for single-page-filled mappings

2025-02-03 Thread Matthew Auld
On 03/02/2025 12:12, Boris Brezillon wrote: On Mon, 3 Feb 2025 11:23:53 + Liviu Dudau wrote: On Mon, Feb 03, 2025 at 10:21:53AM +0100, Boris Brezillon wrote: +Akash with whom we've been discussing adding a 'REPEAT' mode to drm_gpuvm/panthor. On Sun, 2 Feb 2025 19:53:47 +0100 Danilo Krumm

Re: [PATCH v4 28/33] drm/xe: Add SVM VRAM migration

2025-01-30 Thread Matthew Auld
On 30/01/2025 16:32, Matthew Brost wrote: On Thu, Jan 30, 2025 at 02:22:55PM +, Matthew Auld wrote: On 29/01/2025 19:52, Matthew Brost wrote: Migration is implemented with range granularity, with VRAM backing being a VM private TTM BO (i.e., shares dma-resv with VM). The lifetime of the

Re: [PATCH v4 28/33] drm/xe: Add SVM VRAM migration

2025-01-30 Thread Matthew Auld
On 29/01/2025 19:52, Matthew Brost wrote: Migration is implemented with range granularity, with VRAM backing being a VM private TTM BO (i.e., shares dma-resv with VM). The lifetime of the TTM BO is limited to when the SVM range is in VRAM (i.e., when a VRAM SVM range is migrated to SRAM, the TTM

Re: [PATCH v4 06/33] drm/gpusvm: Add support for GPU Shared Virtual Memory

2025-01-30 Thread Matthew Auld
On 29/01/2025 19:51, Matthew Brost wrote: This patch introduces support for GPU Shared Virtual Memory (SVM) in the Direct Rendering Manager (DRM) subsystem. SVM allows for seamless sharing of memory between the CPU and GPU, enhancing performance and flexibility in GPU computing tasks. The patch

Re: [PATCH v4 23/33] drm/xe: Add drm_pagemap ops to SVM

2025-01-30 Thread Matthew Auld
On 29/01/2025 19:52, Matthew Brost wrote: From: Thomas Hellström Add support for mapping device pages to Xe SVM by attaching drm_pagemap to a memory region, which is then linked to a GPU SVM devmem allocation. This enables GPU SVM to derive the device page address. v3: - Better commit messag

Re: [PATCH v4 11/33] drm/xe: Nuke VM's mapping upon close

2025-01-30 Thread Matthew Auld
On 29/01/2025 19:51, Matthew Brost wrote: Clear root PT entry and invalidate entire VM's address space when closing the VM. Will prevent the GPU from accessing any of the VM's memory after closing. v2: - s/vma/vm in kernel doc (CI) - Don't nuke migration VM as this occur at driver unload (CI

[PATCH v2] drm/tests/buddy: fix build with unused prng

2025-01-15 Thread Matthew Auld
: Add a testcase to verify the multiroot fini") Signed-off-by: Matthew Auld Cc: Arunpravin Paneer Selvam Cc: Christian König Reviewed-by: Thomas Hellström --- drivers/gpu/drm/tests/drm_buddy_test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c

[PATCH] drm/tests/buddy: fix build with unused prng

2025-01-15 Thread Matthew Auld
); Reported-by: Jani Nikula Reported-by: Thomas Hellström Fixes: 8cb3a1e2b350 ("drm/buddy: Add a testcase to verify the multiroot fini") Signed-off-by: Matthew Auld Cc: Arunpravin Paneer Selvam Cc: Christian König --- drivers/gpu/drm/tests/drm_buddy_test.c | 1 - 1 file changed,

Re: [PATCH v2 23/25] drm/xe: Compute dumb-buffer sizes with drm_mode_size_dumb()

2025-01-09 Thread Matthew Auld
On 09/01/2025 16:26, Thomas Zimmermann wrote: Hi Am 09.01.25 um 17:05 schrieb Matthew Auld: On 09/01/2025 14:57, Thomas Zimmermann wrote: Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and buffer size. Align the pitch to a multiple of 8. Align the buffer size according to

Re: [PATCH v2 23/25] drm/xe: Compute dumb-buffer sizes with drm_mode_size_dumb()

2025-01-09 Thread Matthew Auld
On 09/01/2025 14:57, Thomas Zimmermann wrote: Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and buffer size. Align the pitch to a multiple of 8. Align the buffer size according to hardware requirements. Signed-off-by: Thomas Zimmermann Cc: Lucas De Marchi Cc: "Thomas Hellströ

Re: [PATCH v2 2/2] drm/buddy: Add a testcase to verify the multiroot fini

2025-01-06 Thread Matthew Auld
Hey, On 06/01/2025 12:37, Paneer Selvam, Arunpravin wrote: Hi Matthew, Ping? Just got back from time off. I already slapped an r-b here: https://lore.kernel.org/dri-devel/aa27455c-04b8-494c-a3b5-c4385a774...@intel.com/ Regards, Arun. On 12/26/2024 12:31 PM, Arunpravin Paneer Selvam wrot

Re: [PATCH v2 2/2] drm/buddy: Add a testcase to verify the multiroot fini

2025-01-06 Thread Matthew Auld
: Arunpravin Paneer Selvam Signed-off-by: Lin.Cao Reviewed-by: Matthew Auld

Re: [PATCH 1/2] drm/buddy: fix issue that force_merge cannot free all roots

2024-12-16 Thread Matthew Auld
could fix this issue. Signed-off-by: Lin.Cao Reviewed-by: Matthew Auld

Re: [PATCH 2/2] drm/buddy: Add a testcase to verify the multiroot fini

2024-12-16 Thread Matthew Auld
On 16/12/2024 13:07, Arunpravin Paneer Selvam wrote: - Added a testcase to verify the multiroot force merge fini. - Added a new field in_use to track the mm freed status. Signed-off-by: Arunpravin Paneer Selvam Signed-off-by: Lin.Cao --- drivers/gpu/drm/drm_buddy.c| 20 ++

  1   2   3   4   5   6   7   8   9   10   >