drm: debugfs: provide infrastructure to dump a DRM GPU VA space

This commit adds a function to dump a DRM GPU VA space and a macro for
drivers to register the struct drm_info_list 'gpuvas' entry.

Most likely, most drivers might maintain one DRM GPU VA space per struct
drm_file, but there might also be drivers not having a fixed relation
between DRM GPU VA spaces and a DRM core infrastructure, hence we need the
indirection via the driver iterating it's maintained DRM GPU VA spaces.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230720001443.2380-3-dakr@redhat.com
This commit is contained in:
Danilo Krummrich
2023-07-20 02:14:23 +02:00
parent e6303f323b
commit 4f66feeab1
2 changed files with 65 additions and 0 deletions

View File

@@ -34,6 +34,22 @@
#include <linux/types.h>
#include <linux/seq_file.h>
#include <drm/drm_gpuva_mgr.h>
/**
* DRM_DEBUGFS_GPUVA_INFO - &drm_info_list entry to dump a GPU VA space
* @show: the &drm_info_list's show callback
* @data: driver private data
*
* Drivers should use this macro to define a &drm_info_list entry to provide a
* debugfs file for dumping the GPU VA space regions and mappings.
*
* For each DRM GPU VA space drivers should call drm_debugfs_gpuva_info() from
* their @show callback.
*/
#define DRM_DEBUGFS_GPUVA_INFO(show, data) {"gpuvas", show, DRIVER_GEM_GPUVA, data}
/**
* struct drm_info_list - debugfs info list entry
*
@@ -134,6 +150,9 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name,
void drm_debugfs_add_files(struct drm_device *dev,
const struct drm_debugfs_info *files, int count);
int drm_debugfs_gpuva_info(struct seq_file *m,
struct drm_gpuva_manager *mgr);
#else
static inline void drm_debugfs_create_files(const struct drm_info_list *files,
int count, struct dentry *root,
@@ -155,6 +174,12 @@ static inline void drm_debugfs_add_files(struct drm_device *dev,
const struct drm_debugfs_info *files,
int count)
{}
static inline int drm_debugfs_gpuva_info(struct seq_file *m,
struct drm_gpuva_manager *mgr)
{
return 0;
}
#endif
#endif /* _DRM_DEBUGFS_H_ */