[PATCH v7 1/2] drm/xe: add a new debugfs file - mmio

Rodrigo Vivi rodrigo.vivi at intel.com
Thu May 9 20:58:48 UTC 2024


On Sun, Apr 14, 2024 at 11:11:04AM +0300, Koby Elbaz wrote:
> Now that the former mmio handlers are fully removed, this
> debugfs file will be used for mmio access (read/write)
> through the debugfs ioctl file operation.
> 
> Signed-off-by: Koby Elbaz <kelbaz at habana.ai>
> ---
>  drivers/gpu/drm/xe/xe_debugfs.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> index c9b30dbdc14d..ce27516ffac0 100644
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> @@ -111,12 +111,22 @@ static int forcewake_release(struct inode *inode, struct file *file)
>  	return 0;
>  }
>  
> +static long xe_debugfs_mmio_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> +{
> +	return 0;
> +}
> +
>  static const struct file_operations forcewake_all_fops = {
>  	.owner = THIS_MODULE,
>  	.open = forcewake_open,
>  	.release = forcewake_release,
>  };
>  
> +static const struct file_operations mmio_fops = {
> +	.owner = THIS_MODULE,
> +	.unlocked_ioctl = xe_debugfs_mmio_ioctl,

I was kind of afraid this was not done by other drivers in the debugfs,
but I found out other cases, so I'm fine with it.

But likely this patch should be merged with the second one?

Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>

> +};
> +
>  void xe_debugfs_register(struct xe_device *xe)
>  {
>  	struct ttm_device *bdev = &xe->ttm;
> @@ -155,6 +165,8 @@ void xe_debugfs_register(struct xe_device *xe)
>  	for_each_gt(gt, xe, id)
>  		xe_gt_debugfs_register(gt);
>  
> +	debugfs_create_file("mmio", 0644, root, xe, &mmio_fops);
> +
>  #ifdef CONFIG_FAULT_INJECTION
>  	fault_create_debugfs_attr("fail_gt_reset", root, &gt_reset_failure);
>  #endif
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list