drm/i915: Sanitize the enable_ppgtt module option once
Subsystems (2)
PATCH 1/1 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 <[email protected]> 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
Rererences: https://bugs.freedesktop.org/show_bug.cgi?id=77916
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +25 -7
@@ -34,25 +34,35 @@ static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv);bool intel_enable_ppgtt (struct drm_device *dev,bool full) { -if (i915.enable_ppgtt ==0 || !HAS_ALIASING_PPGTT (dev)) +if (i915.enable_ppgtt ==0 )return false;if (i915.enable_ppgtt ==1 && full)return false; +return true; +} + +static int sanitize_enable_ppgtt (struct drm_device *dev,int enable_ppgtt) +{ +if (enable_ppgtt ==0 || !HAS_ALIASING_PPGTT (dev)) +return 0 ; + +if (enable_ppgtt ==1 ) +return 1 ; + +if (enable_ppgtt ==2 &&HAS_PPGTT (dev)) +return 2 ; +#ifdef CONFIG_INTEL_IOMMU /* Disable ppgtt on SNB if VT-d is on. */ if (INTEL_INFO (dev)->gen ==6 && intel_iommu_gfx_mapped) {DRM_INFO ("Disabling PPGTT because VT-d is on\n" ); -return false; +return 0 ; }#endif -/* Full ppgtt disabled by default for now due to issues. */ -if (full) -return HAS_PPGTT (dev) && (i915.enable_ppgtt ==2 ); -else -return HAS_ALIASING_PPGTT (dev); +return HAS_ALIASING_PPGTT (dev) ?1 :0 ; }
@@ -1966,6 +1976,14 @@ int i915_gem_gtt_init(struct drm_device *dev)if (intel_iommu_gfx_mapped)DRM_INFO ("VT-d active for gfx access\n" );#endif +/* +* i915.enable_ppgtt is read-only, so do an early pass to validate the +* user's requested state against the hardware/driver capabilities. We +* do this now so that we can print out any log messages once rather +* than every time we check intel_enable_ppgtt(). +*/ + i915.enable_ppgtt =sanitize_enable_ppgtt (dev, i915.enable_ppgtt); +DRM_DEBUG_DRIVER ("ppgtt mode: %i\n" , i915.enable_ppgtt);return 0 ; }
Signature · 1 line
1.9.2
Quoted 22 lines · Daniel Vetter
Otherwise we'll end up spamming dmesg on every context creation on snb with vt-d enabled. This regression was introduced in
commit
246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:14 2013 -0800drm/i915: Reorganize
intel_enable_ppgttAs 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 thesanitize_ppgttcall togtt_init. Fixes boot hangs on pre-gen6.
- Add a debug output for the sanitize ppgtt mode.
Quoted 6 lines
References: https://lkml.org/lkml/2014/4/17/599
Rererences: https://bugs.freedesktop.org/show_bug.cgi?id=77916Cc Alessandro Suardi <[email protected]>Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
I am pretty sure we only call i915_gem_gtt_init() once during driver load... So let's try that r-b again.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 30 lines · Chris Wilson
Quoted 22 lines · Daniel Vetter
Otherwise we'll end up spamming dmesg on every context creation on snb with vt-d enabled. This regression was introduced in
commit
246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:14 2013 -0800drm/i915: Reorganize
intel_enable_ppgttAs 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 thesanitize_ppgttcall togtt_init. Fixes boot hangs on pre-gen6.
- Add a debug output for the sanitize ppgtt mode.Quoted 6 lines
References: https://lkml.org/lkml/2014/4/17/599
Rererences: https://bugs.freedesktop.org/show_bug.cgi?id=77916Cc Alessandro Suardi <[email protected]>Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 4 lines
I am pretty sure we only call
i915_gem_gtt_init()once during driver load... So let's try that r-b again.Reviewed-by Chris Wilson <[email protected]>-Chris
I'd like to add my Tested-By, but this patch doesn't apply cleanly to
3.15-rc3 - is there any prerequisite patch on top of -rc3 or should I use a git tree to test this fix ?
Offtopic, this email has a tiny typo (Rererences in the freedesktop
bug ID line), just in case git actually stores that kind of metadata :)
thanks,
--alessandro
"don't underestimate the things that I will do"
(Adele, "Rolling In The Deep")
Quoted 31 lines · Alessandro Suardi
Quoted 30 lines · Chris Wilson
Quoted 28 lines · Daniel Vetter
Otherwise we'll end up spamming dmesg on every context creation on snb with vt-d enabled. This regression was introduced in
commit
246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:14 2013 -0800drm/i915: Reorganize
intel_enable_ppgttAs 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 thesanitize_ppgttcall togtt_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
Rererences: https://bugs.freedesktop.org/show_bug.cgi?id=77916Cc Alessandro Suardi <[email protected]>Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 8 lines
Quoted 4 lines
I am pretty sure we only call
i915_gem_gtt_init()once during driver load... So let's try that r-b again.Reviewed-by Chris Wilson <[email protected]>-Chris
I'd like to add my Tested-By, but this patch doesn't apply cleanly to
3.15-rc3 - is there any prerequisite patch on top of -rc3 or should I use a git tree to test this fix ?
It needs one patch from drm-intel-fixes, probably easiest if you just grab that git tree. Or grab the relevant patch
http://cgit.freedesktop.org/drm-intel/commit/?id=0f9dc59db6abc475dc23afc077fabbc606b8830f
Quoted 2 lines
Offtopic, this email has a tiny typo (Rererences in the freedesktop
bug ID line), just in case git actually stores that kind of metadata :)
Jani, can you please rectify this?
Thanks, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Jani Nikula
maintainerQuoted 5 lines · Daniel Vetter
Quoted 2 lines · Alessandro Suardi
Offtopic, this email has a tiny typo (Rererences in the freedesktop
bug ID line), just in case git actually stores that kind of metadata :)Jani, can you please rectify this?
Done.
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Quoted 30 lines · Chris Wilson
Quoted 22 lines · Daniel Vetter
Otherwise we'll end up spamming dmesg on every context creation on snb with vt-d enabled. This regression was introduced in
commit
246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:14 2013 -0800drm/i915: Reorganize
intel_enable_ppgttAs 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 thesanitize_ppgttcall togtt_init. Fixes boot hangs on pre-gen6.
- Add a debug output for the sanitize ppgtt mode.Quoted 6 lines
References: https://lkml.org/lkml/2014/4/17/599
Rererences: https://bugs.freedesktop.org/show_bug.cgi?id=77916Cc Alessandro Suardi <[email protected]>Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 3 lines
I am pretty sure we only call
i915_gem_gtt_init()once during driver load... So let's try that r-b again.Reviewed-by Chris Wilson <[email protected]>
Pushed to -fixes, thanks for the patch and review.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center