summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_sys_manager.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2021-02-05 15:58:56 +0100
committerChristian König <christian.koenig@amd.com>2021-05-03 12:50:41 +0200
commitb072b9cd54f3dbd9597f2c0c2b8496a43c179806 (patch)
tree555ea9cfa47f221a2090e6ef90300944fd141594 /drivers/gpu/drm/ttm/ttm_sys_manager.c
parentdc52e41d26610cb7b8e95c7d45aa7457b5dcc002 (diff)
downloadlinux-stable-b072b9cd54f3dbd9597f2c0c2b8496a43c179806.tar.gz
linux-stable-b072b9cd54f3dbd9597f2c0c2b8496a43c179806.tar.bz2
linux-stable-b072b9cd54f3dbd9597f2c0c2b8496a43c179806.zip
drm/ttm: add ttm_sys_manager v3
Add a separate manager for the system domain and make function tables mandatory. v2: debug is still optional v3: return void during init Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210430092508.60710-1-christian.koenig@amd.com
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_sys_manager.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_sys_manager.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_sys_manager.c b/drivers/gpu/drm/ttm/ttm_sys_manager.c
new file mode 100644
index 000000000000..f754d2c965f1
--- /dev/null
+++ b/drivers/gpu/drm/ttm/ttm_sys_manager.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+#include <drm/ttm/ttm_resource.h>
+#include <drm/ttm/ttm_device.h>
+#include <drm/ttm/ttm_placement.h>
+
+static int ttm_sys_man_alloc(struct ttm_resource_manager *man,
+ struct ttm_buffer_object *bo,
+ const struct ttm_place *place,
+ struct ttm_resource *mem)
+{
+ return 0;
+}
+
+static void ttm_sys_man_free(struct ttm_resource_manager *man,
+ struct ttm_resource *mem)
+{
+}
+
+static const struct ttm_resource_manager_func ttm_sys_manager_func = {
+ .alloc = ttm_sys_man_alloc,
+ .free = ttm_sys_man_free,
+};
+
+void ttm_sys_man_init(struct ttm_device *bdev)
+{
+ struct ttm_resource_manager *man = &bdev->sysman;
+
+ /*
+ * Initialize the system memory buffer type.
+ * Other types need to be driver / IOCTL initialized.
+ */
+ man->use_tt = true;
+ man->func = &ttm_sys_manager_func;
+
+ ttm_resource_manager_init(man, 0);
+ ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, man);
+ ttm_resource_manager_set_used(man, true);
+}