[PATCH] drm/amdgpu: fix an underflow on non-4KB-page systems

2021-03-29 Thread Xℹ Ruoyao
If the initial value of `num_entires` (calculated at line 1654) is not an integral multiple of `AMDGPU_GPU_PAGES_IN_CPU_PAGE`, in line 1681 a value greater than the initial value will be assigned to it. That causes `start > last + 1` after line 1708. Then in the next iteration an underflow happen

[PATCH 2/2] drm/amdgpu: check alignment on CPU page for bo map

2021-03-30 Thread Xℹ Ruoyao
The page table of AMDGPU requires an alignment to CPU page so we should check ioctl parameters for it. Return -EINVAL if some parameter is unaligned to CPU page, instead of corrupt the page table sliently. Signed-off-by: Xi Ruoyao --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 1 file

[PATCH 1/2] drm/amdgpu: Set a suitable dev_info.gart_page_size

2021-03-30 Thread Xℹ Ruoyao
From: Huacai Chen In Mesa, dev_info.gart_page_size is used for alignment and it was set to AMDGPU_GPU_PAGE_SIZE(4KB). However, the page table of AMDGPU driver requires an alignment on CPU pages. So, for non-4KB page system, gart_page_size should be max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE). S

[PATCH 0/2] ensure alignment on CPU page for bo mapping

2021-03-30 Thread Xℹ Ruoyao
unaligned parameter to be rejected -EINVAL, instead of causing page table corruption. The patches should be applied for drm-next. Huacai Chen (1): drm/amdgpu: Set a suitable dev_info.gart_page_size Xℹ Ruoyao (1): drm/amdgpu: check alignment on CPU page for bo map drivers/gpu/drm/amd/amdgpu