drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs
Subsystems (3)
Lyude Paul
maintainercover drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs
This is a small patch series that adds a strap_peek file into our debugfs, and sets the size of the vbios.rom debugfs file so that nvbios can easily be used to parse the vbios even on systems where the normal BIOS retrieval methods (for example, laptops that need ACPI to access the vbios for the nvidia GPU) won't work. This should make it a little easier to collect vbioses.
Lyude Paul (2):
drm/nouveau: Add strap_peek to debugfs drm/nouveau: Add size to vbios.rom file in debugfs
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 46 ++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
Lyude Paul
maintainerPATCH 1/2 drm/nouveau: Add strap_peek to debugfs
Since we already expose the vbios.rom file here, why not also expose the strap_peek?
--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +22 -1
@@ -46,6 +46,26 @@ nouveau_debugfs_vbios_image(struct seq_file *m, void *data)return 0 ; } +static int +nouveau_debugfs_strap_peek (struct seq_file *m,void *data) +{ +struct drm_info_node *node = m->private; +struct nouveau_drm *drm =nouveau_drm (node->minor->dev); +int ret; + + ret =pm_runtime_get_sync (drm->dev->dev); +if (ret <0 && ret != -EACCES ) +return ret; + +seq_printf (m,"0x%08x\n" , +nvif_rd32 (&drm->client.device.object,0x101000 )); + +pm_runtime_mark_last_busy (drm->dev->dev); +pm_runtime_put_autosuspend (drm->dev->dev); + +return 0 ; +} +static int nouveau_debugfs_pstate_get (struct seq_file *m,void *data) {
@@ -185,7 +205,8 @@ static const struct file_operations nouveau_pstate_fops = { };static struct drm_info_list nouveau_debugfs_list[] = { - {"vbios.rom" , nouveau_debugfs_vbios_image,0 ,NULL }, + {"vbios.rom" , nouveau_debugfs_vbios_image,0 ,NULL }, + {"strap_peek" , nouveau_debugfs_strap_peek,0 ,NULL }, };#define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
Signature · 1 line
2.17.1
Lyude Paul
maintainerPATCH 2/2 drm/nouveau: Add size to vbios.rom file in debugfs
In reply to Lyude PaulWith this, nvbios /sys/kernel/debug/dri/*/vbios.rom now works!
--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +19 -4
@@ -220,8 +220,9 @@ static const struct nouveau_debugfs_files {int nouveau_drm_debugfs_init (struct drm_minor *minor) { +struct nouveau_drm *drm =nouveau_drm (minor->dev);struct dentry *dentry; -int i; +int i, ret;for (i =0 ; i <ARRAY_SIZE (nouveau_debugfs_files); i++) { dentry = debugfs_create_file(nouveau_debugfs_files[i].name,
@@ -232,9 +233,23 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)return -ENOMEM ; } -return drm_debugfs_create_files (nouveau_debugfs_list, -NOUVEAU_DEBUGFS_ENTRIES , - minor->debugfs_root, minor); + ret =drm_debugfs_create_files (nouveau_debugfs_list, +NOUVEAU_DEBUGFS_ENTRIES , + minor->debugfs_root, minor); +if (ret) +return ret; + +/* Set the size of the vbios since we know it, and it's confusing to +* userspace if it wants to seek() but the file has a length of 0 +*/ + dentry =debugfs_lookup ("vbios.rom" , minor->debugfs_root); +if (!dentry) +return 0 ; + +d_inode (dentry)->i_size = drm->vbios.length; +dput (dentry); + +return 0 ; }int
Signature · 1 line
2.17.1
Both patches are Reviewed-by: Karol Herbst <[email protected]>
Quoted 21 lines · Lyude Paul
This is a small patch series that adds a
strap_peekfile into our debugfs, and sets the size of the vbios.rom debugfs file so that nvbios can easily be used to parse the vbios even on systems where the normal BIOS retrieval methods (for example, laptops that need ACPI to access the vbios for the nvidia GPU) won't work. This should make it a little easier to collect vbioses.Lyude Paul (2):
drm/nouveau: Addstrap_peekto debugfs drm/nouveau: Add size to vbios.rom file in debugfsdrivers/gpu/drm/nouveau/nouveau_debugfs.c | 46 ++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-)--
2.17.1_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau