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

drm/amdgpu: add ip_dump support for vcn 5.0.1

Shared with vcn 5.0.0.

Reviewed-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+33 -22
+21 -14
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
··· 105 105 return amdgpu_vcn_early_init(adev); 106 106 } 107 107 108 + void vcn_v5_0_0_alloc_ip_dump(struct amdgpu_device *adev) 109 + { 110 + uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_5_0); 111 + uint32_t *ptr; 112 + 113 + /* Allocate memory for VCN IP Dump buffer */ 114 + ptr = kcalloc(adev->vcn.num_vcn_inst * reg_count, sizeof(uint32_t), GFP_KERNEL); 115 + if (!ptr) { 116 + DRM_ERROR("Failed to allocate memory for VCN IP Dump\n"); 117 + adev->vcn.ip_dump = NULL; 118 + } else { 119 + adev->vcn.ip_dump = ptr; 120 + } 121 + } 122 + 108 123 /** 109 124 * vcn_v5_0_0_sw_init - sw init for VCN block 110 125 * ··· 132 117 struct amdgpu_ring *ring; 133 118 struct amdgpu_device *adev = ip_block->adev; 134 119 int i, r; 135 - uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_5_0); 136 - uint32_t *ptr; 137 120 138 121 r = amdgpu_vcn_sw_init(adev); 139 122 if (r) ··· 190 177 if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) 191 178 adev->vcn.pause_dpg_mode = vcn_v5_0_0_pause_dpg_mode; 192 179 193 - /* Allocate memory for VCN IP Dump buffer */ 194 - ptr = kcalloc(adev->vcn.num_vcn_inst * reg_count, sizeof(uint32_t), GFP_KERNEL); 195 - if (!ptr) { 196 - DRM_ERROR("Failed to allocate memory for VCN IP Dump\n"); 197 - adev->vcn.ip_dump = NULL; 198 - } else { 199 - adev->vcn.ip_dump = ptr; 200 - } 180 + vcn_v5_0_0_alloc_ip_dump(adev); 201 181 202 182 r = amdgpu_vcn_sysfs_reset_mask_init(adev); 203 183 if (r) ··· 1363 1357 } 1364 1358 } 1365 1359 1366 - static void vcn_v5_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p) 1360 + void vcn_v5_0_0_print_ip_state(struct amdgpu_ip_block *ip_block, 1361 + struct drm_printer *p) 1367 1362 { 1368 1363 struct amdgpu_device *adev = ip_block->adev; 1369 1364 int i, j; ··· 1396 1389 } 1397 1390 } 1398 1391 1399 - static void vcn_v5_0_dump_ip_state(struct amdgpu_ip_block *ip_block) 1392 + void vcn_v5_0_0_dump_ip_state(struct amdgpu_ip_block *ip_block) 1400 1393 { 1401 1394 struct amdgpu_device *adev = ip_block->adev; 1402 1395 int i, j; ··· 1437 1430 .wait_for_idle = vcn_v5_0_0_wait_for_idle, 1438 1431 .set_clockgating_state = vcn_v5_0_0_set_clockgating_state, 1439 1432 .set_powergating_state = vcn_v5_0_0_set_powergating_state, 1440 - .dump_ip_state = vcn_v5_0_dump_ip_state, 1441 - .print_ip_state = vcn_v5_0_print_ip_state, 1433 + .dump_ip_state = vcn_v5_0_0_dump_ip_state, 1434 + .print_ip_state = vcn_v5_0_0_print_ip_state, 1442 1435 }; 1443 1436 1444 1437 const struct amdgpu_ip_block_version vcn_v5_0_0_ip_block = {
+5
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.h
··· 32 32 #define VCN_VID_IP_ADDRESS 0x0 33 33 #define VCN_AON_IP_ADDRESS 0x30000 34 34 35 + void vcn_v5_0_0_alloc_ip_dump(struct amdgpu_device *adev); 36 + void vcn_v5_0_0_print_ip_state(struct amdgpu_ip_block *ip_block, 37 + struct drm_printer *p); 38 + void vcn_v5_0_0_dump_ip_state(struct amdgpu_ip_block *ip_block); 39 + 35 40 extern const struct amdgpu_ip_block_version vcn_v5_0_0_ip_block; 36 41 37 42 #endif /* __VCN_V5_0_0_H__ */
+7
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c
··· 33 33 #include "vcn/vcn_5_0_0_offset.h" 34 34 #include "vcn/vcn_5_0_0_sh_mask.h" 35 35 #include "ivsrcid/vcn/irqsrcs_vcn_5_0.h" 36 + #include "vcn_v5_0_0.h" 36 37 #include "vcn_v5_0_1.h" 37 38 38 39 #include <drm/drm_drv.h> ··· 119 118 amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]); 120 119 } 121 120 121 + vcn_v5_0_0_alloc_ip_dump(adev); 122 + 122 123 return 0; 123 124 } 124 125 ··· 153 150 return r; 154 151 155 152 r = amdgpu_vcn_sw_fini(adev); 153 + 154 + kfree(adev->vcn.ip_dump); 156 155 157 156 return r; 158 157 } ··· 1099 1094 .post_soft_reset = NULL, 1100 1095 .set_clockgating_state = vcn_v5_0_1_set_clockgating_state, 1101 1096 .set_powergating_state = vcn_v5_0_1_set_powergating_state, 1097 + .dump_ip_state = vcn_v5_0_0_dump_ip_state, 1098 + .print_ip_state = vcn_v5_0_0_print_ip_state, 1102 1099 }; 1103 1100 1104 1101 const struct amdgpu_ip_block_version vcn_v5_0_1_ip_block = {
-8
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.h
··· 24 24 #ifndef __VCN_v5_0_1_H__ 25 25 #define __VCN_v5_0_1_H__ 26 26 27 - #define VCN_VID_SOC_ADDRESS 0x1FC00 28 - #define VCN_AON_SOC_ADDRESS 0x1F800 29 - #define VCN1_VID_SOC_ADDRESS 0x48300 30 - #define VCN1_AON_SOC_ADDRESS 0x48000 31 - 32 - #define VCN_VID_IP_ADDRESS 0x0 33 - #define VCN_AON_IP_ADDRESS 0x30000 34 - 35 27 extern const struct amdgpu_ip_block_version vcn_v5_0_1_ip_block; 36 28 37 29 #endif /* __VCN_v5_0_1_H__ */