Skip to contentSkip to conversation

drm-intel-collector - update

PATCH Applied Rodrigo Vivi 5 participants 16 messages Nov 10, 2014 – Nov 14, 2014

Subsystems (3)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

cover drm-intel-collector - update

This is another drm-intel-collector updated notice:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=drm-intel-collector

Here goes the update list in order for better reviewers assignment:

Patch drm/i915: Make the physical object coherent with GTT - Reviewed-by: Ville
Patch drm/i915: Specify bsd rings through exec flag - Reviewer: Rodrigo
Patch drm/i915: add I915_PARAM_HAS_BSD2 to i915_getparam - Reviewer: Rodrigo
Patch drm/i915: Move the ban period onto the context - Reviewer: Mika
Patch drm/i915: Add ioctl to set per-context parameters - Reviewer: Rodrigo
Patch drm/i915: Put logical pipe_control emission into a helper. - Reviewer: Mika
Patch drm/i915: Add WaCsStallBeforeStateCacheInvalidate:bdw, chv to logical ring - Reviewer: Mika
Patch drm/i915: Wait thread status on gen8+ fw sequence - Reviewer: Ville

Hi all,

First of all thanks for Nacks and coments on previous round.

I still need to investigate why so big difference on PRTS when puting testing x collector. But meanwhile let me do another round. This time I just collected one more and removed the Nacks.

This round coverred the gap on drm-intel-testing updates from Oct 03 to Oct 24.

I volunteered myself, Ville and Mika to some Reviews here. Please let me know if this list is ok or other people should be reviewing them.

Thanks in advance,
Rodrigo.

Chris Wilson (3):
drm/i915: Make the physical object coherent with GTT drm/i915: Move the ban period onto the context drm/i915: Add ioctl to set per-context parameters

Mika Kuoppala (1):
drm/i915: Wait thread status on gen8+ fw sequence

Rodrigo Vivi (2):
drm/i915: Put logical pipe_control emission into a helper. drm/i915: Add WaCsStallBeforeStateCacheInvalidate:bdw, chv to logical
ring

Zhipeng Gong (2):
drm/i915: Specify bsd rings through exec flag drm/i915: add I915_PARAM_HAS_BSD2 to i915_getparam

 drivers/gpu/drm/i915/i915_dma.c            |   8 ++
 drivers/gpu/drm/i915/i915_drv.h            |  15 ++-
 drivers/gpu/drm/i915/i915_gem.c            | 210 ++++++++++++++++++++---------
 drivers/gpu/drm/i915/i915_gem_context.c    |  71 ++++++++++
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  19 ++-
 drivers/gpu/drm/i915/intel_dp.c            |   3 +
 drivers/gpu/drm/i915/intel_lrc.c           |  41 ++++--
 drivers/gpu/drm/i915/intel_uncore.c        |   3 +-
 include/uapi/drm/i915_drm.h                |  22 ++-
 9 files changed, 307 insertions(+), 85 deletions(-)
Signature · 6 lines
1.9.3

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

PATCH 1/8 drm/i915: Make the physical object coherent with GTT

From: Chris Wilson <[email protected]>

Currently objects for which the hardware needs a contiguous physical address are allocated a shadow backing storage to satisfy the contraint. This shadow buffer is not wired into the normal obj->pages and so the physical object is incoherent with accesses via the GPU, GTT and CPU. By setting up the appropriate scatter-gather table, we can allow userspace to access the physical object via either a GTT mmaping of or by rendering into the GEM bo. However, keeping the CPU mmap of the shmemfs backing storage coherent with the contiguous shadow is not yet possible. Fortuituously, CPU mmaps of objects requiring physical addresses are not expected to be coherent anyway.

This allows the physical constraint of the GEM object to be transparent to userspace and allow it to efficiently render into or update them via the GTT and GPU.

v2: Fix leak of pci handle spotted by Ville
v3: Remove the now duplicate call to detach_phys_object during free.
v4: Wait for rendering before pwrite. As this patch makes it possible to render into the phys object, we should make it correct as well!

---
 drivers/gpu/drm/i915/i915_dma.c |   3 +
 drivers/gpu/drm/i915/i915_drv.h |   6 +-
 drivers/gpu/drm/i915/i915_gem.c | 207 +++++++++++++++++++++++++++-------------
 include/uapi/drm/i915_drm.h     |   1 +
 4 files changed, 150 insertions(+), 67 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 9a73533..5dc37f0 100644
@@ -1027,6 +1027,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_CMD_PARSER_VERSION:
 		value = i915_cmd_parser_get_version();
 		break;
+	case I915_PARAM_HAS_COHERENT_PHYS_GTT:
+		value = 1;
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
drivers/gpu/drm/i915/i915_drv.h +3 -3
index 8fb8eba..1219282 100644
@@ -1957,10 +1957,10 @@ struct drm_i915_gem_object {
 	unsigned long user_pin_count;
 	struct drm_file *pin_filp;
 
-	/** for phy allocated objects */
-	struct drm_dma_handle *phys_handle;
-
 	union {
+		/** for phy allocated objects */
+		struct drm_dma_handle *phys_handle;
+
 		struct i915_gem_userptr {
 			uintptr_t ptr;
 			unsigned read_only :1;
drivers/gpu/drm/i915/i915_gem.c +143 -64

279 lines not on this page · raw message

include/uapi/drm/i915_drm.h +1 -0
index 2ec0efc..2502622 100644
@@ -340,6 +340,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXEC_HANDLE_LUT   26
 #define I915_PARAM_HAS_WT     	 	 27
 #define I915_PARAM_CMD_PARSER_VERSION	 28
+#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#2 lore raw

PATCH 2/8 drm/i915: Specify bsd rings through exec flag

In reply to Rodrigo Vivi

From: Zhipeng Gong <[email protected]>

On Broadwell GT3 we have 2 Video Command Streamers (VCS), but userspace has no control when using VCS1 or VCS2. This patch introduces a mechanism to avoid the default ping-pong mode and use one specific ring through execution flag.

v2: fix whitespace (Rodrigo)

---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 19 +++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp.c            |  3 +++
 include/uapi/drm/i915_drm.h                |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +17 -2
index e1ed85a..d9081ec 100644
@@ -1273,8 +1273,23 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	else if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) {
 		if (HAS_BSD2(dev)) {
 			int ring_id;
-			ring_id = gen8_dispatch_bsd_ring(dev, file);
-			ring = &dev_priv->ring[ring_id];
+
+			switch (args->flags & I915_EXEC_BSD_MASK) {
+			case I915_EXEC_BSD_DEFAULT:
+				ring_id = gen8_dispatch_bsd_ring(dev, file);
+				ring = &dev_priv->ring[ring_id];
+				break;
+			case I915_EXEC_BSD_RING1:
+				ring = &dev_priv->ring[VCS];
+				break;
+			case I915_EXEC_BSD_RING2:
+				ring = &dev_priv->ring[VCS2];
+				break;
+			default:
+				DRM_DEBUG("execbuf with unknown bsd ring: %d\n",
+					  (int)(args->flags & I915_EXEC_BSD_MASK));
+				return -EINVAL;
+			}
 		} else
 			ring = &dev_priv->ring[VCS];
 	} else
drivers/gpu/drm/i915/intel_dp.c +3 -0
index ceb528f..a8c9e47 100644
@@ -4802,6 +4802,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 		if (HAS_PCH_SPLIT(dev)) {
 			if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
 				goto mst_fail;
+		if (!intel_dp->output_reg)
+			goto mst_fail;
+
 		} else {
 			if (g4x_digital_port_connected(dev, intel_dig_port) != 1)
 				goto mst_fail;
include/uapi/drm/i915_drm.h +7 -1
index 2502622..fcb16bf 100644
@@ -737,7 +737,13 @@ struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_HANDLE_LUT		(1<<12)
 
-#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_HANDLE_LUT<<1)
+/** Used for switching BSD rings on the platforms with two BSD rings */
+#define I915_EXEC_BSD_MASK		(3<<13)
+#define I915_EXEC_BSD_DEFAULT		(0<<13) /* default ping-pong mode */
+#define I915_EXEC_BSD_RING1		(1<<13)
+#define I915_EXEC_BSD_RING2		(2<<13)
+
+#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15)
 
 #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
Signature · 6 lines
1.9.3

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

Re: [PATCH 2/8] drm/i915: Specify bsd rings through exec flag

Quoted 52 lines · Rodrigo Vivi

From: Zhipeng Gong <[email protected]>

On Broadwell GT3 we have 2 Video Command Streamers (VCS), but userspace has no control when using VCS1 or VCS2. This patch introduces a mechanism to avoid the default ping-pong mode and use one specific ring through execution flag.

v2: fix whitespace (Rodrigo)

---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 19 +++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp.c            |  3 +++
 include/uapi/drm/i915_drm.h                |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +17 -2
index e1ed85a..d9081ec 100644
@@ -1273,8 +1273,23 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        else if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) {
                if (HAS_BSD2(dev)) {
                        int ring_id;
-                       ring_id = gen8_dispatch_bsd_ring(dev, file);
-                       ring = &dev_priv->ring[ring_id];
+
+                       switch (args->flags & I915_EXEC_BSD_MASK) {
+                       case I915_EXEC_BSD_DEFAULT:
+                               ring_id = gen8_dispatch_bsd_ring(dev, file);
+                               ring = &dev_priv->ring[ring_id];
+                               break;
+                       case I915_EXEC_BSD_RING1:
+                               ring = &dev_priv->ring[VCS];
+                               break;
+                       case I915_EXEC_BSD_RING2:
+                               ring = &dev_priv->ring[VCS2];
+                               break;
+                       default:
+                               DRM_DEBUG("execbuf with unknown bsd ring: %d\n",
+                                         (int)(args->flags & I915_EXEC_BSD_MASK));
+                               return -EINVAL;
+                       }
                } else
                        ring = &dev_priv->ring[VCS];
        } else
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ceb528f..a8c9e47 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4807

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
@@ -4802,6 +4802,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
                if (HAS_PCH_SPLIT(dev)) {
                        if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
                                goto mst_fail;
+               if (!intel_dp->output_reg)
+                       goto mst_fail;
+

I think this shouldn't be here

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
                } else {
                        if (g4x_digital_port_connected(dev, intel_dig_port) != 1)
                                goto mst_fail;
include/uapi/drm/i915_drm.h +0 -0
index 2502622..fcb16bf 100644
@@ -737,7 +737,13 @@ struct drm_i915_gem_execbuffer2 {
  */

include/uapi/drm/i915_drm.h struct drm_i915_gem_execbuffer2 { · line 746

Quoted 10 lines
include/uapi/drm/i915_drm.h +7 -1
 #define I915_EXEC_HANDLE_LUT           (1<<12)
 
-#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_HANDLE_LUT<<1)
+/** Used for switching BSD rings on the platforms with two BSD rings */
+#define I915_EXEC_BSD_MASK             (3<<13)
+#define I915_EXEC_BSD_DEFAULT          (0<<13) /* default ping-pong mode */
+#define I915_EXEC_BSD_RING1            (1<<13)
+#define I915_EXEC_BSD_RING2            (2<<13)
+
+#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15)

This is inverted and using one bit more than needed. Should be -(14<<1) right?!

Quoted 10 lines
include/uapi/drm/i915_drm.h +0 -1
 #define I915_EXEC_CONTEXT_ID_MASK      (0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
--

1.9.3

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#4 lore raw

PATCH 3/8 drm/i915: add I915_PARAM_HAS_BSD2 to i915_getparam

In reply to Rodrigo Vivi

From: Zhipeng Gong <[email protected]>

This will let userland only try to use the new ring when the appropriate kernel is present

---
 drivers/gpu/drm/i915/i915_dma.c | 3 +++
 include/uapi/drm/i915_drm.h     | 1 +
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 5dc37f0..1c145ed 100644
@@ -979,6 +979,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_VEBOX:
 		value = intel_ring_initialized(&dev_priv->ring[VECS]);
 		break;
+	case I915_PARAM_HAS_BSD2:
+		value = intel_ring_initialized(&dev_priv->ring[VCS2]);
+		break;
 	case I915_PARAM_HAS_RELAXED_FENCING:
 		value = 1;
 		break;
include/uapi/drm/i915_drm.h +1 -0
index fcb16bf..fa99129 100644
@@ -341,6 +341,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_WT     	 	 27
 #define I915_PARAM_CMD_PARSER_VERSION	 28
 #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
+#define I915_PARAM_HAS_BSD2		 30
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/8
#5 lore raw

Re: [PATCH 3/8] drm/i915: add I915_PARAM_HAS_BSD2 to i915_getparam

Quoted 45 lines · Rodrigo Vivi

From: Zhipeng Gong <[email protected]>

This will let userland only try to use the new ring when the appropriate kernel is present

---
 drivers/gpu/drm/i915/i915_dma.c | 3 +++
 include/uapi/drm/i915_drm.h     | 1 +
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 5dc37f0..1c145ed 100644
@@ -979,6 +979,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
        case I915_PARAM_HAS_VEBOX:
                value = intel_ring_initialized(&dev_priv->ring[VECS]);
                break;
+       case I915_PARAM_HAS_BSD2:
+               value = intel_ring_initialized(&dev_priv->ring[VCS2]);
+               break;
        case I915_PARAM_HAS_RELAXED_FENCING:
                value = 1;
                break;
include/uapi/drm/i915_drm.h +1 -1
index fcb16bf..fa99129 100644
@@ -341,6 +341,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_WT               27
 #define I915_PARAM_CMD_PARSER_VERSION   28
 #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
+#define I915_PARAM_HAS_BSD2             30
 
 typedef struct drm_i915_getparam {
        int param;
--

1.9.3

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#6 lore raw

PATCH 4/8 drm/i915: Move the ban period onto the context

In reply to Rodrigo Vivi

From: Chris Wilson <[email protected]>

This will allow us to set per-file, or even per-context, periods in the future.

---
 drivers/gpu/drm/i915/i915_drv.h         | 5 +++++
 drivers/gpu/drm/i915/i915_gem.c         | 3 ++-
 drivers/gpu/drm/i915/i915_gem_context.c | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +5 -0
index 1219282..cddecaf 100644
@@ -622,6 +622,11 @@ struct i915_ctx_hang_stats {
 	/* Time when this context was last blamed for a GPU reset */
 	unsigned long guilty_ts;
 
+	/* If the contexts causes a second GPU hang within this time,
+	 * it is permanently banned from submitting any more work.
+	 */
+	unsigned long ban_period_seconds;
+
 	/* This context is banned to submit more work */
 	bool banned;
 };
drivers/gpu/drm/i915/i915_gem.c +2 -1
index 86cf428..2eb66a6 100644
@@ -2540,7 +2540,8 @@ static bool i915_context_is_banned(struct drm_i915_private *dev_priv,
 	if (ctx->hang_stats.banned)
 		return true;
 
-	if (elapsed <= DRM_I915_CTX_BAN_PERIOD) {
+	if (ctx->hang_stats.ban_period_seconds &&
+	    elapsed <= ctx->hang_stats.ban_period_seconds) {
 		if (!i915_gem_context_is_default(ctx)) {
 			DRM_DEBUG("context hanging too fast, banning!\n");
 			return true;
drivers/gpu/drm/i915/i915_gem_context.c +2 -0
index 7d32571..29150a4 100644
@@ -219,6 +219,8 @@ __create_hw_context(struct drm_device *dev,
 	 * is no remap info, it will be a NOP. */
 	ctx->remap_slice = (1 << NUM_L3_SLICES(dev)) - 1;
 
+	ctx->hang_stats.ban_period_seconds = DRM_I915_CTX_BAN_PERIOD;
+
 	return ctx;
 
 err_out:
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#7 lore raw

PATCH 5/8 drm/i915: Add ioctl to set per-context parameters

In reply to Rodrigo Vivi

From: Chris Wilson <[email protected]>

Sometimes we wish to tweak how an individual context behaves. Since we always create a context for every filp, this means that individual processes can fine tune their behaviour even if they do not explicitly create a context.

The first example parameter here is to enable multi-process GPU testing, but the interface should be able to cope with passing arbitrarily complex parameters.

---
 drivers/gpu/drm/i915/i915_dma.c         |  2 +
 drivers/gpu/drm/i915/i915_drv.h         |  4 ++
 drivers/gpu/drm/i915/i915_gem_context.c | 69 +++++++++++++++++++++++++++++++++
 include/uapi/drm/i915_drm.h             | 12 ++++++
 4 files changed, 87 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +2 -0
index 1c145ed..04a6f77 100644
@@ -2042,6 +2042,8 @@ const struct drm_ioctl_desc i915_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(I915_REG_READ, i915_reg_read_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_GET_RESET_STATS, i915_get_reset_stats_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
 };
 
 int i915_max_ioctl = ARRAY_SIZE(i915_ioctls);
drivers/gpu/drm/i915/i915_drv.h +4 -0
index cddecaf..6d99ddf 100644
@@ -2749,6 +2749,10 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 				  struct drm_file *file);
 int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
 				   struct drm_file *file);
+int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
+				    struct drm_file *file_priv);
+int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
+				    struct drm_file *file_priv);
 
 /* i915_gem_evict.c */
 int __must_check i915_gem_evict_something(struct drm_device *dev,
drivers/gpu/drm/i915/i915_gem_context.c +69 -0

72 lines not on this page · raw message

include/uapi/drm/i915_drm.h +12 -0
index fa99129..d253c85 100644
@@ -224,6 +224,8 @@ typedef struct _drm_i915_sarea {
 #define DRM_I915_REG_READ		0x31
 #define DRM_I915_GET_RESET_STATS	0x32
 #define DRM_I915_GEM_USERPTR		0x33
+#define DRM_I915_GEM_CONTEXT_GETPARAM	0x34
+#define DRM_I915_GEM_CONTEXT_SETPARAM	0x35
 
 #define DRM_IOCTL_I915_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
 #define DRM_IOCTL_I915_FLUSH		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -275,6 +277,8 @@ typedef struct _drm_i915_sarea {
 #define DRM_IOCTL_I915_REG_READ			DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
 #define DRM_IOCTL_I915_GET_RESET_STATS		DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
 #define DRM_IOCTL_I915_GEM_USERPTR			DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
+#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)
+#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param)
 
 /* Allow drivers to submit batchbuffers directly to hardware, relying
  * on the security mechanisms provided by hardware.
@@ -1080,4 +1084,12 @@ struct drm_i915_gem_userptr {
 	__u32 handle;
 };
 
+struct drm_i915_gem_context_param {
+	__u32 ctx_id;
+	__u32 size;
+	__u64 param;
+#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
+	__u64 value;
+};
+
 #endif /* _UAPI_I915_DRM_H_ */
Signature · 6 lines
1.9.3

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

PATCH 6/8 drm/i915: Put logical pipe_control emission into a helper.

In reply to Rodrigo Vivi

To be used for a Workaroud. Similar to:

commit 884ceacee308f0e4616d0c933518af2639f7b1d8

Author: Kenneth Graunke <[email protected]>
Date:   Sat Jun 28 02:04:20 2014 +0300

drm/i915: Refactor Broadwell PIPE_CONTROL emission into a helper.

---
 drivers/gpu/drm/i915/intel_lrc.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +21 -14
index 6025ac7..666c000 100644
@@ -1126,6 +1126,26 @@ static int gen8_emit_flush(struct intel_ringbuffer *ringbuf,
 	return 0;
 }
 
+static int gen8_emit_pipe_control(struct intel_ringbuffer *ringbuf,
+				  u32 flags, u32 scratch_addr)
+{
+	int ret;
+
+	ret = intel_logical_ring_begin(ringbuf, 6);
+	if (ret)
+		return ret;
+
+	intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
+	intel_logical_ring_emit(ringbuf, flags);
+	intel_logical_ring_emit(ringbuf, scratch_addr);
+	intel_logical_ring_emit(ringbuf, 0);
+	intel_logical_ring_emit(ringbuf, 0);
+	intel_logical_ring_emit(ringbuf, 0);
+	intel_logical_ring_advance(ringbuf);
+
+	return 0;
+}
+
 static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 				  u32 invalidate_domains,
 				  u32 flush_domains)
@@ -1133,7 +1153,6 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 	struct intel_engine_cs *ring = ringbuf->ring;
 	u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
 	u32 flags = 0;
-	int ret;
 
 	flags |= PIPE_CONTROL_CS_STALL;
 
@@ -1153,19 +1172,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 		flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
 	}
 
-	ret = intel_logical_ring_begin(ringbuf, 6);
-	if (ret)
-		return ret;
-
-	intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
-	intel_logical_ring_emit(ringbuf, flags);
-	intel_logical_ring_emit(ringbuf, scratch_addr);
-	intel_logical_ring_emit(ringbuf, 0);
-	intel_logical_ring_emit(ringbuf, 0);
-	intel_logical_ring_emit(ringbuf, 0);
-	intel_logical_ring_advance(ringbuf);
-
-	return 0;
+	return gen8_emit_pipe_control(ringbuf, flags, scratch_addr);
 }
 
 static u32 gen8_get_seqno(struct intel_engine_cs *ring, bool lazy_coherency)
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#9 lore raw

PATCH 7/8 drm/i915: Add WaCsStallBeforeStateCacheInvalidate:bdw, chv to logical ring

In reply to Rodrigo Vivi

Similar to:

commit 02c9f7e3cfe76a7f54ef03438c36aade86cc1c8b

Author: Kenneth Graunke <[email protected]>
Date:   Mon Jan 27 14:20:16 2014 -0800

drm/i915: Add the WaCsStallBeforeStateCacheInvalidate:bdw workaround.

On Broadwell, any PIPE_CONTROL with the "State Cache Invalidate" bit set must be preceded by a PIPE_CONTROL with the "CS Stall" bit set.

Documented on the BSpec 3D workarounds page.

---
 drivers/gpu/drm/i915/intel_lrc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +10 -0
index 666c000..54bf724 100644
@@ -1153,6 +1153,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 	struct intel_engine_cs *ring = ringbuf->ring;
 	u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
 	u32 flags = 0;
+	int ret;
 
 	flags |= PIPE_CONTROL_CS_STALL;
 
@@ -1170,6 +1171,15 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 		flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE;
 		flags |= PIPE_CONTROL_QW_WRITE;
 		flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
+
+
+		/* WaCsStallBeforeStateCacheInvalidate:bdw,chv */
+		ret = gen8_emit_pipe_control(ring,
+					     PIPE_CONTROL_CS_STALL |
+					     PIPE_CONTROL_STALL_AT_SCOREBOARD,
+					     0);
+		if (ret)
+			return ret;
 	}
 
 	return gen8_emit_pipe_control(ringbuf, flags, scratch_addr);
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#10 lore raw

PATCH 8/8 drm/i915: Wait thread status on gen8+ fw sequence

In reply to Rodrigo Vivi

From: Mika Kuoppala <[email protected]>

As per latest pm guide, we need to do this also on past hsw.

Cc Ville Syrjälä <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Damien Lespiau <[email protected]>
---
 drivers/gpu/drm/i915/intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -2
index 6a0c3fb..86a755a 100644
@@ -120,8 +120,7 @@ static void __gen7_gt_force_wake_mt_get(struct drm_i915_private *dev_priv,
 		DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
 
 	/* WaRsForcewakeWaitTC0:ivb,hsw */
-	if (INTEL_INFO(dev_priv->dev)->gen < 8)
-		__gen6_gt_wait_for_thread_c0(dev_priv);
+	__gen6_gt_wait_for_thread_c0(dev_priv);
 }
 
 static void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv)
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 8/8
#11 lore raw

Re: [PATCH 8/8] drm/i915: Wait thread status on gen8+ fw

-------------------------------------Summary-------------------------------------
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=247/348->275/348
PNV: pass/total=326/328->323/328
ILK: pass/total=329/330->329/330
IVB: pass/total=544/546->544/546
SNB: pass/total=556/561->556/561
HSW: pass/total=300/301->299/301
BDW: pass/total=435/435->433/435
-------------------------------------Detailed-------------------------------------
test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, machine_id...)...->result_with_patch_applied(count, machine_id)...
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-basic, INIT(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-capture-blt, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-capture-bsd, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-capture-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-debugfs-entry, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-sysfs-entry, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_bad_reloc_negative-reloc-lut, PASS(4, M31M29) -> NSPT(1, M29)PASS(3, M29)
BYT: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, FAIL(3, M29)PASS(1, M31) -> FAIL(1, M29)PASS(3, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_ban-ctx-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_ban-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-blt, INIT(1, M31)DMESG_WARN(7, M31M36M29)PASS(2, M31M36) -> DMESG_WARN(3, M29)PASS(1, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-bsd, INIT(1, M31)DMESG_WARN(5, M36M29)PASS(4, M31M29) -> DMESG_WARN(2, M29)PASS(2, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-ctx-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-blt, INIT(1, M31)DMESG_WARN(5, M31M36M29)PASS(4, M31M36M29) -> DMESG_WARN(2, M29)PASS(2, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-bsd, INIT(1, M31)DMESG_WARN(5, M31M36M29)PASS(4, M31M36M29) -> DMESG_WARN(2, M29)PASS(2, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-reverse-blt, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-reverse-bsd, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-reverse-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_params, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_params-ctx-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-blt, INIT(1, M31)DMESG_WARN(8, M31M36M29)PASS(1, M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-bsd, INIT(1, M31)DMESG_WARN(7, M31M36M29)PASS(2, M36) -> DMESG_WARN(3, M29)PASS(1, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-ctx-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-blt, INIT(1, M31)DMESG_WARN(3, M36M29)PASS(6, M31M36M29) -> DMESG_WARN(2, M29)PASS(2, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-bsd, INIT(1, M31)DMESG_WARN(4, M36M29)PASS(5, M31M36M29) -> DMESG_WARN(2, M29)PASS(2, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-ctx-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_gem_reset_stats_unrelated-ctx-render, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
BYT: Intel_gpu_tools, igt_drv_hangman_ring-stop-sysfs-entry, INIT(1, M31)PASS(9, M31M36M29) -> PASS(4, M29)
PNV: Intel_gpu_tools, igt_drv_hangman_error-state-basic, PASS(4, M25M23) -> DMESG_WARN(1, M23)PASS(3, M23)
PNV: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, FAIL(3, M23)PASS(1, M25) -> FAIL(1, M23)PASS(3, M23)
PNV: Intel_gpu_tools, igt_gem_linear_blits_normal, NSPT(6, M23M7)PASS(1, M25) -> NSPT(4, M23)
ILK: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, FAIL(3, M37)PASS(1, M26) -> FAIL(1, M37)PASS(3, M37)
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-modeset-interruptible, DMESG_WARN(1, M26)PASS(9, M37) -> PASS(4, M37)
IVB: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, FAIL(3, M21)PASS(1, M34) -> FAIL(1, M21)PASS(3, M21)
IVB: Intel_gpu_tools, igt_kms_plane_plane-position-covered-pipe-A-plane-1, TIMEOUT(1, M34)PASS(3, M21) -> PASS(4, M21)
SNB: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, FAIL(3, M35)PASS(1, M35) -> FAIL(1, M35)PASS(3, M35)
SNB: Intel_gpu_tools, igt_kms_cursor_crc_cursor-256x256-sliding, DMESG_WARN(1, M35)PASS(3, M35) -> PASS(4, M35)
HSW: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, PASS(1, M40) -> FAIL(1, M19)
BDW: Intel_gpu_tools, igt_gem_exec_params_invalid-flag, FAIL(3, M30)PASS(1, M42) -> FAIL(1, M30)PASS(3, M30)
BDW: Intel_gpu_tools, igt_gem_reset_stats_ban-bsd, PASS(10, M42M30M28) -> DMESG_WARN(1, M30)PASS(3, M30)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 8/8
#12 lore raw

Re: [PATCH 8/8] drm/i915: Wait thread status on gen8+ fw sequence

In reply to Rodrigo Vivi
Quoted 4 lines · Rodrigo Vivi

From: Mika Kuoppala <[email protected]>

As per latest pm guide, we need to do this also on past hsw.

Yep, matches the doc.

BTW I wonder why we also wait for the [18:16] bits to clear on HSW? I don't see such a thing documented in the HSW PM guide I have here. Maybe we can just drop the HSW special case?

Also I wonder if we want this on CHV too. I should probably know, but I dont't. I'll go bash some registers and see what they say...

Quoted 26 lines
Cc Ville Syrjälä <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Damien Lespiau <[email protected]>
---
 drivers/gpu/drm/i915/intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -2
index 6a0c3fb..86a755a 100644
@@ -120,8 +120,7 @@ static void __gen7_gt_force_wake_mt_get(struct drm_i915_private *dev_priv,
 		DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
 
 	/* WaRsForcewakeWaitTC0:ivb,hsw */
-	if (INTEL_INFO(dev_priv->dev)->gen < 8)
-		__gen6_gt_wait_for_thread_c0(dev_priv);
+	__gen6_gt_wait_for_thread_c0(dev_priv);
 }
 
 static void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv)
Signature · 1 line
1.9.3
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

Re: [PATCH 8/8] drm/i915: Wait thread status on gen8+ fw sequence

Quoted 8 lines · Ville Syrjälä
Quoted 4 lines · Rodrigo Vivi

From: Mika Kuoppala <[email protected]>

As per latest pm guide, we need to do this also on past hsw.

Yep, matches the doc.

Quoted 8 lines

BTW I wonder why we also wait for the [18:16] bits to clear on HSW? I don't see such a thing documented in the HSW PM guide I have here. Maybe we can just drop the HSW special case?

Also I wonder if we want this on CHV too. I should probably know, but I dont't. I'll go bash some registers and see what they say...

So the register doesn't seem to exist on CHV. All I get is 0x0, no matter if the GT is idle or busy. rc6 residency keeps ticking along at a constant rate so it seems to be in rc6 when I tried this.

# ./intel_reg_read 0x13805c
0x13805C : 0x0
# IGT_NO_FORCEWAKE=1 ./intel_reg_read 0x13805c
0x13805C : 0x0

On IVB it clearly works:

# ./intel_reg_read 0x13805c
0x13805C : 0x40000000
# IGT_NO_FORCEWAKE=1 ./intel_reg_read 0x13805c
0x13805C : 0x30303

I think someone needs to try this on VLV too...

Quoted 35 lines
Quoted 27 lines
Cc Ville Syrjälä <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Damien Lespiau <[email protected]>
---
 drivers/gpu/drm/i915/intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -2
index 6a0c3fb..86a755a 100644
@@ -120,8 +120,7 @@ static void __gen7_gt_force_wake_mt_get(struct drm_i915_private *dev_priv,
 		DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
 
 	/* WaRsForcewakeWaitTC0:ivb,hsw */
-	if (INTEL_INFO(dev_priv->dev)->gen < 8)
-		__gen6_gt_wait_for_thread_c0(dev_priv);
+	__gen6_gt_wait_for_thread_c0(dev_priv);
 }
 
 static void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv)
Signature · 1 line
1.9.3
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH 8/8] drm/i915: Wait thread status on gen8+ fw sequence

In reply to Ville Syrjälä
Quoted 9 lines · Ville Syrjälä
Quoted 4 lines · Rodrigo Vivi

From: Mika Kuoppala <[email protected]>

As per latest pm guide, we need to do this also on past hsw.

Yep, matches the doc.

Queued for -next, thanks for the patch.

Quoted 4 lines

BTW I wonder why we also wait for the [18:16] bits to clear on HSW? I don't see such a thing documented in the HSW PM guide I have here. Maybe we can just drop the HSW special case?

Iirc (commit message is silent unfortunately) this is for the GT3. And since they're 0 on other hsw we've opted for a tricky silent gt3 enabling by claiming this is for all of hsw. At least that's the story I remember.

No idea whether bdw gt3 would need this, too. Might be good to double-check.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [PATCH 8/8] drm/i915: Wait thread status on gen8+ fw sequence

Quoted 17 lines · Daniel Vetter
Quoted 9 lines · Ville Syrjälä
Quoted 4 lines · Rodrigo Vivi

From: Mika Kuoppala <[email protected]>

As per latest pm guide, we need to do this also on past hsw.

Yep, matches the doc.

Queued for -next, thanks for the patch.

Quoted 4 lines

BTW I wonder why we also wait for the [18:16] bits to clear on HSW? I don't see such a thing documented in the HSW PM guide I have here. Maybe we can just drop the HSW special case?

Quoted 6 lines

Iirc (commit message is silent unfortunately) this is for the GT3. And since they're 0 on other hsw we've opted for a tricky silent gt3 enabling by claiming this is for all of hsw. At least that's the story I remember.

No idea whether bdw gt3 would need this, too. Might be good to double-check.

The docs claim these are the same old thread wish result bits ever since snb.

I just tried intel_reg_read on hsw gt2 and gt3 and both give identical results to ivb. So my hunch is that we can just drop the hsw special case.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx