From: Hawking Zhang <[email protected]>

Since from soc15, make sure only AndMasked bit get changed
when applied or_mask

Signed-off-by: Hawking Zhang <[email protected]>
Reviewed-by: Le Ma <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 182dc834f7b6..bf5650f7ac8b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -508,7 +508,10 @@ void amdgpu_device_program_register_sequence(struct 
amdgpu_device *adev,
                } else {
                        tmp = RREG32(reg);
                        tmp &= ~and_mask;
-                       tmp |= or_mask;
+                       if (adev->family >= AMDGPU_FAMILY_AI)
+                               tmp |= (or_mask & and_mask);
+                       else
+                               tmp |= or_mask;
                }
                WREG32(reg, tmp);
        }
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 3fbc3cd849ed..9dfbbc65ea67 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -378,7 +378,7 @@ void soc15_program_register_sequence(struct amdgpu_device 
*adev,
                } else {
                        tmp = RREG32(reg);
                        tmp &= ~(entry->and_mask);
-                       tmp |= entry->or_mask;
+                       tmp |= (entry->or_mask & entry->and_mask);
                }
 
                if (reg == SOC15_REG_OFFSET(GC, 0, mmPA_SC_BINNER_EVENT_CNTL_3) 
||
-- 
2.20.1

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

Reply via email to