Re: [PATCH v3 5/5] drm/i915: stolen memory use ttm backend

From: Robert Beckett
Date: Thu Apr 14 2022 - 13:23:16 EST




On 14/04/2022 15:41, Thomas Hellström wrote:
Hi,


On 4/12/22 21:38, Robert Beckett wrote:
+struct ttm_resource *
+i915_gem_stolen_reserve_range(struct drm_i915_private *i915,
+                  resource_size_t size,
+                  u64 start, u64 end)
  {
-    int ret;
+    struct intel_memory_region *mem = i915->mm.stolen_region;
-    if (!drm_mm_initialized(&i915->mm.stolen))
-        return -ENODEV;
-
-    /* WaSkipStolenMemoryFirstPage:bdw+ */
-    if (GRAPHICS_VER(i915) >= 8 && start < 4096)
-        start = 4096;

Did we lose this Workaround?

woops, looks like we did. Nice catch.
I'll add a reservation at start of day if wa is needed when I issue v4.


Need to continue reviewing this patchnext week.


Thx,

Thomas




-
-    mutex_lock(&i915->mm.stolen_lock);
-    ret = drm_mm_insert_node_in_range(&i915->mm.stolen, node,
-                      size, alignment, 0,
-                      start, end, DRM_MM_INSERT_BEST);
-    mutex_unlock(&i915->mm.stolen_lock);
+    if (!mem)
+        return ERR_PTR(-ENODEV);
+    return intel_region_ttm_resource_alloc(mem, size, start, end, I915_BO_ALLOC_CONTIGUOUS);
+}
-