diff options
author | Christian König <christian.koenig@amd.com> | 2017-01-18 07:37:21 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:52:58 -0400 |
commit | 62cd91f99e6b1f1384d69ec68b7ff85c5bbc38c5 (patch) | |
tree | eeebe592a01e7fb961e4b377ecf39cc0625f14b7 | |
parent | f7c35abe933c2ee34008c7415578611adcf3fcc6 (diff) |
drm/amdgpu: implement PRT for GFX7 v2
Enable/disable the handling globally for now and
print a warning when we enable it for the first time.
v2: set correct register
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 8d05e0c4e3d7..4b38d062cbe4 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | |||
@@ -481,6 +481,62 @@ static void gmc_v7_0_set_fault_enable_default(struct amdgpu_device *adev, | |||
481 | } | 481 | } |
482 | 482 | ||
483 | /** | 483 | /** |
484 | * gmc_v7_0_set_prt - set PRT VM fault | ||
485 | * | ||
486 | * @adev: amdgpu_device pointer | ||
487 | * @enable: enable/disable VM fault handling for PRT | ||
488 | */ | ||
489 | static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable) | ||
490 | { | ||
491 | uint32_t tmp; | ||
492 | |||
493 | if (enable && !adev->mc.prt_warning) { | ||
494 | dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n"); | ||
495 | adev->mc.prt_warning = true; | ||
496 | } | ||
497 | |||
498 | tmp = RREG32(mmVM_PRT_CNTL); | ||
499 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
500 | CB_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS, enable); | ||
501 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
502 | CB_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS, enable); | ||
503 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
504 | TC_DISABLE_READ_FAULT_ON_UNMAPPED_ACCESS, enable); | ||
505 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
506 | TC_DISABLE_WRITE_FAULT_ON_UNMAPPED_ACCESS, enable); | ||
507 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
508 | L2_CACHE_STORE_INVALID_ENTRIES, enable); | ||
509 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
510 | L1_TLB_STORE_INVALID_ENTRIES, enable); | ||
511 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
512 | MASK_PDE0_FAULT, enable); | ||
513 | WREG32(mmVM_PRT_CNTL, tmp); | ||
514 | |||
515 | if (enable) { | ||
516 | uint32_t low = AMDGPU_VA_RESERVED_SIZE >> AMDGPU_GPU_PAGE_SHIFT; | ||
517 | uint32_t high = adev->vm_manager.max_pfn; | ||
518 | |||
519 | WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low); | ||
520 | WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low); | ||
521 | WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low); | ||
522 | WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low); | ||
523 | WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high); | ||
524 | WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high); | ||
525 | WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high); | ||
526 | WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high); | ||
527 | } else { | ||
528 | WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); | ||
529 | WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); | ||
530 | WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff); | ||
531 | WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff); | ||
532 | WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0); | ||
533 | WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); | ||
534 | WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); | ||
535 | WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0); | ||
536 | } | ||
537 | } | ||
538 | |||
539 | /** | ||
484 | * gmc_v7_0_gart_enable - gart enable | 540 | * gmc_v7_0_gart_enable - gart enable |
485 | * | 541 | * |
486 | * @adev: amdgpu_device pointer | 542 | * @adev: amdgpu_device pointer |
@@ -1259,6 +1315,7 @@ static const struct amd_ip_funcs gmc_v7_0_ip_funcs = { | |||
1259 | static const struct amdgpu_gart_funcs gmc_v7_0_gart_funcs = { | 1315 | static const struct amdgpu_gart_funcs gmc_v7_0_gart_funcs = { |
1260 | .flush_gpu_tlb = gmc_v7_0_gart_flush_gpu_tlb, | 1316 | .flush_gpu_tlb = gmc_v7_0_gart_flush_gpu_tlb, |
1261 | .set_pte_pde = gmc_v7_0_gart_set_pte_pde, | 1317 | .set_pte_pde = gmc_v7_0_gart_set_pte_pde, |
1318 | .set_prt = gmc_v7_0_set_prt, | ||
1262 | }; | 1319 | }; |
1263 | 1320 | ||
1264 | static const struct amdgpu_irq_src_funcs gmc_v7_0_irq_funcs = { | 1321 | static const struct amdgpu_irq_src_funcs gmc_v7_0_irq_funcs = { |