[Intel-gfx] [PATCH] drm/i915: make i915_stolen_to_physical() return phys_addr_t

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 26 21:21:05 UTC 2017


On Thu, Jan 26, 2017 at 06:19:07PM -0200, Paulo Zanoni wrote:
> The i915_stolen_to_physical() function has 'unsigned long' as its
> return type but it returns the 'base' variable, which is of type
> 'u32'. The only place where this function is called assigns the
> returned value to dev_priv->mm.stolen_base, which is of type
> 'phys_addr_t'. The return value is actually a physical address and
> everything else in the stolen memory code seems to be using
> phys_addr_t, so fix i915_stolen_to_physical() to use phys_addr_t.

My fault for missing this in my recent round of switching to
phys_addr_t.

> @@ -228,11 +228,12 @@ static unsigned long i915_stolen_to_physical(struct drm_i915_private *dev_priv)
>  
>  		if (stolen[0].start != stolen[1].start ||
>  		    stolen[0].end != stolen[1].end) {
> +			phys_addr_t end = base + ggtt->stolen_size - 1;
>  			DRM_DEBUG_KMS("GTT within stolen memory at 0x%llx-0x%llx\n",
>  				      (unsigned long long)ggtt_start,
>  				      (unsigned long long)ggtt_end - 1);
> -			DRM_DEBUG_KMS("Stolen memory adjusted to 0x%x-0x%x\n",
> -				      base, base + (u32)ggtt->stolen_size - 1);
> +			DRM_DEBUG_KMS("Stolen memory adjusted to %pa - %pa\n",
> +				      &base, &end);
>  		}
>  	}
>  
> @@ -261,8 +262,9 @@ static unsigned long i915_stolen_to_physical(struct drm_i915_private *dev_priv)
>  		 * range. Apparently this works.
>  		 */
>  		if (r == NULL && !IS_GEN3(dev_priv)) {
> -			DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
> -				  base, base + (uint32_t)ggtt->stolen_size);
> +			phys_addr_t end = base + ggtt->stolen_size;

Could make checkpatch happy by leaving a blank line here (and above). Maybe
overkill.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list