drm/i915/ttm: restore min_page_size behaviour
authorMatthew Auld <matthew.auld@intel.com>
Wed, 16 Jun 2021 15:25:01 +0000 (16:25 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Wed, 16 Jun 2021 15:48:02 +0000 (16:48 +0100)
We now have bo->page_alignment which perfectly describes what we need if
we have min page size restrictions for lmem. We can also drop the flag
here, since this is the default behaviour for all objects.

v2(Thomas):
    - bo->page_alignment is in page units

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210616152501.394518-7-matthew.auld@intel.com
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
drivers/gpu/drm/i915/intel_memory_region.h
drivers/gpu/drm/i915/intel_region_ttm.c
drivers/gpu/drm/i915/selftests/mock_region.c

index b8739f3d34623b22d6b1df9ee44ccb32f4dc86c2..9366b18d1bc6f04bb943888d29543a442cef6f31 100644 (file)
@@ -672,9 +672,9 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
         */
        obj->base.vma_node.driver_private = i915_gem_to_ttm(obj);
        ret = ttm_bo_init(&i915->bdev, i915_gem_to_ttm(obj), size,
-                         bo_type, &i915_sys_placement, 1,
+                         bo_type, &i915_sys_placement,
+                         mem->min_page_size >> PAGE_SHIFT,
                          true, NULL, NULL, i915_ttm_bo_destroy);
-
        if (!ret)
                obj->ttm.created = true;
 
index b04fb22726d9dfc1238b89bf5e49f126efd410f3..2be8433d373ac6c800ad5749fa4ec80f062f1af9 100644 (file)
@@ -40,8 +40,7 @@ enum intel_region_id {
 #define REGION_STOLEN_SMEM   BIT(INTEL_REGION_STOLEN_SMEM)
 #define REGION_STOLEN_LMEM   BIT(INTEL_REGION_STOLEN_LMEM)
 
-#define I915_ALLOC_MIN_PAGE_SIZE  BIT(0)
-#define I915_ALLOC_CONTIGUOUS     BIT(1)
+#define I915_ALLOC_CONTIGUOUS     BIT(0)
 
 #define for_each_memory_region(mr, i915, id) \
        for (id = 0; id < ARRAY_SIZE((i915)->mm.regions); id++) \
index 052253c81e984d8eafd672a499a8f76f0f2e7e6f..d53d78dec2bece2d64538848bd0226cceb2720fd 100644 (file)
@@ -167,7 +167,7 @@ intel_region_ttm_resource_alloc(struct intel_memory_region *mem,
        int ret;
 
        mock_bo.base.size = size;
-       mock_bo.page_alignment = 1;
+       mock_bo.page_alignment = mem->min_page_size >> PAGE_SHIFT;
        place.flags = flags;
 
        ret = man->func->alloc(man, &mock_bo, &place, &res);
index 3b3264311c910932fe44cba2348481e95eae5999..fa786dede60802d4d0440297077678639c24ce2d 100644 (file)
@@ -28,7 +28,7 @@ static int mock_region_get_pages(struct drm_i915_gem_object *obj)
        struct sg_table *pages;
        int err;
 
-       flags = I915_ALLOC_MIN_PAGE_SIZE;
+       flags = 0;
        if (obj->flags & I915_BO_ALLOC_CONTIGUOUS)
                flags |= TTM_PL_FLAG_CONTIGUOUS;