Lyude Paul
2018-Sep-19 17:13 UTC
[Nouveau] [PATCH 0/2] 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(-) -- 2.17.1
Lyude Paul
2018-Sep-19 17:13 UTC
[Nouveau] [PATCH 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? Signed-off-by: Lyude Paul <lyude at redhat.com> --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 9109b69cd052..7379c20584a2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -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) -- 2.17.1
Lyude Paul
2018-Sep-19 17:13 UTC
[Nouveau] [PATCH 2/2] drm/nouveau: Add size to vbios.rom file in debugfs
With this, nvbios /sys/kernel/debug/dri/*/vbios.rom now works! Signed-off-by: Lyude Paul <lyude at redhat.com> --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 7379c20584a2..88a52f6b39fe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -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 -- 2.17.1
Karol Herbst
2018-Sep-21 19:05 UTC
[Nouveau] [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs
Both patches are Reviewed-by: Karol Herbst <kherbst at redhat.com> On Wed, Sep 19, 2018 at 7:13 PM, Lyude Paul <lyude at redhat.com> wrote:> 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(-) > > -- > 2.17.1 > > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau
Seemingly Similar Threads
- [PATCH v2 0/5] move pstate interface to debugfs
- [PATCH] drm/nouveau: remove checks for return value of debugfs functions
- [PATCH] nouveau: no need to check return value of debugfs_create functions
- [PATCH 4/4] nouveau/debugfs: add interface for current load
- [PATCH 0/2] drm/nouveau: Add support for dp_mst_info in debugfs