diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-15 20:52:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-15 20:52:52 -0400 |
commit | 02cfe977e813501ad0e524477eb5cd5b52860448 (patch) | |
tree | cb812876a469d4c74e0fbea1c9df73d386532496 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | bbe05e543bfeab1c37127f38b7e575db916fbc6c (diff) | |
parent | 47e0cd6b1dbbbff7591fe7eecc20bac5ca674351 (diff) |
Merge tag 'drm-fixes-for-v4.14-rc1' of git://people.freedesktop.org/~airlied/linux
Pull drm AMD fixes from Dave Airlie:
"Just had a single AMD fixes pull from Alex for rc1"
* tag 'drm-fixes-for-v4.14-rc1' of git://people.freedesktop.org/~airlied/linux:
drm/amdgpu: revert "fix deadlock of reservation between cs and gpu reset v2"
drm/amdgpu: remove duplicate return statement
drm/amdgpu: check memory allocation failure
drm/amd/amdgpu: fix BANK_SELECT on Vega10 (v2)
drm/amdgpu: inline amdgpu_ttm_do_bind again
drm/amdgpu: fix amdgpu_ttm_bind
drm/amdgpu: remove the GART copy hack
drm/ttm:fix wrong decoding of bo_count
drm/ttm: fix missing inc bo_count
drm/amdgpu: set sched_hw_submission higher for KIQ (v3)
drm/amdgpu: move default gart size setting into gmc modules
drm/amdgpu: refine default gart size
drm/amd/powerplay: ACG frequency added in PPTable
drm/amdgpu: discard commands of killed processes
drm/amdgpu: fix and cleanup shadow handling
drm/amdgpu: add automatic per asic settings for gart_size
drm/amdgpu/gfx8: fix spelling typo in mqd allocation
drm/amd/powerplay: unhalt mec after loading
drm/amdgpu/virtual_dce: Virtual display doesn't support disable vblank immediately
drm/amdgpu: Fix huge page updates with CPU
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b9a5a77eedaf..bd20ff018512 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -165,14 +165,6 @@ static int amdgpu_vm_validate_level(struct amdgpu_vm_pt *parent, | |||
165 | unsigned i; | 165 | unsigned i; |
166 | int r; | 166 | int r; |
167 | 167 | ||
168 | if (parent->bo->shadow) { | ||
169 | struct amdgpu_bo *shadow = parent->bo->shadow; | ||
170 | |||
171 | r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem); | ||
172 | if (r) | ||
173 | return r; | ||
174 | } | ||
175 | |||
176 | if (use_cpu_for_update) { | 168 | if (use_cpu_for_update) { |
177 | r = amdgpu_bo_kmap(parent->bo, NULL); | 169 | r = amdgpu_bo_kmap(parent->bo, NULL); |
178 | if (r) | 170 | if (r) |
@@ -1277,7 +1269,7 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, | |||
1277 | /* In the case of a mixed PT the PDE must point to it*/ | 1269 | /* In the case of a mixed PT the PDE must point to it*/ |
1278 | if (p->adev->asic_type < CHIP_VEGA10 || | 1270 | if (p->adev->asic_type < CHIP_VEGA10 || |
1279 | nptes != AMDGPU_VM_PTE_COUNT(p->adev) || | 1271 | nptes != AMDGPU_VM_PTE_COUNT(p->adev) || |
1280 | p->func == amdgpu_vm_do_copy_ptes || | 1272 | p->src || |
1281 | !(flags & AMDGPU_PTE_VALID)) { | 1273 | !(flags & AMDGPU_PTE_VALID)) { |
1282 | 1274 | ||
1283 | dst = amdgpu_bo_gpu_offset(entry->bo); | 1275 | dst = amdgpu_bo_gpu_offset(entry->bo); |
@@ -1294,9 +1286,23 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, | |||
1294 | entry->addr = (dst | flags); | 1286 | entry->addr = (dst | flags); |
1295 | 1287 | ||
1296 | if (use_cpu_update) { | 1288 | if (use_cpu_update) { |
1289 | /* In case a huge page is replaced with a system | ||
1290 | * memory mapping, p->pages_addr != NULL and | ||
1291 | * amdgpu_vm_cpu_set_ptes would try to translate dst | ||
1292 | * through amdgpu_vm_map_gart. But dst is already a | ||
1293 | * GPU address (of the page table). Disable | ||
1294 | * amdgpu_vm_map_gart temporarily. | ||
1295 | */ | ||
1296 | dma_addr_t *tmp; | ||
1297 | |||
1298 | tmp = p->pages_addr; | ||
1299 | p->pages_addr = NULL; | ||
1300 | |||
1297 | pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo); | 1301 | pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo); |
1298 | pde = pd_addr + (entry - parent->entries) * 8; | 1302 | pde = pd_addr + (entry - parent->entries) * 8; |
1299 | amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); | 1303 | amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); |
1304 | |||
1305 | p->pages_addr = tmp; | ||
1300 | } else { | 1306 | } else { |
1301 | if (parent->bo->shadow) { | 1307 | if (parent->bo->shadow) { |
1302 | pd_addr = amdgpu_bo_gpu_offset(parent->bo->shadow); | 1308 | pd_addr = amdgpu_bo_gpu_offset(parent->bo->shadow); |
@@ -1610,7 +1616,6 @@ error_free: | |||
1610 | * | 1616 | * |
1611 | * @adev: amdgpu_device pointer | 1617 | * @adev: amdgpu_device pointer |
1612 | * @exclusive: fence we need to sync to | 1618 | * @exclusive: fence we need to sync to |
1613 | * @gtt_flags: flags as they are used for GTT | ||
1614 | * @pages_addr: DMA addresses to use for mapping | 1619 | * @pages_addr: DMA addresses to use for mapping |
1615 | * @vm: requested vm | 1620 | * @vm: requested vm |
1616 | * @mapping: mapped range and flags to use for the update | 1621 | * @mapping: mapped range and flags to use for the update |
@@ -1624,7 +1629,6 @@ error_free: | |||
1624 | */ | 1629 | */ |
1625 | static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, | 1630 | static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, |
1626 | struct dma_fence *exclusive, | 1631 | struct dma_fence *exclusive, |
1627 | uint64_t gtt_flags, | ||
1628 | dma_addr_t *pages_addr, | 1632 | dma_addr_t *pages_addr, |
1629 | struct amdgpu_vm *vm, | 1633 | struct amdgpu_vm *vm, |
1630 | struct amdgpu_bo_va_mapping *mapping, | 1634 | struct amdgpu_bo_va_mapping *mapping, |
@@ -1679,11 +1683,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, | |||
1679 | } | 1683 | } |
1680 | 1684 | ||
1681 | if (pages_addr) { | 1685 | if (pages_addr) { |
1682 | if (flags == gtt_flags) | 1686 | max_entries = min(max_entries, 16ull * 1024ull); |
1683 | src = adev->gart.table_addr + | ||
1684 | (addr >> AMDGPU_GPU_PAGE_SHIFT) * 8; | ||
1685 | else | ||
1686 | max_entries = min(max_entries, 16ull * 1024ull); | ||
1687 | addr = 0; | 1687 | addr = 0; |
1688 | } else if (flags & AMDGPU_PTE_VALID) { | 1688 | } else if (flags & AMDGPU_PTE_VALID) { |
1689 | addr += adev->vm_manager.vram_base_offset; | 1689 | addr += adev->vm_manager.vram_base_offset; |
@@ -1728,10 +1728,10 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1728 | struct amdgpu_vm *vm = bo_va->base.vm; | 1728 | struct amdgpu_vm *vm = bo_va->base.vm; |
1729 | struct amdgpu_bo_va_mapping *mapping; | 1729 | struct amdgpu_bo_va_mapping *mapping; |
1730 | dma_addr_t *pages_addr = NULL; | 1730 | dma_addr_t *pages_addr = NULL; |
1731 | uint64_t gtt_flags, flags; | ||
1732 | struct ttm_mem_reg *mem; | 1731 | struct ttm_mem_reg *mem; |
1733 | struct drm_mm_node *nodes; | 1732 | struct drm_mm_node *nodes; |
1734 | struct dma_fence *exclusive; | 1733 | struct dma_fence *exclusive; |
1734 | uint64_t flags; | ||
1735 | int r; | 1735 | int r; |
1736 | 1736 | ||
1737 | if (clear || !bo_va->base.bo) { | 1737 | if (clear || !bo_va->base.bo) { |
@@ -1751,15 +1751,10 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1751 | exclusive = reservation_object_get_excl(bo->tbo.resv); | 1751 | exclusive = reservation_object_get_excl(bo->tbo.resv); |
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | if (bo) { | 1754 | if (bo) |
1755 | flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); | 1755 | flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); |
1756 | gtt_flags = (amdgpu_ttm_is_bound(bo->tbo.ttm) && | 1756 | else |
1757 | adev == amdgpu_ttm_adev(bo->tbo.bdev)) ? | ||
1758 | flags : 0; | ||
1759 | } else { | ||
1760 | flags = 0x0; | 1757 | flags = 0x0; |
1761 | gtt_flags = ~0x0; | ||
1762 | } | ||
1763 | 1758 | ||
1764 | spin_lock(&vm->status_lock); | 1759 | spin_lock(&vm->status_lock); |
1765 | if (!list_empty(&bo_va->base.vm_status)) | 1760 | if (!list_empty(&bo_va->base.vm_status)) |
@@ -1767,8 +1762,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1767 | spin_unlock(&vm->status_lock); | 1762 | spin_unlock(&vm->status_lock); |
1768 | 1763 | ||
1769 | list_for_each_entry(mapping, &bo_va->invalids, list) { | 1764 | list_for_each_entry(mapping, &bo_va->invalids, list) { |
1770 | r = amdgpu_vm_bo_split_mapping(adev, exclusive, | 1765 | r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, |
1771 | gtt_flags, pages_addr, vm, | ||
1772 | mapping, flags, nodes, | 1766 | mapping, flags, nodes, |
1773 | &bo_va->last_pt_update); | 1767 | &bo_va->last_pt_update); |
1774 | if (r) | 1768 | if (r) |