diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-04-29 05:53:58 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2014-04-29 11:46:09 -0400 |
commit | cfa7c862982b431add7f2b362526bf31372fc7b0 (patch) | |
tree | a776bf96fc985885f33df7bebaf3f8291e47df2d | |
parent | 7f1950fbb989e8fc5463b307e062b4529d51c862 (diff) |
drm/i915: Sanitize the enable_ppgtt module option once
Otherwise we'll end up spamming dmesg on every context creation on snb
with vt-d enabled. This regression was introduced in
commit 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549
Author: Ben Widawsky <benjamin.widawsky@intel.com>
Date: Fri Dec 6 14:11:14 2013 -0800
drm/i915: Reorganize intel_enable_ppgtt
As the i915.enable_ppgtt is read-only it cannot be changed after the
module is loaded and so we can perform an early sanitization of the
values.
v2:
- Add comment and pimp commit message (Chris)
- Use the param consistently (Jani)
v3:
- Fix init sequence on pre-gen6 by moving the sanitize_ppgtt call to
gtt_init. Fixes boot hangs on pre-gen6.
- Add a debug output for the sanitize ppgtt mode.
References: https://lkml.org/lkml/2014/4/17/599
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77916
Cc: Alessandro Suardi <alessandro.suardi@gmail.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 62a5c3627b90..154b0f8bb88d 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -34,25 +34,35 @@ static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); | |||
34 | 34 | ||
35 | bool intel_enable_ppgtt(struct drm_device *dev, bool full) | 35 | bool intel_enable_ppgtt(struct drm_device *dev, bool full) |
36 | { | 36 | { |
37 | if (i915.enable_ppgtt == 0 || !HAS_ALIASING_PPGTT(dev)) | 37 | if (i915.enable_ppgtt == 0) |
38 | return false; | 38 | return false; |
39 | 39 | ||
40 | if (i915.enable_ppgtt == 1 && full) | 40 | if (i915.enable_ppgtt == 1 && full) |
41 | return false; | 41 | return false; |
42 | 42 | ||
43 | return true; | ||
44 | } | ||
45 | |||
46 | static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt) | ||
47 | { | ||
48 | if (enable_ppgtt == 0 || !HAS_ALIASING_PPGTT(dev)) | ||
49 | return 0; | ||
50 | |||
51 | if (enable_ppgtt == 1) | ||
52 | return 1; | ||
53 | |||
54 | if (enable_ppgtt == 2 && HAS_PPGTT(dev)) | ||
55 | return 2; | ||
56 | |||
43 | #ifdef CONFIG_INTEL_IOMMU | 57 | #ifdef CONFIG_INTEL_IOMMU |
44 | /* Disable ppgtt on SNB if VT-d is on. */ | 58 | /* Disable ppgtt on SNB if VT-d is on. */ |
45 | if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped) { | 59 | if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped) { |
46 | DRM_INFO("Disabling PPGTT because VT-d is on\n"); | 60 | DRM_INFO("Disabling PPGTT because VT-d is on\n"); |
47 | return false; | 61 | return 0; |
48 | } | 62 | } |
49 | #endif | 63 | #endif |
50 | 64 | ||
51 | /* Full ppgtt disabled by default for now due to issues. */ | 65 | return HAS_ALIASING_PPGTT(dev) ? 1 : 0; |
52 | if (full) | ||
53 | return HAS_PPGTT(dev) && (i915.enable_ppgtt == 2); | ||
54 | else | ||
55 | return HAS_ALIASING_PPGTT(dev); | ||
56 | } | 66 | } |
57 | 67 | ||
58 | #define GEN6_PPGTT_PD_ENTRIES 512 | 68 | #define GEN6_PPGTT_PD_ENTRIES 512 |
@@ -2031,6 +2041,14 @@ int i915_gem_gtt_init(struct drm_device *dev) | |||
2031 | gtt->base.total >> 20); | 2041 | gtt->base.total >> 20); |
2032 | DRM_DEBUG_DRIVER("GMADR size = %ldM\n", gtt->mappable_end >> 20); | 2042 | DRM_DEBUG_DRIVER("GMADR size = %ldM\n", gtt->mappable_end >> 20); |
2033 | DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n", gtt->stolen_size >> 20); | 2043 | DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n", gtt->stolen_size >> 20); |
2044 | /* | ||
2045 | * i915.enable_ppgtt is read-only, so do an early pass to validate the | ||
2046 | * user's requested state against the hardware/driver capabilities. We | ||
2047 | * do this now so that we can print out any log messages once rather | ||
2048 | * than every time we check intel_enable_ppgtt(). | ||
2049 | */ | ||
2050 | i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt); | ||
2051 | DRM_DEBUG_DRIVER("ppgtt mode: %i\n", i915.enable_ppgtt); | ||
2034 | 2052 | ||
2035 | return 0; | 2053 | return 0; |
2036 | } | 2054 | } |