[Intel-gfx] [PATCH 6/9] drm/i915: make dsm struct resource centric

Chris Wilson chris at chris-wilson.co.uk
Fri Nov 24 22:15:45 UTC 2017


Quoting Matthew Auld (2017-11-24 21:29:27)
> v2: check range_overflow when writing to 32b registers (Chris)
>     pepper in some comments (Chris)
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
> @@ -352,11 +352,14 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
>         if (ggtt->stolen_size == 0)
>                 return 0;
>  
> -       dev_priv->mm.stolen_base = i915_stolen_to_dma(dev_priv);
> -       if (dev_priv->mm.stolen_base == 0)
> +       dev_priv->dsm.start = i915_stolen_to_dma(dev_priv);
> +       if (dev_priv->dsm.start == 0)
>                 return 0;
>  
> -       stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
> +       dev_priv->dsm.end = dev_priv->dsm.start + ggtt->stolen_size - 1;
> +       dev_priv->dsm.flags = IORESOURCE_MEM;

I'm confused. I thought we exported the stolen resource from x86/quirks
so that we could use it here? I wasn't expecting to keep a bunch of
intermediates.

> +
> +       stolen_top = dev_priv->dsm.end + 1;
>         reserved_base = 0;
>         reserved_size = 0;
>  

> @@ -460,7 +463,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
>         sg->offset = 0;
>         sg->length = size;

For safety sake we should have a GEM_BUG_ON(range_overflow(offset, size,
resource_size(dsm));
-Chris


More information about the Intel-gfx mailing list