Skip to contentSkip to conversation

drm/i915: Avoid snooping with userptr where not supported

PATCH Superseded Tvrtko Ursulin 3 participants 11 messages Mar 1, 2016 – Mar 2, 2016

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

PATCH 1/1 drm/i915: Avoid snooping with userptr where not supported

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

Idea is that userspace which relies on userptr snooping, for example for fine grained buffered SVM, can query the caching mode on a created userptr object to determine whether coherency is supported or not.

---
 drivers/gpu/drm/i915/i915_drv.h         | 1 +
 drivers/gpu/drm/i915/i915_gem.c         | 2 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 671295523317..73f0db17b990 100644
@@ -2629,6 +2629,7 @@ struct drm_i915_cmd_table {
 #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
 #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
 				 __I915__(dev)->ellc_size)
+#define HAS_SNOOP(dev)		(!IS_BXT_REVID(dev, 0, BXT_REVID_A1))
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 3d31d3ac589e..1c6e8fb9d392 100644
@@ -3949,7 +3949,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 		 * cacheline, whereas normally such cachelines would get
 		 * invalidated.
 		 */
-		if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
+		if (!HAS_SNOOP(dev))
 			return -ENODEV;
 
 		level = I915_CACHE_LLC;
drivers/gpu/drm/i915/i915_gem_userptr.c +1 -1
index 4b09c840d493..48aaff019b42 100644
@@ -782,7 +782,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
 
 	drm_gem_private_object_init(dev, &obj->base, args->user_size);
 	i915_gem_object_init(obj, &i915_gem_userptr_ops);
-	obj->cache_level = I915_CACHE_LLC;
+	obj->cache_level = HAS_SNOOP(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;
 	obj->base.write_domain = I915_GEM_DOMAIN_CPU;
 	obj->base.read_domains = I915_GEM_DOMAIN_CPU;
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Avoid snooping with userptr where not supported

== Series Details ==

== Series Details ==

Series: drm/i915: Avoid snooping with userptr where not supported
URL : https://patchwork.freedesktop.org/series/3979/
State : failure

== Summary ==

Series 3979v1 drm/i915: Avoid snooping with userptr where not supported
http://patchwork.freedesktop.org/api/1.0/series/3979/revisions/1/mbox/

Test kms_flip:

        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (bdw-ultra)
                pass       -> DMESG-WARN (ilk-hp8440p) UNSTABLE
        Subgroup basic-flip-vs-wf_vblank:
                dmesg-warn -> PASS       (hsw-gt2)
Test kms_force_connector_basic:
        Subgroup force-edid:
                pass       -> SKIP       (ilk-hp8440p)
        Subgroup force-load-detect:
                dmesg-fail -> FAIL       (snb-x220t)
                skip       -> FAIL       (ivb-t430s)
        Subgroup prune-stale-modes:
                pass       -> SKIP       (ivb-t430s)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                pass       -> DMESG-WARN (skl-i7k-2)
        Subgroup read-crc-pipe-a:
                pass       -> DMESG-WARN (snb-x220t)
Test pm_rpm:
        Subgroup basic-rte:
                pass       -> DMESG-WARN (bsw-nuc-2)
bdw-nuci7        total:169  pass:158  dwarn:0   dfail:0   fail:0   skip:11 
bdw-ultra        total:169  pass:154  dwarn:1   dfail:0   fail:0   skip:14 
bsw-nuc-2        total:169  pass:137  dwarn:1   dfail:0   fail:1   skip:30 
byt-nuc          total:169  pass:144  dwarn:0   dfail:0   fail:0   skip:25 
hsw-brixbox      total:169  pass:154  dwarn:0   dfail:0   fail:0   skip:15 
hsw-gt2          total:169  pass:158  dwarn:0   dfail:0   fail:1   skip:10 
ilk-hp8440p      total:169  pass:115  dwarn:1   dfail:0   fail:2   skip:51 
ivb-t430s        total:169  pass:152  dwarn:0   dfail:0   fail:1   skip:16 
skl-i5k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16 
skl-i7k-2        total:169  pass:152  dwarn:1   dfail:0   fail:0   skip:16 
snb-dellxps      total:169  pass:143  dwarn:2   dfail:0   fail:1   skip:23 
snb-x220t        total:169  pass:144  dwarn:1   dfail:0   fail:2   skip:22 

Results at /archive/results/CI_IGT_test/Patchwork_1506/

bb25273010c1ea81428ad36a53058ef286653283 drm-intel-nightly: 2016y-03m-01d-15h-09m-38s UTC integration manifest a08173ef1c8f8e2c35637a9f4771bbd66ebfd3df drm/i915: Avoid snooping with userptr where not supported

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Tvrtko Ursulin
Quoted 45 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

Idea is that userspace which relies on userptr snooping, for example for fine grained buffered SVM, can query the caching mode on a created userptr object to determine whether coherency is supported or not.

---
 drivers/gpu/drm/i915/i915_drv.h         | 1 +
 drivers/gpu/drm/i915/i915_gem.c         | 2 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 671295523317..73f0db17b990 100644
@@ -2629,6 +2629,7 @@ struct drm_i915_cmd_table {
 #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
 #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
 				 __I915__(dev)->ellc_size)
+#define HAS_SNOOP(dev)		(!IS_BXT_REVID(dev, 0, BXT_REVID_A1))
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 3d31d3ac589e..1c6e8fb9d392 100644

drivers/gpu/drm/i915/i915_gem.c int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · line 3952

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -3949,7 +3949,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 		 * cacheline, whereas normally such cachelines would get
 		 * invalidated.
 		 */
-		if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
+		if (!HAS_SNOOP(dev))

if (!HAS_LLC && !HAS_SNOOP)

and HAS_SNOOP should be true for everything that is not llc, with the exception above. So make a dev_info->has_snoop feature bit (or uses_snoop?) and then clear the copy inside the struct for the special case.

drivers/gpu/drm/i915/i915_gem_userptr.c i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file · line 785

Quoted 13 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
 			return -ENODEV;
 
 		level = I915_CACHE_LLC;
drivers/gpu/drm/i915/i915_gem_userptr.c +1 -1
index 4b09c840d493..48aaff019b42 100644
@@ -782,7 +782,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
 
 	drm_gem_private_object_init(dev, &obj->base, args->user_size);
 	i915_gem_object_init(obj, &i915_gem_userptr_ops);
-	obj->cache_level = I915_CACHE_LLC;
+	obj->cache_level = HAS_SNOOP(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;

This should be
if (!HAS_SNOOP && !HAS_LLC)

	return -ENODEV;

as we can not support a coherent pointer shared between memory and the GPU in this case.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 54 lines · Chris Wilson
Quoted 45 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

Idea is that userspace which relies on userptr snooping, for example for fine grained buffered SVM, can query the caching mode on a created userptr object to determine whether coherency is supported or not.

---
  drivers/gpu/drm/i915/i915_drv.h         | 1 +
  drivers/gpu/drm/i915/i915_gem.c         | 2 +-
  drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
  3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 671295523317..73f0db17b990 100644
@@ -2629,6 +2629,7 @@ struct drm_i915_cmd_table {
  #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
  #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
  				 __I915__(dev)->ellc_size)
+#define HAS_SNOOP(dev)		(!IS_BXT_REVID(dev, 0, BXT_REVID_A1))
  #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
  #define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 3d31d3ac589e..1c6e8fb9d392 100644

drivers/gpu/drm/i915/i915_gem.c int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · line 3952

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -3949,7 +3949,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
  		 * cacheline, whereas normally such cachelines would get
  		 * invalidated.
  		 */
-		if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
+		if (!HAS_SNOOP(dev))

if (!HAS_LLC && !HAS_SNOOP)

Quoted 4 lines

and HAS_SNOOP should be true for everything that is not llc, with the exception above. So make a dev_info->has_snoop feature bit (or uses_snoop?) and then clear the copy inside the struct for the special case.

Sure I can do that, but isn't it the same as this patch? Unless something with LLC and no snooping appears?

Quoted 16 lines

drivers/gpu/drm/i915/i915_gem_userptr.c i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file · line 785

Quoted 13 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
  			return -ENODEV;
 
  		level = I915_CACHE_LLC;
drivers/gpu/drm/i915/i915_gem_userptr.c +1 -1
index 4b09c840d493..48aaff019b42 100644
@@ -782,7 +782,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
 
  	drm_gem_private_object_init(dev, &obj->base, args->user_size);
  	i915_gem_object_init(obj, &i915_gem_userptr_ops);
-	obj->cache_level = I915_CACHE_LLC;
+	obj->cache_level = HAS_SNOOP(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;

This should be
if (!HAS_SNOOP && !HAS_LLC)

Quoted 4 lines
	return -ENODEV;

as we can not support a coherent pointer shared between memory and the GPU in this case.

Hm interesting, why not? I mean, what is the difference compared to normal BOs which will be uncached on !LLC?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 56 lines · Tvrtko Ursulin
Quoted 54 lines · Chris Wilson
Quoted 45 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

Idea is that userspace which relies on userptr snooping, for example for fine grained buffered SVM, can query the caching mode on a created userptr object to determine whether coherency is supported or not.

---
 drivers/gpu/drm/i915/i915_drv.h         | 1 +
 drivers/gpu/drm/i915/i915_gem.c         | 2 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 671295523317..73f0db17b990 100644
@@ -2629,6 +2629,7 @@ struct drm_i915_cmd_table {
 #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
 #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
 				 __I915__(dev)->ellc_size)
+#define HAS_SNOOP(dev)		(!IS_BXT_REVID(dev, 0, BXT_REVID_A1))
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 3d31d3ac589e..1c6e8fb9d392 100644

drivers/gpu/drm/i915/i915_gem.c int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · line 3952

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -3949,7 +3949,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 		 * cacheline, whereas normally such cachelines would get
 		 * invalidated.
 		 */
-		if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
+		if (!HAS_SNOOP(dev))

if (!HAS_LLC && !HAS_SNOOP)

Quoted 7 lines
Quoted 4 lines

and HAS_SNOOP should be true for everything that is not llc, with the exception above. So make a dev_info->has_snoop feature bit (or uses_snoop?) and then clear the copy inside the struct for the special case.

Sure I can do that, but isn't it the same as this patch? Unless something with LLC and no snooping appears?

I am generalising into something that makes sense here.

if (!HAS_SNOOP(dev)) does not make sense by itself since LLC is not snooping and so this would appear to also reject all of LLC.

Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
 			return -ENODEV;
 
 		level = I915_CACHE_LLC;
drivers/gpu/drm/i915/i915_gem_userptr.c +0 -0
index 4b09c840d493..48aaff019b42 100644

drivers/gpu/drm/i915/i915_gem_userptr.c i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file · line 785

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_userptr.c +1 -1
@@ -782,7 +782,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
 
 	drm_gem_private_object_init(dev, &obj->base, args->user_size);
 	i915_gem_object_init(obj, &i915_gem_userptr_ops);
-	obj->cache_level = I915_CACHE_LLC;
+	obj->cache_level = HAS_SNOOP(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;

This should be
if (!HAS_SNOOP && !HAS_LLC)

	return -ENODEV;
Quoted 5 lines
Quoted 2 lines

as we can not support a coherent pointer shared between memory and the GPU in this case.

Hm interesting, why not? I mean, what is the difference compared to normal BOs which will be uncached on !LLC?

They are allocated as device memory. userptr is for importing normal system pages into the device with the expectation that such is coherent. To change that we should have additional flags that tell us that the user is expecting non-coherent bo which requires the user to manage sync. That is also typically (thinking about the GL spec) also explicitly requested at the client API level.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH v2 1/1 drm/i915: Avoid snooping with userptr where not supported

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

v2: Userptr cannot be supported when it cannot be coherent and
generalize the code better. (Chris Wilson)

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_drv.h         | 2 ++
 drivers/gpu/drm/i915/i915_gem.c         | 2 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c | 7 +++++++
 4 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 36c0cf131e93..615935e6fa3f 100644
@@ -853,6 +853,9 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen >= 9)
 		gen9_sseu_info_init(dev);
 
+	/* Snooping is broken on BXT A stepping. */
+	info->has_snoop = !IS_BXT_REVID(dev, 0, BXT_REVID_A1);
+
 	DRM_DEBUG_DRIVER("slice total: %u\n", info->slice_total);
 	DRM_DEBUG_DRIVER("subslice total: %u\n", info->subslice_total);
 	DRM_DEBUG_DRIVER("subslice per slice: %u\n", info->subslice_per_slice);
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 671295523317..d5fc17adc155 100644
@@ -783,6 +783,7 @@ struct intel_csr {
 	func(overlay_needs_physical) sep \
 	func(supports_tv) sep \
 	func(has_llc) sep \
+	func(has_snoop) sep \
 	func(has_ddi) sep \
 	func(has_fpga_dbg)
 
@@ -2627,6 +2628,7 @@ struct drm_i915_cmd_table {
 #define HAS_BLT(dev)		(INTEL_INFO(dev)->ring_mask & BLT_RING)
 #define HAS_VEBOX(dev)		(INTEL_INFO(dev)->ring_mask & VEBOX_RING)
 #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
+#define HAS_SNOOP(dev)		(INTEL_INFO(dev)->has_snoop)
 #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
 				 __I915__(dev)->ellc_size)
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 3d31d3ac589e..b854af2c4141 100644
@@ -3949,7 +3949,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 		 * cacheline, whereas normally such cachelines would get
 		 * invalidated.
 		 */
-		if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
+		if (!HAS_LLC(dev) && !HAS_SNOOP(dev))
 			return -ENODEV;
 
 		level = I915_CACHE_LLC;
drivers/gpu/drm/i915/i915_gem_userptr.c +7 -0
index 4b09c840d493..54088a4d6498 100644
@@ -758,6 +758,13 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
 	int ret;
 	u32 handle;
 
+	if (!HAS_LLC(dev) && !HAS_SNOOP(dev)) {
+		/* We cannot support coherent userptr objects on hw without
+		 * LLC and broken snooping.
+		 */
+		return -ENODEV;
+	}
+
 	if (args->flags & ~(I915_USERPTR_READ_ONLY |
 			    I915_USERPTR_UNSYNCHRONIZED))
 		return -EINVAL;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#6 lore raw
Quoted 32 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

v2: Userptr cannot be supported when it cannot be coherent and
generalize the code better. (Chris Wilson)

---
 drivers/gpu/drm/i915/i915_dma.c         | 3 +++
 drivers/gpu/drm/i915/i915_drv.h         | 2 ++
 drivers/gpu/drm/i915/i915_gem.c         | 2 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c | 7 +++++++
 4 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +0 -0
index 36c0cf131e93..615935e6fa3f 100644

drivers/gpu/drm/i915/i915_dma.c static void intel_device_info_runtime_init(struct drm_device *dev) · line 856

Quoted 4 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
@@ -853,6 +853,9 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen >= 9)
 		gen9_sseu_info_init(dev);
 
+	/* Snooping is broken on BXT A stepping. */
	info->has_snoop = !info->has_llc;

drivers/gpu/drm/i915/i915_dma.c static void intel_device_info_runtime_init(struct drm_device *dev) · line 857

Quoted 1 line
drivers/gpu/drm/i915/i915_dma.c +1 -0
+	info->has_snoop &= !IS_BXT_REVID(dev, 0, BXT_REVID_A1);

LLC and FSB-snooping are two very different coherency protocols and I do believe it is important that we avoid conflating the two.

With that change,

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH v3 1/1 drm/i915: Avoid snooping with userptr where not supported

From: Tvrtko Ursulin <[email protected]>

commit e5756c10d841ddb448293c849392f3d6b809561f
Author: Imre Deak <[email protected]>
Date: Fri Aug 14 18:43:30 2015 +0300

drm/i915/bxt: don't allow cached GEM mappings on A stepping

Added an exception of disallowing snooping for Broxton A stepping hardware but userptr was still enabling it regardless.

Move the check to HAS_SNOOP now that it is used from multiple call sites and use it.

v2: Userptr cannot be supported when it cannot be coherent and
generalize the code better. (Chris Wilson)

v3: Make has_snoop true only when !has_llc. (Chris Wilson)

---
 drivers/gpu/drm/i915/i915_dma.c         | 4 ++++
 drivers/gpu/drm/i915/i915_drv.h         | 2 ++
 drivers/gpu/drm/i915/i915_gem.c         | 2 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c | 7 +++++++
 4 files changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +4 -0
index 36c0cf131e93..4aa3db61a535 100644
@@ -853,6 +853,10 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen >= 9)
 		gen9_sseu_info_init(dev);
 
+	/* Snooping is broken on BXT A stepping. */
+	info->has_snoop = !info->has_llc;
+	info->has_snoop &= !IS_BXT_REVID(dev, 0, BXT_REVID_A1);
+
 	DRM_DEBUG_DRIVER("slice total: %u\n", info->slice_total);
 	DRM_DEBUG_DRIVER("subslice total: %u\n", info->subslice_total);
 	DRM_DEBUG_DRIVER("subslice per slice: %u\n", info->subslice_per_slice);
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 671295523317..d5fc17adc155 100644
@@ -783,6 +783,7 @@ struct intel_csr {
 	func(overlay_needs_physical) sep \
 	func(supports_tv) sep \
 	func(has_llc) sep \
+	func(has_snoop) sep \
 	func(has_ddi) sep \
 	func(has_fpga_dbg)
 
@@ -2627,6 +2628,7 @@ struct drm_i915_cmd_table {
 #define HAS_BLT(dev)		(INTEL_INFO(dev)->ring_mask & BLT_RING)
 #define HAS_VEBOX(dev)		(INTEL_INFO(dev)->ring_mask & VEBOX_RING)
 #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
+#define HAS_SNOOP(dev)		(INTEL_INFO(dev)->has_snoop)
 #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
 				 __I915__(dev)->ellc_size)
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 3d31d3ac589e..b854af2c4141 100644
@@ -3949,7 +3949,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 		 * cacheline, whereas normally such cachelines would get
 		 * invalidated.
 		 */
-		if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
+		if (!HAS_LLC(dev) && !HAS_SNOOP(dev))
 			return -ENODEV;
 
 		level = I915_CACHE_LLC;
drivers/gpu/drm/i915/i915_gem_userptr.c +7 -0
index 4b09c840d493..54088a4d6498 100644
@@ -758,6 +758,13 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
 	int ret;
 	u32 handle;
 
+	if (!HAS_LLC(dev) && !HAS_SNOOP(dev)) {
+		/* We cannot support coherent userptr objects on hw without
+		 * LLC and broken snooping.
+		 */
+		return -ENODEV;
+	}
+
 	if (args->flags & ~(I915_USERPTR_READ_ONLY |
 			    I915_USERPTR_UNSYNCHRONIZED))
 		return -EINVAL;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

✗ Fi.CI.BAT: warning for drm/i915: Avoid snooping with userptr where not supported (rev2)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Avoid snooping with userptr where not supported (rev2)
URL : https://patchwork.freedesktop.org/series/3979/
State : warning

== Summary ==

Series 3979v2 drm/i915: Avoid snooping with userptr where not supported
http://patchwork.freedesktop.org/api/1.0/series/3979/revisions/2/mbox/

Test kms_flip:

        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (snb-x220t)
                dmesg-warn -> PASS       (hsw-gt2)
        Subgroup basic-plain-flip:
                pass       -> DMESG-WARN (hsw-brixbox)
Test kms_force_connector_basic:
        Subgroup force-load-detect:
                pass       -> SKIP       (ilk-hp8440p)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                dmesg-warn -> PASS       (bsw-nuc-2)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (snb-x220t)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                dmesg-fail -> FAIL       (snb-x220t)
                pass       -> DMESG-WARN (snb-dellxps)
bdw-nuci7        total:169  pass:158  dwarn:0   dfail:0   fail:0   skip:11 
bdw-ultra        total:169  pass:155  dwarn:0   dfail:0   fail:0   skip:14 
bsw-nuc-2        total:169  pass:138  dwarn:0   dfail:0   fail:1   skip:30 
byt-nuc          total:169  pass:144  dwarn:0   dfail:0   fail:0   skip:25 
hsw-brixbox      total:169  pass:153  dwarn:1   dfail:0   fail:0   skip:15 
hsw-gt2          total:169  pass:159  dwarn:0   dfail:0   fail:0   skip:10 
ilk-hp8440p      total:169  pass:117  dwarn:0   dfail:0   fail:1   skip:51 
ivb-t430s        total:169  pass:154  dwarn:0   dfail:0   fail:0   skip:15 
skl-i5k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16 
skl-i7k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16 
snb-dellxps      total:169  pass:145  dwarn:1   dfail:0   fail:0   skip:23 
snb-x220t        total:169  pass:145  dwarn:1   dfail:0   fail:1   skip:22 

Results at /archive/results/CI_IGT_test/Patchwork_1511/

37415cefa4f17869f5ed40a42dae85f1e6b519be drm-intel-nightly: 2016y-03m-02d-10h-20m-17s UTC integration manifest 402f86c709ec6ad3346b2ec141c78cacd8d058a2 drm/i915: Avoid snooping with userptr where not supported

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Avoid snooping with userptr where not supported (rev3)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Avoid snooping with userptr where not supported (rev3)
URL : https://patchwork.freedesktop.org/series/3979/
State : failure

== Summary ==

Series 3979v3 drm/i915: Avoid snooping with userptr where not supported
http://patchwork.freedesktop.org/api/1.0/series/3979/revisions/3/mbox/

Test kms_flip:

        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (snb-x220t)
                dmesg-warn -> PASS       (hsw-gt2)
        Subgroup basic-plain-flip:
                pass       -> DMESG-WARN (hsw-brixbox)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                dmesg-warn -> PASS       (bsw-nuc-2)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> FAIL       (byt-nuc)
        Subgroup suspend-read-crc-pipe-c:
                skip       -> FAIL       (byt-nuc)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (bsw-nuc-2)
        Subgroup basic-rte:
                pass       -> DMESG-WARN (snb-dellxps)
bdw-nuci7        total:169  pass:158  dwarn:0   dfail:0   fail:0   skip:11 
bdw-ultra        total:169  pass:155  dwarn:0   dfail:0   fail:0   skip:14 
bsw-nuc-2        total:169  pass:137  dwarn:1   dfail:0   fail:1   skip:30 
byt-nuc          total:169  pass:143  dwarn:0   dfail:0   fail:2   skip:24 
hsw-brixbox      total:169  pass:153  dwarn:1   dfail:0   fail:0   skip:15 
hsw-gt2          total:169  pass:159  dwarn:0   dfail:0   fail:0   skip:10 
ilk-hp8440p      total:169  pass:118  dwarn:0   dfail:0   fail:1   skip:50 
ivb-t430s        total:169  pass:154  dwarn:0   dfail:0   fail:0   skip:15 
skl-i5k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16 
skl-i7k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16 
snb-dellxps      total:169  pass:145  dwarn:1   dfail:0   fail:0   skip:23 
snb-x220t        total:169  pass:146  dwarn:0   dfail:1   fail:0   skip:22 

Results at /archive/results/CI_IGT_test/Patchwork_1513/

37415cefa4f17869f5ed40a42dae85f1e6b519be drm-intel-nightly: 2016y-03m-02d-10h-20m-17s UTC integration manifest d37b311fb28390fd8131caa5db1a623a86e81842 drm/i915: Avoid snooping with userptr where not supported

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author Applied
#10 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915: Avoid snooping with userptr where not supported (rev3)

Quoted 11 lines · Patchwork

== Series Details ==

Series: drm/i915: Avoid snooping with userptr where not supported (rev3)
URL : https://patchwork.freedesktop.org/series/3979/
State : failure

== Summary ==

Series 3979v3 drm/i915: Avoid snooping with userptr where not supported
http://patchwork.freedesktop.org/api/1.0/series/3979/revisions/3/mbox/

Quoted 6 lines

Test kms_flip:

         Subgroup basic-flip-vs-wf_vblank:
                 fail       -> PASS       (snb-x220t)
                 dmesg-warn -> PASS       (hsw-gt2)
         Subgroup basic-plain-flip:
                 pass       -> DMESG-WARN (hsw-brixbox)

Unrelated: https://bugs.freedesktop.org/show_bug.cgi?id=94349

Quoted 7 lines

Test kms_pipe_crc_basic:

         Subgroup read-crc-pipe-c:
                 dmesg-warn -> PASS       (bsw-nuc-2)
         Subgroup suspend-read-crc-pipe-b:
                 pass       -> FAIL       (byt-nuc)
         Subgroup suspend-read-crc-pipe-c:
                 skip       -> FAIL       (byt-nuc)

New unrelated: https://bugs.freedesktop.org/show_bug.cgi?id=94370

Quoted 3 lines

Test pm_rpm:

         Subgroup basic-pci-d3-state:
                 pass       -> DMESG-WARN (bsw-nuc-2)

Unrelated: https://bugs.freedesktop.org/show_bug.cgi?id=94164

Quoted 2 lines
         Subgroup basic-rte:
                 pass       -> DMESG-WARN (snb-dellxps)

Again: https://bugs.freedesktop.org/show_bug.cgi?id=94349

Quoted 14 lines
bdw-nuci7        total:169  pass:158  dwarn:0   dfail:0   fail:0   skip:11
bdw-ultra        total:169  pass:155  dwarn:0   dfail:0   fail:0   skip:14
bsw-nuc-2        total:169  pass:137  dwarn:1   dfail:0   fail:1   skip:30
byt-nuc          total:169  pass:143  dwarn:0   dfail:0   fail:2   skip:24
hsw-brixbox      total:169  pass:153  dwarn:1   dfail:0   fail:0   skip:15
hsw-gt2          total:169  pass:159  dwarn:0   dfail:0   fail:0   skip:10
ilk-hp8440p      total:169  pass:118  dwarn:0   dfail:0   fail:1   skip:50
ivb-t430s        total:169  pass:154  dwarn:0   dfail:0   fail:0   skip:15
skl-i5k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16
skl-i7k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16
snb-dellxps      total:169  pass:145  dwarn:1   dfail:0   fail:0   skip:23
snb-x220t        total:169  pass:146  dwarn:0   dfail:1   fail:0   skip:22
Quoted 4 lines

Results at /archive/results/CI_IGT_test/Patchwork_1513/

37415cefa4f17869f5ed40a42dae85f1e6b519be drm-intel-nightly: 2016y-03m-02d-10h-20m-17s UTC integration manifest d37b311fb28390fd8131caa5db1a623a86e81842 drm/i915: Avoid snooping with userptr where not supported

Merged, thanks for the review!

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx