Skip to contentSkip to conversation

drm/amdgpu: fix baco handling for soc15

PATCH In review Alex Deucher 3 participants 3 messages Jan 25, 2019 – Jan 28, 2019 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: fix baco handling for soc15

Need to check if the operation is one that involves registers before getting the register offset. Fixes a crash in when handling commands without a register offset, e.g., wait.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c +6 -3
index 002693c421d2..9c57c1f67749 100644
@@ -84,11 +84,14 @@ bool soc15_baco_program_registers(struct pp_hwmgr *hwmgr,
 				 const u32 array_size)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
-	u32 i, reg;
+	u32 i, reg = 0;
 
 	for (i = 0; i < array_size; i++) {
-		reg = adev->reg_offset[entry[i].hwip][entry[i].inst][entry[i].seg]
-			+ entry[i].reg_offset;
+		if ((entry[i].cmd == CMD_WRITE) ||
+		    (entry[i].cmd == CMD_READMODIFYWRITE) ||
+		    (entry[i].cmd == CMD_WAITFOR))
+			reg = adev->reg_offset[entry[i].hwip][entry[i].inst][entry[i].seg]
+				+ entry[i].reg_offset;
 		if (!baco_cmd_handler(hwmgr, entry[i].cmd, reg, entry[i].mask,
 				     entry[i].shift, entry[i].val, entry[i].timeout))
 			return false;
Signature · 6 lines
2.20.1

_______________________________________________
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): 20190125203122.19195-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Andrey

Quoted 22 lines · Alex Deucher

Need to check if the operation is one that involves registers before getting the register offset. Fixes a crash in when handling commands without a register offset, e.g., wait.

---
  drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c +1 -1
index 002693c421d2..9c57c1f67749 100644
@@ -84,11 +84,14 @@ bool soc15_baco_program_registers(struct pp_hwmgr *hwmgr,
  				 const u32 array_size)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
-	u32 i, reg;
+	u32 i, reg = 0;
 
  	for (i = 0; i < array_size; i++) {

drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c bool soc15_baco_program_registers(struct pp_hwmgr *hwmgr, · line 97

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c +5 -2
-		reg = adev->reg_offset[entry[i].hwip][entry[i].inst][entry[i].seg]
-			+ entry[i].reg_offset;
+		if ((entry[i].cmd == CMD_WRITE) ||
+		    (entry[i].cmd == CMD_READMODIFYWRITE) ||
+		    (entry[i].cmd == CMD_WAITFOR))
+			reg = adev->reg_offset[entry[i].hwip][entry[i].inst][entry[i].seg]
+				+ entry[i].reg_offset;
  		if (!baco_cmd_handler(hwmgr, entry[i].cmd, reg, entry[i].mask,
  				     entry[i].shift, entry[i].val, entry[i].timeout))
  			return false;

_______________________________________________
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): d4dcee2e-fcda-3037-5293-769d37221f5f-5C7GfCeVMHo@public.gmane.org

Reviewed-by Jim Qu
#4 lore raw

Thanks
JimQu

________________________________________
发件人: amd-gfx <[email protected]> 代表 Grodzovsky, Andrey <[email protected]> 发送时间: 2019年1月26日 5:03:30
收件人: Alex Deucher; [email protected]
抄送: Deucher, Alexander
主题: Re: [PATCH] drm/amdgpu: fix baco handling for soc15

Andrey

Quoted 22 lines · Alex Deucher

Need to check if the operation is one that involves registers before getting the register offset. Fixes a crash in when handling commands without a register offset, e.g., wait.

---
  drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c +1 -1
index 002693c421d2..9c57c1f67749 100644
@@ -84,11 +84,14 @@ bool soc15_baco_program_registers(struct pp_hwmgr *hwmgr,
                               const u32 array_size)
  {
      struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
-     u32 i, reg;
+     u32 i, reg = 0;
 
      for (i = 0; i < array_size; i++) {

drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c bool soc15_baco_program_registers(struct pp_hwmgr *hwmgr, · line 97

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c +5 -2
-             reg = adev->reg_offset[entry[i].hwip][entry[i].inst][entry[i].seg]
-                     + entry[i].reg_offset;
+             if ((entry[i].cmd == CMD_WRITE) ||
+                 (entry[i].cmd == CMD_READMODIFYWRITE) ||
+                 (entry[i].cmd == CMD_WAITFOR))
+                     reg = adev->reg_offset[entry[i].hwip][entry[i].inst][entry[i].seg]
+                             + entry[i].reg_offset;
              if (!baco_cmd_handler(hwmgr, entry[i].cmd, reg, entry[i].mask,
                                   entry[i].shift, entry[i].val, entry[i].timeout))
                      return false;

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