Skip to contentSkip to conversation

drm/amdgpu: fix invadate operation for pg_flags

PATCH In review Jesse Zhang 2 participants 2 messages May 21, 2024

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

PATCH v3 3/4 drm/amdgpu: fix invadate operation for pg_flags

Since the type of pg_flags is u32, adev->pg_flags >> 16 >> 16 is 0 regardless of the values of its operands.

So removing the operations upper_32_bits and lower_32_bits.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -2
index ac0ba8b8c1aa..0e1a11b6b989 100644
@@ -918,7 +918,7 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf,
 
 	/* rev==1 */
 	config[no_regs++] = adev->rev_id;
-	config[no_regs++] = lower_32_bits(adev->pg_flags);
+	config[no_regs++] = adev->pg_flags;
 	config[no_regs++] = lower_32_bits(adev->cg_flags);
 
 	/* rev==2 */
@@ -935,7 +935,7 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf,
 	config[no_regs++] = adev->flags & AMD_IS_APU ? 1 : 0;
 
 	/* rev==5 PG/CG flag upper 32bit */
-	config[no_regs++] = upper_32_bits(adev->pg_flags);
+	config[no_regs++] = 0;
 	config[no_regs++] = upper_32_bits(adev->cg_flags);
 
 	while (size && (*pos < no_regs * 4)) {
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 3/4
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

________________________________
From: Jesse Zhang <[email protected]>
Sent: Tuesday, May 21, 2024 3:17 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 3/4 V3] drm/amdgpu: fix invadate operation for pg_flags

Since the type of pg_flags is u32, adev->pg_flags >> 16 >> 16 is 0 regardless of the values of its operands.

So removing the operations upper_32_bits and lower_32_bits.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -2
index ac0ba8b8c1aa..0e1a11b6b989 100644
@@ -918,7 +918,7 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf,
 
         /* rev==1 */
         config[no_regs++] = adev->rev_id;
-       config[no_regs++] = lower_32_bits(adev->pg_flags);
+       config[no_regs++] = adev->pg_flags;
         config[no_regs++] = lower_32_bits(adev->cg_flags);
 
         /* rev==2 */
@@ -935,7 +935,7 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf,
         config[no_regs++] = adev->flags & AMD_IS_APU ? 1 : 0;
 
         /* rev==5 PG/CG flag upper 32bit */
-       config[no_regs++] = upper_32_bits(adev->pg_flags);
+       config[no_regs++] = 0;
         config[no_regs++] = upper_32_bits(adev->cg_flags);
 
         while (size && (*pos < no_regs * 4)) {

--
2.25.1