*** multiple level VMPT enablement ***
Subsystems (2)
cover *** multiple level VMPT enablement ***
*** BLURB HERE ***
From Vega, ascis start to support multiple level vmpt, the series is to implement it.
Tested successfully with 2/3/4 levels.
Christian König (10):
drm/amdgpu: rename page_directory_fence to last_dir_update drm/amdgpu: add the VM pointer to the amdgpu_pte_update_params as well drm/amdgpu: add num_level to the VM manager
drm/amdgpu: generalize page table level
drm/amdgpu: handle multi level PD size calculation drm/amdgpu: handle multi level PD during validation drm/amdgpu: handle multi level PD in the LRU
drm/amdgpu: handle multi level PD updates
drm/amdgpu: handle multi level PD during PT updates drm/amdgpu: add alloc/free for multi level PDs
Chunming Zhou (8):
drm/amdgpu: set page table depth by num_level drm/amdgpu: block size of multiple level vmpt prefers one page drm/amdgpu: fix update sub levels
drm/amdgpu: sub levels need to update regardless of parent updates drm/amdgpu: clear entries allocation
drm/amdgpu: fix entries index calculation
drm/amdgpu: need alloc sub level even parent bo was allocated drm/amdgpu: enable four level vmpt
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 474 ++++++++++++++++++++----------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 16 +- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 2 +- 11 files changed, 336 insertions(+), 175 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1490325417-26745-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org
PATCH 1/18 drm/amdgpu: rename page_directory_fence to last_dir_update
From: Christian König <[email protected]>
Decribes better what this is used for.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -791,7 +791,7 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,if (r)return r; - r =amdgpu_sync_fence (adev, &p->job->sync, vm->page_directory_fence); + r =amdgpu_sync_fence (adev, &p->job->sync, vm->last_dir_update);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -4
@@ -705,8 +705,8 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, goto error_free;amdgpu_bo_fence (vm->page_directory, fence, true); -fence_put (vm->page_directory_fence); - vm->page_directory_fence =fence_get (fence); +fence_put (vm->last_dir_update); + vm->last_dir_update =fence_get (fence);fence_put (fence);return 0 ;
@@ -1596,7 +1596,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)if (r) goto err; - vm->page_directory_fence =NULL ; + vm->last_dir_update =NULL ; r = amdgpu_bo_create(adev, pd_size, align, true, AMDGPU_GEM_DOMAIN_VRAM,
@@ -1673,7 +1673,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)amdgpu_bo_unref (&vm->page_directory->shadow);amdgpu_bo_unref (&vm->page_directory); -fence_put (vm->page_directory_fence); +fence_put (vm->last_dir_update); }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -1
@@ -97,7 +97,7 @@ struct amdgpu_vm {/* contains the page directory */ struct amdgpu_bo *page_directory;unsigned max_pde_used; -struct fence *page_directory_fence; +struct fence *last_dir_update;uint64_t last_eviction_counter;/* array of page tables, one for each page directory entry */
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/18 drm/amdgpu: add the VM pointer to the amdgpu_pte_update_params as well
In reply to a message not in the archiveFrom: Christian König <[email protected]>
This way we save passing it through the different functions.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +11 -10
@@ -61,6 +61,8 @@struct amdgpu_pte_update_params {/* amdgpu device we do this update for */ struct amdgpu_device *adev; +/* optional amdgpu_vm we do this update for */ +struct amdgpu_vm *vm;/* address where to copy page table entries from */ uint64_t src;/* indirect buffer to fill with commands */
@@ -729,7 +731,6 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,* Update the page tables in the range @start - @end. */ static void amdgpu_vm_update_ptes (struct amdgpu_pte_update_params *params, -struct amdgpu_vm *vm,uint64_t start,uint64_t end,uint64_t dst,uint64_t flags) {
@@ -745,7 +746,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,/* initialize the variables */ addr = start; pt_idx = addr >> amdgpu_vm_block_size; - pt = vm->page_tables[pt_idx].bo; + pt = params->vm->page_tables[pt_idx].bo;if (params->shadow) {if (!pt->shadow)return ;
@@ -768,7 +769,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,/* walk over the address space and update the page tables */ while (addr < end) { pt_idx = addr >> amdgpu_vm_block_size; - pt = vm->page_tables[pt_idx].bo; + pt = params->vm->page_tables[pt_idx].bo;if (params->shadow) {if (!pt->shadow)return ;
@@ -819,7 +820,6 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,* @flags: hw mapping flags */ static void amdgpu_vm_frag_ptes (struct amdgpu_pte_update_params *params, -struct amdgpu_vm *vm,uint64_t start,uint64_t end,uint64_t dst,uint64_t flags) {
@@ -853,25 +853,25 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params,if (params->src || !(flags &AMDGPU_PTE_VALID ) || (frag_start >= frag_end)) { -amdgpu_vm_update_ptes (params, vm, start, end, dst, flags); +amdgpu_vm_update_ptes (params, start, end, dst, flags);return ; }/* handle the 4K area at the beginning */ if (start != frag_start) { -amdgpu_vm_update_ptes (params, vm, start, frag_start, +amdgpu_vm_update_ptes (params, start, frag_start, dst, flags); dst += (frag_start - start) *AMDGPU_GPU_PAGE_SIZE ; }/* handle the area in the middle */ -amdgpu_vm_update_ptes (params, vm, frag_start, frag_end, dst, +amdgpu_vm_update_ptes (params, frag_start, frag_end, dst, flags | frag_flags);/* handle the 4K area at the end */ if (frag_end != end) { dst += (frag_end - frag_start) *AMDGPU_GPU_PAGE_SIZE ; -amdgpu_vm_update_ptes (params, vm, frag_end, end, dst, flags); +amdgpu_vm_update_ptes (params, frag_end, end, dst, flags); } }
@@ -911,6 +911,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,memset (¶ms,0 ,sizeof (params)); params.adev = adev; + params.vm = vm; params.src = src; ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
@@ -992,9 +993,9 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, goto error_free; params.shadow = true; -amdgpu_vm_frag_ptes (¶ms, vm, start, last +1 , addr, flags); +amdgpu_vm_frag_ptes (¶ms, start, last +1 , addr, flags); params.shadow = false; -amdgpu_vm_frag_ptes (¶ms, vm, start, last +1 , addr, flags); +amdgpu_vm_frag_ptes (¶ms, start, last +1 , addr, flags);amdgpu_ring_pad_ib (ring, params.ib);WARN_ON (params.ib->length_dw > ndw);
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/18 drm/amdgpu: add num_level to the VM manager
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Needs to be filled with handling.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + 5 files changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -0
@@ -151,6 +151,7 @@ struct amdgpu_vm_manager {unsigned seqno[AMDGPU_MAX_RINGS ];uint32_t max_pfn; +uint32_t num_level;/* vram base address for page table entry */ u64 vram_base_offset;/* is vm enabled? */
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
@@ -607,6 +607,7 @@ static int gmc_v6_0_vm_init(struct amdgpu_device *adev)* amdkfd will use VMIDs 8-15 */ adev->vm_manager.num_ids =AMDGPU_NUM_OF_VMIDS ; + adev->vm_manager.num_level =1 ;amdgpu_vm_manager_init (adev);/* base offset of vram pages */
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -0
@@ -734,6 +734,7 @@ static int gmc_v7_0_vm_init(struct amdgpu_device *adev)* amdkfd will use VMIDs 8-15 */ adev->vm_manager.num_ids =AMDGPU_NUM_OF_VMIDS ; + adev->vm_manager.num_level =1 ; adev->vm_manager.shared_aperture_start =0x2000000000000000ULL ; adev->vm_manager.shared_aperture_end = adev->vm_manager.shared_aperture_start + (4ULL <<30 ) -1 ;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
@@ -865,6 +865,7 @@ static int gmc_v8_0_vm_init(struct amdgpu_device *adev)* amdkfd will use VMIDs 8-15 */ adev->vm_manager.num_ids =AMDGPU_NUM_OF_VMIDS ; + adev->vm_manager.num_level =1 ; adev->vm_manager.shared_aperture_start =0x2000000000000000ULL ; adev->vm_manager.shared_aperture_end = adev->vm_manager.shared_aperture_start + (4ULL <<30 ) -1 ;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -0
@@ -508,6 +508,7 @@ static int gmc_v9_0_vm_init(struct amdgpu_device *adev)* amdkfd will use VMIDs 8-15 */ adev->vm_manager.num_ids =AMDGPU_NUM_OF_VMIDS ; + adev->vm_manager.num_level =1 ;amdgpu_vm_manager_init (adev);return 0 ;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/18 drm/amdgpu: generalize page table level
In reply to a message not in the archiveFrom: Christian König <[email protected]>
No functional change, but the base for multi level page tables.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 87 +++++++++++++++++----------------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 9 ++-- 3 files changed, 50 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -873,7 +873,7 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, }if (p->job->vm) { - p->job->vm_pd_addr =amdgpu_bo_gpu_offset (vm->page_directory); + p->job->vm_pd_addr =amdgpu_bo_gpu_offset (vm->root.bo); r =amdgpu_bo_vm_update_pte (p, vm);if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +44 -43
235 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +5 -4
@@ -76,6 +76,10 @@struct amdgpu_vm_pt {struct amdgpu_bo *bo;uint64_t addr; + +/* array of page tables, one for each directory entry */ +struct amdgpu_vm_pt *entries; +unsigned last_entry_used; };struct amdgpu_vm {
@@ -95,13 +99,10 @@ struct amdgpu_vm {struct list_head freed;/* contains the page directory */ -struct amdgpu_bo *page_directory; -unsigned max_pde_used; +struct amdgpu_vm_pt root;struct fence *last_dir_update;uint64_t last_eviction_counter; -/* array of page tables, one for each page directory entry */ -struct amdgpu_vm_pt *page_tables;/* for id and flush management per ring */ struct amdgpu_vm_id *ids[AMDGPU_MAX_RINGS ];
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/18 drm/amdgpu: handle multi level PD size calculation
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Allows us to get the size for all levels as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +22 -12
@@ -76,27 +76,37 @@ struct amdgpu_pte_update_params { };/** -* amdgpu_vm_num_pde - return the number of page directory entries +* amdgpu_vm_num_entries - return the number of entries in a PD/PT * * @adev: amdgpu_device pointer * -* Calculate the number of page directory entries. +* Calculate the number of entries in a page directory or page table. */ -static unsigned amdgpu_vm_num_pdes (struct amdgpu_device *adev) +static unsigned amdgpu_vm_num_entries (struct amdgpu_device *adev, +unsigned level) { -return adev->vm_manager.max_pfn >> amdgpu_vm_block_size; +if (level ==0 ) +/* For the root directory */ +return adev->vm_manager.max_pfn >> + (amdgpu_vm_block_size * adev->vm_manager.num_level); +else if (level == adev->vm_manager.num_level) +/* For the page tables on the leaves */ +return AMDGPU_VM_PTE_COUNT ; +else +/* Everything in between */ +return 1 << amdgpu_vm_block_size; }/** -* amdgpu_vm_directory_size - returns the size of the page directory in bytes +* amdgpu_vm_bo_size - returns the size of the BOs in bytes * * @adev: amdgpu_device pointer * -* Calculate the size of the page directory in bytes. +* Calculate the size of the BO for a page directory or page table in bytes. */ -static unsigned amdgpu_vm_directory_size (struct amdgpu_device *adev) +static unsigned amdgpu_vm_bo_size (struct amdgpu_device *adev,unsigned level) { -return AMDGPU_GPU_PAGE_ALIGN (amdgpu_vm_num_pdes (adev) *8 ); +return AMDGPU_GPU_PAGE_ALIGN (amdgpu_vm_num_entries (adev, level) *8 ); }/**
@@ -1393,7 +1403,7 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, saddr >>= amdgpu_vm_block_size; eaddr >>= amdgpu_vm_block_size; -BUG_ON (eaddr >=amdgpu_vm_num_pdes (adev)); +BUG_ON (eaddr >=amdgpu_vm_num_entries (adev,0 ));if (eaddr > vm->root.last_entry_used) vm->root.last_entry_used = eaddr;
@@ -1576,8 +1586,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)INIT_LIST_HEAD (&vm->cleared);INIT_LIST_HEAD (&vm->freed); - pd_size =amdgpu_vm_directory_size (adev); - pd_entries =amdgpu_vm_num_pdes (adev); + pd_size =amdgpu_vm_bo_size (adev,0 ); + pd_entries =amdgpu_vm_num_entries (adev,0 );/* allocate page table array */ vm->root.entries = drm_calloc_large(pd_entries,
@@ -1662,7 +1672,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)kfree (mapping); } -for (i =0 ; i <amdgpu_vm_num_pdes (adev); i++) { +for (i =0 ; i <amdgpu_vm_num_entries (adev,0 ); i++) {struct amdgpu_bo *pt = vm->root.entries[i].bo;if (!pt)
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/18 drm/amdgpu: handle multi level PD during validation
In reply to a message not in the archiveFrom: Christian König <[email protected]>
All page directory levels should be in place after this.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 57 +++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +42 -15
@@ -132,6 +132,47 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, }/** +* amdgpu_vm_validate_layer - validate a single page table level +* +* @parent: parent page table level +* @validate: callback to do the validation +* @param: parameter for the validation callback +* +* Validate the page table BOs on command submission if neccessary. +*/ +static int amdgpu_vm_validate_level (struct amdgpu_vm_pt *parent, +int (*validate)(void *,struct amdgpu_bo *), +void *param) +{ +unsigned i; +int r; + +if (!parent->entries) +return 0 ; + +for (i =0 ; i <= parent->last_entry_used; ++i) { +struct amdgpu_vm_pt *entry = &parent->entries[i]; + +if (!entry->bo) +continue ; + + r =validate (param, entry->bo); +if (r) +return r; + +/* +* Recurse into the sub directory. This is harmless because we +* have only a maximum of 5 layers. +*/ + r =amdgpu_vm_validate_level (entry, validate, param); +if (r) +return r; + } + +return r; +} + +/** * amdgpu_vm_validate_pt_bos - validate the page table BOs * * @adev: amdgpu device pointer
@@ -146,8 +187,6 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, void *param) {uint64_t num_evictions; -unsigned i; -int r;/* We only need to validate the page tables * if they aren't already valid.
@@ -156,19 +195,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,if (num_evictions == vm->last_eviction_counter)return 0 ; -/* add the vm page table to the list */ -for (i =0 ; i <= vm->root.last_entry_used; ++i) { -struct amdgpu_bo *bo = vm->root.entries[i].bo; - -if (!bo) -continue ; - - r =validate (param, bo); -if (r) -return r; - } - -return 0 ; +return amdgpu_vm_validate_level (&vm->root, validate, param); }/**
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/18 drm/amdgpu: handle multi level PD in the LRU
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Move all levels to the end after command submission.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 36 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +27 -9
@@ -199,28 +199,46 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, }/** -* amdgpu_vm_move_pt_bos_in_lru - move the PT BOs to the LRU tail +* amdgpu_vm_move_level_in_lru - move one level of PT BOs to the LRU tail * * @adev: amdgpu device instance * @vm: vm providing the BOs * * Move the PT BOs to the tail of the LRU. */ -void amdgpu_vm_move_pt_bos_in_lru (struct amdgpu_device *adev, -struct amdgpu_vm *vm) +static void amdgpu_vm_move_level_in_lru (struct amdgpu_vm_pt *parent) { -struct ttm_bo_global *glob = adev->mman.bdev.glob;unsigned i; -spin_lock (&glob->lru_lock); -for (i =0 ; i <= vm->root.last_entry_used; ++i) { -struct amdgpu_bo *bo = vm->root.entries[i].bo; +if (!parent->entries) +return ; -if (!bo) +for (i =0 ; i <= parent->last_entry_used; ++i) { +struct amdgpu_vm_pt *entry = &parent->entries[i]; + +if (!entry->bo)continue ; -ttm_bo_move_to_lru_tail (&bo->tbo); +ttm_bo_move_to_lru_tail (&entry->bo->tbo); +amdgpu_vm_move_level_in_lru (entry); } +} + +/** +* amdgpu_vm_move_pt_bos_in_lru - move the PT BOs to the LRU tail +* +* @adev: amdgpu device instance +* @vm: vm providing the BOs +* +* Move the PT BOs to the tail of the LRU. +*/ +void amdgpu_vm_move_pt_bos_in_lru (struct amdgpu_device *adev, +struct amdgpu_vm *vm) +{ +struct ttm_bo_global *glob = adev->mman.bdev.glob; + +spin_lock (&glob->lru_lock); +amdgpu_vm_move_level_in_lru (&vm->root);spin_unlock (&glob->lru_lock); }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/18 drm/amdgpu: handle multi level PD updates
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Update all levels of the page directory.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 67 ++++++++++++++++++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 +- 4 files changed, 54 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -787,7 +787,7 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,struct amdgpu_bo *bo;int i, r; - r =amdgpu_vm_update_page_directory (adev, vm); + r =amdgpu_vm_update_directories (adev, vm);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
@@ -691,7 +691,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,if (r) goto error; - r =amdgpu_vm_update_page_directory (adev, bo_va->vm); + r =amdgpu_vm_update_directories (adev, bo_va->vm);if (r) goto error;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +50 -17
133 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -2
@@ -191,8 +191,8 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, struct amdgpu_job *job);int amdgpu_vm_flush (struct amdgpu_ring *ring,struct amdgpu_job *job);void amdgpu_vm_reset_id (struct amdgpu_device *adev,unsigned vm_id); -int amdgpu_vm_update_page_directory (struct amdgpu_device *adev, -struct amdgpu_vm *vm); +int amdgpu_vm_update_directories (struct amdgpu_device *adev, +struct amdgpu_vm *vm);int amdgpu_vm_clear_freed (struct amdgpu_device *adev,struct amdgpu_vm *vm); int amdgpu_vm_clear_invalids(struct amdgpu_device *adev, struct amdgpu_vm *vm,
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/18 drm/amdgpu: handle multi level PD during PT updates
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Not the best solution, but good enough for now.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 39 +++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +34 -5
@@ -807,6 +807,32 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev, }/** +* amdgpu_vm_find_pt - find the page table for an address +* +* @p: see amdgpu_pte_update_params definition +* @addr: virtual address in question +* +* Find the page table BO for a virtual address, return NULL when none found. +*/ +static struct amdgpu_bo *amdgpu_vm_get_pt (struct amdgpu_pte_update_params *p, +uint64_t addr) +{ +struct amdgpu_vm_pt *entry = &p->vm->root; +unsigned idx, level = p->adev->vm_manager.num_level; + +while (entry->entries) { + idx = addr >> (amdgpu_vm_block_size * level--); + idx %=amdgpu_bo_size (entry->bo) /8 ; + entry = &entry->entries[idx]; + } + +if (level) +return NULL ; + +return entry->bo; +} + +/** * amdgpu_vm_update_ptes - make sure that page tables are valid * * @params: see amdgpu_pte_update_params definition
@@ -826,15 +852,16 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,uint64_t cur_pe_start, cur_nptes, cur_dst;uint64_t addr;/* next GPU address to be updated */ -uint64_t pt_idx;struct amdgpu_bo *pt;unsigned nptes;/* next number of ptes to be updated */ uint64_t next_pe_start;/* initialize the variables */ addr = start; - pt_idx = addr >> amdgpu_vm_block_size; - pt = params->vm->root.entries[pt_idx].bo; + pt =amdgpu_vm_get_pt (params, addr); +if (!pt) +return ; +if (params->shadow) {if (!pt->shadow)return ;
@@ -856,8 +883,10 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,/* walk over the address space and update the page tables */ while (addr < end) { - pt_idx = addr >> amdgpu_vm_block_size; - pt = params->vm->root.entries[pt_idx].bo; + pt =amdgpu_vm_get_pt (params, addr); +if (!pt) +return ; +if (params->shadow) {if (!pt->shadow)return ;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/18 drm/amdgpu: add alloc/free for multi level PDs
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Allocate and free page directories on demand.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 178 ++++++++++++++++++++------------- 1 file changed, 107 insertions(+), 71 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +107 -71
@@ -1433,6 +1433,83 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,return bo_va; } +/** +* amdgpu_vm_alloc_levels - allocate the PD/PT levels +* +* @adev: amdgpu_device pointer +* @vm: requested vm +* @saddr: start of the address range +* @eaddr: end of the address range +* +* Make sure the page directories and page tables are allocated +*/ +static int amdgpu_vm_alloc_levels (struct amdgpu_device *adev, +struct amdgpu_vm *vm, +struct amdgpu_vm_pt *parent, +uint64_t saddr,uint64_t eaddr, +unsigned level) +{ +unsigned shift = (adev->vm_manager.num_level - level) * + amdgpu_vm_block_size; +unsigned pt_idx, from, to; +int r; + +if (!parent->entries) { +unsigned num_entries =amdgpu_vm_num_entries (adev, level); + + parent->entries =drm_calloc_large (num_entries, +sizeof (struct amdgpu_vm_pt )); +if (!parent->entries) +return -ENOMEM ; + } + + from = saddr >> shift; + to = eaddr >> shift; + +if (to > parent->last_entry_used) + parent->last_entry_used = to; + + ++level; + +/* walk over the address space and allocate the page tables */ +for (pt_idx = from; pt_idx <= to; ++pt_idx) { +struct reservation_object *resv = vm->root.bo->tbo.resv; +struct amdgpu_vm_pt *entry = &parent->entries[pt_idx]; +struct amdgpu_bo *pt; + +if (entry->bo) +continue ; + + r =amdgpu_bo_create (adev,amdgpu_vm_bo_size (adev, level), +AMDGPU_GPU_PAGE_SIZE , true, +AMDGPU_GEM_DOMAIN_VRAM , +AMDGPU_GEM_CREATE_NO_CPU_ACCESS | +AMDGPU_GEM_CREATE_SHADOW | +AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | +AMDGPU_GEM_CREATE_VRAM_CLEARED , +NULL , resv, &pt); +if (r) +return r; + +/* Keep a reference to the root directory to avoid +* freeing them up in the wrong order. +*/ + pt->parent =amdgpu_bo_ref (vm->root.bo); + + entry->bo = pt; + entry->addr =0 ; + +if (level < adev->vm_manager.num_level) { + r =amdgpu_vm_alloc_levels (adev, vm, entry, saddr, + eaddr, level); +if (r) +return r; + } + } + +return 0 ; +} +/** * amdgpu_vm_bo_map - map bo inside a vm *
@@ -1455,7 +1532,7 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,struct amdgpu_bo_va_mapping *mapping;struct amdgpu_vm *vm = bo_va->vm;struct interval_tree_node *it; -unsigned last_pfn, pt_idx; +unsigned last_pfn;uint64_t eaddr;int r;
@@ -1506,46 +1583,10 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,list_add (&mapping->list, &bo_va->invalids);interval_tree_insert (&mapping->it, &vm->va); -/* Make sure the page tables are allocated */ - saddr >>= amdgpu_vm_block_size; - eaddr >>= amdgpu_vm_block_size; - -BUG_ON (eaddr >=amdgpu_vm_num_entries (adev,0 )); - -if (eaddr > vm->root.last_entry_used) - vm->root.last_entry_used = eaddr; - -/* walk over the address space and allocate the page tables */ -for (pt_idx = saddr; pt_idx <= eaddr; ++pt_idx) { -struct reservation_object *resv = vm->root.bo->tbo.resv; -struct amdgpu_bo *pt; - -if (vm->root.entries[pt_idx].bo) -continue ; - - r =amdgpu_bo_create (adev,AMDGPU_VM_PTE_COUNT *8 , -AMDGPU_GPU_PAGE_SIZE , true, -AMDGPU_GEM_DOMAIN_VRAM , -AMDGPU_GEM_CREATE_NO_CPU_ACCESS | -AMDGPU_GEM_CREATE_SHADOW | -AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | -AMDGPU_GEM_CREATE_VRAM_CLEARED , -NULL , resv, &pt); -if (r) - goto error_free; - -/* Keep a reference to the page table to avoid freeing -* them up in the wrong order. -*/ - pt->parent =amdgpu_bo_ref (vm->root.bo); - - vm->root.entries[pt_idx].bo = pt; - vm->root.entries[pt_idx].addr =0 ; - } - -return 0 ; + r =amdgpu_vm_alloc_levels (adev, vm, &vm->root, saddr, eaddr,0 ); +if (!r) +return 0 ; -error_free:list_del (&mapping->list);interval_tree_remove (&mapping->it, &vm->va);trace_amdgpu_vm_bo_unmap (bo_va, mapping);
@@ -1678,7 +1719,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) {const unsigned align =min (AMDGPU_VM_PTB_ALIGN_SIZE ,AMDGPU_VM_PTE_COUNT *8 ); -unsigned pd_size, pd_entries;unsigned ring_instance;struct amdgpu_ring *ring;struct amd_sched_rq *rq;
@@ -1693,17 +1733,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)INIT_LIST_HEAD (&vm->cleared);INIT_LIST_HEAD (&vm->freed); - pd_size =amdgpu_vm_bo_size (adev,0 ); - pd_entries =amdgpu_vm_num_entries (adev,0 ); - -/* allocate page table array */ - vm->root.entries =drm_calloc_large (pd_entries, -sizeof (struct amdgpu_vm_pt )); -if (vm->root.entries ==NULL ) { -DRM_ERROR ("Cannot allocate memory for page table array\n" ); -return -ENOMEM ; - } -/* create scheduler entity for page table updates */ ring_instance =atomic_inc_return (&adev->vm_manager.vm_pte_next_ring);
@@ -1713,11 +1742,11 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) r =amd_sched_entity_init (&ring->sched, &vm->entity, rq, amdgpu_sched_jobs);if (r) - goto err; +return r; vm->last_dir_update =NULL ; - r = amdgpu_bo_create(adev, pd_size, align, true, + r = amdgpu_bo_create(adev, amdgpu_vm_bo_size(adev, 0), align, true, AMDGPU_GEM_DOMAIN_VRAM, AMDGPU_GEM_CREATE_NO_CPU_ACCESS | AMDGPU_GEM_CREATE_SHADOW |
@@ -1744,13 +1773,33 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) error_free_sched_entity:amd_sched_entity_fini (&ring->sched, &vm->entity); -err: -drm_free_large (vm->root.entries); -return r; }/** +* amdgpu_vm_free_levels - free PD/PT levels +* +* @level: PD/PT starting level to free +* +* Free the page directory or page table level and all sub levels. +*/ +static void amdgpu_vm_free_levels (struct amdgpu_vm_pt *level) +{ +unsigned i; + +if (level->bo) { +amdgpu_bo_unref (&level->bo->shadow); +amdgpu_bo_unref (&level->bo); + } + +if (level->entries) +for (i =0 ; i <= level->last_entry_used; i++) +amdgpu_vm_free_levels (&level->entries[i]); + +drm_free_large (level->entries); +} + +/** * amdgpu_vm_fini - tear down a vm instance * * @adev: amdgpu_device pointer
@@ -1762,7 +1811,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)void amdgpu_vm_fini (struct amdgpu_device *adev,struct amdgpu_vm *vm) {struct amdgpu_bo_va_mapping *mapping, *tmp; -int i;amd_sched_entity_fini (vm->entity.sched, &vm->entity);
@@ -1779,19 +1827,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)kfree (mapping); } -for (i =0 ; i <amdgpu_vm_num_entries (adev,0 ); i++) { -struct amdgpu_bo *pt = vm->root.entries[i].bo; - -if (!pt) -continue ; - -amdgpu_bo_unref (&pt->shadow); -amdgpu_bo_unref (&pt); - } -drm_free_large (vm->root.entries); - -amdgpu_bo_unref (&vm->root.bo->shadow); -amdgpu_bo_unref (&vm->root.bo); +amdgpu_vm_free_levels (&vm->root);fence_put (vm->last_dir_update); }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/18 drm/amdgpu: set page table depth by num_level
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +2 -1
@@ -200,7 +200,8 @@ int gfxhub_v1_0_gart_enable(struct amdgpu_device *adev)for (i =0 ; i <=14 ; i++) { tmp =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmVM_CONTEXT1_CNTL) + i); tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL ,ENABLE_CONTEXT ,1 ); - tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL ,PAGE_TABLE_DEPTH ,1 ); + tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL ,PAGE_TABLE_DEPTH , + adev->vm_manager.num_level); tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL ,RANGE_PROTECTION_FAULT_ENABLE_DEFAULT ,1 ); tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 -1
@@ -218,7 +218,7 @@ int mmhub_v1_0_gart_enable(struct amdgpu_device *adev) tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL ,ENABLE_CONTEXT ,1 ); tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL , -PAGE_TABLE_DEPTH ,1 ); +PAGE_TABLE_DEPTH , adev->vm_manager.num_level); tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL ,RANGE_PROTECTION_FAULT_ENABLE_DEFAULT ,1 ); tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/18 drm/amdgpu: block size of multiple level vmpt prefers one page
In reply to a message not in the archivemultiple level vmpt will cover bigger va space, if vmpt is 4 levels, one highest pde will cover 1TB, so increase vm size to 1TB.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -2
@@ -82,8 +82,8 @@unsigned amdgpu_ip_block_mask =0xffffffff ;int amdgpu_bapm =-1 ;int amdgpu_deep_color =0 ; -int amdgpu_vm_size =64 ; -int amdgpu_vm_block_size =-1 ; +int amdgpu_vm_size =1024 ; +int amdgpu_vm_block_size =9 ;int amdgpu_vm_fault_stop =0 ;int amdgpu_vm_debug =0 ;int amdgpu_vram_page_split =1024 ;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/18 drm/amdgpu: fix update sub levels
In reply to a message not in the archivesub level pdes always are written to incorrect place.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -661,7 +661,7 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,/* assume the worst case */ ndw += parent->last_entry_used *6 ; - pd_addr =amdgpu_bo_gpu_offset (vm->root.bo); + pd_addr =amdgpu_bo_gpu_offset (parent->bo); shadow = parent->bo->shadow;if (shadow) {
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/18 drm/amdgpu: sub levels need to update regardless of parent updates
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +16 -18
@@ -748,27 +748,25 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,if (params.ib->length_dw ==0 ) {amdgpu_job_free (job); -return 0 ; - } - -amdgpu_ring_pad_ib (ring, params.ib); -amdgpu_sync_resv (adev, &job->sync, parent->bo->tbo.resv, -AMDGPU_FENCE_OWNER_VM ); -if (shadow) -amdgpu_sync_resv (adev, &job->sync, shadow->tbo.resv, + }else { +amdgpu_ring_pad_ib (ring, params.ib); +amdgpu_sync_resv (adev, &job->sync, parent->bo->tbo.resv,AMDGPU_FENCE_OWNER_VM ); +if (shadow) +amdgpu_sync_resv (adev, &job->sync, shadow->tbo.resv, +AMDGPU_FENCE_OWNER_VM ); -WARN_ON (params.ib->length_dw > ndw); - r =amdgpu_job_submit (job, ring, &vm->entity, -AMDGPU_FENCE_OWNER_VM , &fence); -if (r) - goto error_free; - -amdgpu_bo_fence (parent->bo, fence, true); -fence_put (vm->last_dir_update); - vm->last_dir_update =fence_get (fence); -fence_put (fence); +WARN_ON (params.ib->length_dw > ndw); + r =amdgpu_job_submit (job, ring, &vm->entity, +AMDGPU_FENCE_OWNER_VM , &fence); +if (r) + goto error_free; +amdgpu_bo_fence (parent->bo, fence, true); +fence_put (vm->last_dir_update); + vm->last_dir_update =fence_get (fence); +fence_put (fence); + }/* * Recurse into the subdirectories. This recursion is harmless because * we only have a maximum of 5 layers.
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/18 drm/amdgpu: clear entries allocation
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
@@ -1459,6 +1459,7 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, sizeof(struct amdgpu_vm_pt));if (!parent->entries)return -ENOMEM ; +memset (parent->entries,0 ,sizeof (struct amdgpu_vm_pt )); } from = saddr >> shift;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/18 drm/amdgpu: fix entries index calculation
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
@@ -1462,8 +1462,8 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,memset (parent->entries,0 ,sizeof (struct amdgpu_vm_pt )); } - from = saddr >> shift; - to = eaddr >> shift; + from = (saddr >> shift) %amdgpu_vm_num_entries (adev, level); + to = (eaddr >> shift) %amdgpu_vm_num_entries (adev, level);if (to > parent->last_entry_used) parent->last_entry_used = to;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/18 drm/amdgpu: need alloc sub level even parent bo was allocated
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +19 -19
@@ -1476,27 +1476,27 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,struct amdgpu_vm_pt *entry = &parent->entries[pt_idx];struct amdgpu_bo *pt; -if (entry->bo) -continue ; - - r =amdgpu_bo_create (adev,amdgpu_vm_bo_size (adev, level), -AMDGPU_GPU_PAGE_SIZE , true, -AMDGPU_GEM_DOMAIN_VRAM , -AMDGPU_GEM_CREATE_NO_CPU_ACCESS | -AMDGPU_GEM_CREATE_SHADOW | -AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | -AMDGPU_GEM_CREATE_VRAM_CLEARED , -NULL , resv, &pt); -if (r) -return r; +if (!entry->bo) { + r =amdgpu_bo_create (adev, +amdgpu_vm_bo_size (adev, level), +AMDGPU_GPU_PAGE_SIZE , true, +AMDGPU_GEM_DOMAIN_VRAM , +AMDGPU_GEM_CREATE_NO_CPU_ACCESS | +AMDGPU_GEM_CREATE_SHADOW | +AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | +AMDGPU_GEM_CREATE_VRAM_CLEARED , +NULL , resv, &pt); +if (r) +return r; -/* Keep a reference to the root directory to avoid -* freeing them up in the wrong order. -*/ - pt->parent =amdgpu_bo_ref (vm->root.bo); +/* Keep a reference to the root directory to avoid +* freeing them up in the wrong order. +*/ + pt->parent =amdgpu_bo_ref (vm->root.bo); - entry->bo = pt; - entry->addr =0 ; + entry->bo = pt; + entry->addr =0 ; + }if (level < adev->vm_manager.num_level) { r = amdgpu_vm_alloc_levels(adev, vm, entry, saddr,
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/18 drm/amdgpu: enable four level vmpt
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
@@ -508,7 +508,7 @@ static int gmc_v9_0_vm_init(struct amdgpu_device *adev)* amdkfd will use VMIDs 8-15 */ adev->vm_manager.num_ids =AMDGPU_NUM_OF_VMIDS ; - adev->vm_manager.num_level =1 ; + adev->vm_manager.num_level =3 ;amdgpu_vm_manager_init (adev);return 0 ;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Patches #11 and #18 are Reviewed-by: Christian König <[email protected]>.
Patch #12 is a NAK, that will also increase the VM space for pre gfx9 and we already found that this isn't a good idea.
We should change how that value is evaluated in the different GMC handling code instead.
In other words, set it to -1 as default value and handle -1 in gmc v6/v7/v9 as 64GB, while in gmc v9 as 1TB (or even 256TB?).
Patch #13, #14: Good catch, but please squash into my original patch #8.
Patch #15, #16, #17: Please squash into patch #10.
Apart from that thanks a lot to pick this up while I was busy tracking the hw problem down.
And BTW did you tested the 48bit (256TB) address space support as well? That should also work now.
Regards,
Christian.
Am 24.03.2017 um 04:16 schrieb Chunming Zhou:
Quoted 27 lines
*** BLURB HERE ***
From Vega, ascis start to support multiple level vmpt, the series is to implement it.Tested successfully with 2/3/4 levels.
Christian König (10):
drm/amdgpu: renamepage_directory_fencetolast_dir_updatedrm/amdgpu: add the VM pointer to theamdgpu_pte_update_paramsas well drm/amdgpu: addnum_levelto the VM manager
drm/amdgpu: generalize page table level
drm/amdgpu: handle multi level PD size calculation drm/amdgpu: handle multi level PD during validation drm/amdgpu: handle multi level PD in the LRU
drm/amdgpu: handle multi level PD updates
drm/amdgpu: handle multi level PD during PT updates drm/amdgpu: add alloc/free for multi level PDsChunming Zhou (8):
drm/amdgpu: set page table depth bynum_leveldrm/amdgpu: block size of multiple level vmpt prefers one page drm/amdgpu: fix update sub levels
drm/amdgpu: sub levels need to update regardless of parent updates drm/amdgpu: clear entries allocation
drm/amdgpu: fix entries index calculation
drm/amdgpu: need alloc sub level even parent bo was allocated drm/amdgpu: enable four level vmpt
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 474 ++++++++++++++++++++----------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 16 +- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 2 +- 11 files changed, 336 insertions(+), 175 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx