Commit 27ebf21f authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher

drm/amd/pm: Add debugfs node to read private buffer

Add debugfs interface to read region allocated for FW private buffer
Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Suggested-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarKevin Wang <kevin1.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b8c78bdb
......@@ -3534,6 +3534,45 @@ static int amdgpu_debugfs_pm_info_show(struct seq_file *m, void *unused)
DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_pm_info);
/*
* amdgpu_pm_priv_buffer_read - Read memory region allocated to FW
*
* Reads debug memory region allocated to PMFW
*/
static ssize_t amdgpu_pm_prv_buffer_read(struct file *f, char __user *buf,
size_t size, loff_t *pos)
{
struct amdgpu_device *adev = file_inode(f)->i_private;
const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
void *pp_handle = adev->powerplay.pp_handle;
size_t smu_prv_buf_size;
void *smu_prv_buf;
if (amdgpu_in_reset(adev))
return -EPERM;
if (adev->in_suspend && !adev->in_runpm)
return -EPERM;
if (pp_funcs && pp_funcs->get_smu_prv_buf_details)
pp_funcs->get_smu_prv_buf_details(pp_handle, &smu_prv_buf,
&smu_prv_buf_size);
else
return -ENOSYS;
if (!smu_prv_buf || !smu_prv_buf_size)
return -EINVAL;
return simple_read_from_buffer(buf, size, pos, smu_prv_buf,
smu_prv_buf_size);
}
static const struct file_operations amdgpu_debugfs_pm_prv_buffer_fops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = amdgpu_pm_prv_buffer_read,
.llseek = default_llseek,
};
#endif
void amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
......@@ -3545,5 +3584,10 @@ void amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
debugfs_create_file("amdgpu_pm_info", 0444, root, adev,
&amdgpu_debugfs_pm_info_fops);
if (adev->pm.smu_prv_buffer_size > 0)
debugfs_create_file_size("amdgpu_pm_prv_buffer", 0444, root,
adev,
&amdgpu_debugfs_pm_prv_buffer_fops,
adev->pm.smu_prv_buffer_size);
#endif
}
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