Skip to contentSkip to conversation

drm/i915: Sanitize the enable_ppgtt module option once

PATCH In review Daniel Vetter 5 participants 9 messages Apr 22, 2014 – Apr 25, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +19 -7
index 0d514ff9b94c..47491c4a1181 100644
@@ -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 (i915.enable_ppgtt == 1)
+		return 1;
+
+	if (i915.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;
 }
 
 
@@ -1157,6 +1167,8 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
 
+	i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt);
+
 	ppgtt->base.dev = dev;
 	ppgtt->base.scratch = dev_priv->gtt.base.scratch;
 
Signature · 1 line
1.9.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

I started to consider what would happen if i915.enable_ppgtt changed on the fly, but then saw that it is 0400 and this pre-initialisation makes a lot of sense. So maybe we could mention that here:

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.

Quoted 4 lines

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>

If you care to add in some of the comments,

Quoted 11 lines
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 0d514ff9b94c..47491c4a1181 100644
@@ -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)
 {

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 45

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
-	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;
+}
+

/* 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().
*/

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 47

Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
+static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
+{

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 18 lines · Chris Wilson
Quoted 8 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

I started to consider what would happen if i915.enable_ppgtt changed on the fly, but then saw that it is 0400 and this pre-initialisation makes a lot of sense. So maybe we could mention that here:

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.

Quoted 7 lines
Quoted 4 lines

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>

If you care to add in some of the comments,

Fully agreed on both since the first thing I've checked is that the enable_ppgtt option is indeed 0400 ;-)

Jani, can you please apply Chris' commit message text and comment when merging?
-Daniel

Quoted 34 lines
Quoted 12 lines
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 0d514ff9b94c..47491c4a1181 100644
@@ -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)
 {

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 45

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
-	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;
+}
+

/* 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().
*/

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 47

Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
+static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
+{

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by
#3 lore raw
Quoted 27 lines · Daniel Vetter
Quoted 18 lines · Chris Wilson
Quoted 8 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

I started to consider what would happen if i915.enable_ppgtt changed on the fly, but then saw that it is 0400 and this pre-initialisation makes a lot of sense. So maybe we could mention that here:

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.

Quoted 7 lines
Quoted 4 lines

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>

If you care to add in some of the comments,

Quoted 6 lines

Fully agreed on both since the first thing I've checked is that the enable_ppgtt option is indeed 0400 ;-)

Jani, can you please apply Chris' commit message text and comment when merging?
-Daniel

Here as well:

Quoted 40 lines
Quoted 35 lines
Quoted 13 lines

 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 0d514ff9b94c..47491c4a1181 100644
@@ -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)
 {

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 45

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
-	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;
+}
+

/* 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().
*/

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 47

Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
+static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
+{

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
maintainer
#4 lore raw
In reply to Daniel Vetter
Quoted 35 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
index 0d514ff9b94c..47491c4a1181 100644
@@ -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;
+}
+

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 55

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -0
+static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
+{
+	if (enable_ppgtt == 0 || !HAS_ALIASING_PPGTT(dev))
+		return 0;
+
+	if (i915.enable_ppgtt == 1)
+		return 1;
+
+	if (i915.enable_ppgtt == 2 && HAS_PPGTT(dev))
+		return 2;

You should probably either pass enable_ppgtt as parameter and use that exclusively, or not pass it and refer to i915.enable_ppgtt directly, but not mix them.

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
+
 #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;

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 65

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -5
+		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;

This conflicts in -fixes due to
commit 8d214b7d9c45f4af23ce41b2bc74f79c44f760de

Author: Ben Widawsky <[email protected]>
Date:   Mon Mar 24 18:06:00 2014 -0700

drm/i915: Allow full PPGTT with param override

Should I incorporate that in the conflict resolution for simplicity, letting 3.15 users also play with full ppgtt with the module param?

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
 }
 
 
@@ -1157,6 +1167,8 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
 
+	i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt);
+
 	ppgtt->base.dev = dev;
 	ppgtt->base.scratch = dev_priv->gtt.base.scratch;
 
Signature · 6 lines
1.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#5 lore raw

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)

References: https://lkml.org/lkml/2014/4/17/599

---
 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
index 0d514ff9b94c..70e8892f81a6 100644
@@ -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;
 }
 
 
@@ -1157,6 +1167,14 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
 
+	/*
+	 * 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);
+
 	ppgtt->base.dev = dev;
 	ppgtt->base.scratch = dev_priv->gtt.base.scratch;
 
Signature · 1 line
1.9.2
#6 lore raw
In reply to Jani Nikula
Quoted 42 lines · Jani Nikula
Quoted 41 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -1
index 0d514ff9b94c..47491c4a1181 100644
@@ -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 (i915.enable_ppgtt == 1)
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 55

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -0
+		return 1;
+
+	if (i915.enable_ppgtt == 2 && HAS_PPGTT(dev))
+		return 2;

You should probably either pass enable_ppgtt as parameter and use that exclusively, or not pass it and refer to i915.enable_ppgtt directly, but not mix them.

New patch on its way with Chris' comments also applied.

Quoted 21 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
+
 #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;

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 65

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -5
+		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;

This conflicts in -fixes due to
commit 8d214b7d9c45f4af23ce41b2bc74f79c44f760de

Quoted 7 lines
Author: Ben Widawsky <[email protected]>
Date:   Mon Mar 24 18:06:00 2014 -0700

drm/i915: Allow full PPGTT with param override

Should I incorporate that in the conflict resolution for simplicity, letting 3.15 users also play with full ppgtt with the module param?

Yeah I guess it's easiest to just cherry-pick that one to -fixes, too. -Daniel

Quoted 28 lines

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
 }
 
 
@@ -1157,6 +1167,8 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
 
+	i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt);
+
 	ppgtt->base.dev = dev;
 	ppgtt->base.scratch = dev_priv->gtt.base.scratch;
 
Signature · 6 lines
1.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
maintainer
#7 lore raw
Quoted 77 lines · Daniel Vetter
Quoted 42 lines · Jani Nikula
Quoted 41 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -1
index 0d514ff9b94c..47491c4a1181 100644
@@ -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 (i915.enable_ppgtt == 1)
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 55

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -0
+		return 1;
+
+	if (i915.enable_ppgtt == 2 && HAS_PPGTT(dev))
+		return 2;

You should probably either pass enable_ppgtt as parameter and use that exclusively, or not pass it and refer to i915.enable_ppgtt directly, but not mix them.

New patch on its way with Chris' comments also applied.

Quoted 24 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
+
 #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;

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 65

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -5
+		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;

This conflicts in -fixes due to
commit 8d214b7d9c45f4af23ce41b2bc74f79c44f760de

Author: Ben Widawsky <[email protected]>
Date:   Mon Mar 24 18:06:00 2014 -0700
Quoted 7 lines
Quoted 4 lines

drm/i915: Allow full PPGTT with param override

Should I incorporate that in the conflict resolution for simplicity, letting 3.15 users also play with full ppgtt with the module param?

Yeah I guess it's easiest to just cherry-pick that one to -fixes, too. -Daniel

Pushed v2 to -fixes, along with "drm/i915: Allow full PPGTT with param override". Thanks for the patch and review.

BR,
Jani.

Quoted 34 lines
Quoted 29 lines

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
 }
 
 
@@ -1157,6 +1167,8 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
 
+	i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt);
+
 	ppgtt->base.dev = dev;
 	ppgtt->base.scratch = dev_priv->gtt.base.scratch;
 
Signature · 6 lines
1.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
maintainer
#8 lore raw
Quoted 80 lines · Jani Nikula
Quoted 79 lines · Daniel Vetter
Quoted 42 lines · Jani Nikula
Quoted 41 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 246cbfb5fb9a1ca0997fbb135464c1ff5bb9c549

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:11:14 2013 -0800

drm/i915: Reorganize intel_enable_ppgtt

References: https://lkml.org/lkml/2014/4/17/599

Cc Alessandro Suardi <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -1
index 0d514ff9b94c..47491c4a1181 100644
@@ -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 (i915.enable_ppgtt == 1)
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 55

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -0
+		return 1;
+
+	if (i915.enable_ppgtt == 2 && HAS_PPGTT(dev))
+		return 2;

You should probably either pass enable_ppgtt as parameter and use that exclusively, or not pass it and refer to i915.enable_ppgtt directly, but not mix them.

New patch on its way with Chris' comments also applied.

Quoted 26 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
+
 #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;

drivers/gpu/drm/i915/i915_gem_gtt.c static void gen8_setup_private_ppat(struct drm_i915_private *dev_priv); · line 65

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -5
+		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;

This conflicts in -fixes due to
commit 8d214b7d9c45f4af23ce41b2bc74f79c44f760de

Author: Ben Widawsky <[email protected]>
Date:   Mon Mar 24 18:06:00 2014 -0700

drm/i915: Allow full PPGTT with param override

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Should I incorporate that in the conflict resolution for simplicity, letting 3.15 users also play with full ppgtt with the module param?

Yeah I guess it's easiest to just cherry-pick that one to -fixes, too. -Daniel

Pushed v2 to -fixes, along with "drm/i915: Allow full PPGTT with param override". Thanks for the patch and review.

And yanked out again due to [1]. Back to the drawing board. Please also add a ppgtt sanity check BUG_ON before returning true from intel_enable_ppgtt().

BR,
Jani.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=77916

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center