diff options
author | Christian König <christian.koenig@amd.com> | 2017-01-27 05:56:05 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:52:57 -0400 |
commit | f7c35abe933c2ee34008c7415578611adcf3fcc6 (patch) | |
tree | 194b6fac2e6a9174df80d86e3e86b0f8f215a3e2 /drivers | |
parent | b85891bd6d1bf887b3398f4c44b7a30b37f4485e (diff) |
drm/amdgpu: implement PRT for GFX6 v2
Enable/disable the handling globally for now and
print a warning when we enable it for the first time.
v2: write to the correct register, adjust bits to that hw generation
v3: fix compilation, add the missing register bit definitions
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 55 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_sh_mask.h | 4 |
3 files changed, 60 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index b9212537b17d..3edc8719e1be 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -569,6 +569,7 @@ struct amdgpu_mc { | |||
569 | uint32_t vram_type; | 569 | uint32_t vram_type; |
570 | uint32_t srbm_soft_reset; | 570 | uint32_t srbm_soft_reset; |
571 | struct amdgpu_mode_mc_save save; | 571 | struct amdgpu_mode_mc_save save; |
572 | bool prt_warning; | ||
572 | }; | 573 | }; |
573 | 574 | ||
574 | /* | 575 | /* |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index 0635829b18cf..33284287cdf3 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | |||
@@ -400,6 +400,60 @@ static void gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev, | |||
400 | WREG32(mmVM_CONTEXT1_CNTL, tmp); | 400 | WREG32(mmVM_CONTEXT1_CNTL, tmp); |
401 | } | 401 | } |
402 | 402 | ||
403 | /** | ||
404 | + * gmc_v8_0_set_prt - set PRT VM fault | ||
405 | + * | ||
406 | + * @adev: amdgpu_device pointer | ||
407 | + * @enable: enable/disable VM fault handling for PRT | ||
408 | +*/ | ||
409 | static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable) | ||
410 | { | ||
411 | u32 tmp; | ||
412 | |||
413 | if (enable && !adev->mc.prt_warning) { | ||
414 | dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n"); | ||
415 | adev->mc.prt_warning = true; | ||
416 | } | ||
417 | |||
418 | tmp = RREG32(mmVM_PRT_CNTL); | ||
419 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
420 | CB_DISABLE_FAULT_ON_UNMAPPED_ACCESS, | ||
421 | enable); | ||
422 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
423 | TC_DISABLE_FAULT_ON_UNMAPPED_ACCESS, | ||
424 | enable); | ||
425 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
426 | L2_CACHE_STORE_INVALID_ENTRIES, | ||
427 | enable); | ||
428 | tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL, | ||
429 | L1_TLB_STORE_INVALID_ENTRIES, | ||
430 | enable); | ||
431 | WREG32(mmVM_PRT_CNTL, tmp); | ||
432 | |||
433 | if (enable) { | ||
434 | uint32_t low = AMDGPU_VA_RESERVED_SIZE >> AMDGPU_GPU_PAGE_SHIFT; | ||
435 | uint32_t high = adev->vm_manager.max_pfn; | ||
436 | |||
437 | WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, low); | ||
438 | WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, low); | ||
439 | WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, low); | ||
440 | WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, low); | ||
441 | WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, high); | ||
442 | WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high); | ||
443 | WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high); | ||
444 | WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high); | ||
445 | } else { | ||
446 | WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); | ||
447 | WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); | ||
448 | WREG32(mmVM_PRT_APERTURE2_LOW_ADDR, 0xfffffff); | ||
449 | WREG32(mmVM_PRT_APERTURE3_LOW_ADDR, 0xfffffff); | ||
450 | WREG32(mmVM_PRT_APERTURE0_HIGH_ADDR, 0x0); | ||
451 | WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); | ||
452 | WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); | ||
453 | WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0); | ||
454 | } | ||
455 | } | ||
456 | |||
403 | static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) | 457 | static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) |
404 | { | 458 | { |
405 | int r, i; | 459 | int r, i; |
@@ -1082,6 +1136,7 @@ static const struct amd_ip_funcs gmc_v6_0_ip_funcs = { | |||
1082 | static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = { | 1136 | static const struct amdgpu_gart_funcs gmc_v6_0_gart_funcs = { |
1083 | .flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb, | 1137 | .flush_gpu_tlb = gmc_v6_0_gart_flush_gpu_tlb, |
1084 | .set_pte_pde = gmc_v6_0_gart_set_pte_pde, | 1138 | .set_pte_pde = gmc_v6_0_gart_set_pte_pde, |
1139 | .set_prt = gmc_v6_0_set_prt, | ||
1085 | }; | 1140 | }; |
1086 | 1141 | ||
1087 | static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = { | 1142 | static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = { |
diff --git a/drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_sh_mask.h b/drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_sh_mask.h index 0f6c6c8d089b..7155312326e8 100644 --- a/drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_sh_mask.h +++ b/drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_sh_mask.h | |||
@@ -11891,5 +11891,9 @@ | |||
11891 | #define VM_PRT_CNTL__L1_TLB_STORE_INVALID_ENTRIES__SHIFT 0x00000003 | 11891 | #define VM_PRT_CNTL__L1_TLB_STORE_INVALID_ENTRIES__SHIFT 0x00000003 |
11892 | #define VM_PRT_CNTL__L2_CACHE_STORE_INVALID_ENTRIES_MASK 0x00000004L | 11892 | #define VM_PRT_CNTL__L2_CACHE_STORE_INVALID_ENTRIES_MASK 0x00000004L |
11893 | #define VM_PRT_CNTL__L2_CACHE_STORE_INVALID_ENTRIES__SHIFT 0x00000002 | 11893 | #define VM_PRT_CNTL__L2_CACHE_STORE_INVALID_ENTRIES__SHIFT 0x00000002 |
11894 | #define VM_PRT_CNTL__CB_DISABLE_FAULT_ON_UNMAPPED_ACCESS_MASK 0x00000001L | ||
11895 | #define VM_PRT_CNTL__CB_DISABLE_FAULT_ON_UNMAPPED_ACCESS__SHIFT 0x00000000 | ||
11896 | #define VM_PRT_CNTL__TC_DISABLE_FAULT_ON_UNMAPPED_ACCESS_MASK 0x00000002L | ||
11897 | #define VM_PRT_CNTL__TC_DISABLE_FAULT_ON_UNMAPPED_ACCESS__SHIFT 0x00000001 | ||
11894 | 11898 | ||
11895 | #endif | 11899 | #endif |