drm/amdgpu: add ip_dump support for vcn 5.0.1
Subsystems (2)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu: add ip_dump support for vcn 5.0.1
Shared with vcn 5.0.0.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 35 +++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.h | 5 ++++ drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 7 +++++ drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.h | 8 ------ 4 files changed, 33 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +21 -14
@@ -105,6 +105,21 @@ static int vcn_v5_0_0_early_init(struct amdgpu_ip_block *ip_block)return amdgpu_vcn_early_init (adev); } +void vcn_v5_0_0_alloc_ip_dump (struct amdgpu_device *adev) +{ +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_5_0); +uint32_t *ptr; + +/* Allocate memory for VCN IP Dump buffer */ + ptr =kcalloc (adev->vcn.num_vcn_inst * reg_count,sizeof (uint32_t ),GFP_KERNEL ); +if (!ptr) { +DRM_ERROR ("Failed to allocate memory for VCN IP Dump\n" ); + adev->vcn.ip_dump =NULL ; + }else { + adev->vcn.ip_dump = ptr; + } +} +/** * vcn_v5_0_0_sw_init - sw init for VCN block *
@@ -117,8 +132,6 @@ static int vcn_v5_0_0_sw_init(struct amdgpu_ip_block *ip_block)struct amdgpu_ring *ring;struct amdgpu_device *adev = ip_block->adev;int i, r; -uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_5_0); -uint32_t *ptr; r =amdgpu_vcn_sw_init (adev);if (r)
@@ -177,14 +190,7 @@ static int vcn_v5_0_0_sw_init(struct amdgpu_ip_block *ip_block)if (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) adev->vcn.pause_dpg_mode = vcn_v5_0_0_pause_dpg_mode; -/* Allocate memory for VCN IP Dump buffer */ - ptr =kcalloc (adev->vcn.num_vcn_inst * reg_count,sizeof (uint32_t ),GFP_KERNEL ); -if (!ptr) { -DRM_ERROR ("Failed to allocate memory for VCN IP Dump\n" ); - adev->vcn.ip_dump =NULL ; - }else { - adev->vcn.ip_dump = ptr; - } +vcn_v5_0_0_alloc_ip_dump (adev); r =amdgpu_vcn_sysfs_reset_mask_init (adev);if (r)
@@ -1357,7 +1363,8 @@ static void vcn_v5_0_0_set_irq_funcs(struct amdgpu_device *adev) } } -static void vcn_v5_0_print_ip_state (struct amdgpu_ip_block *ip_block,struct drm_printer *p) +void vcn_v5_0_0_print_ip_state (struct amdgpu_ip_block *ip_block, +struct drm_printer *p) {struct amdgpu_device *adev = ip_block->adev;int i, j;
@@ -1389,7 +1396,7 @@ static void vcn_v5_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm } } -static void vcn_v5_0_dump_ip_state (struct amdgpu_ip_block *ip_block) +void vcn_v5_0_0_dump_ip_state (struct amdgpu_ip_block *ip_block) {struct amdgpu_device *adev = ip_block->adev;int i, j;
@@ -1430,8 +1437,8 @@ static const struct amd_ip_funcs vcn_v5_0_0_ip_funcs = { .wait_for_idle = vcn_v5_0_0_wait_for_idle, .set_clockgating_state = vcn_v5_0_0_set_clockgating_state, .set_powergating_state = vcn_v5_0_0_set_powergating_state, - .dump_ip_state = vcn_v5_0_dump_ip_state, - .print_ip_state = vcn_v5_0_print_ip_state, + .dump_ip_state = vcn_v5_0_0_dump_ip_state, + .print_ip_state = vcn_v5_0_0_print_ip_state, };const struct amdgpu_ip_block_version vcn_v5_0_0_ip_block = {
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.h +5 -0
@@ -32,6 +32,11 @@#define VCN_VID_IP_ADDRESS 0x0#define VCN_AON_IP_ADDRESS 0x30000 +void vcn_v5_0_0_alloc_ip_dump (struct amdgpu_device *adev); +void vcn_v5_0_0_print_ip_state (struct amdgpu_ip_block *ip_block, +struct drm_printer *p); +void vcn_v5_0_0_dump_ip_state (struct amdgpu_ip_block *ip_block); +extern const struct amdgpu_ip_block_version vcn_v5_0_0_ip_block;#endif /* __VCN_V5_0_0_H__ */
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +7 -0
@@ -33,6 +33,7 @@#include "vcn/vcn_5_0_0_offset.h" #include "vcn/vcn_5_0_0_sh_mask.h" #include "ivsrcid/vcn/irqsrcs_vcn_5_0.h" +#include "vcn_v5_0_0.h" #include "vcn_v5_0_1.h" #include <drm/drm_drv.h>
@@ -118,6 +119,8 @@ static int vcn_v5_0_1_sw_init(struct amdgpu_ip_block *ip_block)amdgpu_vcn_fwlog_init (&adev->vcn.inst[i]); } +vcn_v5_0_0_alloc_ip_dump (adev); +return 0 ; }
@@ -151,6 +154,8 @@ static int vcn_v5_0_1_sw_fini(struct amdgpu_ip_block *ip_block) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1094,6 +1099,8 @@ static const struct amd_ip_funcs vcn_v5_0_1_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v5_0_1_set_clockgating_state, .set_powergating_state = vcn_v5_0_1_set_powergating_state, + .dump_ip_state = vcn_v5_0_0_dump_ip_state, + .print_ip_state = vcn_v5_0_0_print_ip_state, };const struct amdgpu_ip_block_version vcn_v5_0_1_ip_block = {
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.h +0 -8
@@ -24,14 +24,6 @@#ifndef __VCN_v5_0_1_H__#define __VCN_v5_0_1_H__ -#define VCN_VID_SOC_ADDRESS 0x1FC00 -#define VCN_AON_SOC_ADDRESS 0x1F800 -#define VCN1_VID_SOC_ADDRESS 0x48300 -#define VCN1_AON_SOC_ADDRESS 0x48000 - -#define VCN_VID_IP_ADDRESS 0x0 -#define VCN_AON_IP_ADDRESS 0x30000 -extern const struct amdgpu_ip_block_version vcn_v5_0_1_ip_block;#endif /* __VCN_v5_0_1_H__ */
Signature · 1 line
2.47.1
Alex Deucher
maintainerPATCH 2/2 drm/amdgpu: add sysfs reset mask for vcn 5.0.1
Add the calls to the vcn 5.0.1 code.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +10 -0
@@ -119,8 +119,16 @@ static int vcn_v5_0_1_sw_init(struct amdgpu_ip_block *ip_block)amdgpu_vcn_fwlog_init (&adev->vcn.inst[i]); } +/* TODO: Add queue reset mask when FW fully supports it */ + adev->vcn.supported_reset = +amdgpu_get_soft_full_reset_mask (&adev->vcn.inst[0 ].ring_enc[0 ]); +vcn_v5_0_0_alloc_ip_dump (adev); + r =amdgpu_vcn_sysfs_reset_mask_init (adev); +if (r) +return r; +return 0 ; }
@@ -154,6 +162,8 @@ static int vcn_v5_0_1_sw_fini(struct amdgpu_ip_block *ip_block) r =amdgpu_vcn_sw_fini (adev); +amdgpu_vcn_sysfs_reset_mask_fini (adev); +kfree (adev->vcn.ip_dump);return r;
Signature · 1 line
2.47.1
Re: [PATCH 2/2] drm/amdgpu: add sysfs reset mask for vcn 5.0.1
Series is:
Reviewed-by David (Ming Qiang) Wu <[email protected]>
one thing I would like to do:
return amdgpu_vcn_sysfs_reset_mask_init(adev);
Quoted 37 lines · Alex Deucher
Add the calls to the vcn 5.0.1 code.
Signed-off-by Alex Deucher<[email protected]>--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +10
-0@@ -119,8 +119,16 @@ static int vcn_v5_0_1_sw_init(struct amdgpu_ip_block *ip_block)amdgpu_vcn_fwlog_init (&adev->vcn.inst[i]); } +/* TODO: Add queue reset mask when FW fully supports it */ + adev->vcn.supported_reset = +amdgpu_get_soft_full_reset_mask (&adev->vcn.inst[0 ].ring_enc[0 ]); +vcn_v5_0_0_alloc_ip_dump (adev); + r =amdgpu_vcn_sysfs_reset_mask_init (adev); +if (r) +return r; +return 0 ; }@@ -154,6 +162,8 @@ static int vcn_v5_0_1_sw_fini(struct amdgpu_ip_block *ip_block) r =amdgpu_vcn_sw_fini (adev); +amdgpu_vcn_sysfs_reset_mask_fini (adev); +kfree (adev->vcn.ip_dump);return r;