diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 10 | ||||
-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 | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 2 |
9 files changed, 52 insertions, 35 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index d78c523c93fe..831c2bfd2072 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1042,14 +1042,6 @@ static bool amdgpu_check_pot_argument(int arg) | |||
1042 | 1042 | ||
1043 | static void amdgpu_get_block_size(struct amdgpu_device *adev) | 1043 | static void amdgpu_get_block_size(struct amdgpu_device *adev) |
1044 | { | 1044 | { |
1045 | /* from AI, asic starts to support multiple level VMPT */ | ||
1046 | if (adev->asic_type >= CHIP_VEGA10) { | ||
1047 | if (amdgpu_vm_block_size != 9) | ||
1048 | dev_warn(adev->dev, | ||
1049 | "Multi-VMPT limits block size to one page!\n"); | ||
1050 | amdgpu_vm_block_size = 9; | ||
1051 | return; | ||
1052 | } | ||
1053 | /* defines number of bits in page table versus page directory, | 1045 | /* defines number of bits in page table versus page directory, |
1054 | * a page is 4KB so we have 12 bits offset, minimum 9 bits in the | 1046 | * a page is 4KB so we have 12 bits offset, minimum 9 bits in the |
1055 | * page table and the remaining bits are in the page directory */ | 1047 | * page table and the remaining bits are in the page directory */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 14f0889f7563..2895d9d86f29 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -100,13 +100,14 @@ static unsigned amdgpu_vm_num_entries(struct amdgpu_device *adev, | |||
100 | if (level == 0) | 100 | if (level == 0) |
101 | /* For the root directory */ | 101 | /* For the root directory */ |
102 | return adev->vm_manager.max_pfn >> | 102 | return adev->vm_manager.max_pfn >> |
103 | (amdgpu_vm_block_size * adev->vm_manager.num_level); | 103 | (adev->vm_manager.block_size * |
104 | adev->vm_manager.num_level); | ||
104 | else if (level == adev->vm_manager.num_level) | 105 | else if (level == adev->vm_manager.num_level) |
105 | /* For the page tables on the leaves */ | 106 | /* For the page tables on the leaves */ |
106 | return AMDGPU_VM_PTE_COUNT; | 107 | return AMDGPU_VM_PTE_COUNT(adev); |
107 | else | 108 | else |
108 | /* Everything in between */ | 109 | /* Everything in between */ |
109 | return 1 << amdgpu_vm_block_size; | 110 | return 1 << adev->vm_manager.block_size; |
110 | } | 111 | } |
111 | 112 | ||
112 | /** | 113 | /** |
@@ -271,7 +272,7 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, | |||
271 | unsigned level) | 272 | unsigned level) |
272 | { | 273 | { |
273 | unsigned shift = (adev->vm_manager.num_level - level) * | 274 | unsigned shift = (adev->vm_manager.num_level - level) * |
274 | amdgpu_vm_block_size; | 275 | adev->vm_manager.block_size; |
275 | unsigned pt_idx, from, to; | 276 | unsigned pt_idx, from, to; |
276 | int r; | 277 | int r; |
277 | 278 | ||
@@ -976,7 +977,7 @@ static struct amdgpu_bo *amdgpu_vm_get_pt(struct amdgpu_pte_update_params *p, | |||
976 | unsigned idx, level = p->adev->vm_manager.num_level; | 977 | unsigned idx, level = p->adev->vm_manager.num_level; |
977 | 978 | ||
978 | while (entry->entries) { | 979 | while (entry->entries) { |
979 | idx = addr >> (amdgpu_vm_block_size * level--); | 980 | idx = addr >> (p->adev->vm_manager.block_size * level--); |
980 | idx %= amdgpu_bo_size(entry->bo) / 8; | 981 | idx %= amdgpu_bo_size(entry->bo) / 8; |
981 | entry = &entry->entries[idx]; | 982 | entry = &entry->entries[idx]; |
982 | } | 983 | } |
@@ -1003,7 +1004,8 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params, | |||
1003 | uint64_t start, uint64_t end, | 1004 | uint64_t start, uint64_t end, |
1004 | uint64_t dst, uint64_t flags) | 1005 | uint64_t dst, uint64_t flags) |
1005 | { | 1006 | { |
1006 | const uint64_t mask = AMDGPU_VM_PTE_COUNT - 1; | 1007 | struct amdgpu_device *adev = params->adev; |
1008 | const uint64_t mask = AMDGPU_VM_PTE_COUNT(adev) - 1; | ||
1007 | 1009 | ||
1008 | uint64_t cur_pe_start, cur_nptes, cur_dst; | 1010 | uint64_t cur_pe_start, cur_nptes, cur_dst; |
1009 | uint64_t addr; /* next GPU address to be updated */ | 1011 | uint64_t addr; /* next GPU address to be updated */ |
@@ -1027,7 +1029,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params, | |||
1027 | if ((addr & ~mask) == (end & ~mask)) | 1029 | if ((addr & ~mask) == (end & ~mask)) |
1028 | nptes = end - addr; | 1030 | nptes = end - addr; |
1029 | else | 1031 | else |
1030 | nptes = AMDGPU_VM_PTE_COUNT - (addr & mask); | 1032 | nptes = AMDGPU_VM_PTE_COUNT(adev) - (addr & mask); |
1031 | 1033 | ||
1032 | cur_pe_start = amdgpu_bo_gpu_offset(pt); | 1034 | cur_pe_start = amdgpu_bo_gpu_offset(pt); |
1033 | cur_pe_start += (addr & mask) * 8; | 1035 | cur_pe_start += (addr & mask) * 8; |
@@ -1055,7 +1057,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params, | |||
1055 | if ((addr & ~mask) == (end & ~mask)) | 1057 | if ((addr & ~mask) == (end & ~mask)) |
1056 | nptes = end - addr; | 1058 | nptes = end - addr; |
1057 | else | 1059 | else |
1058 | nptes = AMDGPU_VM_PTE_COUNT - (addr & mask); | 1060 | nptes = AMDGPU_VM_PTE_COUNT(adev) - (addr & mask); |
1059 | 1061 | ||
1060 | next_pe_start = amdgpu_bo_gpu_offset(pt); | 1062 | next_pe_start = amdgpu_bo_gpu_offset(pt); |
1061 | next_pe_start += (addr & mask) * 8; | 1063 | next_pe_start += (addr & mask) * 8; |
@@ -1202,7 +1204,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, | |||
1202 | * reserve space for one command every (1 << BLOCK_SIZE) | 1204 | * reserve space for one command every (1 << BLOCK_SIZE) |
1203 | * entries or 2k dwords (whatever is smaller) | 1205 | * entries or 2k dwords (whatever is smaller) |
1204 | */ | 1206 | */ |
1205 | ncmds = (nptes >> min(amdgpu_vm_block_size, 11)) + 1; | 1207 | ncmds = (nptes >> min(adev->vm_manager.block_size, 11u)) + 1; |
1206 | 1208 | ||
1207 | /* padding, etc. */ | 1209 | /* padding, etc. */ |
1208 | ndw = 64; | 1210 | ndw = 64; |
@@ -2073,7 +2075,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, | |||
2073 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) | 2075 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) |
2074 | { | 2076 | { |
2075 | const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE, | 2077 | const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE, |
2076 | AMDGPU_VM_PTE_COUNT * 8); | 2078 | AMDGPU_VM_PTE_COUNT(adev) * 8); |
2077 | unsigned ring_instance; | 2079 | unsigned ring_instance; |
2078 | struct amdgpu_ring *ring; | 2080 | struct amdgpu_ring *ring; |
2079 | struct amd_sched_rq *rq; | 2081 | struct amd_sched_rq *rq; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index ed2467881b74..02b0dd3b135f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |||
@@ -45,7 +45,7 @@ struct amdgpu_bo_list_entry; | |||
45 | #define AMDGPU_VM_MAX_UPDATE_SIZE 0x3FFFF | 45 | #define AMDGPU_VM_MAX_UPDATE_SIZE 0x3FFFF |
46 | 46 | ||
47 | /* number of entries in page table */ | 47 | /* number of entries in page table */ |
48 | #define AMDGPU_VM_PTE_COUNT (1 << amdgpu_vm_block_size) | 48 | #define AMDGPU_VM_PTE_COUNT(adev) (1 << (adev)->vm_manager.block_size) |
49 | 49 | ||
50 | /* PTBs (Page Table Blocks) need to be aligned to 32K */ | 50 | /* PTBs (Page Table Blocks) need to be aligned to 32K */ |
51 | #define AMDGPU_VM_PTB_ALIGN_SIZE 32768 | 51 | #define AMDGPU_VM_PTB_ALIGN_SIZE 32768 |
@@ -162,6 +162,8 @@ struct amdgpu_vm_manager { | |||
162 | 162 | ||
163 | uint64_t max_pfn; | 163 | uint64_t max_pfn; |
164 | uint32_t num_level; | 164 | uint32_t num_level; |
165 | uint64_t vm_size; | ||
166 | uint32_t block_size; | ||
165 | /* vram base address for page table entry */ | 167 | /* vram base address for page table entry */ |
166 | u64 vram_base_offset; | 168 | u64 vram_base_offset; |
167 | /* is vm enabled? */ | 169 | /* is vm enabled? */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c index b808d4ce86d6..70c21f9b904b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | |||
@@ -222,7 +222,7 @@ int gfxhub_v1_0_gart_enable(struct amdgpu_device *adev) | |||
222 | EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | 222 | EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); |
223 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | 223 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, |
224 | PAGE_TABLE_BLOCK_SIZE, | 224 | PAGE_TABLE_BLOCK_SIZE, |
225 | amdgpu_vm_block_size - 9); | 225 | adev->vm_manager.block_size - 9); |
226 | WREG32(SOC15_REG_OFFSET(GC, 0, mmVM_CONTEXT1_CNTL) + i, tmp); | 226 | WREG32(SOC15_REG_OFFSET(GC, 0, mmVM_CONTEXT1_CNTL) + i, tmp); |
227 | WREG32(SOC15_REG_OFFSET(GC, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32) + i*2, 0); | 227 | WREG32(SOC15_REG_OFFSET(GC, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32) + i*2, 0); |
228 | WREG32(SOC15_REG_OFFSET(GC, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32) + i*2, 0); | 228 | WREG32(SOC15_REG_OFFSET(GC, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32) + i*2, 0); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index d9586601a437..8f18d14f8eda 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | |||
@@ -543,7 +543,8 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) | |||
543 | WREG32(mmVM_CONTEXT1_CNTL, | 543 | WREG32(mmVM_CONTEXT1_CNTL, |
544 | VM_CONTEXT1_CNTL__ENABLE_CONTEXT_MASK | | 544 | VM_CONTEXT1_CNTL__ENABLE_CONTEXT_MASK | |
545 | (1UL << VM_CONTEXT1_CNTL__PAGE_TABLE_DEPTH__SHIFT) | | 545 | (1UL << VM_CONTEXT1_CNTL__PAGE_TABLE_DEPTH__SHIFT) | |
546 | ((amdgpu_vm_block_size - 9) << VM_CONTEXT1_CNTL__PAGE_TABLE_BLOCK_SIZE__SHIFT)); | 546 | ((adev->vm_manager.block_size - 9) |
547 | << VM_CONTEXT1_CNTL__PAGE_TABLE_BLOCK_SIZE__SHIFT)); | ||
547 | if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) | 548 | if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) |
548 | gmc_v6_0_set_fault_enable_default(adev, false); | 549 | gmc_v6_0_set_fault_enable_default(adev, false); |
549 | else | 550 | else |
@@ -848,7 +849,12 @@ static int gmc_v6_0_sw_init(void *handle) | |||
848 | if (r) | 849 | if (r) |
849 | return r; | 850 | return r; |
850 | 851 | ||
851 | adev->vm_manager.max_pfn = amdgpu_vm_size << 18; | 852 | adev->vm_manager.vm_size = amdgpu_vm_size; |
853 | adev->vm_manager.block_size = amdgpu_vm_block_size; | ||
854 | adev->vm_manager.max_pfn = adev->vm_manager.vm_size << 18; | ||
855 | |||
856 | DRM_INFO("vm size is %llu GB, block size is %d-bit\n", | ||
857 | adev->vm_manager.vm_size, adev->vm_manager.block_size); | ||
852 | 858 | ||
853 | adev->mc.mc_mask = 0xffffffffffULL; | 859 | adev->mc.mc_mask = 0xffffffffffULL; |
854 | 860 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 78643a1baa5c..b86b454197f8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | |||
@@ -644,7 +644,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) | |||
644 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1); | 644 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1); |
645 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, 1); | 645 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, 1); |
646 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE, | 646 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE, |
647 | amdgpu_vm_block_size - 9); | 647 | adev->vm_manager.block_size - 9); |
648 | WREG32(mmVM_CONTEXT1_CNTL, tmp); | 648 | WREG32(mmVM_CONTEXT1_CNTL, tmp); |
649 | if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) | 649 | if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) |
650 | gmc_v7_0_set_fault_enable_default(adev, false); | 650 | gmc_v7_0_set_fault_enable_default(adev, false); |
@@ -1003,7 +1003,12 @@ static int gmc_v7_0_sw_init(void *handle) | |||
1003 | * Currently set to 4GB ((1 << 20) 4k pages). | 1003 | * Currently set to 4GB ((1 << 20) 4k pages). |
1004 | * Max GPUVM size for cayman and SI is 40 bits. | 1004 | * Max GPUVM size for cayman and SI is 40 bits. |
1005 | */ | 1005 | */ |
1006 | adev->vm_manager.max_pfn = amdgpu_vm_size << 18; | 1006 | adev->vm_manager.vm_size = amdgpu_vm_size; |
1007 | adev->vm_manager.block_size = amdgpu_vm_block_size; | ||
1008 | adev->vm_manager.max_pfn = adev->vm_manager.vm_size << 18; | ||
1009 | |||
1010 | DRM_INFO("vm size is %llu GB, block size is %d-bit\n", | ||
1011 | adev->vm_manager.vm_size, adev->vm_manager.block_size); | ||
1007 | 1012 | ||
1008 | /* Set the internal MC address mask | 1013 | /* Set the internal MC address mask |
1009 | * This is the max address of the GPU's | 1014 | * This is the max address of the GPU's |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 42b2f357a799..108a20e832cf 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | |||
@@ -853,7 +853,7 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) | |||
853 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | 853 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); |
854 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | 854 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); |
855 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE, | 855 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE, |
856 | amdgpu_vm_block_size - 9); | 856 | adev->vm_manager.block_size - 9); |
857 | WREG32(mmVM_CONTEXT1_CNTL, tmp); | 857 | WREG32(mmVM_CONTEXT1_CNTL, tmp); |
858 | if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) | 858 | if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) |
859 | gmc_v8_0_set_fault_enable_default(adev, false); | 859 | gmc_v8_0_set_fault_enable_default(adev, false); |
@@ -1087,7 +1087,12 @@ static int gmc_v8_0_sw_init(void *handle) | |||
1087 | * Currently set to 4GB ((1 << 20) 4k pages). | 1087 | * Currently set to 4GB ((1 << 20) 4k pages). |
1088 | * Max GPUVM size for cayman and SI is 40 bits. | 1088 | * Max GPUVM size for cayman and SI is 40 bits. |
1089 | */ | 1089 | */ |
1090 | adev->vm_manager.max_pfn = amdgpu_vm_size << 18; | 1090 | adev->vm_manager.vm_size = amdgpu_vm_size; |
1091 | adev->vm_manager.block_size = amdgpu_vm_block_size; | ||
1092 | adev->vm_manager.max_pfn = adev->vm_manager.vm_size << 18; | ||
1093 | |||
1094 | DRM_INFO("vm size is %llu GB, block size is %d-bit\n", | ||
1095 | adev->vm_manager.vm_size, adev->vm_manager.block_size); | ||
1091 | 1096 | ||
1092 | /* Set the internal MC address mask | 1097 | /* Set the internal MC address mask |
1093 | * This is the max address of the GPU's | 1098 | * This is the max address of the GPU's |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index d81372357ae6..7632f4ad7aa9 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | |||
@@ -532,11 +532,23 @@ static int gmc_v9_0_sw_init(void *handle) | |||
532 | 532 | ||
533 | if (adev->flags & AMD_IS_APU) { | 533 | if (adev->flags & AMD_IS_APU) { |
534 | adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; | 534 | adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; |
535 | adev->vm_manager.vm_size = amdgpu_vm_size; | ||
536 | adev->vm_manager.block_size = amdgpu_vm_block_size; | ||
535 | } else { | 537 | } else { |
536 | /* XXX Don't know how to get VRAM type yet. */ | 538 | /* XXX Don't know how to get VRAM type yet. */ |
537 | adev->mc.vram_type = AMDGPU_VRAM_TYPE_HBM; | 539 | adev->mc.vram_type = AMDGPU_VRAM_TYPE_HBM; |
540 | /* | ||
541 | * To fulfill 4-level page support, | ||
542 | * vm size is 256TB (48bit), maximum size of Vega10, | ||
543 | * block size 512 (9bit) | ||
544 | */ | ||
545 | adev->vm_manager.vm_size = 1U << 18; | ||
546 | adev->vm_manager.block_size = 9; | ||
538 | } | 547 | } |
539 | 548 | ||
549 | DRM_INFO("vm size is %llu GB, block size is %d-bit\n", | ||
550 | adev->vm_manager.vm_size, adev->vm_manager.block_size); | ||
551 | |||
540 | /* This interrupt is VMC page fault.*/ | 552 | /* This interrupt is VMC page fault.*/ |
541 | r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_VMC, 0, | 553 | r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_VMC, 0, |
542 | &adev->mc.vm_fault); | 554 | &adev->mc.vm_fault); |
@@ -546,14 +558,7 @@ static int gmc_v9_0_sw_init(void *handle) | |||
546 | if (r) | 558 | if (r) |
547 | return r; | 559 | return r; |
548 | 560 | ||
549 | /* Because of four level VMPTs, vm size is at least 512GB. | 561 | adev->vm_manager.max_pfn = adev->vm_manager.vm_size << 18; |
550 | * The maximum size is 256TB (48bit). | ||
551 | */ | ||
552 | if (amdgpu_vm_size < 512) { | ||
553 | DRM_WARN("VM size is at least 512GB!\n"); | ||
554 | amdgpu_vm_size = 512; | ||
555 | } | ||
556 | adev->vm_manager.max_pfn = (uint64_t)amdgpu_vm_size << 18; | ||
557 | 562 | ||
558 | /* Set the internal MC address mask | 563 | /* Set the internal MC address mask |
559 | * This is the max address of the GPU's | 564 | * This is the max address of the GPU's |
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c index a065b4394ea7..3c9e27effc6a 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | |||
@@ -242,7 +242,7 @@ int mmhub_v1_0_gart_enable(struct amdgpu_device *adev) | |||
242 | EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | 242 | EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); |
243 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | 243 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, |
244 | PAGE_TABLE_BLOCK_SIZE, | 244 | PAGE_TABLE_BLOCK_SIZE, |
245 | amdgpu_vm_block_size - 9); | 245 | adev->vm_manager.block_size - 9); |
246 | WREG32(SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT1_CNTL) + i, tmp); | 246 | WREG32(SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT1_CNTL) + i, tmp); |
247 | WREG32(SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32) + i*2, 0); | 247 | WREG32(SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32) + i*2, 0); |
248 | WREG32(SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32) + i*2, 0); | 248 | WREG32(SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32) + i*2, 0); |