Skip to content

Commit

Permalink
drm/amdgpu: add print support for vcn_v2_0 ip dump
Browse files Browse the repository at this point in the history
Add support for logging the registers in devcoredump
buffer for vcn_v2_0.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Sunil Khatri authored and Alex Deucher committed Aug 16, 2024
1 parent 2239aaa commit b910cac
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit b910cac

Please sign in to comment.