drm/i915: Pull MTRR setup to its own function
Subsystems (2)
PATCH 1/2 drm/i915: Pull MTRR setup to its own function
No functional change here, just clarifying code flow.
--- drivers/gpu/drm/i915/i915_dma.c | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +17 -12
@@ -1893,6 +1893,22 @@ ips_ping_for_i915_load(void) } } +static void +i915_mtrr_setup (struct drm_i915_private *dev_priv,unsigned long base, +unsigned long size) +{ +/* Set up a WC MTRR for non-PAT systems. This is more common than +* one would think, because the kernel disables PAT on first +* generation Core chips because WC PAT gets overridden by a UC +* MTRR if present. Even if a UC MTRR isn't present. +*/ + dev_priv->mm.gtt_mtrr =mtrr_add (base, size,MTRR_TYPE_WRCOMB ,1 ); +if (dev_priv->mm.gtt_mtrr <0 ) { +DRM_INFO ("MTRR allocation failed. Graphics " +"performance may suffer.\n" ); + } +} +/** * i915_driver_load - setup chip and create an initial config * @dev: DRM device
@@ -1969,18 +1985,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) goto out_rmmap; } -/* Set up a WC MTRR for non-PAT systems. This is more common than -* one would think, because the kernel disables PAT on first -* generation Core chips because WC PAT gets overridden by a UC -* MTRR if present. Even if a UC MTRR isn't present. -*/ - dev_priv->mm.gtt_mtrr =mtrr_add (dev->agp->base, - agp_size, -MTRR_TYPE_WRCOMB ,1 ); -if (dev_priv->mm.gtt_mtrr <0 ) { -DRM_INFO ("MTRR allocation failed. Graphics " -"performance may suffer.\n" ); - } +i915_mtrr_setup (dev_priv, dev->agp->base, agp_size);/* The i915 workqueue is primarily used for batched retirement of * requests (and thus managing bo) once the task has been completed
Signature · 1 line
1.7.7.6
PATCH 2/2 drm/i915: Don't do MTRR setup if PAT is enabled
Some newer BIOSes are shipping with all MTRRs already populated. These BIOSes are all on machines with sufficiently new CPUs that the referenced errata doesn't apply anyway, so just don't try to claim the MTRR.
--- drivers/gpu/drm/i915/i915_dma.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +6 -0
@@ -43,6 +43,7 @@#include <linux/slab.h> #include <linux/module.h> #include <acpi/video.h> +#include <asm/pat.h> static void i915_write_hws_pga (struct drm_device *dev) {
@@ -1897,6 +1898,11 @@ static void i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base, unsigned long size) { +#if defined(CONFIG_X86_PAT ) +if (cpu_has_pat) +return ; +#endif +/* Set up a WC MTRR for non-PAT systems. This is more common than * one would think, because the kernel disables PAT on first * generation Core chips because WC PAT gets overridden by a UC
Signature · 1 line
1.7.7.6
Daniel Vetter
AppliedRe: [PATCH 2/2] drm/i915: Don't do MTRR setup if PAT is enabled
Quoted 6 lines · Adam Jackson
Some newer BIOSes are shipping with all MTRRs already populated. These BIOSes are all on machines with sufficiently new CPUs that the referenced errata doesn't apply anyway, so just don't try to claim the MTRR.
Signed-off-by Adam Jackson <[email protected]>
Queued both patches for -next (with a bz link added to the later one), thanks.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 3 lines · Adam Jackson
No functional change here, just clarifying code flow.
Signed-off-by Adam Jackson<[email protected]>
I'm not qualified to review patch 2, though from the little I know it sounds like a good idea.