[Intel-gfx] [PATCH] drm/i915: Codify our assumption that the Global GTT is <= 4GiB

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 15 03:52:36 PST 2016


On Fri, Jan 15, 2016 at 11:25:38AM +0000, Dave Gordon wrote:
> On 15/01/16 10:20, Chris Wilson wrote:
> >Throughout the code base, we use u32 for offsets into the global GTT. If
> >we ever see any hardware with a larger GGTT, then we run the real risk
> >of silent corruption. So test for our assumption up front so that we
> >have a nice reminder should the time come when it fails.
> >
> >Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> >Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >Cc: Daniel Vetter <daniel at ffwll.ch>
> >---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> >index 2e460b369e82..0d910638972c 100644
> >--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> >+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> >@@ -3143,6 +3143,13 @@ int i915_gem_gtt_init(struct drm_device *dev)
> >  	if (ret)
> >  		return ret;
> >
> >+	if ((gtt->base.total - 1) >> 32) {
> >+		DRM_ERROR("We never expected a Global GTT with more than 32bits of address space! Found %lldM!\n",
> >+			  gtt->base.total >> 20);
> >+		gtt->base.total = 1ull << 32;
> >+		gtt->mappable_end = min(gtt->mappable_end, gtt->base.total);
> 
> Assuming Mika's comment on 'struct i915_address_space' is correct:
> ...
> 	u64 start;              /* Start offset always 0 for dri2 */
> ...
> otherwise this calculation would need to be adjusted.

The address_space start was for the obsolete UMS call where the xserver
would tell the kernel the range of the (then only global) GTT to use for
itself.

The vgpu plugin comes later? Though if I remember correctly, it reserves
ranges of the GGTT for itself rather than alter the drm_mm.

So I don't think it has been revitalised since. Removing the start value
from the struct i915_address_space confirms it is obsolete.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list