diff options
author | Christian König <christian.koenig@amd.com> | 2018-08-21 11:18:22 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-27 12:11:19 -0400 |
commit | 4e830fb1b5f589352e711fc0df515c34e978e1a0 (patch) | |
tree | 4b62f781db8cb8fb51bfc1dfe87d0302483e8eda /drivers/gpu/drm/amd | |
parent | 1123b989c50613ea555c51ced26257e54c6fa029 (diff) |
drm/amdgpu: remove gart.table_addr
We can easily figure out the address on the fly.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 7 |
9 files changed, 24 insertions, 25 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index f5cb5e2856c1..11fea28f8ad3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | |||
@@ -157,7 +157,6 @@ int amdgpu_gart_table_vram_pin(struct amdgpu_device *adev) | |||
157 | if (r) | 157 | if (r) |
158 | amdgpu_bo_unpin(adev->gart.bo); | 158 | amdgpu_bo_unpin(adev->gart.bo); |
159 | amdgpu_bo_unreserve(adev->gart.bo); | 159 | amdgpu_bo_unreserve(adev->gart.bo); |
160 | adev->gart.table_addr = amdgpu_bo_gpu_offset(adev->gart.bo); | ||
161 | return r; | 160 | return r; |
162 | } | 161 | } |
163 | 162 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h index d7b7c2d408d5..9ff62887e4e3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h | |||
@@ -40,7 +40,6 @@ struct amdgpu_bo; | |||
40 | #define AMDGPU_GPU_PAGES_IN_CPU_PAGE (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE) | 40 | #define AMDGPU_GPU_PAGES_IN_CPU_PAGE (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE) |
41 | 41 | ||
42 | struct amdgpu_gart { | 42 | struct amdgpu_gart { |
43 | u64 table_addr; | ||
44 | struct amdgpu_bo *bo; | 43 | struct amdgpu_bo *bo; |
45 | void *ptr; | 44 | void *ptr; |
46 | unsigned num_gpu_pages; | 45 | unsigned num_gpu_pages; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index b4333f60ed8b..e7f73deed975 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1988,7 +1988,7 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo, | |||
1988 | src_addr = num_dw * 4; | 1988 | src_addr = num_dw * 4; |
1989 | src_addr += job->ibs[0].gpu_addr; | 1989 | src_addr += job->ibs[0].gpu_addr; |
1990 | 1990 | ||
1991 | dst_addr = adev->gart.table_addr; | 1991 | dst_addr = amdgpu_bo_gpu_offset(adev->gart.bo); |
1992 | dst_addr += window * AMDGPU_GTT_MAX_TRANSFER_SIZE * 8; | 1992 | dst_addr += window * AMDGPU_GTT_MAX_TRANSFER_SIZE * 8; |
1993 | amdgpu_emit_copy_buffer(adev, &job->ibs[0], src_addr, | 1993 | amdgpu_emit_copy_buffer(adev, &job->ibs[0], src_addr, |
1994 | dst_addr, num_bytes); | 1994 | dst_addr, num_bytes); |
@@ -2049,7 +2049,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, | |||
2049 | return r; | 2049 | return r; |
2050 | 2050 | ||
2051 | if (vm_needs_flush) { | 2051 | if (vm_needs_flush) { |
2052 | job->vm_pd_addr = adev->gart.table_addr; | 2052 | job->vm_pd_addr = amdgpu_bo_gpu_offset(adev->gart.bo); |
2053 | job->vm_needs_flush = true; | 2053 | job->vm_needs_flush = true; |
2054 | } | 2054 | } |
2055 | if (resv) { | 2055 | if (resv) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c index acfbd2d749cf..2baab7e69ef5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | |||
@@ -37,11 +37,10 @@ u64 gfxhub_v1_0_get_mc_fb_offset(struct amdgpu_device *adev) | |||
37 | 37 | ||
38 | static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) | 38 | static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) |
39 | { | 39 | { |
40 | uint64_t value; | 40 | uint64_t value = amdgpu_bo_gpu_offset(adev->gart.bo); |
41 | 41 | ||
42 | BUG_ON(adev->gart.table_addr & (~0x0000FFFFFFFFF000ULL)); | 42 | BUG_ON(value & (~0x0000FFFFFFFFF000ULL)); |
43 | value = adev->gart.table_addr - adev->gmc.vram_start | 43 | value -= adev->gmc.vram_start + adev->vm_manager.vram_base_offset; |
44 | + adev->vm_manager.vram_base_offset; | ||
45 | value &= 0x0000FFFFFFFFF000ULL; | 44 | value &= 0x0000FFFFFFFFF000ULL; |
46 | value |= 0x1; /*valid bit*/ | 45 | value |= 0x1; /*valid bit*/ |
47 | 46 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index b4302aaa1c14..543287e5d67b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | |||
@@ -494,6 +494,7 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable) | |||
494 | 494 | ||
495 | static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) | 495 | static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) |
496 | { | 496 | { |
497 | uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo); | ||
497 | int r, i; | 498 | int r, i; |
498 | u32 field; | 499 | u32 field; |
499 | 500 | ||
@@ -532,7 +533,7 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) | |||
532 | /* setup context0 */ | 533 | /* setup context0 */ |
533 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->gmc.gart_start >> 12); | 534 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->gmc.gart_start >> 12); |
534 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->gmc.gart_end >> 12); | 535 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->gmc.gart_end >> 12); |
535 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12); | 536 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, table_addr >> 12); |
536 | WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 537 | WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
537 | (u32)(adev->dummy_page_addr >> 12)); | 538 | (u32)(adev->dummy_page_addr >> 12)); |
538 | WREG32(mmVM_CONTEXT0_CNTL2, 0); | 539 | WREG32(mmVM_CONTEXT0_CNTL2, 0); |
@@ -556,10 +557,10 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) | |||
556 | for (i = 1; i < 16; i++) { | 557 | for (i = 1; i < 16; i++) { |
557 | if (i < 8) | 558 | if (i < 8) |
558 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + i, | 559 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + i, |
559 | adev->gart.table_addr >> 12); | 560 | table_addr >> 12); |
560 | else | 561 | else |
561 | WREG32(mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR + i - 8, | 562 | WREG32(mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR + i - 8, |
562 | adev->gart.table_addr >> 12); | 563 | table_addr >> 12); |
563 | } | 564 | } |
564 | 565 | ||
565 | /* enable context1-15 */ | 566 | /* enable context1-15 */ |
@@ -579,7 +580,7 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) | |||
579 | gmc_v6_0_flush_gpu_tlb(adev, 0); | 580 | gmc_v6_0_flush_gpu_tlb(adev, 0); |
580 | dev_info(adev->dev, "PCIE GART of %uM enabled (table at 0x%016llX).\n", | 581 | dev_info(adev->dev, "PCIE GART of %uM enabled (table at 0x%016llX).\n", |
581 | (unsigned)(adev->gmc.gart_size >> 20), | 582 | (unsigned)(adev->gmc.gart_size >> 20), |
582 | (unsigned long long)adev->gart.table_addr); | 583 | (unsigned long long)table_addr); |
583 | adev->gart.ready = true; | 584 | adev->gart.ready = true; |
584 | return 0; | 585 | return 0; |
585 | } | 586 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index b41b8515670d..c88708abe016 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | |||
@@ -602,6 +602,7 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable) | |||
602 | */ | 602 | */ |
603 | static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) | 603 | static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) |
604 | { | 604 | { |
605 | uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo); | ||
605 | int r, i; | 606 | int r, i; |
606 | u32 tmp, field; | 607 | u32 tmp, field; |
607 | 608 | ||
@@ -643,7 +644,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) | |||
643 | /* setup context0 */ | 644 | /* setup context0 */ |
644 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->gmc.gart_start >> 12); | 645 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->gmc.gart_start >> 12); |
645 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->gmc.gart_end >> 12); | 646 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->gmc.gart_end >> 12); |
646 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12); | 647 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, table_addr >> 12); |
647 | WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 648 | WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
648 | (u32)(adev->dummy_page_addr >> 12)); | 649 | (u32)(adev->dummy_page_addr >> 12)); |
649 | WREG32(mmVM_CONTEXT0_CNTL2, 0); | 650 | WREG32(mmVM_CONTEXT0_CNTL2, 0); |
@@ -667,10 +668,10 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) | |||
667 | for (i = 1; i < 16; i++) { | 668 | for (i = 1; i < 16; i++) { |
668 | if (i < 8) | 669 | if (i < 8) |
669 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + i, | 670 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + i, |
670 | adev->gart.table_addr >> 12); | 671 | table_addr >> 12); |
671 | else | 672 | else |
672 | WREG32(mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR + i - 8, | 673 | WREG32(mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR + i - 8, |
673 | adev->gart.table_addr >> 12); | 674 | table_addr >> 12); |
674 | } | 675 | } |
675 | 676 | ||
676 | /* enable context1-15 */ | 677 | /* enable context1-15 */ |
@@ -697,7 +698,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) | |||
697 | gmc_v7_0_flush_gpu_tlb(adev, 0); | 698 | gmc_v7_0_flush_gpu_tlb(adev, 0); |
698 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 699 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
699 | (unsigned)(adev->gmc.gart_size >> 20), | 700 | (unsigned)(adev->gmc.gart_size >> 20), |
700 | (unsigned long long)adev->gart.table_addr); | 701 | (unsigned long long)table_addr); |
701 | adev->gart.ready = true; | 702 | adev->gart.ready = true; |
702 | return 0; | 703 | return 0; |
703 | } | 704 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index d2fc97a2ab00..8213ea1a6cbc 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | |||
@@ -807,6 +807,7 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable) | |||
807 | */ | 807 | */ |
808 | static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) | 808 | static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) |
809 | { | 809 | { |
810 | uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo); | ||
810 | int r, i; | 811 | int r, i; |
811 | u32 tmp, field; | 812 | u32 tmp, field; |
812 | 813 | ||
@@ -864,7 +865,7 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) | |||
864 | /* setup context0 */ | 865 | /* setup context0 */ |
865 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->gmc.gart_start >> 12); | 866 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->gmc.gart_start >> 12); |
866 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->gmc.gart_end >> 12); | 867 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->gmc.gart_end >> 12); |
867 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12); | 868 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, table_addr >> 12); |
868 | WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 869 | WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
869 | (u32)(adev->dummy_page_addr >> 12)); | 870 | (u32)(adev->dummy_page_addr >> 12)); |
870 | WREG32(mmVM_CONTEXT0_CNTL2, 0); | 871 | WREG32(mmVM_CONTEXT0_CNTL2, 0); |
@@ -888,10 +889,10 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) | |||
888 | for (i = 1; i < 16; i++) { | 889 | for (i = 1; i < 16; i++) { |
889 | if (i < 8) | 890 | if (i < 8) |
890 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + i, | 891 | WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + i, |
891 | adev->gart.table_addr >> 12); | 892 | table_addr >> 12); |
892 | else | 893 | else |
893 | WREG32(mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR + i - 8, | 894 | WREG32(mmVM_CONTEXT8_PAGE_TABLE_BASE_ADDR + i - 8, |
894 | adev->gart.table_addr >> 12); | 895 | table_addr >> 12); |
895 | } | 896 | } |
896 | 897 | ||
897 | /* enable context1-15 */ | 898 | /* enable context1-15 */ |
@@ -919,7 +920,7 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) | |||
919 | gmc_v8_0_flush_gpu_tlb(adev, 0); | 920 | gmc_v8_0_flush_gpu_tlb(adev, 0); |
920 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 921 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
921 | (unsigned)(adev->gmc.gart_size >> 20), | 922 | (unsigned)(adev->gmc.gart_size >> 20), |
922 | (unsigned long long)adev->gart.table_addr); | 923 | (unsigned long long)table_addr); |
923 | adev->gart.ready = true; | 924 | adev->gart.ready = true; |
924 | return 0; | 925 | return 0; |
925 | } | 926 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index c9550b11e19a..dc48e19d01f8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | |||
@@ -1106,7 +1106,7 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) | |||
1106 | 1106 | ||
1107 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 1107 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
1108 | (unsigned)(adev->gmc.gart_size >> 20), | 1108 | (unsigned)(adev->gmc.gart_size >> 20), |
1109 | (unsigned long long)adev->gart.table_addr); | 1109 | (unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo)); |
1110 | adev->gart.ready = true; | 1110 | adev->gart.ready = true; |
1111 | return 0; | 1111 | return 0; |
1112 | } | 1112 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c index e70a0d4d6db4..800ec4687f13 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | |||
@@ -47,11 +47,10 @@ u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev) | |||
47 | 47 | ||
48 | static void mmhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) | 48 | static void mmhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) |
49 | { | 49 | { |
50 | uint64_t value; | 50 | uint64_t value = amdgpu_bo_gpu_offset(adev->gart.bo); |
51 | 51 | ||
52 | BUG_ON(adev->gart.table_addr & (~0x0000FFFFFFFFF000ULL)); | 52 | BUG_ON(value & (~0x0000FFFFFFFFF000ULL)); |
53 | value = adev->gart.table_addr - adev->gmc.vram_start + | 53 | value -= adev->gmc.vram_start + adev->vm_manager.vram_base_offset; |
54 | adev->vm_manager.vram_base_offset; | ||
55 | value &= 0x0000FFFFFFFFF000ULL; | 54 | value &= 0x0000FFFFFFFFF000ULL; |
56 | value |= 0x1; /* valid bit */ | 55 | value |= 0x1; /* valid bit */ |
57 | 56 | ||