Commit 651d7ee6 authored by Somalapuram Amaranath's avatar Somalapuram Amaranath Committed by Alex Deucher

drm/amdgpu: save the reset dump register value for devcoredump

Allocate memory for register value and use the same values for devcoredump.
v1 -> v2: Change krealloc_array() to kmalloc_array()
v2 -> v3: Fix alignment
Signed-off-by: default avatarSomalapuram Amaranath <Amaranath.Somalapuram@amd.com>
Reviewed-by: default avatarShashank Sharma <Shashank.sharma@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6d1044a0
...@@ -1044,6 +1044,7 @@ struct amdgpu_device { ...@@ -1044,6 +1044,7 @@ struct amdgpu_device {
/* reset dump register */ /* reset dump register */
uint32_t *reset_dump_reg_list; uint32_t *reset_dump_reg_list;
uint32_t *reset_dump_reg_value;
int num_regs; int num_regs;
bool scpm_enabled; bool scpm_enabled;
......
...@@ -1709,17 +1709,24 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f, ...@@ -1709,17 +1709,24 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
i++; i++;
} while (len < size); } while (len < size);
new = kmalloc_array(i, sizeof(uint32_t), GFP_KERNEL);
if (!new) {
ret = -ENOMEM;
goto error_free;
}
ret = down_write_killable(&adev->reset_domain->sem); ret = down_write_killable(&adev->reset_domain->sem);
if (ret) if (ret)
goto error_free; goto error_free;
swap(adev->reset_dump_reg_list, tmp); swap(adev->reset_dump_reg_list, tmp);
swap(adev->reset_dump_reg_value, new);
adev->num_regs = i; adev->num_regs = i;
up_write(&adev->reset_domain->sem); up_write(&adev->reset_domain->sem);
ret = size; ret = size;
error_free: error_free:
kfree(tmp); kfree(tmp);
kfree(new);
return ret; return ret;
} }
......
...@@ -4666,15 +4666,15 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, ...@@ -4666,15 +4666,15 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
static int amdgpu_reset_reg_dumps(struct amdgpu_device *adev) static int amdgpu_reset_reg_dumps(struct amdgpu_device *adev)
{ {
uint32_t reg_value;
int i; int i;
lockdep_assert_held(&adev->reset_domain->sem); lockdep_assert_held(&adev->reset_domain->sem);
dump_stack(); dump_stack();
for (i = 0; i < adev->num_regs; i++) { for (i = 0; i < adev->num_regs; i++) {
reg_value = RREG32(adev->reset_dump_reg_list[i]); adev->reset_dump_reg_value[i] = RREG32(adev->reset_dump_reg_list[i]);
trace_amdgpu_reset_reg_dumps(adev->reset_dump_reg_list[i], reg_value); trace_amdgpu_reset_reg_dumps(adev->reset_dump_reg_list[i],
adev->reset_dump_reg_value[i]);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment