VCN patches with updated register list
Subsystems (2)
cover VCN patches with updated register list
*** BLURB HERE ***
Sunil Khatri (18):
drm/amdgpu: add vcn ip dump ptr in vcn global struct drm/amdgpu: add vcn_v3_0 ip dump support drm/amdgpu: add print support for vcn_v3_0 ip dump drm/amdgpu: add vcn_v5_0 ip dump support drm/amdgpu: add print support for vcn_v5_0 ip dump drm/amdgpu: add vcn_v4_0 ip dump support drm/amdgpu: add print support for vcn_v4_0 ip dump drm/amdgpu: add vcn_v4_0_3 ip dump support drm/amdgpu: add print support for vcn_v4_0_3 ip dump drm/amdgpu: add vcn_v4_0_5 ip dump support drm/amdgpu: add print support for vcn_v4_0_5 ip dump drm/amdgpu: add vcn_v1_0 ip dump support drm/amdgpu: add print support for vcn_v1_0 ip dump drm/amdgpu: add vcn_v2_0 ip dump support drm/amdgpu: add print support for vcn_v2_0 ip dump drm/amdgpu: add vcn_v2_5 ip dump support drm/amdgpu: add print support for vcn_v2_5 ip dump drm/amdgpu: add vcn ip dump support for vcn_v2_6
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 + drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 112 +++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 113 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 118 +++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 113 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 114 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 115 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 113 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 110 +++++++++++++++++++++- 9 files changed, 893 insertions(+), 18 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/18 drm/amdgpu: add vcn ip dump ptr in vcn global struct
Add pointer to the vcn ip dump in the vcn global structure to be accessible for all vcn version via global adev.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
@@ -330,6 +330,9 @@ struct amdgpu_vcn {uint16_t inst_mask;uint8_t num_inst_per_aid;bool using_unified_queue; + +/* IP reg dump */ +uint32_t *ip_dump; };struct amdgpu_fw_shared_rb_ptrs_struct {
Signature · 1 line
2.34.1
PATCH 2/18 drm/amdgpu: add vcn_v3_0 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v3_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 78 ++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +77 -1
@@ -60,6 +60,42 @@#define RDECODE_MSG_CREATE 0x00000000#define RDECODE_MESSAGE_CREATE 0x00000001 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_3_0[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_PAUSE) +}; +static int amdgpu_ih_clientid_vcns[] = {SOC15_IH_CLIENTID_VCN ,SOC15_IH_CLIENTID_VCN1
@@ -126,6 +162,8 @@ static int vcn_v3_0_sw_init(void *handle)struct amdgpu_ring *ring;int i, j, r;int vcn_doorbell_index =0 ; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_3_0); +uint32_t *ptr;struct amdgpu_device *adev = (struct amdgpu_device *)handle; r =amdgpu_vcn_sw_init (adev);
@@ -246,6 +284,15 @@ static int vcn_v3_0_sw_init(void *handle)if (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) adev->vcn.pause_dpg_mode = vcn_v3_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 ==NULL ) { +DRM_ERROR ("Failed to allocate memory for VCN IP Dump\n" ); + adev->vcn.ip_dump =NULL ; + }else { + adev->vcn.ip_dump = ptr; + } +return 0 ; }
@@ -284,6 +331,7 @@ static int vcn_v3_0_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump);return r; }
@@ -2203,6 +2251,34 @@ static void vcn_v3_0_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v3_0_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_3_0); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, mmUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_3_0[j], i)); + } +} +static const struct amd_ip_funcs vcn_v3_0_ip_funcs = { .name ="vcn_v3_0" , .early_init = vcn_v3_0_early_init,
@@ -2221,7 +2297,7 @@ static const struct amd_ip_funcs vcn_v3_0_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v3_0_set_clockgating_state, .set_powergating_state = vcn_v3_0_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v3_0_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 3/18 drm/amdgpu: add print support for vcn_v3_0 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v3_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 35 ++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +34 -1
@@ -2251,6 +2251,39 @@ static void vcn_v3_0_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v3_0_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_3_0); +uint32_t inst_off; +bool is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_3_0[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v3_0_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -2298,7 +2331,7 @@ static const struct amd_ip_funcs vcn_v3_0_ip_funcs = { .set_clockgating_state = vcn_v3_0_set_clockgating_state, .set_powergating_state = vcn_v3_0_set_powergating_state, .dump_ip_state = vcn_v3_0_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v3_0_print_ip_state, };const struct amdgpu_ip_block_version vcn_v3_0_ip_block = {
Signature · 1 line
2.34.1
PATCH 4/18 drm/amdgpu: add vcn_v5_0 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v5_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 76 ++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +75 -1
@@ -37,6 +37,40 @@#include <drm/drm_drv.h> +static const struct amdgpu_hwip_reg_entry vcn_reg_list_5_0[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_PAUSE) +}; +static int amdgpu_ih_clientid_vcns[] = {SOC15_IH_CLIENTID_VCN ,SOC15_IH_CLIENTID_VCN1
@@ -83,6 +117,8 @@ static int vcn_v5_0_0_sw_init(void *handle)struct amdgpu_ring *ring;struct amdgpu_device *adev = (struct amdgpu_device *)handle;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)
@@ -137,6 +173,14 @@ static int vcn_v5_0_0_sw_init(void *handle)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; + }return 0 ; }
@@ -173,6 +217,8 @@ static int vcn_v5_0_0_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1297,6 +1343,34 @@ static void vcn_v5_0_0_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v5_0_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_5_0); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, regUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_5_0[j], i)); + } +} +static const struct amd_ip_funcs vcn_v5_0_0_ip_funcs = { .name ="vcn_v5_0_0" , .early_init = vcn_v5_0_0_early_init,
@@ -1315,7 +1389,7 @@ static const struct amd_ip_funcs vcn_v5_0_0_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v5_0_0_set_clockgating_state, .set_powergating_state = vcn_v5_0_0_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v5_0_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 5/18 drm/amdgpu: add print support for vcn_v5_0 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v5_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 34 ++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +33 -1
@@ -1343,6 +1343,38 @@ static void vcn_v5_0_0_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v5_0_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_5_0); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_5_0[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v5_0_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1390,7 +1422,7 @@ static const struct amd_ip_funcs vcn_v5_0_0_ip_funcs = { .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 = NULL, + .print_ip_state = vcn_v5_0_print_ip_state, };const struct amdgpu_ip_block_version vcn_v5_0_0_ip_block = {
Signature · 1 line
2.34.1
PATCH 6/18 drm/amdgpu: add vcn_v4_0 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v4_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 80 ++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +79 -1
@@ -52,6 +52,42 @@#define RDECODE_MSG_CREATE 0x00000000#define RDECODE_MESSAGE_CREATE 0x00000001 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_4_0[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_PAUSE) +}; +static int amdgpu_ih_clientid_vcns[] = {SOC15_IH_CLIENTID_VCN ,SOC15_IH_CLIENTID_VCN1
@@ -137,6 +173,8 @@ static int vcn_v4_0_sw_init(void *handle)struct amdgpu_ring *ring;struct amdgpu_device *adev = (struct amdgpu_device *)handle;int i, r; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0); +uint32_t *ptr; r =amdgpu_vcn_sw_init (adev);if (r)
@@ -200,6 +238,15 @@ static int vcn_v4_0_sw_init(void *handle)if (r)return r; +/* 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; + } +return 0 ; }
@@ -239,6 +286,8 @@ static int vcn_v4_0_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -2109,6 +2158,35 @@ static void vcn_v4_0_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v4_0_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, regUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_4_0[j], + i)); + } +} +static const struct amd_ip_funcs vcn_v4_0_ip_funcs = { .name ="vcn_v4_0" , .early_init = vcn_v4_0_early_init,
@@ -2127,7 +2205,7 @@ static const struct amd_ip_funcs vcn_v4_0_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v4_0_set_clockgating_state, .set_powergating_state = vcn_v4_0_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v4_0_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 7/18 drm/amdgpu: add print support for vcn_v4_0 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v4_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 34 ++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +33 -1
@@ -2158,6 +2158,38 @@ static void vcn_v4_0_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v4_0_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_4_0[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v4_0_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -2206,7 +2238,7 @@ static const struct amd_ip_funcs vcn_v4_0_ip_funcs = { .set_clockgating_state = vcn_v4_0_set_clockgating_state, .set_powergating_state = vcn_v4_0_set_powergating_state, .dump_ip_state = vcn_v4_0_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v4_0_print_ip_state, };const struct amdgpu_ip_block_version vcn_v4_0_ip_block = {
Signature · 1 line
2.34.1
PATCH 8/18 drm/amdgpu: add vcn_v4_0_3 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v4_0_3.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 81 ++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +80 -1
@@ -45,6 +45,42 @@#define VCN_VID_SOC_ADDRESS_2_0 0x1fb00#define VCN1_VID_SOC_ADDRESS_3_0 0x48300 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_4_0_3[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_PAUSE) +}; +#define NORMALIZE_VCN_REG_OFFSET (offset) \ (offset & 0x1FFFF)
@@ -92,6 +128,8 @@ static int vcn_v4_0_3_sw_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct amdgpu_ring *ring;int i, r, vcn_inst; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0_3); +uint32_t *ptr; r =amdgpu_vcn_sw_init (adev);if (r)
@@ -159,6 +197,15 @@ static int vcn_v4_0_3_sw_init(void *handle) } } +/* 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; + } +return 0 ; }
@@ -194,6 +241,8 @@ static int vcn_v4_0_3_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1684,6 +1733,36 @@ static void vcn_v4_0_3_set_irq_funcs(struct amdgpu_device *adev) adev->vcn.inst->irq.funcs = &vcn_v4_0_3_irq_funcs; } +static void vcn_v4_0_3_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off, inst_id; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0_3); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_id =GET_INST (VCN , i); + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , inst_id, regUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_4_0_3[j], + inst_id)); + } +} +static const struct amd_ip_funcs vcn_v4_0_3_ip_funcs = { .name ="vcn_v4_0_3" , .early_init = vcn_v4_0_3_early_init,
@@ -1702,7 +1781,7 @@ static const struct amd_ip_funcs vcn_v4_0_3_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v4_0_3_set_clockgating_state, .set_powergating_state = vcn_v4_0_3_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v4_0_3_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 9/18 drm/amdgpu: add print support for vcn_v4_0_3 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v4_0_3.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 34 ++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +33 -1
@@ -1733,6 +1733,38 @@ static void vcn_v4_0_3_set_irq_funcs(struct amdgpu_device *adev) adev->vcn.inst->irq.funcs = &vcn_v4_0_3_irq_funcs; } +static void vcn_v4_0_3_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0_3); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_4_0_3[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v4_0_3_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1782,7 +1814,7 @@ static const struct amd_ip_funcs vcn_v4_0_3_ip_funcs = { .set_clockgating_state = vcn_v4_0_3_set_clockgating_state, .set_powergating_state = vcn_v4_0_3_set_powergating_state, .dump_ip_state = vcn_v4_0_3_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v4_0_3_print_ip_state, };const struct amdgpu_ip_block_version vcn_v4_0_3_ip_block = {
Signature · 1 line
2.34.1
PATCH 10/18 drm/amdgpu: add vcn_v4_0_5 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v4_0_5.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 79 ++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +78 -1
@@ -52,6 +52,42 @@#define RDECODE_MSG_CREATE 0x00000000#define RDECODE_MESSAGE_CREATE 0x00000001 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_4_0_5[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , regUVD_DPG_PAUSE) +}; +static int amdgpu_ih_clientid_vcns[] = {SOC15_IH_CLIENTID_VCN ,SOC15_IH_CLIENTID_VCN1
@@ -97,6 +133,8 @@ static int vcn_v4_0_5_sw_init(void *handle)struct amdgpu_ring *ring;struct amdgpu_device *adev = (struct amdgpu_device *)handle;int i, r; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0_5); +uint32_t *ptr; r =amdgpu_vcn_sw_init (adev);if (r)
@@ -168,6 +206,14 @@ static int vcn_v4_0_5_sw_init(void *handle)if (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) adev->vcn.pause_dpg_mode = vcn_v4_0_5_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; + }return 0 ; }
@@ -207,6 +253,8 @@ static int vcn_v4_0_5_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1733,6 +1781,35 @@ static void vcn_v4_0_5_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v4_0_5_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0_5); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, regUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_4_0_5[j], + i)); + } +} +static const struct amd_ip_funcs vcn_v4_0_5_ip_funcs = { .name ="vcn_v4_0_5" , .early_init = vcn_v4_0_5_early_init,
@@ -1751,7 +1828,7 @@ static const struct amd_ip_funcs vcn_v4_0_5_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v4_0_5_set_clockgating_state, .set_powergating_state = vcn_v4_0_5_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v4_0_5_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 11/18 drm/amdgpu: add print support for vcn_v4_0_5 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v4_0_5.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 34 ++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +33 -1
@@ -1781,6 +1781,38 @@ static void vcn_v4_0_5_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v4_0_5_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_4_0_5); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_4_0_5[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v4_0_5_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1829,7 +1861,7 @@ static const struct amd_ip_funcs vcn_v4_0_5_ip_funcs = { .set_clockgating_state = vcn_v4_0_5_set_clockgating_state, .set_powergating_state = vcn_v4_0_5_set_powergating_state, .dump_ip_state = vcn_v4_0_5_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v4_0_5_print_ip_state, };const struct amdgpu_ip_block_version vcn_v4_0_5_ip_block = {
Signature · 1 line
2.34.1
PATCH 12/18 drm/amdgpu: add vcn_v1_0 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v1_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 78 ++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +77 -1
@@ -45,6 +45,42 @@#define mmUVD_REG_XX_MASK_1_0 0x05ac#define mmUVD_REG_XX_MASK_1_0_BASE_IDX 1 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_1_0[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_PAUSE) +}; +static int vcn_v1_0_stop (struct amdgpu_device *adev);static void vcn_v1_0_set_dec_ring_funcs (struct amdgpu_device *adev);static void vcn_v1_0_set_enc_ring_funcs (struct amdgpu_device *adev);
@@ -90,6 +126,8 @@ static int vcn_v1_0_sw_init(void *handle) {struct amdgpu_ring *ring;int i, r; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_1_0); +uint32_t *ptr;struct amdgpu_device *adev = (struct amdgpu_device *)handle;/* VCN DEC TRAP */
@@ -161,6 +199,14 @@ static int vcn_v1_0_sw_init(void *handle) r =jpeg_v1_0_sw_init (handle); +/* 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; + }return r; }
@@ -184,6 +230,8 @@ static int vcn_v1_0_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1877,6 +1925,34 @@ void vcn_v1_0_ring_end_use(struct amdgpu_ring *ring)mutex_unlock (&ring->adev->vcn.vcn1_jpeg1_workaround); } +static void vcn_v1_0_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_1_0); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, mmUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_1_0[j], i)); + } +} +static const struct amd_ip_funcs vcn_v1_0_ip_funcs = { .name ="vcn_v1_0" , .early_init = vcn_v1_0_early_init,
@@ -1895,7 +1971,7 @@ static const struct amd_ip_funcs vcn_v1_0_ip_funcs = { .post_soft_reset = NULL /* vcn_v1_0_post_soft_reset */, .set_clockgating_state = vcn_v1_0_set_clockgating_state, .set_powergating_state = vcn_v1_0_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v1_0_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 13/18 drm/amdgpu: add print support for vcn_v1_0 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v1_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 34 ++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +33 -1
@@ -1925,6 +1925,38 @@ void vcn_v1_0_ring_end_use(struct amdgpu_ring *ring)mutex_unlock (&ring->adev->vcn.vcn1_jpeg1_workaround); } +static void vcn_v1_0_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_1_0); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_1_0[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v1_0_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1972,7 +2004,7 @@ static const struct amd_ip_funcs vcn_v1_0_ip_funcs = { .set_clockgating_state = vcn_v1_0_set_clockgating_state, .set_powergating_state = vcn_v1_0_set_powergating_state, .dump_ip_state = vcn_v1_0_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v1_0_print_ip_state, };/*
Signature · 1 line
2.34.1
PATCH 14/18 drm/amdgpu: add vcn_v2_0 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v2_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 79 ++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +78 -1
@@ -53,6 +53,42 @@#define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x5a7#define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET 0x1e2 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_2_0[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_PAUSE) +}; +static void vcn_v2_0_set_dec_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_0_set_enc_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_0_set_irq_funcs (struct amdgpu_device *adev);
@@ -96,6 +132,8 @@ static int vcn_v2_0_sw_init(void *handle) {struct amdgpu_ring *ring;int i, r; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_2_0); +uint32_t *ptr;struct amdgpu_device *adev = (struct amdgpu_device *)handle;volatile struct amdgpu_fw_shared *fw_shared;
@@ -184,6 +222,15 @@ static int vcn_v2_0_sw_init(void *handle)if (amdgpu_vcnfw_log)amdgpu_vcn_fwlog_init (adev->vcn.inst); +/* 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; + } +return 0 ; }
@@ -213,6 +260,8 @@ static int vcn_v2_0_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1985,6 +2034,34 @@ static int vcn_v2_0_start_sriov(struct amdgpu_device *adev)return vcn_v2_0_start_mmsch (adev, &adev->virt.mm_table); } +static void vcn_v2_0_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_2_0); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, mmUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_2_0[j], i)); + } +} +static const struct amd_ip_funcs vcn_v2_0_ip_funcs = { .name ="vcn_v2_0" , .early_init = vcn_v2_0_early_init,
@@ -2003,7 +2080,7 @@ static const struct amd_ip_funcs vcn_v2_0_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v2_0_set_clockgating_state, .set_powergating_state = vcn_v2_0_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v2_0_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 15/18 drm/amdgpu: add print support for vcn_v2_0 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v2_0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 34 ++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +33 -1
@@ -2034,6 +2034,38 @@ static int vcn_v2_0_start_sriov(struct amdgpu_device *adev)return vcn_v2_0_start_mmsch (adev, &adev->virt.mm_table); } +static void vcn_v2_0_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_2_0); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_2_0[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v2_0_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -2081,7 +2113,7 @@ static const struct amd_ip_funcs vcn_v2_0_ip_funcs = { .set_clockgating_state = vcn_v2_0_set_clockgating_state, .set_powergating_state = vcn_v2_0_set_powergating_state, .dump_ip_state = vcn_v2_0_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v2_0_print_ip_state, };static const struct amdgpu_ring_funcs vcn_v2_0_dec_ring_vm_funcs = {
Signature · 1 line
2.34.1
PATCH 16/18 drm/amdgpu: add vcn_v2_5 ip dump support
In reply to Sunil KhatriAdd support of vcn ip dump in the devcoredump
for vcn_v2_5.
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 80 ++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +79 -1
@@ -55,6 +55,43 @@#define VCN25_MAX_HW_INSTANCES_ARCTURUS 2 +static const struct amdgpu_hwip_reg_entry vcn_reg_list_2_5[] = { +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_POWER_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_CONTEXT_ID2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA0), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_DATA1), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_GPCOM_VCPU_CMD), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_HI4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_BASE_LO4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_RPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_WPTR4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE2), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE3), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_RB_SIZE4), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_CONFIG), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_PGFSM_STATUS), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_CTL), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_DATA), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_LMA_MASK), +SOC15_REG_ENTRY_STR (VCN ,0 , mmUVD_DPG_PAUSE) +}; +static void vcn_v2_5_set_dec_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_5_set_enc_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_5_set_irq_funcs (struct amdgpu_device *adev);
@@ -122,6 +159,8 @@ static int vcn_v2_5_sw_init(void *handle) {struct amdgpu_ring *ring;int i, j, r; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_2_5); +uint32_t *ptr;struct amdgpu_device *adev = (struct amdgpu_device *)handle;for (j =0 ; j < adev->vcn.num_vcn_inst; j++) {
@@ -241,6 +280,15 @@ static int vcn_v2_5_sw_init(void *handle)if (r)return r; +/* 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; + } +return 0 ; }
@@ -277,6 +325,8 @@ static int vcn_v2_5_sw_fini(void *handle) r =amdgpu_vcn_sw_fini (adev); +kfree (adev->vcn.ip_dump); +return r; }
@@ -1876,6 +1926,34 @@ static void vcn_v2_5_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v2_5_dump_ip_state (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +bool is_powered; +uint32_t inst_off; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_2_5); + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * reg_count; +/* mmUVD_POWER_STATUS is always readable and is first element of the array */ + adev->vcn.ip_dump[inst_off] =RREG32_SOC15 (VCN , i, mmUVD_POWER_STATUS); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) +for (j =1 ; j < reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (vcn_reg_list_2_5[j], i)); + } +} +static const struct amd_ip_funcs vcn_v2_5_ip_funcs = { .name ="vcn_v2_5" , .early_init = vcn_v2_5_early_init,
@@ -1894,7 +1972,7 @@ static const struct amd_ip_funcs vcn_v2_5_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v2_5_set_clockgating_state, .set_powergating_state = vcn_v2_5_set_powergating_state, - .dump_ip_state = NULL, + .dump_ip_state = vcn_v2_5_dump_ip_state, .print_ip_state = NULL, };
Signature · 1 line
2.34.1
PATCH 17/18 drm/amdgpu: add print support for vcn_v2_5 ip dump
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v2_5.
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 34 ++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +33 -1
@@ -1926,6 +1926,38 @@ static void vcn_v2_5_set_irq_funcs(struct amdgpu_device *adev) } } +static void vcn_v2_5_print_ip_state (void *handle,struct drm_printer *p) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int i, j; +uint32_t reg_count =ARRAY_SIZE (vcn_reg_list_2_5); +uint32_t inst_off, is_powered; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK ) !=1 ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , vcn_reg_list_2_5[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +} +static void vcn_v2_5_dump_ip_state (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1973,7 +2005,7 @@ static const struct amd_ip_funcs vcn_v2_5_ip_funcs = { .set_clockgating_state = vcn_v2_5_set_clockgating_state, .set_powergating_state = vcn_v2_5_set_powergating_state, .dump_ip_state = vcn_v2_5_dump_ip_state, - .print_ip_state = NULL, + .print_ip_state = vcn_v2_5_print_ip_state, };static const struct amd_ip_funcs vcn_v2_6_ip_funcs = {
Signature · 1 line
2.34.1
PATCH 18/18 drm/amdgpu: add vcn ip dump support for vcn_v2_6
In reply to Sunil KhatriAdd support for logging the registers in devcoredump buffer for vcn_v2_6.
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +2 -2
@@ -2026,8 +2026,8 @@ static const struct amd_ip_funcs vcn_v2_6_ip_funcs = { .post_soft_reset = NULL, .set_clockgating_state = vcn_v2_5_set_clockgating_state, .set_powergating_state = vcn_v2_5_set_powergating_state, - .dump_ip_state = NULL, - .print_ip_state = NULL, + .dump_ip_state = vcn_v2_5_dump_ip_state, + .print_ip_state = vcn_v2_5_print_ip_state, }; const struct amdgpu_ip_block_version vcn_v2_5_ip_block =
Signature · 1 line
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
The series is:
Quoted 48 lines
-----Original Message-----
From: Sunil Khatri <[email protected]>
Sent: Tuesday, August 13, 2024 7:30 AM
To: Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Liu, Leo <[email protected]>
Cc: [email protected]; Khatri, Sunil <[email protected]>
Subject: [PATCH v1 00/18] VCN patches with updated register list*** BLURB HERE ***
Sunil Khatri (18):
drm/amdgpu: add vcn ip dump ptr in vcn global struct drm/amdgpu: addvcn_v3_0ip dump support drm/amdgpu: add print support forvcn_v3_0ip dump drm/amdgpu: addvcn_v5_0ip dump support drm/amdgpu: add print support forvcn_v5_0ip dump drm/amdgpu: addvcn_v4_0ip dump support drm/amdgpu: add print support forvcn_v4_0ip dump drm/amdgpu: addvcn_v4_0_3ip dump support drm/amdgpu: add print support forvcn_v4_0_3ip dump drm/amdgpu: addvcn_v4_0_5ip dump support drm/amdgpu: add print support forvcn_v4_0_5ip dump drm/amdgpu: addvcn_v1_0ip dump support drm/amdgpu: add print support forvcn_v1_0ip dump drm/amdgpu: addvcn_v2_0ip dump support drm/amdgpu: add print support forvcn_v2_0ip dump drm/amdgpu: addvcn_v2_5ip dump support drm/amdgpu: add print support forvcn_v2_5ip dump drm/amdgpu: add vcn ip dump support forvcn_v2_6drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 + drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 112 +++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 113 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 118 +++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 113 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 114 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 115 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 113 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 110 +++++++++++++++++++++- 9 files changed, 893 insertions(+), 18 deletions(-)--
2.34.1