aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-12-12 09:13:10 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-01-25 16:15:34 -0500
commite95b93ce4116780285f11f08a2bf78f48b23ed11 (patch)
tree926b1e4e0daf77215ed0f966fb422b5dbedfddbf /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent5d50fcbda7b0acd301bb1fc3d828df0aa29237b8 (diff)
drm/amdgpu: set the executable flag on unused Vega10 PTEs v2
Otherwise we run into a non-retry fault on access. It seems to be a hardware bug that the executable bit has higher priority than the valid bit. v2: handle clears as well Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index ffffe021cccf..0bc6f553dc08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -821,9 +821,16 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
821 addr += ats_entries * 8; 821 addr += ats_entries * 8;
822 } 822 }
823 823
824 if (entries) 824 if (entries) {
825 uint64_t value = 0;
826
827 /* Workaround for fault priority problem on GMC9 */
828 if (level == AMDGPU_VM_PTB && adev->asic_type >= CHIP_VEGA10)
829 value = AMDGPU_PTE_EXECUTABLE;
830
825 amdgpu_vm_set_pte_pde(adev, &job->ibs[0], addr, 0, 831 amdgpu_vm_set_pte_pde(adev, &job->ibs[0], addr, 0,
826 entries, 0, 0); 832 entries, 0, value);
833 }
827 834
828 amdgpu_ring_pad_ib(ring, &job->ibs[0]); 835 amdgpu_ring_pad_ib(ring, &job->ibs[0]);
829 836
@@ -1525,20 +1532,27 @@ error:
1525} 1532}
1526 1533
1527/** 1534/**
1528 * amdgpu_vm_update_huge - figure out parameters for PTE updates 1535 * amdgpu_vm_update_flags - figure out flags for PTE updates
1529 * 1536 *
1530 * Make sure to set the right flags for the PTEs at the desired level. 1537 * Make sure to set the right flags for the PTEs at the desired level.
1531 */ 1538 */
1532static void amdgpu_vm_update_huge(struct amdgpu_pte_update_params *params, 1539static void amdgpu_vm_update_flags(struct amdgpu_pte_update_params *params,
1533 struct amdgpu_bo *bo, unsigned level, 1540 struct amdgpu_bo *bo, unsigned level,
1534 uint64_t pe, uint64_t addr, 1541 uint64_t pe, uint64_t addr,
1535 unsigned count, uint32_t incr, 1542 unsigned count, uint32_t incr,
1536 uint64_t flags) 1543 uint64_t flags)
1537 1544
1538{ 1545{
1539 if (level != AMDGPU_VM_PTB) { 1546 if (level != AMDGPU_VM_PTB) {
1540 flags |= AMDGPU_PDE_PTE; 1547 flags |= AMDGPU_PDE_PTE;
1541 amdgpu_gmc_get_vm_pde(params->adev, level, &addr, &flags); 1548 amdgpu_gmc_get_vm_pde(params->adev, level, &addr, &flags);
1549
1550 } else if (params->adev->asic_type >= CHIP_VEGA10 &&
1551 !(flags & AMDGPU_PTE_VALID) &&
1552 !(flags & AMDGPU_PTE_PRT)) {
1553
1554 /* Workaround for fault priority problem on GMC9 */
1555 flags |= AMDGPU_PTE_EXECUTABLE;
1542 } 1556 }
1543 1557
1544 amdgpu_vm_update_func(params, bo, pe, addr, count, incr, flags); 1558 amdgpu_vm_update_func(params, bo, pe, addr, count, incr, flags);
@@ -1695,9 +1709,9 @@ static int amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
1695 uint64_t upd_end = min(entry_end, frag_end); 1709 uint64_t upd_end = min(entry_end, frag_end);
1696 unsigned nptes = (upd_end - frag_start) >> shift; 1710 unsigned nptes = (upd_end - frag_start) >> shift;
1697 1711
1698 amdgpu_vm_update_huge(params, pt, cursor.level, 1712 amdgpu_vm_update_flags(params, pt, cursor.level,
1699 pe_start, dst, nptes, incr, 1713 pe_start, dst, nptes, incr,
1700 flags | AMDGPU_PTE_FRAG(frag)); 1714 flags | AMDGPU_PTE_FRAG(frag));
1701 1715
1702 pe_start += nptes * 8; 1716 pe_start += nptes * 8;
1703 dst += (uint64_t)nptes * AMDGPU_GPU_PAGE_SIZE << shift; 1717 dst += (uint64_t)nptes * AMDGPU_GPU_PAGE_SIZE << shift;