[PATCH] drm/amdgpu: GPU vs CPU page size fixes in amdgpu_vm_bo_split_mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 22, 2018 at 5:10 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> 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 at vger.kernel.org
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106258
> Reported-by: Matt Corallo <freedesktop at bluematt.me>
> Tested-by: foxbat at ruin.net
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 7c30451ba897..590db78b8c72 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1577,7 +1577,9 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
>                         uint64_t count;
>
>                         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;
>
>                                 if (pages_addr[idx] !=
> @@ -1590,7 +1592,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
>                                 dma_addr = pages_addr;
>                         } else {
>                                 addr = pages_addr[pfn];
> -                               max_entries = count;
> +                               max_entries = count * (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
>                         }
>
>                 } else if (flags & AMDGPU_PTE_VALID) {
> @@ -1605,7 +1607,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
>                 if (r)
>                         return r;
>
> -               pfn += last - start + 1;
> +               pfn += (last - start + 1) / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
>                 if (nodes && nodes->size == pfn) {
>                         pfn = 0;
>                         ++nodes;
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux