Skip to contentSkip to conversation

drm/amdgpu: Use correct address to setup gart page table for vram access

PATCH In review Xiaogang.Chen 3 participants 3 messages Jan 8 – Jan 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Use correct address to setup gart page table for vram access

From: Xiaogang Chen <[email protected]>

Fixes 68a5940841684 ("drm/amdgpu/gart: Add helper to bind VRAM pages (v2)")

Use dst input parameter to setup gart page table entries instead of using fixed location.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +2 -2
index 16c3b78e50cb..ec911dce345f 100644
@@ -375,7 +375,7 @@ void amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
  * @start_page: first page to map in the GART aperture
  * @num_pages: number of pages to be mapped
  * @flags: page table entry flags
- * @dst: CPU address of the GART table
+ * @dst: valid CPU address of GART table, cannot be null
  *
  * Binds a BO that is allocated in VRAM to the GART page table
  * (all ASICs).
@@ -396,7 +396,7 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device *adev, uint64_t pa,
 		return;
 
 	for (i = 0; i < num_pages; ++i) {
-		amdgpu_gmc_set_pte_pde(adev, adev->gart.ptr,
+		amdgpu_gmc_set_pte_pde(adev, dst,
 			start_page + i, pa + AMDGPU_GPU_PAGE_SIZE * i, flags);
 	}
 
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Xiaogang.Chen

From: Xiaogang Chen <[email protected]>

Fixes 68a5940841684 ("drm/amdgpu/gart: Add helper to bind VRAM pages (v2)")

Use dst input parameter to setup gart page table entries instead of using fixed location.

Quoted 29 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +2 -3
index 16c3b78e50cb..ec911dce345f 100644
@@ -375,7 +375,7 @@ void amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
  * @start_page: first page to map in the GART aperture
  * @num_pages: number of pages to be mapped
  * @flags: page table entry flags
- * @dst: CPU address of the GART table
+ * @dst: valid CPU address of GART table, cannot be null
  *
  * Binds a BO that is allocated in VRAM to the GART page table
  * (all ASICs).
@@ -396,7 +396,7 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device *adev, uint64_t pa,
                return;
 
        for (i = 0; i < num_pages; ++i) {
-               amdgpu_gmc_set_pte_pde(adev, adev->gart.ptr,
+               amdgpu_gmc_set_pte_pde(adev, dst,
                        start_page + i, pa + AMDGPU_GPU_PAGE_SIZE * i, flags);
        }
 
--

2.34.1

maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Xiaogang.Chen
Quoted 8 lines · Xiaogang.Chen

From: Xiaogang Chen <[email protected]>

Fixes 68a5940841684 ("drm/amdgpu/gart: Add helper to bind VRAM pages (v2)")

Use dst input parameter to setup gart page table entries instead of using fixed location.

Quoted 26 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +2 -2
index 16c3b78e50cb..ec911dce345f 100644
@@ -375,7 +375,7 @@ void amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
  * @start_page: first page to map in the GART aperture
  * @num_pages: number of pages to be mapped
  * @flags: page table entry flags
- * @dst: CPU address of the GART table
+ * @dst: valid CPU address of GART table, cannot be null
  *
  * Binds a BO that is allocated in VRAM to the GART page table
  * (all ASICs).
@@ -396,7 +396,7 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device *adev, uint64_t pa,
 		return;
 
 	for (i = 0; i < num_pages; ++i) {
-		amdgpu_gmc_set_pte_pde(adev, adev->gart.ptr,
+		amdgpu_gmc_set_pte_pde(adev, dst,
 			start_page + i, pa + AMDGPU_GPU_PAGE_SIZE * i, flags);
 	}