<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>I agree it's a bit dodgy that's why I added a version number. If we do add this I reckon we can just zero out removed fields and/or append to the end anything new. <span style="font-size: 12pt;">Almost none of the members of the structure are actually
used in the kernel though (which I found interesting).</span></p>
<p><br>
</p>
<p>Currently I use a few fields in the debugger tool to sanity check bank selection. I suppose some of the other fields could be used in scriptware when debugging. </p>
<p><br>
</p>
<p>I thought about using the other amdgpu debug routines but they're text based and I wanted a simple binary file. At least this is added/removed automagically so driver load/unload should be fine.</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Christian König <deathsimple@vodafone.de><br>
<b>Sent:</b> Tuesday, June 28, 2016 11:11<br>
<b>To:</b> Tom St Denis; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> StDenis, Tom<br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amd/amdgpu: Add gca config debug entry</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Am 28.06.2016 um 16:43 schrieb Tom St Denis:<br>
> A binary entry that lists GCA configuration data (and can be<br>
> read by umr).<br>
><br>
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com><br>
<br>
Uff exporting the internal structures of the driver through a binary <br>
debugfs entry...<br>
<br>
We don't need to be backward compatible because it is debugfs, but I <br>
don't think that is such a good idea.<br>
<br>
Regards,<br>
Christian.<br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 70 ++++++++++++++++++++++++++++++<br>
> 1 file changed, 70 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
> index 4598093ad50b..7f08ac02f9de 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
> @@ -2464,6 +2464,68 @@ static ssize_t amdgpu_debugfs_regs_smc_write(struct file *f, const char __user *<br>
> return result;<br>
> }<br>
> <br>
> +static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf,<br>
> + size_t size, loff_t *pos)<br>
> +{<br>
> + struct amdgpu_device *adev = f->f_inode->i_private;<br>
> + ssize_t result = 0;<br>
> + int r;<br>
> + uint32_t *config, no_regs = 0;<br>
> +<br>
> + if (size & 0x3 || *pos & 0x3)<br>
> + return -EINVAL;<br>
> +<br>
> + config = vmalloc(256*sizeof(*config));<br>
> + if (!config)<br>
> + return -ENOMEM;<br>
> +<br>
> + /* version, increment each time something is added */<br>
> + config[no_regs++] = 0;<br>
> + config[no_regs++] = adev->gfx.config.max_shader_engines;<br>
> + config[no_regs++] = adev->gfx.config.max_tile_pipes;<br>
> + config[no_regs++] = adev->gfx.config.max_cu_per_sh;<br>
> + config[no_regs++] = adev->gfx.config.max_sh_per_se;<br>
> + config[no_regs++] = adev->gfx.config.max_backends_per_se;<br>
> + config[no_regs++] = adev->gfx.config.max_texture_channel_caches;<br>
> + config[no_regs++] = adev->gfx.config.max_gprs;<br>
> + config[no_regs++] = adev->gfx.config.max_gs_threads;<br>
> + config[no_regs++] = adev->gfx.config.max_hw_contexts;<br>
> + config[no_regs++] = adev->gfx.config.sc_prim_fifo_size_frontend;<br>
> + config[no_regs++] = adev->gfx.config.sc_prim_fifo_size_backend;<br>
> + config[no_regs++] = adev->gfx.config.sc_hiz_tile_fifo_size;<br>
> + config[no_regs++] = adev->gfx.config.sc_earlyz_tile_fifo_size;<br>
> + config[no_regs++] = adev->gfx.config.num_tile_pipes;<br>
> + config[no_regs++] = adev->gfx.config.backend_enable_mask;<br>
> + config[no_regs++] = adev->gfx.config.mem_max_burst_length_bytes;<br>
> + config[no_regs++] = adev->gfx.config.mem_row_size_in_kb;<br>
> + config[no_regs++] = adev->gfx.config.shader_engine_tile_size;<br>
> + config[no_regs++] = adev->gfx.config.num_gpus;<br>
> + config[no_regs++] = adev->gfx.config.multi_gpu_tile_size;<br>
> + config[no_regs++] = adev->gfx.config.mc_arb_ramcfg;<br>
> + config[no_regs++] = adev->gfx.config.gb_addr_config;<br>
> + config[no_regs++] = adev->gfx.config.num_rbs;<br>
> +<br>
> + while (size && (*pos < no_regs*4)) {<br>
> + uint32_t value;<br>
> +<br>
> + value = config[*pos >> 2];<br>
> + r = put_user(value, (uint32_t *)buf);<br>
> + if (r) {<br>
> + vfree(config);<br>
> + return r;<br>
> + }<br>
> +<br>
> + result += 4;<br>
> + buf += 4;<br>
> + *pos += 4;<br>
> + size -= 4;<br>
> + }<br>
> +<br>
> + vfree(config);<br>
> + return result;<br>
> +}<br>
> +<br>
> +<br>
> static const struct file_operations amdgpu_debugfs_regs_fops = {<br>
> .owner = THIS_MODULE,<br>
> .read = amdgpu_debugfs_regs_read,<br>
> @@ -2489,11 +2551,18 @@ static const struct file_operations amdgpu_debugfs_regs_smc_fops = {<br>
> .llseek = default_llseek<br>
> };<br>
> <br>
> +static const struct file_operations amdgpu_debugfs_gca_config_fops = {<br>
> + .owner = THIS_MODULE,<br>
> + .read = amdgpu_debugfs_gca_config_read,<br>
> + .llseek = default_llseek<br>
> +};<br>
> +<br>
> static const struct file_operations *debugfs_regs[] = {<br>
> &amdgpu_debugfs_regs_fops,<br>
> &amdgpu_debugfs_regs_didt_fops,<br>
> &amdgpu_debugfs_regs_pcie_fops,<br>
> &amdgpu_debugfs_regs_smc_fops,<br>
> + &amdgpu_debugfs_gca_config_fops,<br>
> };<br>
> <br>
> static const char *debugfs_regs_names[] = {<br>
> @@ -2501,6 +2570,7 @@ static const char *debugfs_regs_names[] = {<br>
> "amdgpu_regs_didt",<br>
> "amdgpu_regs_pcie",<br>
> "amdgpu_regs_smc",<br>
> + "amdgpu_gca_config",<br>
> };<br>
> <br>
> static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>