[PATCH 6/6] HAX drm/i915: Enable TTM system for integrated

Thomas Hellström thomas.hellstrom at linux.intel.com
Mon Jun 14 07:59:28 UTC 2021


Just testing what breaks. In particular functionality that relies on
the shrinker and that system is actually shmem should give up. phys as well.

Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c         | 6 ++++--
 drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 9 ++++++++-
 drivers/gpu/drm/i915/intel_memory_region.c      | 2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index 7c5e5a698cde..7c0bd60baa99 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -675,14 +675,14 @@ static void ttm_vm_close(struct vm_area_struct *vma)
 	i915_gem_object_put(obj);
 }
 
-static const struct vm_operations_struct vm_ops_ttm = {
+static const struct __maybe_unused vm_operations_struct vm_ops_ttm = {
 	.fault = vm_fault_ttm,
 	.access = vm_access_ttm,
 	.open = ttm_vm_open,
 	.close = ttm_vm_close,
 };
 
-static u64 i915_ttm_mmap_offset(struct drm_i915_gem_object *obj)
+static u64 __maybe_unused i915_ttm_mmap_offset(struct drm_i915_gem_object *obj)
 {
 	/* The ttm_bo must be allocated with I915_BO_ALLOC_USER */
 	GEM_BUG_ON(!drm_mm_node_allocated(&obj->base.vma_node.vm_node));
@@ -699,8 +699,10 @@ const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = {
 	.truncate = i915_ttm_purge,
 	.adjust_lru = i915_ttm_adjust_lru,
 	.delayed_free = i915_ttm_delayed_free,
+#if 0
 	.mmap_offset = i915_ttm_mmap_offset,
 	.mmap_ops = &vm_ops_ttm,
+#endif
 };
 
 void i915_ttm_bo_destroy(struct ttm_buffer_object *bo)
diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
index ccc67ed1a84b..c129c0aced76 100644
--- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
@@ -1512,6 +1512,7 @@ static int igt_shrink_thp(void *arg)
 	struct i915_gem_context *ctx = arg;
 	struct drm_i915_private *i915 = ctx->i915;
 	struct i915_address_space *vm = i915_gem_context_get_vm_rcu(ctx);
+	intel_wakeref_t wakeref;
 	struct drm_i915_gem_object *obj;
 	struct i915_gem_engines_iter it;
 	struct intel_context *ce;
@@ -1574,7 +1575,13 @@ static int igt_shrink_thp(void *arg)
 	 * Now that the pages are *unpinned* shrink-all should invoke
 	 * shmem to truncate our pages.
 	 */
-	i915_gem_shrink_all(i915);
+	with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
+		i915_gem_shrink(NULL, i915, -1UL, NULL,
+				I915_SHRINK_BOUND |
+				I915_SHRINK_UNBOUND |
+				I915_SHRINK_ACTIVE);
+	}
+
 	if (i915_gem_object_has_pages(obj)) {
 		pr_err("shrink-all didn't truncate the pages\n");
 		err = -EINVAL;
diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c
index 0b016bdb8b84..a8ad1149b02d 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.c
+++ b/drivers/gpu/drm/i915/intel_memory_region.c
@@ -220,7 +220,7 @@ int intel_memory_regions_hw_probe(struct drm_i915_private *i915)
 		instance = intel_region_map[i].instance;
 		switch (type) {
 		case INTEL_MEMORY_SYSTEM:
-			if (IS_DGFX(i915))
+			if (1 || IS_DGFX(i915))
 				mem = i915_gem_ttm_system_setup(i915, type,
 								instance);
 			else
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list