Re: [PATCH drm-next v5 03/14] drm: manager to keep track of GPUs VA mappings

From: Christian König
Date: Tue Jun 20 2023 - 02:45:53 EST


Hi Danilo,

sorry for the delayed reply. I've trying to dig myself out of a hole at the moment.

Am 20.06.23 um 02:42 schrieb Danilo Krummrich:
[SNIP]
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index bbc721870c13..5ec8148a30ee 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -36,6 +36,8 @@
#include <linux/kref.h>
#include <linux/dma-resv.h>
+#include <linux/list.h>
+#include <linux/mutex.h>
#include <drm/drm_vma_manager.h>
@@ -379,6 +381,18 @@ struct drm_gem_object {
*/
struct dma_resv _resv;
+ /**
+ * @gpuva:
+ *
+ * Provides the list of GPU VAs attached to this GEM object.
+ *
+ * Drivers should lock list accesses with the GEMs &dma_resv lock
+ * (&drm_gem_object.resv).
+ */
+ struct {
+ struct list_head list;
+ } gpuva;
+
/**
* @funcs:
*

I'm pretty sure that it's not a good idea to attach this directly to the GEM object.

As you wrote in the commit message it's highly driver specific what to map and where to map it.

Instead I suggest to have a separate structure for mappings in a VA space which driver can then add to their GEM objects or whatever they want to map into their VMs.

Regards,
Christian.