[PATCH] drm/xe: Fix a build error

2024-01-27 Thread Oak Zeng
This fixes a build failure on drm-tip. This issue was introduced during merge of "drm/ttm: replace busy placement with flags v6". For some reason, the xe_bo.c part of above change is not merged. Manually merge the missing part to drm_tip Signed-off-by: Oak Zeng --- drivers/gpu/drm/

[PATCH 21/23] drm/xe/svm: GPU page fault support

2024-01-17 Thread Oak Zeng
: decide whether to migrate memory to GPU or map in place with CPU memory; migration granularity. There is rather complicated locking strategy in this patch. See more details in xe_svm_doc.h, lock design section. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas

[PATCH 17/23] drm/xe/svm: clean up svm range during process exit

2024-01-17 Thread Oak Zeng
Clean up svm range during process exit: Zap GPU page table of the svm process on process exit; unregister all the mmu interval notifiers which are registered before; free svm range and svm data structure. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas

[PATCH 19/23] drm/xe/svm: migrate svm range to vram

2024-01-17 Thread Oak Zeng
some pages, we will try to migrate the rest pages. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.c | 7 ++ drivers/gpu/drm/xe/xe_svm.h

[PATCH 11/23] drm/xe/svm: implement functions to allocate and free device memory

2024-01-17 Thread Oak Zeng
freed, we return all the pages in this memory block back to drm buddy. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.h| 9 ++ drivers/gpu

[PATCH 20/23] drm/xe/svm: Populate svm range

2024-01-17 Thread Oak Zeng
will be used for the GPU binding. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.c | 61 + 1 file changed, 61

[PATCH 23/23] drm/xe/svm: Add svm memory hints interface

2024-01-17 Thread Oak Zeng
Signed-off-by: Oak Zeng --- include/uapi/drm/xe_drm.h | 40 +++ 1 file changed, 40 insertions(+) diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h index 50bbea0992d9..551ed8706097 100644 --- a/include/uapi/drm/xe_drm.h +++ b/include/uapi/drm

[PATCH 13/23] drm/xe/svm: Handle CPU page fault

2024-01-17 Thread Oak Zeng
a page fault. Implement a page fault handler to migrate memory back to system memory and map it to CPU page table so the CPU program can proceed. Also unbind this page from GPU side, and free the original GPU device page Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off

[PATCH 07/23] drm/xe/svm: Add helper for binding hmm range to gpu

2024-01-17 Thread Oak Zeng
is introduced for svm range pre-commitment. A hmm_range pointer is added to xe_vma struct. v1: Make userptr member to be the last member of xe_vma struct Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_pt.c

[PATCH 02/23] drm/xe/svm: Add svm key data structures

2024-01-17 Thread Oak Zeng
virtual address range. All address ranges are maintained in xe_svm's interval tree. Also add a xe_svm pointer to xe_vm data structure. So we have a 1:1 mapping b/t xe_svm and xe_vm. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty

[PATCH 22/23] drm/xe/svm: Add DRM_XE_SVM kernel config entry

2024-01-17 Thread Oak Zeng
DRM_XE_SVM kernel config entry is added so xe svm feature can be configured before kernel compilation. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe

[PATCH 12/23] drm/xe/svm: Trace buddy block allocation and free

2024-01-17 Thread Oak Zeng
Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm_devmem.c | 5 - drivers/gpu/drm/xe/xe_trace.h | 35 ++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git

[PATCH 16/23] drm/xe/svm: Implement the mmu notifier range invalidate callback

2024-01-17 Thread Oak Zeng
. Thus, we start a kernel worker to unregister mmu interval notifier on a MMU_NOTIFY_UNMAP event. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.c

[PATCH 15/23] drm/xe/svm: Implement functions to register and unregister mmu notifier

2024-01-17 Thread Oak Zeng
-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.h | 14 ++ drivers/gpu/drm/xe/xe_svm_range.c | 73 +++ 2 files changed, 87 insertions(+) diff --git a/drivers/gpu/drm/xe

[PATCH 18/23] drm/xe/svm: Move a few structures to xe_gt.h

2024-01-17 Thread Oak Zeng
Move access_type and pagefault struct to header file so it can be shared with svm sub-system. This is preparation work for enabling page fault for svm. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_gt.h

[PATCH 14/23] drm/xe/svm: trace svm range migration

2024-01-17 Thread Oak Zeng
Add function to trace svm range migration, either from vram to sram, or sram to vram Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm_migrate.c | 1 + drivers/gpu/drm/xe/xe_trace.h | 30

[PATCH 10/23] drm/xe/svm: Introduce svm migration function

2024-01-17 Thread Oak Zeng
-system which doesn't have BO and TTM concept. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_migrate.c | 213 drivers/gpu/drm/xe/xe_migrate.h | 7 ++ 2 files changed, 220

[PATCH 09/23] drm/xe/svm: Remap and provide memmap backing for GPU vram

2024-01-17 Thread Oak Zeng
. This is TBD. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_device_types.h | 8 +++ drivers/gpu/drm/xe/xe_mmio.c | 7 +++ drivers/gpu/drm/xe

[PATCH 08/23] drm/xe/svm: Add helper to invalidate svm range from GPU

2024-01-17 Thread Oak Zeng
the zap_pte/tlb_inv functions directly. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_pt.c | 33 + drivers/gpu/drm/xe/xe_pt.h | 1 + 2 files changed, 34 insertions(+) diff

[PATCH 03/23] drm/xe/svm: create xe svm during vm creation

2024-01-17 Thread Oak Zeng
Create the xe_svm struct during xe_vm creation. Add xe_svm to a global hash table so later on we can retrieve xe_svm using mm_struct (the key). Destroy svm process during xe_vm close. Also add a helper function to retrieve svm struct from mm struct Signed-off-by: Oak Zeng Cc: Niranjana

[PATCH 05/23] drm/xe/svm: add helper to retrieve svm range from address

2024-01-17 Thread Oak Zeng
All valid virtual address range are maintained in svm's range_tree. This functions iterate svm's range tree and return the svm range that contains specific address. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu

[PATCH 04/23] drm/xe/svm: Trace svm creation

2024-01-17 Thread Oak Zeng
xe_vm tracepoint is extended to also print svm. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_trace.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe

[PATCH 06/23] drm/xe/svm: Introduce a helper to build sg table from hmm range

2024-01-17 Thread Oak Zeng
Introduce xe_svm_build_sg helper function to build a scatter gather table from a hmm_range struct. This is prepare work for binding hmm range to gpu. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas

[PATCH 01/23] drm/xe/svm: Add SVM document

2024-01-17 Thread Oak Zeng
Add shared virtual memory document. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- Documentation/gpu/xe/index.rst | 1 + Documentation/gpu/xe/xe_svm.rst | 8

[PATCH 00/23] XeKmd basic SVM support

2024-01-17 Thread Oak Zeng
. This work is based on previous I915 SVM implementation mainly from Niranjana Vishwanathapura and Oak Zeng, which has never been upstreamed before. This is our first attempt to upstream this work. This implementation depends on Linux kernel HMM support. See some key designs in patch #1. We are aware

[PATCH 16/22] drm/xe/svm: Implement the mmu notifier range invalidate callback

2023-12-20 Thread Oak Zeng
. Thus, we start a kernel worker to unregister mmu interval notifier on a MMU_NOTIFY_UNMAP event. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.c

[PATCH 21/22] drm/xe/svm: GPU page fault support

2023-12-20 Thread Oak Zeng
: decide whether to migrate memory to GPU or map in place with CPU memory; migration granularity. There is rather complicated locking strategy in this patch. See more details in xe_svm_doc.h, lock design section. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas

[PATCH 06/22] drm/xe/svm: Introduce a helper to build sg table from hmm range

2023-12-20 Thread Oak Zeng
Introduce xe_svm_build_sg helper function to build a scatter gather table from a hmm_range struct. This is prepare work for binding hmm range to gpu. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas

[PATCH 13/22] drm/xe/svm: Handle CPU page fault

2023-12-20 Thread Oak Zeng
a page fault. Implement a page fault handler to migrate memory back to system memory and map it to CPU page table so the CPU program can proceed. Also unbind this page from GPU side, and free the original GPU device page Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off

[PATCH 17/22] drm/xe/svm: clean up svm range during process exit

2023-12-20 Thread Oak Zeng
Clean up svm range during process exit: Zap GPU page table of the svm process on process exit; unregister all the mmu interval notifiers which are registered before; free svm range and svm data structure. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas

[PATCH 22/22] drm/xe/svm: Add DRM_XE_SVM kernel config entry

2023-12-20 Thread Oak Zeng
DRM_XE_SVM kernel config entry is added so xe svm feature can be configured before kernel compilation. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe

[PATCH 18/22] drm/xe/svm: Move a few structures to xe_gt.h

2023-12-20 Thread Oak Zeng
Move access_type and pagefault struct to header file so it can be shared with svm sub-system. This is preparation work for enabling page fault for svm. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_gt.h

[PATCH 10/22] drm/xe/svm: Introduce svm migration function

2023-12-20 Thread Oak Zeng
-system which doesn't have BO and TTM concept. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_migrate.c | 213 drivers/gpu/drm/xe/xe_migrate.h | 7 ++ 2 files changed, 220

[PATCH 20/22] drm/xe/svm: Populate svm range

2023-12-20 Thread Oak Zeng
will be used for the GPU binding. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.c | 61 + 1 file changed, 61

[PATCH 07/22] drm/xe/svm: Add helper for binding hmm range to gpu

2023-12-20 Thread Oak Zeng
is introduced for svm range pre-commitment. A hmm_range pointer is added to xe_vma struct. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_pt.c | 101 ++- drivers/gpu/drm/xe

[PATCH 15/22] drm/xe/svm: Implement functions to register and unregister mmu notifier

2023-12-20 Thread Oak Zeng
-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.h | 14 ++ drivers/gpu/drm/xe/xe_svm_range.c | 73 +++ 2 files changed, 87 insertions(+) diff --git a/drivers/gpu/drm/xe

[PATCH 14/22] drm/xe/svm: trace svm range migration

2023-12-20 Thread Oak Zeng
Add function to trace svm range migration, either from vram to sram, or sram to vram Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm_migrate.c | 1 + drivers/gpu/drm/xe/xe_trace.h | 30

[PATCH 02/22] drm/xe/svm: Add svm key data structures

2023-12-20 Thread Oak Zeng
virtual address range. All address ranges are maintained in xe_svm's interval tree. Also add a xe_svm pointer to xe_vm data structure. So we have a 1:1 mapping b/t xe_svm and xe_vm. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty

[PATCH 09/22] drm/xe/svm: Remap and provide memmap backing for GPU vram

2023-12-20 Thread Oak Zeng
. This is TBD. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_device_types.h | 8 +++ drivers/gpu/drm/xe/xe_mmio.c | 7 +++ drivers/gpu/drm/xe

[PATCH 19/22] drm/xe/svm: migrate svm range to vram

2023-12-20 Thread Oak Zeng
some pages, we will try to migrate the rest pages. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.c | 7 ++ drivers/gpu/drm/xe/xe_svm.h

[PATCH 03/22] drm/xe/svm: create xe svm during vm creation

2023-12-20 Thread Oak Zeng
Create the xe_svm struct during xe_vm creation. Add xe_svm to a global hash table so later on we can retrieve xe_svm using mm_struct (the key). Destroy svm process during xe_vm close. Also add a helper function to retrieve svm struct from mm struct Signed-off-by: Oak Zeng Cc: Niranjana

[PATCH 08/22] drm/xe/svm: Add helper to invalidate svm range from GPU

2023-12-20 Thread Oak Zeng
the zap_pte/tlb_inv functions directly. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_pt.c | 33 + drivers/gpu/drm/xe/xe_pt.h | 1 + 2 files changed, 34 insertions(+) diff

[PATCH 11/22] drm/xe/svm: implement functions to allocate and free device memory

2023-12-20 Thread Oak Zeng
freed, we return all the pages in this memory block back to drm buddy. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm.h| 9 ++ drivers/gpu

[PATCH 12/22] drm/xe/svm: Trace buddy block allocation and free

2023-12-20 Thread Oak Zeng
Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_svm_devmem.c | 5 - drivers/gpu/drm/xe/xe_trace.h | 35 ++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git

[PATCH 00/22] XeKmd basic SVM support

2023-12-20 Thread Oak Zeng
. This work is based on previous I915 SVM implementation mainly from Niranjana Vishwanathapura and Oak Zeng, which has never been upstreamed before. This is our first attempt to upstream this work. This implementation depends on Linux kernel HMM support. See some key designs in patch #1. We are aware

[PATCH 05/22] drm/xe/svm: add helper to retrieve svm range from address

2023-12-20 Thread Oak Zeng
All valid virtual address range are maintained in svm's range_tree. This functions iterate svm's range tree and return the svm range that contains specific address. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu

[PATCH 04/22] drm/xe/svm: Trace svm creation

2023-12-20 Thread Oak Zeng
xe_vm tracepoint is extended to also print svm. Signed-off-by: Oak Zeng Cc: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- drivers/gpu/drm/xe/xe_trace.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe

[PATCH 01/22] drm/xe/svm: Add SVM document

2023-12-20 Thread Oak Zeng
Add shared virtual memory document. Signed-off-by: Oak Zeng Co-developed-by: Niranjana Vishwanathapura Signed-off-by: Niranjana Vishwanathapura Cc: Matthew Brost Cc: Thomas Hellström Cc: Brian Welty --- Documentation/gpu/xe/index.rst | 1 + Documentation/gpu/xe/xe_svm.rst | 8

[RFC 04/11] drm: Add evict function pointer to drm lru entity

2023-11-01 Thread Oak Zeng
list. This way ttm and svm codes can mutually evict resources from each other. Signed-off-by: Oak Zeng --- drivers/gpu/drm/drm_evictable_lru.c | 36 +- include/drm/drm_evictable_lru.h | 74 - 2 files changed, 108 insertions(+), 2 deletions(-) diff --git

[RFC 11/11] drm/ttm: Write ttm functions using drm lru manager functions

2023-11-01 Thread Oak Zeng
manager functions. Signed-off-by: Oak Zeng --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/ttm/tests/ttm_device_test.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c| 20 +-- drivers/gpu/drm/ttm/ttm_bo_util.c

[RFC 10/11] drm/ttm: Implement ttm memory evict functions

2023-11-01 Thread Oak Zeng
resource eviction functions, thus TTM and SVM can mutually evict resources from each other. Signed-off-by: Oak Zeng --- drivers/gpu/drm/ttm/ttm_bo.c | 192 --- include/drm/ttm/ttm_bo.h | 2 + 2 files changed, 158 insertions(+), 36 deletions(-) diff --git

[RFC 06/11] drm/ttm: Set lru manager to ttm resource manager

2023-11-01 Thread Oak Zeng
Add a weak reference of lru manager to ttm resource manager, and add a function to set lru manager for ttm resource manager. Signed-off-by: Oak Zeng --- include/drm/ttm/ttm_resource.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/include/drm/ttm/ttm_resource.h b

[RFC 09/11] drm/ttm: Use drm LRU manager iterator

2023-11-01 Thread Oak Zeng
Since TTM resource LRU list is moved to drm LRU manager layer, use drm lru manager iterator instead of TTM resource manager iterator. TTM resource manager iterator is deleted. No function change. Signed-off-by: Oak Zeng --- drivers/gpu/drm/ttm/ttm_bo.c | 7 ++-- drivers/gpu/drm/ttm

[RFC 05/11] drm: Replace ttm macros with drm macros

2023-11-01 Thread Oak Zeng
TTM_MAX_BO_PRIORITY and TTM_NUM_MEM_TYPES are move from ttm to drm, so: s/TTM_MAX_BO_PRIORITY/DRM_MAX_LRU_PRIORITY s/TTM_NUM_MEM_TYPES/DRM_NUM_MEM_TYPES Signed-off-by: Oak Zeng --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- drivers/gpu/drm/i915/intel_region_ttm.c | 2

[RFC 08/11] drm: Initialize drm lru manager

2023-11-01 Thread Oak Zeng
Initialize lru_mgr for each memory type or memory region. Also set ttm_resource_manager's weak reference to drm lru manager. Signed-off-by: Oak Zeng --- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 6 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 6 ++ drivers/gpu/drm/amd

[RFC 07/11] drm/ttm: re-parameterize a few ttm functions

2023-11-01 Thread Oak Zeng
Add a struct drm_device *drm parameter to function ttm_range_man_init, ttm_range_man_fini, ttm_sys_man_init, and ttm_sys_man_free. This drm parameter will be used in the coming patches to retrieve and initialize drm lru manager. Signed-off-by: Oak Zeng --- drivers/gpu/drm/amd/amdgpu

[PATCH 00/11] Introduce drm evictable lru

2023-11-01 Thread Oak Zeng
. Oak Zeng (11): drm/ttm: re-parameter ttm_device_init drm: move lru_lock from ttm_device to drm_device drm: introduce drm evictable LRU drm: Add evict function pointer to drm lru entity drm: Replace ttm macros with drm macros drm/ttm: Set lru manager to ttm resource manager drm/ttm

[RFC 02/11] drm: move lru_lock from ttm_device to drm_device

2023-11-01 Thread Oak Zeng
. To minimize code change, struct ttm_device still hold a weak reference of lru_lock, so ttm layer can still reference to this lock easily. Signed-off-by: Oak Zeng --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 4 +- drivers/gpu/drm/drm_drv.c

[RFC 03/11] drm: introduce drm evictable LRU

2023-11-01 Thread Oak Zeng
ice and is added to struct drm_deive, so it can be shared b/t ttm code and svm code. Signed-off-by: Oak Zeng --- drivers/gpu/drm/Makefile| 1 + drivers/gpu/drm/drm_evictable_lru.c | 232 include/drm/drm_device.h| 7 + include/drm/drm_evictable_lr

[RFC 01/11] drm/ttm: re-parameter ttm_device_init

2023-11-01 Thread Oak Zeng
Change the 3rd parameter of ttm_device_init from struct device * to struct drm_device *. This is a prepare work for moving lru_lock from ttm_device to drm_device. Signed-off-by: Oak Zeng --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 2

[PATCH 1/2] drm/amdgpu: fix compile error on architecture s390

2021-03-15 Thread Oak Zeng
ioremap_cache is not supported on some architecture such as s390. Put the codes into a #ifdef to fix some compile error reported by test robot. Signed-off-by: Oak Zeng Reported-by: Kernel test robot --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 1/2] drm/amdgpu: fix compile error on architecture s390

2021-03-10 Thread Oak Zeng
ioremap_cache is not supported on some architecture such as s390. Put the codes into a #ifdef to fix some compile error reported by test robot. Signed-off-by: Oak Zeng Reported-by: Kernel test robot --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 2/2] drm/amdgpu: fix a few compiler warnings

2021-03-10 Thread Oak Zeng
1. make function mmhub_v1_7_setup_vm_pt_regs static 2. indent a if statement Signed-off-by: Oak Zeng Reported-by: kernel test robot Reported-by: Dan Carpenter --- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c | 2 +- 2 files changed, 3 insertions

[PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

2021-03-04 Thread Oak Zeng
-by: Oak Zeng Reviewed-by: Christian Konig --- drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 031e581..296bb20 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers

[PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

2021-03-04 Thread Oak Zeng
-by: Oak Zeng Reviewed-by: Christian Konig --- drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 031e581..7429464 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers

[PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

2021-03-03 Thread Oak Zeng
-by: Oak Zeng Reviewed-by: Christian Konig --- drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 031e581..7c848e2 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers

[PATCH] drm/ttm: PLEASE ignore. Just test Intel build robot.

2021-03-02 Thread Oak Zeng
as device memory is mapped cached from CPU. Signed-off-by: Oak Zeng Reviewed-by: Christian Konig --- drivers/gpu/drm/ttm/ttm_bo_util.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 031e581..8c65a13 100644

[PATCH] drm/ttm: PLEASE ignore. Just test Intel build robot.

2021-03-02 Thread Oak Zeng
as device memory is mapped cached from CPU. Signed-off-by: Oak Zeng Reviewed-by: Christian Konig --- drivers/gpu/drm/ttm/ttm_bo_util.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 031e581..8c65a13 100644

[PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

2021-03-01 Thread Oak Zeng
-by: Oak Zeng Reviewed-by: Christian Konig --- drivers/gpu/drm/ttm/ttm_bo_util.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 031e581..8c65a13 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm