[Intel-gfx] [PATCH 6/6] drm/i915/ttm: restore min_page_size behaviour

Thomas Hellström thomas.hellstrom at linux.intel.com
Tue Jun 8 07:41:03 UTC 2021


On Mon, 2021-06-07 at 19:22 +0100, Matthew Auld wrote:
> 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.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_ttm.c      | 3 +--
>  drivers/gpu/drm/i915/intel_memory_region.h   | 3 +--
>  drivers/gpu/drm/i915/intel_region_ttm.c      | 2 +-
>  drivers/gpu/drm/i915/selftests/mock_region.c | 2 +-
>  4 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> index 3f5624f36afc..eda6c258ea92 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> @@ -684,9 +684,8 @@ 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, PAGE_SIZE,
> +                         bo_type, &i915_sys_placement, mem-
> >min_page_size,

Page size units here as well.

>                           true, NULL, NULL, i915_ttm_bo_destroy);
> -
>         if (!ret)
>                 obj->ttm.created = true;
>  
> diff --git a/drivers/gpu/drm/i915/intel_memory_region.h
> b/drivers/gpu/drm/i915/intel_memory_region.h
> index b04fb22726d9..2be8433d373a 100644
> --- a/drivers/gpu/drm/i915/intel_memory_region.h
> +++ b/drivers/gpu/drm/i915/intel_memory_region.h
> @@ -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++) \
> diff --git a/drivers/gpu/drm/i915/intel_region_ttm.c
> b/drivers/gpu/drm/i915/intel_region_ttm.c
> index 23af995f7b67..59fa78225852 100644
> --- a/drivers/gpu/drm/i915/intel_region_ttm.c
> +++ b/drivers/gpu/drm/i915/intel_region_ttm.c
> @@ -153,7 +153,7 @@ intel_region_ttm_node_alloc(struct
> intel_memory_region *mem,
>         int ret;
>  
>         mock_bo.base.size = size;
> -       mock_bo.page_alignment = PAGE_SIZE;
> +       mock_bo.page_alignment = mem->min_page_size;

And here.

>         place.flags = flags;
>  
>         ret = man->func->alloc(man, &mock_bo, &place, &res);
> diff --git a/drivers/gpu/drm/i915/selftests/mock_region.c
> b/drivers/gpu/drm/i915/selftests/mock_region.c
> index d3e4e6573cb9..6ce0f9dacad7 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_region.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_region.c
> @@ -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;
>  




More information about the Intel-gfx mailing list