Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Use generic hdp flush function

Except HDP v5.2 all use a common logic for HDP flush. Use a generic
function. HDP v5.2 forces NO_KIQ logic, revisit it later.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
18a878fd d6b22b1d

+27 -48
+21
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
··· 22 22 */ 23 23 #include "amdgpu.h" 24 24 #include "amdgpu_ras.h" 25 + #include <uapi/linux/kfd_ioctl.h> 25 26 26 27 int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev) 27 28 { ··· 46 45 47 46 /* hdp ras follows amdgpu_ras_block_late_init_default for late init */ 48 47 return 0; 48 + } 49 + 50 + void amdgpu_hdp_generic_flush(struct amdgpu_device *adev, 51 + struct amdgpu_ring *ring) 52 + { 53 + if (!ring || !ring->funcs->emit_wreg) { 54 + WREG32((adev->rmmio_remap.reg_offset + 55 + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 56 + 2, 57 + 0); 58 + RREG32((adev->rmmio_remap.reg_offset + 59 + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 60 + 2); 61 + } else { 62 + amdgpu_ring_emit_wreg(ring, 63 + (adev->rmmio_remap.reg_offset + 64 + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 65 + 2, 66 + 0); 67 + } 49 68 }
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h
··· 44 44 }; 45 45 46 46 int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev); 47 + void amdgpu_hdp_generic_flush(struct amdgpu_device *adev, 48 + struct amdgpu_ring *ring); 47 49 #endif /* __AMDGPU_HDP_H__ */
+1 -12
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c
··· 36 36 #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L 37 37 #define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 38 38 39 - static void hdp_v4_0_flush_hdp(struct amdgpu_device *adev, 40 - struct amdgpu_ring *ring) 41 - { 42 - if (!ring || !ring->funcs->emit_wreg) { 43 - WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 44 - RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2); 45 - } else { 46 - amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 47 - } 48 - } 49 - 50 39 static void hdp_v4_0_invalidate_hdp(struct amdgpu_device *adev, 51 40 struct amdgpu_ring *ring) 52 41 { ··· 169 180 }; 170 181 171 182 const struct amdgpu_hdp_funcs hdp_v4_0_funcs = { 172 - .flush_hdp = hdp_v4_0_flush_hdp, 183 + .flush_hdp = amdgpu_hdp_generic_flush, 173 184 .invalidate_hdp = hdp_v4_0_invalidate_hdp, 174 185 .update_clock_gating = hdp_v4_0_update_clock_gating, 175 186 .get_clock_gating_state = hdp_v4_0_get_clockgating_state,
+1 -12
drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c
··· 27 27 #include "hdp/hdp_5_0_0_sh_mask.h" 28 28 #include <uapi/linux/kfd_ioctl.h> 29 29 30 - static void hdp_v5_0_flush_hdp(struct amdgpu_device *adev, 31 - struct amdgpu_ring *ring) 32 - { 33 - if (!ring || !ring->funcs->emit_wreg) { 34 - WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 35 - RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2); 36 - } else { 37 - amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 38 - } 39 - } 40 - 41 30 static void hdp_v5_0_invalidate_hdp(struct amdgpu_device *adev, 42 31 struct amdgpu_ring *ring) 43 32 { ··· 206 217 } 207 218 208 219 const struct amdgpu_hdp_funcs hdp_v5_0_funcs = { 209 - .flush_hdp = hdp_v5_0_flush_hdp, 220 + .flush_hdp = amdgpu_hdp_generic_flush, 210 221 .invalidate_hdp = hdp_v5_0_invalidate_hdp, 211 222 .update_clock_gating = hdp_v5_0_update_clock_gating, 212 223 .get_clock_gating_state = hdp_v5_0_get_clockgating_state,
+1 -12
drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c
··· 30 30 #define regHDP_CLK_CNTL_V6_1 0xd5 31 31 #define regHDP_CLK_CNTL_V6_1_BASE_IDX 0 32 32 33 - static void hdp_v6_0_flush_hdp(struct amdgpu_device *adev, 34 - struct amdgpu_ring *ring) 35 - { 36 - if (!ring || !ring->funcs->emit_wreg) { 37 - WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 38 - RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2); 39 - } else { 40 - amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 41 - } 42 - } 43 - 44 33 static void hdp_v6_0_update_clock_gating(struct amdgpu_device *adev, 45 34 bool enable) 46 35 { ··· 138 149 } 139 150 140 151 const struct amdgpu_hdp_funcs hdp_v6_0_funcs = { 141 - .flush_hdp = hdp_v6_0_flush_hdp, 152 + .flush_hdp = amdgpu_hdp_generic_flush, 142 153 .update_clock_gating = hdp_v6_0_update_clock_gating, 143 154 .get_clock_gating_state = hdp_v6_0_get_clockgating_state, 144 155 };
+1 -12
drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c
··· 27 27 #include "hdp/hdp_7_0_0_sh_mask.h" 28 28 #include <uapi/linux/kfd_ioctl.h> 29 29 30 - static void hdp_v7_0_flush_hdp(struct amdgpu_device *adev, 31 - struct amdgpu_ring *ring) 32 - { 33 - if (!ring || !ring->funcs->emit_wreg) { 34 - WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 35 - RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2); 36 - } else { 37 - amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0); 38 - } 39 - } 40 - 41 30 static void hdp_v7_0_update_clock_gating(struct amdgpu_device *adev, 42 31 bool enable) 43 32 { ··· 126 137 } 127 138 128 139 const struct amdgpu_hdp_funcs hdp_v7_0_funcs = { 129 - .flush_hdp = hdp_v7_0_flush_hdp, 140 + .flush_hdp = amdgpu_hdp_generic_flush, 130 141 .update_clock_gating = hdp_v7_0_update_clock_gating, 131 142 .get_clock_gating_state = hdp_v7_0_get_clockgating_state, 132 143 };