Re: [PATCH drm-misc-next v4 1/8] drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm

2023-09-24 Thread Dave Airlie
On Thu, 21 Sept 2023 at 16:49, Christian König  wrote:
>
> Am 20.09.23 um 16:42 schrieb Danilo Krummrich:
> > Rename struct drm_gpuva_manager to struct drm_gpuvm including
> > corresponding functions. This way the GPUVA manager's structures align
> > very well with the documentation of VM_BIND [1] and VM_BIND locking [2].
> >
> > It also provides a better foundation for the naming of data structures
> > and functions introduced for implementing a common dma-resv per GPU-VM
> > including tracking of external and evicted objects in subsequent
> > patches.
> >
> > [1] Documentation/gpu/drm-vm-bind-async.rst
> > [2] Documentation/gpu/drm-vm-bind-locking.rst
> >
> > Cc: Thomas Hellström 
> > Cc: Matthew Brost 
> > Signed-off-by: Danilo Krummrich 
>
> Not sure if that name is better or worse, but from the handling I
> suggest to have this patch separately pushed to drm-misc-next.
>
> Feel free to add my Acked-by for pushing this.
>

Acked-by: Dave Airlie 


> Regards,
> Christian.
>
> > ---
> >   drivers/gpu/drm/Makefile  |   2 +-
> >   drivers/gpu/drm/drm_debugfs.c |  16 +-
> >   .../gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c}  | 400 +-
> >   drivers/gpu/drm/nouveau/nouveau_exec.c|   2 +-
> >   drivers/gpu/drm/nouveau/nouveau_uvmm.c|  24 +-
> >   drivers/gpu/drm/nouveau/nouveau_uvmm.h|   6 +-
> >   include/drm/drm_debugfs.h |   6 +-
> >   include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h}  | 153 ---
> >   8 files changed, 304 insertions(+), 305 deletions(-)
> >   rename drivers/gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} (78%)
> >   rename include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} (78%)
> >
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index 215e78e79125..7a84b3cddeab 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -45,7 +45,7 @@ drm-y := \
> >   drm_vblank.o \
> >   drm_vblank_work.o \
> >   drm_vma_manager.o \
> > - drm_gpuva_mgr.o \
> > + drm_gpuvm.o \
> >   drm_writeback.o
> >   drm-$(CONFIG_DRM_LEGACY) += \
> >   drm_agpsupport.o \
> > diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> > index 44ecd7d0daac..f291fb4b359f 100644
> > --- a/drivers/gpu/drm/drm_debugfs.c
> > +++ b/drivers/gpu/drm/drm_debugfs.c
> > @@ -40,7 +40,7 @@
> >   #include 
> >   #include 
> >   #include 
> > -#include 
> > +#include 
> >
> >   #include "drm_crtc_internal.h"
> >   #include "drm_internal.h"
> > @@ -189,31 +189,31 @@ static const struct file_operations drm_debugfs_fops 
> > = {
> >   /**
> >* drm_debugfs_gpuva_info - dump the given DRM GPU VA space
> >* @m: pointer to the _file to write
> > - * @mgr: the _gpuva_manager representing the GPU VA space
> > + * @gpuvm: the _gpuvm representing the GPU VA space
> >*
> >* Dumps the GPU VA mappings of a given DRM GPU VA manager.
> >*
> >* For each DRM GPU VA space drivers should call this function from their
> >* _info_list's show callback.
> >*
> > - * Returns: 0 on success, -ENODEV if the  is not initialized
> > + * Returns: 0 on success, -ENODEV if the  is not initialized
> >*/
> >   int drm_debugfs_gpuva_info(struct seq_file *m,
> > -struct drm_gpuva_manager *mgr)
> > +struct drm_gpuvm *gpuvm)
> >   {
> > - struct drm_gpuva *va, *kva = >kernel_alloc_node;
> > + struct drm_gpuva *va, *kva = >kernel_alloc_node;
> >
> > - if (!mgr->name)
> > + if (!gpuvm->name)
> >   return -ENODEV;
> >
> >   seq_printf(m, "DRM GPU VA space (%s) [0x%016llx;0x%016llx]\n",
> > -mgr->name, mgr->mm_start, mgr->mm_start + mgr->mm_range);
> > +gpuvm->name, gpuvm->mm_start, gpuvm->mm_start + 
> > gpuvm->mm_range);
> >   seq_printf(m, "Kernel reserved node [0x%016llx;0x%016llx]\n",
> >  kva->va.addr, kva->va.addr + kva->va.range);
> >   seq_puts(m, "\n");
> >   seq_puts(m, " VAs | start  | range  | end 
> >| object | object offset\n");
> >   seq_puts(m, 
> > "-\n");
> > - drm_gpuva_for_each_va(va, mgr) {
> > + drm_gpuvm_for_each_va(va, gpuvm) {
> >   if (unlikely(va == kva))
> >   continue;
> >
> > diff --git a/drivers/gpu/drm/drm_gpuva_mgr.c b/drivers/gpu/drm/drm_gpuvm.c
> > similarity index 78%
> > rename from drivers/gpu/drm/drm_gpuva_mgr.c
> > rename to drivers/gpu/drm/drm_gpuvm.c
> > index f86bfad74ff8..7074bcad5b28 100644
> > --- a/drivers/gpu/drm/drm_gpuva_mgr.c
> > +++ b/drivers/gpu/drm/drm_gpuvm.c
> > @@ -25,7 +25,7 @@
> >*
> >*/
> >
> > -#include 
> > +#include 
> >
> >   #include 
> >   #include 
> > @@ -33,8 +33,8 @@
> >   /**
> >* DOC: Overview
> >*
> > - * The DRM GPU VA Manager, represented by 

Re: [PATCH drm-misc-next v4 1/8] drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm

2023-09-21 Thread Christian König

Am 20.09.23 um 16:42 schrieb Danilo Krummrich:

Rename struct drm_gpuva_manager to struct drm_gpuvm including
corresponding functions. This way the GPUVA manager's structures align
very well with the documentation of VM_BIND [1] and VM_BIND locking [2].

It also provides a better foundation for the naming of data structures
and functions introduced for implementing a common dma-resv per GPU-VM
including tracking of external and evicted objects in subsequent
patches.

[1] Documentation/gpu/drm-vm-bind-async.rst
[2] Documentation/gpu/drm-vm-bind-locking.rst

Cc: Thomas Hellström 
Cc: Matthew Brost 
Signed-off-by: Danilo Krummrich 


Not sure if that name is better or worse, but from the handling I 
suggest to have this patch separately pushed to drm-misc-next.


Feel free to add my Acked-by for pushing this.

Regards,
Christian.


---
  drivers/gpu/drm/Makefile  |   2 +-
  drivers/gpu/drm/drm_debugfs.c |  16 +-
  .../gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c}  | 400 +-
  drivers/gpu/drm/nouveau/nouveau_exec.c|   2 +-
  drivers/gpu/drm/nouveau/nouveau_uvmm.c|  24 +-
  drivers/gpu/drm/nouveau/nouveau_uvmm.h|   6 +-
  include/drm/drm_debugfs.h |   6 +-
  include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h}  | 153 ---
  8 files changed, 304 insertions(+), 305 deletions(-)
  rename drivers/gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} (78%)
  rename include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} (78%)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 215e78e79125..7a84b3cddeab 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -45,7 +45,7 @@ drm-y := \
drm_vblank.o \
drm_vblank_work.o \
drm_vma_manager.o \
-   drm_gpuva_mgr.o \
+   drm_gpuvm.o \
drm_writeback.o
  drm-$(CONFIG_DRM_LEGACY) += \
drm_agpsupport.o \
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 44ecd7d0daac..f291fb4b359f 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -40,7 +40,7 @@
  #include 
  #include 
  #include 
-#include 
+#include 
  
  #include "drm_crtc_internal.h"

  #include "drm_internal.h"
@@ -189,31 +189,31 @@ static const struct file_operations drm_debugfs_fops = {
  /**
   * drm_debugfs_gpuva_info - dump the given DRM GPU VA space
   * @m: pointer to the _file to write
- * @mgr: the _gpuva_manager representing the GPU VA space
+ * @gpuvm: the _gpuvm representing the GPU VA space
   *
   * Dumps the GPU VA mappings of a given DRM GPU VA manager.
   *
   * For each DRM GPU VA space drivers should call this function from their
   * _info_list's show callback.
   *
- * Returns: 0 on success, -ENODEV if the  is not initialized
+ * Returns: 0 on success, -ENODEV if the  is not initialized
   */
  int drm_debugfs_gpuva_info(struct seq_file *m,
-  struct drm_gpuva_manager *mgr)
+  struct drm_gpuvm *gpuvm)
  {
-   struct drm_gpuva *va, *kva = >kernel_alloc_node;
+   struct drm_gpuva *va, *kva = >kernel_alloc_node;
  
-	if (!mgr->name)

+   if (!gpuvm->name)
return -ENODEV;
  
  	seq_printf(m, "DRM GPU VA space (%s) [0x%016llx;0x%016llx]\n",

-  mgr->name, mgr->mm_start, mgr->mm_start + mgr->mm_range);
+  gpuvm->name, gpuvm->mm_start, gpuvm->mm_start + 
gpuvm->mm_range);
seq_printf(m, "Kernel reserved node [0x%016llx;0x%016llx]\n",
   kva->va.addr, kva->va.addr + kva->va.range);
seq_puts(m, "\n");
seq_puts(m, " VAs | start  | range  | end
| object | object offset\n");
seq_puts(m, 
"-\n");
-   drm_gpuva_for_each_va(va, mgr) {
+   drm_gpuvm_for_each_va(va, gpuvm) {
if (unlikely(va == kva))
continue;
  
diff --git a/drivers/gpu/drm/drm_gpuva_mgr.c b/drivers/gpu/drm/drm_gpuvm.c

similarity index 78%
rename from drivers/gpu/drm/drm_gpuva_mgr.c
rename to drivers/gpu/drm/drm_gpuvm.c
index f86bfad74ff8..7074bcad5b28 100644
--- a/drivers/gpu/drm/drm_gpuva_mgr.c
+++ b/drivers/gpu/drm/drm_gpuvm.c
@@ -25,7 +25,7 @@
   *
   */
  
-#include 

+#include 
  
  #include 

  #include 
@@ -33,8 +33,8 @@
  /**
   * DOC: Overview
   *
- * The DRM GPU VA Manager, represented by struct drm_gpuva_manager keeps track
- * of a GPU's virtual address (VA) space and manages the corresponding virtual
+ * The DRM GPU VA Manager, represented by struct drm_gpuvm keeps track of a
+ * GPU's virtual address (VA) space and manages the corresponding virtual
   * mappings represented by _gpuva objects. It also keeps track of the
   * mapping's backing _gem_object buffers.
   *
@@ -47,28 +47,28 @@
   * The GPU VA manager internally uses a rb-tree to manage the
   * _gpuva mappings 

[PATCH drm-misc-next v4 1/8] drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm

2023-09-20 Thread Danilo Krummrich
Rename struct drm_gpuva_manager to struct drm_gpuvm including
corresponding functions. This way the GPUVA manager's structures align
very well with the documentation of VM_BIND [1] and VM_BIND locking [2].

It also provides a better foundation for the naming of data structures
and functions introduced for implementing a common dma-resv per GPU-VM
including tracking of external and evicted objects in subsequent
patches.

[1] Documentation/gpu/drm-vm-bind-async.rst
[2] Documentation/gpu/drm-vm-bind-locking.rst

Cc: Thomas Hellström 
Cc: Matthew Brost 
Signed-off-by: Danilo Krummrich 
---
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/drm_debugfs.c |  16 +-
 .../gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c}  | 400 +-
 drivers/gpu/drm/nouveau/nouveau_exec.c|   2 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.c|  24 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.h|   6 +-
 include/drm/drm_debugfs.h |   6 +-
 include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h}  | 153 ---
 8 files changed, 304 insertions(+), 305 deletions(-)
 rename drivers/gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} (78%)
 rename include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} (78%)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 215e78e79125..7a84b3cddeab 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -45,7 +45,7 @@ drm-y := \
drm_vblank.o \
drm_vblank_work.o \
drm_vma_manager.o \
-   drm_gpuva_mgr.o \
+   drm_gpuvm.o \
drm_writeback.o
 drm-$(CONFIG_DRM_LEGACY) += \
drm_agpsupport.o \
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 44ecd7d0daac..f291fb4b359f 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "drm_crtc_internal.h"
 #include "drm_internal.h"
@@ -189,31 +189,31 @@ static const struct file_operations drm_debugfs_fops = {
 /**
  * drm_debugfs_gpuva_info - dump the given DRM GPU VA space
  * @m: pointer to the _file to write
- * @mgr: the _gpuva_manager representing the GPU VA space
+ * @gpuvm: the _gpuvm representing the GPU VA space
  *
  * Dumps the GPU VA mappings of a given DRM GPU VA manager.
  *
  * For each DRM GPU VA space drivers should call this function from their
  * _info_list's show callback.
  *
- * Returns: 0 on success, -ENODEV if the  is not initialized
+ * Returns: 0 on success, -ENODEV if the  is not initialized
  */
 int drm_debugfs_gpuva_info(struct seq_file *m,
-  struct drm_gpuva_manager *mgr)
+  struct drm_gpuvm *gpuvm)
 {
-   struct drm_gpuva *va, *kva = >kernel_alloc_node;
+   struct drm_gpuva *va, *kva = >kernel_alloc_node;
 
-   if (!mgr->name)
+   if (!gpuvm->name)
return -ENODEV;
 
seq_printf(m, "DRM GPU VA space (%s) [0x%016llx;0x%016llx]\n",
-  mgr->name, mgr->mm_start, mgr->mm_start + mgr->mm_range);
+  gpuvm->name, gpuvm->mm_start, gpuvm->mm_start + 
gpuvm->mm_range);
seq_printf(m, "Kernel reserved node [0x%016llx;0x%016llx]\n",
   kva->va.addr, kva->va.addr + kva->va.range);
seq_puts(m, "\n");
seq_puts(m, " VAs | start  | range  | end   
 | object | object offset\n");
seq_puts(m, 
"-\n");
-   drm_gpuva_for_each_va(va, mgr) {
+   drm_gpuvm_for_each_va(va, gpuvm) {
if (unlikely(va == kva))
continue;
 
diff --git a/drivers/gpu/drm/drm_gpuva_mgr.c b/drivers/gpu/drm/drm_gpuvm.c
similarity index 78%
rename from drivers/gpu/drm/drm_gpuva_mgr.c
rename to drivers/gpu/drm/drm_gpuvm.c
index f86bfad74ff8..7074bcad5b28 100644
--- a/drivers/gpu/drm/drm_gpuva_mgr.c
+++ b/drivers/gpu/drm/drm_gpuvm.c
@@ -25,7 +25,7 @@
  *
  */
 
-#include 
+#include 
 
 #include 
 #include 
@@ -33,8 +33,8 @@
 /**
  * DOC: Overview
  *
- * The DRM GPU VA Manager, represented by struct drm_gpuva_manager keeps track
- * of a GPU's virtual address (VA) space and manages the corresponding virtual
+ * The DRM GPU VA Manager, represented by struct drm_gpuvm keeps track of a
+ * GPU's virtual address (VA) space and manages the corresponding virtual
  * mappings represented by _gpuva objects. It also keeps track of the
  * mapping's backing _gem_object buffers.
  *
@@ -47,28 +47,28 @@
  * The GPU VA manager internally uses a rb-tree to manage the
  * _gpuva mappings within a GPU's virtual address space.
  *
- * The _gpuva_manager contains a special _gpuva representing the
+ * The _gpuvm structure contains a special _gpuva representing the
  * portion of VA space reserved by the kernel. This node is initialized 
together
  * with the GPU VA manager instance and