Skip to contentSkip to conversation

drm/amdgpu: Only retrieve GPU address of GART table after pinning it

PATCH In review Michel Dänzer 3 participants 3 messages Aug 28, 2018 – Aug 29, 2018 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: Only retrieve GPU address of GART table after pinning it

From: Michel Dänzer <[email protected]>

Doing it earlier hits a WARN_ON_ONCE in amdgpu_bo_gpu_offset.

Fixes "drm/amdgpu: remove gart.table_addr"
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -1
index 543287e5d67b..9c45ea318bd6 100644
@@ -494,7 +494,7 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
 
 static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
 {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
 	int r, i;
 	u32 field;
 
@@ -505,6 +505,9 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
 	r = amdgpu_gart_table_vram_pin(adev);
 	if (r)
 		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
 	/* Setup TLB control */
 	WREG32(mmMC_VM_MX_L1_TLB_CNTL,
 	       (0xA << 7) |
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -1
index 060c79afef80..fc5fe187b614 100644
@@ -604,7 +604,7 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
  */
 static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
 {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
 	int r, i;
 	u32 tmp, field;
 
@@ -615,6 +615,9 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
 	r = amdgpu_gart_table_vram_pin(adev);
 	if (r)
 		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
 	/* Setup TLB control */
 	tmp = RREG32(mmMC_VM_MX_L1_TLB_CNTL);
 	tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -1
index 3fe9b9755cf7..91216cdf4d1c 100644
@@ -806,7 +806,7 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
  */
 static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
 {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
 	int r, i;
 	u32 tmp, field;
 
@@ -817,6 +817,9 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
 	r = amdgpu_gart_table_vram_pin(adev);
 	if (r)
 		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
 	/* Setup TLB control */
 	tmp = RREG32(mmMC_VM_MX_L1_TLB_CNTL);
 	tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180828092714.2131-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw

Am 28.08.2018 um 11:27 schrieb Michel Dänzer:

Quoted 6 lines

From: Michel Dänzer <[email protected]>

Doing it earlier hits a WARN_ON_ONCE in amdgpu_bo_gpu_offset.

Fixes "drm/amdgpu: remove gart.table_addr"
Quoted 66 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 5 ++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 5 ++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 5 ++++-
  3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -1
index 543287e5d67b..9c45ea318bd6 100644
@@ -494,7 +494,7 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
 
  static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
  {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
  	int r, i;
  	u32 field;
 
@@ -505,6 +505,9 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
  	r = amdgpu_gart_table_vram_pin(adev);
  	if (r)
  		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
  	/* Setup TLB control */
  	WREG32(mmMC_VM_MX_L1_TLB_CNTL,
  	       (0xA << 7) |
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -1
index 060c79afef80..fc5fe187b614 100644
@@ -604,7 +604,7 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
   */
  static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
  {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
  	int r, i;
  	u32 tmp, field;
 
@@ -615,6 +615,9 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
  	r = amdgpu_gart_table_vram_pin(adev);
  	if (r)
  		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
  	/* Setup TLB control */
  	tmp = RREG32(mmMC_VM_MX_L1_TLB_CNTL);
  	tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -1
index 3fe9b9755cf7..91216cdf4d1c 100644
@@ -806,7 +806,7 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
   */
  static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
  {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
  	int r, i;
  	u32 tmp, field;
 

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) · line 825

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +3 -0
@@ -817,6 +817,9 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
  	r = amdgpu_gart_table_vram_pin(adev);
  	if (r)
  		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
  	/* Setup TLB control */
  	tmp = RREG32(mmMC_VM_MX_L1_TLB_CNTL);
  	tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Junwei Zhang
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

Doing it earlier hits a WARN_ON_ONCE in amdgpu_bo_gpu_offset.

Fixes "drm/amdgpu: remove gart.table_addr"
Quoted 67 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 5 ++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 5 ++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 5 ++++-
  3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -1
index 543287e5d67b..9c45ea318bd6 100644
@@ -494,7 +494,7 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
 
  static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
  {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
  	int r, i;
  	u32 field;
 
@@ -505,6 +505,9 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
  	r = amdgpu_gart_table_vram_pin(adev);
  	if (r)
  		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
  	/* Setup TLB control */
  	WREG32(mmMC_VM_MX_L1_TLB_CNTL,
  	       (0xA << 7) |
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -1
index 060c79afef80..fc5fe187b614 100644
@@ -604,7 +604,7 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
   */
  static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
  {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
  	int r, i;
  	u32 tmp, field;
 
@@ -615,6 +615,9 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
  	r = amdgpu_gart_table_vram_pin(adev);
  	if (r)
  		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
  	/* Setup TLB control */
  	tmp = RREG32(mmMC_VM_MX_L1_TLB_CNTL);
  	tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -1
index 3fe9b9755cf7..91216cdf4d1c 100644
@@ -806,7 +806,7 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
   */
  static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
  {
-	uint64_t table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+	uint64_t table_addr;
  	int r, i;
  	u32 tmp, field;
 

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) · line 825

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +3 -0
@@ -817,6 +817,9 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
  	r = amdgpu_gart_table_vram_pin(adev);
  	if (r)
  		return r;
+
+	table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
+
  	/* Setup TLB control */
  	tmp = RREG32(mmMC_VM_MX_L1_TLB_CNTL);
  	tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx