diff mbox series

[v2,2/5] drm/i915: sanitize mem_flags for stolen buffers

Message ID 20220412151838.1298956-3-bob.beckett@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: ttm for stolen region | expand

Commit Message

Bob Beckett April 12, 2022, 3:18 p.m. UTC
stolen regions are not page backed or considered iomem.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Thomas Hellström April 14, 2022, 1:58 p.m. UTC | #1
On Tue, 2022-04-12 at 15:18 +0000, Robert Beckett wrote:
> stolen regions are not page backed or considered iomem.

thus...

A little more elaborate commit message please.


> 
> Signed-off-by: Robert Beckett <bob.beckett@collabora.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>


> ---
>  drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> index 358f8a1a30ce..9fe8132de3b2 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> @@ -122,8 +122,9 @@ void i915_ttm_adjust_gem_after_move(struct
> drm_i915_gem_object *obj)
>  
>         obj->mem_flags &= ~(I915_BO_FLAG_STRUCT_PAGE |
> I915_BO_FLAG_IOMEM);
>  
> -       obj->mem_flags |= i915_ttm_cpu_maps_iomem(bo->resource) ?
> I915_BO_FLAG_IOMEM :
> -               I915_BO_FLAG_STRUCT_PAGE;
> +       if (obj->mm.region->id != INTEL_REGION_STOLEN_SMEM)
> +               obj->mem_flags |= i915_ttm_cpu_maps_iomem(bo-
> >resource) ? I915_BO_FLAG_IOMEM :
> +                       I915_BO_FLAG_STRUCT_PAGE;
>  
>         cache_level = i915_ttm_cache_level(to_i915(bo->base.dev), bo-
> >resource,
>                                            bo->ttm);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
index 358f8a1a30ce..9fe8132de3b2 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
@@ -122,8 +122,9 @@  void i915_ttm_adjust_gem_after_move(struct drm_i915_gem_object *obj)
 
 	obj->mem_flags &= ~(I915_BO_FLAG_STRUCT_PAGE | I915_BO_FLAG_IOMEM);
 
-	obj->mem_flags |= i915_ttm_cpu_maps_iomem(bo->resource) ? I915_BO_FLAG_IOMEM :
-		I915_BO_FLAG_STRUCT_PAGE;
+	if (obj->mm.region->id != INTEL_REGION_STOLEN_SMEM)
+		obj->mem_flags |= i915_ttm_cpu_maps_iomem(bo->resource) ? I915_BO_FLAG_IOMEM :
+			I915_BO_FLAG_STRUCT_PAGE;
 
 	cache_level = i915_ttm_cache_level(to_i915(bo->base.dev), bo->resource,
 					   bo->ttm);