[PATCH 71/71] drm/i915: Only preallocate the aliasing GTT to the extents of the global GTT

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 6 23:09:18 UTC 2017


As the aliasing GTT is only accessed via the global GTT, we will never
use more of it than we expose via the Global GTT and so we only need to
preallocate sufficient space within the ppgtt for the full GTT. Equally,
if the aliasing GTT is smaller than the global GTT, we have a serious
issue and must bail.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 21cdf77da1ed..97e3bb8223f7 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2411,9 +2411,14 @@ int i915_gem_init_ggtt(struct drm_i915_private *dev_priv)
 			goto err;
 		}
 
+		if (WARN_ON(ppgtt->base.total < ggtt->base.total)) {
+			ret = -ENODEV;
+			goto err_ppgtt;
+		}
+
 		if (ppgtt->base.allocate_va_range) {
 			ret = ppgtt->base.allocate_va_range(&ppgtt->base, 0,
-							    ppgtt->base.total);
+							    ggtt->base.total);
 			if (ret)
 				goto err_ppgtt;
 		}
-- 
2.11.0



More information about the Intel-gfx-trybot mailing list