Skip to contentSkip to conversation

drm/amdgpu: adjust register address calculation

PATCH In review Stanley.Yang 2 participants 2 messages Feb 11, 2022

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

PATCH 1/1 drm/amdgpu: adjust register address calculation

the UMC_STATUS register is not liner, adjust offset calculation formula to get correct address

Change-Id Ic8926078301848330babf289c4238dc8cbcf313d
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +7 -0
index e613511e07e1..87e4ef18e151 100644
@@ -47,6 +47,13 @@ static inline uint32_t get_umc_v6_7_reg_offset(struct amdgpu_device *adev,
 					      uint32_t umc_inst,
 					      uint32_t ch_inst)
 {
+	uint32_t index = umc_inst * adev->umc.channel_inst_num + ch_inst;
+
+	/* adjust umc and channel index offset,
+	 * the register address is not linear on each umc instace */
+	umc_inst = index / 4;
+	ch_inst = index % 4;
+
 	return adev->umc.channel_offs * ch_inst + UMC_V6_7_INST_DIST * umc_inst;
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

With the typo fixed, the patch is:

Quoted 10 lines

-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Friday, February 11, 2022 6:15 PM
To: [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Zhou1, Tao <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amdgpu: adjust register address calculation

the UMC_STATUS register is not liner, adjust offset calculation formula to get

[Tao]: typo, liner -> linear

Quoted 30 lines

correct address

Change-Id Ic8926078301848330babf289c4238dc8cbcf313d
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +7 -1
index e613511e07e1..87e4ef18e151 100644
@@ -47,6 +47,13 @@ static inline uint32_t get_umc_v6_7_reg_offset(struct
 amdgpu_device *adev,
 					      uint32_t umc_inst,
 					      uint32_t ch_inst)
 {
+	uint32_t index = umc_inst * adev->umc.channel_inst_num + ch_inst;
+
+	/* adjust umc and channel index offset,
+	 * the register address is not linear on each umc instace */
+	umc_inst = index / 4;
+	ch_inst = index % 4;
+
 	return adev->umc.channel_offs * ch_inst + UMC_V6_7_INST_DIST *
 umc_inst;  }
 
--

2.17.1