drm/amdgpu: move GTT allocation from gmc_sw_init to gmc_hw_init
Subsystems (2)
PATCH 1/1 drm/amdgpu: move GTT allocation from gmc_sw_init to gmc_hw_init
The below patch causes system hang for harvested ASICs. d015e9861e55 drm/amdgpu: improve debug VRAM access performance using sdma
The root cause is that GTT buffer should be allocated after GC SA harvest programming completed.
For harvested AISC, the GC SA harvest process(see utcl2_harvest) is programmed in gmc_v10_0_hw_init function. This is a hardware programming. Therefore should be located in hw init. Hence need to move GTT allocation from gmc_v10_0_sw_init to gmc_v10_0_hw_init.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 -------- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -8
@@ -1823,12 +1823,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)return r; } -if (amdgpu_bo_create_kernel (adev,PAGE_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , - &adev->mman.sdma_access_bo,NULL , - &adev->mman.sdma_access_ptr)) -DRM_WARN ("Debug VRAM access will use slowpath MM access\n" ); -return 0 ; }
@@ -1850,8 +1844,6 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)if (adev->mman.stolen_reserved_size)amdgpu_bo_free_kernel (&adev->mman.stolen_reserved_memory,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->mman.sdma_access_bo,NULL , - &adev->mman.sdma_access_ptr);amdgpu_ttm_fw_reserve_vram_fini (adev);if (drm_dev_enter (adev_to_drm (adev), &idx)) {
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
@@ -1062,6 +1062,12 @@ static int gmc_v10_0_hw_init(void *handle)if (adev->umc.funcs && adev->umc.funcs->init_registers) adev->umc.funcs->init_registers (adev); +if (amdgpu_bo_create_kernel (adev,PAGE_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_GTT , + &adev->mman.sdma_access_bo,NULL , + &adev->mman.sdma_access_ptr)) +DRM_WARN ("Debug VRAM access will use slowpath MM access\n" ); +return 0 ; }
@@ -1082,6 +1088,9 @@ static int gmc_v10_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +amdgpu_bo_free_kernel (&adev->mman.sdma_access_bo,NULL , + &adev->mman.sdma_access_ptr); +gmc_v10_0_gart_disable (adev);if (amdgpu_sriov_vf (adev)) {
Signature · 1 line
2.25.1
[Public]
This will create sdma_access_bo only for ASIC with gmc v10? Original creation occurs in amdgpu_ttm_init, it's not limited to ASICs with gmc v10.
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Aaron Liu
Sent: Thursday, January 27, 2022 3:04 PM
To: [email protected]
Cc: Ji, Ruili <[email protected]>; Kim, Jonathan <[email protected]>; Kuehling, Felix <[email protected]>; Liu, Aaron <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: move GTT allocation from gmc_sw_init to gmc_hw_init
The below patch causes system hang for harvested ASICs. d015e9861e55 drm/amdgpu: improve debug VRAM access performance using sdma
The root cause is that GTT buffer should be allocated after GC SA harvest programming completed.
For harvested AISC, the GC SA harvest process(see utcl2_harvest) is programmed in gmc_v10_0_hw_init function. This is a hardware programming. Therefore should be located in hw init. Hence need to move GTT allocation from gmc_v10_0_sw_init to gmc_v10_0_hw_init.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 -------- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -8
@@ -1823,12 +1823,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)return r; } -if (amdgpu_bo_create_kernel (adev,PAGE_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , - &adev->mman.sdma_access_bo,NULL , - &adev->mman.sdma_access_ptr)) -DRM_WARN ("Debug VRAM access will use slowpath MM access\n" ); -return 0 ; }
@@ -1850,8 +1844,6 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)if (adev->mman.stolen_reserved_size)amdgpu_bo_free_kernel (&adev->mman.stolen_reserved_memory,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->mman.sdma_access_bo,NULL , - &adev->mman.sdma_access_ptr);amdgpu_ttm_fw_reserve_vram_fini (adev); if (drm_dev_enter(adev_to_drm(adev), &idx)) { diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 73ab0eebe4e2..c560bdc2a93c 100644
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -1
@@ -1062,6 +1062,12 @@ static int gmc_v10_0_hw_init(void *handle)if (adev->umc.funcs && adev->umc.funcs->init_registers) adev->umc.funcs->init_registers (adev); +if (amdgpu_bo_create_kernel (adev,PAGE_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_GTT , + &adev->mman.sdma_access_bo,NULL , + &adev->mman.sdma_access_ptr)) +DRM_WARN ("Debug VRAM access will use slowpath MM access\n" ); +return 0 ; }
@@ -1082,6 +1088,9 @@ static int gmc_v10_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +amdgpu_bo_free_kernel (&adev->mman.sdma_access_bo,NULL , + &adev->mman.sdma_access_ptr); +gmc_v10_0_gart_disable (adev);if (amdgpu_sriov_vf (adev)) { --
2.25.1
[Public]
Guchun.
Thanks your reminder. I need to modify again.
--
Best Regards
Aaron Liu
Quoted 111 lines
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Thursday, January 27, 2022 3:10 PM
To: Liu, Aaron <[email protected]>; [email protected]
Cc: Ji, Ruili <[email protected]>; Kim, Jonathan <[email protected]>; Kuehling, Felix <[email protected]>; Liu, Aaron <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: move GTT allocation fromgmc_sw_inittogmc_hw_init[Public]
This will create
sdma_access_boonly for ASIC with gmc v10? Original creation occurs inamdgpu_ttm_init, it's not limited to ASICs with gmc v10.Regards,
Guchun-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Aaron Liu
Sent: Thursday, January 27, 2022 3:04 PM
To: [email protected]
Cc: Ji, Ruili <[email protected]>; Kim, Jonathan <[email protected]>; Kuehling, Felix <[email protected]>; Liu, Aaron <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: move GTT allocation fromgmc_sw_inittogmc_hw_initThe below patch causes system hang for harvested ASICs.
d015e9861e55drm/amdgpu: improve debug VRAM access performance using sdmaThe root cause is that GTT buffer should be allocated after GC SA harvest programming completed.
For harvested AISC, the GC SA harvest
process(see utcl2_harvest)is programmed ingmc_v10_0_hw_initfunction. This is a hardware programming.
Therefore should be located in hw init. Hence need to move GTT allocation fromgmc_v10_0_sw_inittogmc_v10_0_hw_init.Signed-off-by Aaron Liu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 -------- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-6@@ -1823,12 +1823,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)return r; } -if (amdgpu_bo_create_kernel (adev,PAGE_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , - &adev->mman.sdma_access_bo,NULL , - &adev->mman.sdma_access_ptr)) -DRM_WARN ("Debug VRAM access will use slowpath MM access\n"); -return 0 ;}
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-2@@ -1850,8 +1844,6 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)if (adev->mman.stolen_reserved_size)amdgpu_bo_free_kernel (&adev- >mman.stolen_reserved_memory,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->mman.sdma_access_bo,NULL , - &adev->mman.sdma_access_ptr);amdgpu_ttm_fw_reserve_vram_fini (adev);if (
drm_dev_enter(adev_to_drm(adev), &idx)) { diff --gita/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.cb/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index73ab0eebe4e2..c560bdc2a93c100644drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9
-1@@ -1062,6 +1062,12 @@ static int gmc_v10_0_hw_init(void *handle)if (adev->umc.funcs && adev->umc.funcs->init_registers) adev->umc.funcs->init_registers (adev); +if (amdgpu_bo_create_kernel (adev,PAGE_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_GTT , + &adev->mman.sdma_access_bo,NULL , + &adev->mman.sdma_access_ptr)) +DRM_WARN ("Debug VRAM access will use slowpath MM access\n"); +return 0 ; }@@ -1082,6 +1088,9 @@ static int gmc_v10_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +amdgpu_bo_free_kernel (&adev->mman.sdma_access_bo,NULL , + &adev->mman.sdma_access_ptr); +gmc_v10_0_gart_disable (adev);if (amdgpu_sriov_vf (adev)) { --2.25.1