Skip to contentSkip to conversation

drm/amdgpu: handle asics with 1 SDMA instance

PATCH In review Alex Deucher 4 participants 5 messages May 3, 2022 – May 5, 2022

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/2 drm/amdgpu: handle asics with 1 SDMA instance

From: Xiaojian Du <[email protected]>

This patch will handle asics with 1 SDMA instance.

---
 drivers/gpu/drm/amd/amdgpu/soc21.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +3 -2
index 307a1da13557..29acc5573f56 100644
@@ -252,8 +252,9 @@ static int soc21_read_register(struct amdgpu_device *adev, u32 se_num,
 	*value = 0;
 	for (i = 0; i < ARRAY_SIZE(soc21_allowed_read_registers); i++) {
 		en = &soc21_allowed_read_registers[i];
-		if (reg_offset !=
-		    (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))
+		if ((i == 7 && (adev->sdma.num_instances == 1)) || /* some asics don't have SDMA1 */
+			reg_offset !=
+			(adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))
 			continue;
 
 		*value = soc21_get_register_value(adev,
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/2 drm/amdgpu: skip the new gc doorbell function for some asics

From: Xiaojian Du <[email protected]>

This patch will skip the new gc doorbell function for some asics, only enable new doorbell model on aisc where it is supported.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -1
index 97d37b2e58f2..85fddec0d4ba 100644
@@ -4592,7 +4592,8 @@ static int gfx_v11_0_hw_init(void *handle)
 	if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
 		gfx_v11_0_select_cp_fw_arch(adev);
 
-	adev->nbio.funcs->gc_doorbell_init(adev);
+	if (adev->nbio.funcs->gc_doorbell_init)
+		adev->nbio.funcs->gc_doorbell_init(adev);
 
 	r = gfx_v11_0_rlc_resume(adev);
 	if (r)
Signature · 1 line
2.35.1
maintainer
#2 lore raw
In reply to Alex Deucher

Am 03.05.22 um 22:38 schrieb Alex Deucher:

Quoted 17 lines

From: Xiaojian Du <[email protected]>

This patch will handle asics with 1 SDMA instance.

---
  drivers/gpu/drm/amd/amdgpu/soc21.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +0 -0
index 307a1da13557..29acc5573f56 100644

drivers/gpu/drm/amd/amdgpu/soc21.c static int soc21_read_register(struct amdgpu_device *adev, u32 se_num, · line 257

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +3 -2
@@ -252,8 +252,9 @@ static int soc21_read_register(struct amdgpu_device *adev, u32 se_num,
  	*value = 0;
  	for (i = 0; i < ARRAY_SIZE(soc21_allowed_read_registers); i++) {
  		en = &soc21_allowed_read_registers[i];
-		if (reg_offset !=
-		    (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))
+		if ((i == 7 && (adev->sdma.num_instances == 1)) || /* some asics don't have SDMA1 */
+			reg_offset !=
+			(adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))

Hui what? Why do we filter out register reads in the low level function?

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0 -0
  			continue;
 
  		*value = soc21_get_register_value(adev,
#3 lore raw
Quoted 14 lines · Christian König

Am 03.05.22 um 22:38 schrieb Alex Deucher:

Quoted 12 lines

From: Xiaojian Du <[email protected]>

This patch will handle asics with 1 SDMA instance.

---
  drivers/gpu/drm/amd/amdgpu/soc21.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 15 lines

drivers/gpu/drm/amd/amdgpu/soc21.c static int soc21_read_register(struct amdgpu_device *adev, u32 se_num, · line 257

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +3 -2
index 307a1da13557..29acc5573f56 100644
@@ -252,8 +252,9 @@ static int soc21_read_register(struct amdgpu_device *adev, u32 se_num,
      *value = 0;
      for (i = 0; i < ARRAY_SIZE(soc21_allowed_read_registers); i++) {
              en = &soc21_allowed_read_registers[i];
-             if (reg_offset !=
-                 (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))
+             if ((i == 7 && (adev->sdma.num_instances == 1)) || /* some asics don't have SDMA1 */
+                     reg_offset !=
+                     (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))

Hui what? Why do we filter out register reads in the low level function?

It was copied from nv.c. The proper solution is to handle it like we do in soc15.c:
if (adev->reg_offset[en->hwip][en->inst] &&

                    reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
                                        + en->reg_offset))
                    continue;

Alex

Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0 -0
                      continue;
 
              *value = soc21_get_register_value(adev,
#4 lore raw
Quoted 31 lines · Alex Deucher
Quoted 14 lines · Christian König

Am 03.05.22 um 22:38 schrieb Alex Deucher:

Quoted 12 lines

From: Xiaojian Du <[email protected]>

This patch will handle asics with 1 SDMA instance.

---
  drivers/gpu/drm/amd/amdgpu/soc21.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 15 lines

drivers/gpu/drm/amd/amdgpu/soc21.c static int soc21_read_register(struct amdgpu_device *adev, u32 se_num, · line 257

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +3 -2
index 307a1da13557..29acc5573f56 100644
@@ -252,8 +252,9 @@ static int soc21_read_register(struct amdgpu_device *adev, u32 se_num,
      *value = 0;
      for (i = 0; i < ARRAY_SIZE(soc21_allowed_read_registers); i++) {
              en = &soc21_allowed_read_registers[i];
-             if (reg_offset !=
-                 (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))
+             if ((i == 7 && (adev->sdma.num_instances == 1)) || /* some asics don't have SDMA1 */
+                     reg_offset !=
+                     (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset))

Hui what? Why do we filter out register reads in the low level function?

Quoted 7 lines

It was copied from nv.c. The proper solution is to handle it like we do in soc15.c:
if (adev->reg_offset[en->hwip][en->inst] &&

                    reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
                                        + en->reg_offset))
                    continue;

The SDMA1_BASE are not contained in GC V11.0.1 APUs, so cannot refer this pointer. Above check is better than before, thanks!

Thanks,
Ray