All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-5.10] drm/amdgpu: Set a suitable dev_info.gart_page_size
@ 2022-02-09 20:16 Salvatore Bonaccorso
  2022-02-10  6:55 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Salvatore Bonaccorso @ 2022-02-09 20:16 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, Sasha Levin, Rui Wang, Huacai Chen,
	Xi Ruoyao, Dan Horák, Christian König, Alex Deucher,
	Timothy Pearson, Salvatore Bonaccorso

From: Huacai Chen <chenhc@lemote.com>

commit f4d3da72a76a9ce5f57bba64788931686a9dc333 upstream.

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).

Signed-off-by: Rui Wang <wangr@lemote.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Link: https://github.com/loongson-community/linux-stable/commit/caa9c0a1
[Xi: rebased for drm-next, use max_t for checkpatch,
     and reworded commit message.]
Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1549
Tested-by: Dan Horák <dan@danny.cz>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[Salvatore Bonaccorso: Backport to 5.10.y which does not contain
a5a52a43eac0 ("drm/amd/amdgpu/amdgpu_kms: Remove 'struct
drm_amdgpu_info_device dev_info' from the stack") which removes dev_info
from the stack and places it on the heap.]
Tested-by: Timothy Pearson <tpearson@raptorengineering.com>
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index efda38349a03..917b94002f4b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -766,9 +766,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 			dev_info.high_va_offset = AMDGPU_GMC_HOLE_END;
 			dev_info.high_va_max = AMDGPU_GMC_HOLE_END | vm_size;
 		}
-		dev_info.virtual_address_alignment = max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
+		dev_info.virtual_address_alignment = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
 		dev_info.pte_fragment_size = (1 << adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE;
-		dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
+		dev_info.gart_page_size = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
 		dev_info.cu_active_number = adev->gfx.cu_info.number;
 		dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
 		dev_info.ce_ram_size = adev->gfx.ce_ram_size;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for-5.10] drm/amdgpu: Set a suitable dev_info.gart_page_size
  2022-02-09 20:16 [PATCH for-5.10] drm/amdgpu: Set a suitable dev_info.gart_page_size Salvatore Bonaccorso
@ 2022-02-10  6:55 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2022-02-10  6:55 UTC (permalink / raw)
  To: Salvatore Bonaccorso, stable
  Cc: Greg Kroah-Hartman, Sasha Levin, Rui Wang, Huacai Chen,
	Xi Ruoyao, Dan Horák, Alex Deucher, Timothy Pearson

Am 09.02.22 um 21:16 schrieb Salvatore Bonaccorso:
> From: Huacai Chen <chenhc@lemote.com>
>
> commit f4d3da72a76a9ce5f57bba64788931686a9dc333 upstream.
>
> 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).
>
> Signed-off-by: Rui Wang <wangr@lemote.com>
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> Link: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Floongson-community%2Flinux-stable%2Fcommit%2Fcaa9c0a1&amp;data=04%7C01%7Cchristian.koenig%40amd.com%7Cb78f6e9d698e43c98f9208d9ec091418%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637800346008209568%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=NC6sHsmTLKCZcsR2drU0y5qqHDbmLlbksCjr2n7M9vU%3D&amp;reserved=0
> [Xi: rebased for drm-next, use max_t for checkpatch,
>       and reworded commit message.]
> Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
> BugLink: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1549&amp;data=04%7C01%7Cchristian.koenig%40amd.com%7Cb78f6e9d698e43c98f9208d9ec091418%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637800346008209568%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=lCJLm1GpevRtltwOiAWSJoNmXLxsEikVxxYc8oGCoyc%3D&amp;reserved=0
> Tested-by: Dan Horák <dan@danny.cz>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> [Salvatore Bonaccorso: Backport to 5.10.y which does not contain
> a5a52a43eac0 ("drm/amd/amdgpu/amdgpu_kms: Remove 'struct
> drm_amdgpu_info_device dev_info' from the stack") which removes dev_info
> from the stack and places it on the heap.]
> Tested-by: Timothy Pearson <tpearson@raptorengineering.com>
> Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index efda38349a03..917b94002f4b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -766,9 +766,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>   			dev_info.high_va_offset = AMDGPU_GMC_HOLE_END;
>   			dev_info.high_va_max = AMDGPU_GMC_HOLE_END | vm_size;
>   		}
> -		dev_info.virtual_address_alignment = max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
> +		dev_info.virtual_address_alignment = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
>   		dev_info.pte_fragment_size = (1 << adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE;
> -		dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
> +		dev_info.gart_page_size = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
>   		dev_info.cu_active_number = adev->gfx.cu_info.number;
>   		dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
>   		dev_info.ce_ram_size = adev->gfx.ce_ram_size;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-10  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 20:16 [PATCH for-5.10] drm/amdgpu: Set a suitable dev_info.gart_page_size Salvatore Bonaccorso
2022-02-10  6:55 ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.