drm/amdgpu: GPU vs CPU page size fixes in amdgpu_vm_bo_split_mapping
start / last / max_entries are numbers of GPU pages, pfn / count are numbers of CPU pages. Convert between them accordingly. Fixes badness on systems with > 4K page size. Cc: stable@vger.kernel.org Bugzilla: https://bugs.freedesktop.org/106258 Reported-by: Matt Corallo <freedesktop@bluematt.me> Tested-by: foxbat@ruin.net Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
fe2a196529
commit
38e624a18f
@@ -1463,7 +1463,9 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
|
|||||||
uint64_t count;
|
uint64_t count;
|
||||||
|
|
||||||
max_entries = min(max_entries, 16ull * 1024ull);
|
max_entries = min(max_entries, 16ull * 1024ull);
|
||||||
for (count = 1; count < max_entries; ++count) {
|
for (count = 1;
|
||||||
|
count < max_entries / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
|
||||||
|
++count) {
|
||||||
uint64_t idx = pfn + count;
|
uint64_t idx = pfn + count;
|
||||||
|
|
||||||
if (pages_addr[idx] !=
|
if (pages_addr[idx] !=
|
||||||
@@ -1476,7 +1478,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
|
|||||||
dma_addr = pages_addr;
|
dma_addr = pages_addr;
|
||||||
} else {
|
} else {
|
||||||
addr = pages_addr[pfn];
|
addr = pages_addr[pfn];
|
||||||
max_entries = count;
|
max_entries = count * (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (flags & AMDGPU_PTE_VALID) {
|
} else if (flags & AMDGPU_PTE_VALID) {
|
||||||
@@ -1491,7 +1493,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
|
|||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
pfn += last - start + 1;
|
pfn += (last - start + 1) / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
|
||||||
if (nodes && nodes->size == pfn) {
|
if (nodes && nodes->size == pfn) {
|
||||||
pfn = 0;
|
pfn = 0;
|
||||||
++nodes;
|
++nodes;
|
||||||
|
|||||||
Reference in New Issue
Block a user