* [PATCH 1/2] drm/nouveau: Add strap_peek to debugfs
2018-09-19 17:13 [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs Lyude Paul
@ 2018-09-19 17:13 ` Lyude Paul
2018-09-19 17:13 ` [PATCH 2/2] drm/nouveau: Add size to vbios.rom file in debugfs Lyude Paul
2018-09-21 19:05 ` [Nouveau] [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs Karol Herbst
2 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2018-09-19 17:13 UTC (permalink / raw)
To: nouveau; +Cc: Ben Skeggs, David Airlie, dri-devel, linux-kernel
Since we already expose the vbios.rom file here, why not also expose the
strap_peek?
Signed-off-by: Lyude Paul <lyude@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
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] drm/nouveau: Add size to vbios.rom file in debugfs
2018-09-19 17:13 [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs Lyude Paul
2018-09-19 17:13 ` [PATCH 1/2] drm/nouveau: Add strap_peek to debugfs Lyude Paul
@ 2018-09-19 17:13 ` Lyude Paul
2018-09-21 19:05 ` [Nouveau] [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs Karol Herbst
2 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2018-09-19 17:13 UTC (permalink / raw)
To: nouveau; +Cc: Ben Skeggs, David Airlie, dri-devel, linux-kernel
With this, nvbios /sys/kernel/debug/dri/*/vbios.rom now works!
Signed-off-by: Lyude Paul <lyude@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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Nouveau] [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs
2018-09-19 17:13 [PATCH 0/2] drm/nouveau: Allow parsing vbios.rom with nvbios from debugfs Lyude Paul
2018-09-19 17:13 ` [PATCH 1/2] drm/nouveau: Add strap_peek to debugfs Lyude Paul
2018-09-19 17:13 ` [PATCH 2/2] drm/nouveau: Add size to vbios.rom file in debugfs Lyude Paul
@ 2018-09-21 19:05 ` Karol Herbst
2 siblings, 0 replies; 4+ messages in thread
From: Karol Herbst @ 2018-09-21 19:05 UTC (permalink / raw)
To: Lyude Paul; +Cc: nouveau, David Airlie, LKML, dri-devel, Ben Skeggs
Both patches are Reviewed-by: Karol Herbst <kherbst@redhat.com>
On Wed, Sep 19, 2018 at 7:13 PM, Lyude Paul <lyude@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 4+ messages in thread