From: John.C.Harrison@Intel.com
To: Intel-GFX@lists.freedesktop.org
Subject: [RFC 05/44] drm/i915: Updating assorted register and status page definitions
Date: Thu, 26 Jun 2014 18:23:56 +0100 [thread overview]
Message-ID: <1403803475-16337-6-git-send-email-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <1403803475-16337-1-git-send-email-John.C.Harrison@Intel.com>
From: John Harrison <John.C.Harrison@Intel.com>
Added various definitions that will be useful for the scheduler in general and
pre-emptive context switching in particular.
---
drivers/gpu/drm/i915/i915_drv.h | 5 ++-
drivers/gpu/drm/i915/i915_reg.h | 30 ++++++++++++++-
drivers/gpu/drm/i915/intel_ringbuffer.h | 61 ++++++++++++++++++++++++++++++-
3 files changed, 92 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e3295cb..53f6fe5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -584,7 +584,10 @@ struct i915_ctx_hang_stats {
};
/* This must match up with the value previously used for execbuf2.rsvd1. */
-#define DEFAULT_CONTEXT_ID 0
+#define DEFAULT_CONTEXT_ID 0
+/* This must not match any user context */
+#define PREEMPTION_CONTEXT_ID (-1)
+
struct intel_context {
struct kref ref;
int id;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 242df99..cfc918d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -205,6 +205,10 @@
#define MI_GLOBAL_GTT (1<<22)
#define MI_NOOP MI_INSTR(0, 0)
+#define MI_NOOP_WRITE_ID (1<<22)
+#define MI_NOOP_ID_MASK ((1<<22) - 1)
+#define MI_NOOP_MID(id) ((id) & MI_NOOP_ID_MASK)
+#define MI_NOOP_WITH_ID(id) MI_INSTR(0, MI_NOOP_WRITE_ID|MI_NOOP_MID(id))
#define MI_USER_INTERRUPT MI_INSTR(0x02, 0)
#define MI_WAIT_FOR_EVENT MI_INSTR(0x03, 0)
#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
@@ -222,6 +226,7 @@
#define MI_ARB_ON_OFF MI_INSTR(0x08, 0)
#define MI_ARB_ENABLE (1<<0)
#define MI_ARB_DISABLE (0<<0)
+#define MI_ARB_CHECK MI_INSTR(0x05, 0)
#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)
#define MI_SUSPEND_FLUSH MI_INSTR(0x0b, 0)
#define MI_SUSPEND_FLUSH_EN (1<<0)
@@ -260,6 +265,8 @@
#define MI_SEMAPHORE_SYNC_INVALID (3<<16)
#define MI_SEMAPHORE_SYNC_MASK (3<<16)
#define MI_SET_CONTEXT MI_INSTR(0x18, 0)
+#define MI_CONTEXT_ADDR_MASK ((~0)<<12)
+#define MI_SET_CONTEXT_FLAG_MASK ((1<<12)-1)
#define MI_MM_SPACE_GTT (1<<8)
#define MI_MM_SPACE_PHYSICAL (0<<8)
#define MI_SAVE_EXT_STATE_EN (1<<3)
@@ -270,6 +277,10 @@
#define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */
#define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
#define MI_STORE_DWORD_INDEX_SHIFT 2
+#define MI_STORE_REG_MEM MI_INSTR(0x24, 1)
+#define MI_STORE_REG_MEM_GTT (1 << 22)
+#define MI_STORE_REG_MEM_PREDICATE (1 << 21)
+
/* Official intel docs are somewhat sloppy concerning MI_LOAD_REGISTER_IMM:
* - Always issue a MI_NOOP _before_ the MI_LOAD_REGISTER_IMM - otherwise hw
* simply ignores the register load under certain conditions.
@@ -283,7 +294,10 @@
#define MI_FLUSH_DW MI_INSTR(0x26, 1) /* for GEN6 */
#define MI_FLUSH_DW_STORE_INDEX (1<<21)
#define MI_INVALIDATE_TLB (1<<18)
+#define MI_FLUSH_DW_OP_NONE (0<<14)
#define MI_FLUSH_DW_OP_STOREDW (1<<14)
+#define MI_FLUSH_DW_OP_RSVD (2<<14)
+#define MI_FLUSH_DW_OP_STAMP (3<<14)
#define MI_FLUSH_DW_OP_MASK (3<<14)
#define MI_FLUSH_DW_NOTIFY (1<<8)
#define MI_INVALIDATE_BSD (1<<7)
@@ -1005,6 +1019,19 @@ enum punit_power_well {
#define GEN6_VERSYNC (RING_SYNC_1(VEBOX_RING_BASE))
#define GEN6_VEVSYNC (RING_SYNC_2(VEBOX_RING_BASE))
#define GEN6_NOSYNC 0
+
+/*
+ * Premption-related registers
+ */
+#define RING_UHPTR(base) ((base)+0x134)
+#define UHPTR_GFX_ADDR_ALIGN (0x7)
+#define UHPTR_VALID (0x1)
+#define RING_PREEMPT_ADDR 0x0214c
+#define PREEMPT_BATCH_LEVEL_MASK (0x3)
+#define BB_PREEMPT_ADDR 0x02148
+#define SBB_PREEMPT_ADDR 0x0213c
+#define RS_PREEMPT_STATUS 0x0215c
+
#define RING_MAX_IDLE(base) ((base)+0x54)
#define RING_HWS_PGA(base) ((base)+0x80)
#define RING_HWS_PGA_GEN6(base) ((base)+0x2080)
@@ -5383,7 +5410,8 @@ enum punit_power_well {
#define VLV_SPAREG2H 0xA194
#define GTFIFODBG 0x120000
-#define GT_FIFO_SBDROPERR (1<<6)
+#define GT_FIFO_CPU_ERROR_MASK 0xf
+#define GT_FIFO_SDDROPERR (1<<6)
#define GT_FIFO_BLOBDROPERR (1<<5)
#define GT_FIFO_SB_READ_ABORTERR (1<<4)
#define GT_FIFO_DROPERR (1<<3)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 910c83c..30841ea 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -40,6 +40,12 @@ struct intel_hw_status_page {
#define I915_READ_MODE(ring) I915_READ(RING_MI_MODE((ring)->mmio_base))
#define I915_WRITE_MODE(ring, val) I915_WRITE(RING_MI_MODE((ring)->mmio_base), val)
+#define I915_READ_UHPTR(ring) \
+ I915_READ(RING_UHPTR((ring)->mmio_base))
+#define I915_WRITE_UHPTR(ring, val) \
+ I915_WRITE(RING_UHPTR((ring)->mmio_base), val)
+#define I915_READ_NOPID(ring) I915_READ(RING_NOPID((ring)->mmio_base))
+
enum intel_ring_hangcheck_action {
HANGCHECK_IDLE = 0,
HANGCHECK_WAIT,
@@ -280,10 +286,61 @@ intel_write_status_page(struct intel_engine_cs *ring,
* 0x1f: Last written status offset. (GM45)
*
* The area from dword 0x20 to 0x3ff is available for driver usage.
+ *
+ * Note: in general the allocation of these indices is arbitrary, as long
+ * as they're all unique. But a few of them are used with instructions that
+ * have specific alignment requirements, those particular indices must be
+ * chosen carefully to meet those requirements. The list below shows the
+ * currently-known alignment requirements:
+ *
+ * I915_GEM_SCRATCH_INDEX must be EVEN
*/
#define I915_GEM_HWS_INDEX 0x20
-#define I915_GEM_HWS_SCRATCH_INDEX 0x30
-#define I915_GEM_HWS_SCRATCH_ADDR (I915_GEM_HWS_SCRATCH_INDEX << MI_STORE_DWORD_INDEX_SHIFT)
+#define I915_GEM_ACTIVE_SEQNO_INDEX 0x21 /* Executing seqno for TDR only */
+#define I915_GEM_PGFLIP_INDEX 0x22
+#define I915_GEM_BREADCRUMB_INDEX 0x23
+
+#define I915_GEM_HWS_SCRATCH_INDEX 0x24 /* QWord */
+#define I915_GEM_HWS_SCRATCH_ADDR (I915_GEM_HWS_SCRATCH_INDEX << MI_STORE_DWORD_INDEX_SHIFT)
+
+/*
+ * Software (CPU) tracking of batch start/end addresses in the ring
+ */
+#define I915_GEM_BATCH_START_ADDR 0x2e /* Start of batch in ring */
+#define I915_GEM_BATCH_END_ADDR 0x2f /* End of batch in ring */
+
+/*
+ * Tracking; these are updated by the GPU at the beginning and/or end of every batch
+ */
+#define I915_BATCH_DONE_SEQNO 0x30 /* Last completed batch seqno */
+#define I915_BATCH_ACTIVE_SEQNO 0x31 /* Seqno of batch in progress */
+#define I915_BATCH_ACTIVE_ADDR 0x32 /* Addr of batch cmds in ring */
+#define I915_BATCH_ACTIVE_END 0x33 /* End of batch cmds in ring */
+
+/*
+ * Tracking; these are updated by the GPU at the beginning and/or end of a preemptive batch
+ */
+#define I915_PREEMPTIVE_DONE_SEQNO 0x34 /* Last completed preemptive batch seqno */
+#define I915_PREEMPTIVE_ACTIVE_SEQNO 0x35 /* Seqno of preemptive batch in progress */
+#define I915_PREEMPTIVE_ACTIVE_ADDR 0x36 /* Addr of preemptive batch cmds in ring */
+#define I915_PREEMPTIVE_ACTIVE_END 0x37 /* End of preemptive batch cmds in ring */
+
+/*
+ * Preemption; these are used by the GPU to save important registers
+ */
+#define I915_SAVE_PREEMPTED_RING_PTR 0x38 /* HEAD before preemption */
+#define I915_SAVE_PREEMPTED_BB_PTR 0x39 /* BB ptr before preemption */
+#define I915_SAVE_PREEMPTED_SBB_PTR 0x3a /* SBB before preemption */
+#define I915_SAVE_PREEMPTED_UHPTR 0x3b /* UHPTR after preemption */
+#define I915_SAVE_PREEMPTED_HEAD 0x3c /* HEAD after preemption */
+#define I915_SAVE_PREEMPTED_TAIL 0x3d /* TAIL after preemption */
+#define I915_SAVE_PREEMPTED_STATUS 0x3e /* RS preemption status */
+#define I915_SAVE_PREEMPTED_NOPID 0x3f /* Dummy */
+
+/* Range of DWORDs to snapshot in the interrupt handler */
+#define I915_IRQ_SNAP_START I915_GEM_HWS_INDEX
+#define I915_IRQ_SNAP_SPLIT (I915_SAVE_PREEMPTED_NOPID/4*4+4)
+#define I915_IRQ_SNAP_END ((I915_SAVE_PREEMPTED_NOPID+128)/4*4+4)
void intel_stop_ring_buffer(struct intel_engine_cs *ring);
void intel_cleanup_ring_buffer(struct intel_engine_cs *ring);
--
1.7.9.5
next prev parent reply other threads:[~2014-06-26 17:25 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 17:23 [RFC 00/44] GPU scheduler for i915 driver John.C.Harrison
2014-06-26 17:23 ` [RFC 01/44] drm/i915: Corrected 'file_priv' to 'file' in 'i915_driver_preclose()' John.C.Harrison
2014-06-30 21:03 ` Jesse Barnes
2014-07-07 18:02 ` Daniel Vetter
2014-06-26 17:23 ` [RFC 02/44] drm/i915: Added getparam for native sync John.C.Harrison
2014-07-07 18:52 ` Daniel Vetter
2014-06-26 17:23 ` [RFC 03/44] drm/i915: Add extra add_request calls John.C.Harrison
2014-06-30 21:10 ` Jesse Barnes
2014-07-07 18:41 ` Daniel Vetter
2014-07-08 7:44 ` Chris Wilson
2014-06-26 17:23 ` [RFC 04/44] drm/i915: Fix null pointer dereference in error capture John.C.Harrison
2014-06-30 21:40 ` Jesse Barnes
2014-07-01 7:12 ` Chris Wilson
2014-07-07 18:49 ` Daniel Vetter
2014-07-01 7:20 ` [PATCH] drm/i915: Remove num_pages parameter to i915_error_object_create() Chris Wilson
2014-06-26 17:23 ` John.C.Harrison [this message]
2014-07-02 17:49 ` [RFC 05/44] drm/i915: Updating assorted register and status page definitions Jesse Barnes
2014-06-26 17:23 ` [RFC 06/44] drm/i915: Fixes for FIFO space queries John.C.Harrison
2014-07-02 17:50 ` Jesse Barnes
2014-06-26 17:23 ` [RFC 07/44] drm/i915: Disable 'get seqno' workaround for VLV John.C.Harrison
2014-07-02 17:51 ` Jesse Barnes
2014-07-07 18:56 ` Daniel Vetter
2014-06-26 17:23 ` [RFC 08/44] drm/i915: Added GPU scheduler config option John.C.Harrison
2014-07-07 18:58 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 09/44] drm/i915: Start of GPU scheduler John.C.Harrison
2014-07-02 17:55 ` Jesse Barnes
2014-07-07 19:02 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 10/44] drm/i915: Prepare retire_requests to handle out-of-order seqnos John.C.Harrison
2014-07-02 18:11 ` Jesse Barnes
2014-07-07 19:05 ` Daniel Vetter
2014-07-09 14:08 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 11/44] drm/i915: Added scheduler hook into i915_seqno_passed() John.C.Harrison
2014-07-02 18:14 ` Jesse Barnes
2014-06-26 17:24 ` [RFC 12/44] drm/i915: Disable hardware semaphores when GPU scheduler is enabled John.C.Harrison
2014-07-02 18:16 ` Jesse Barnes
2014-06-26 17:24 ` [RFC 13/44] drm/i915: Added scheduler hook when closing DRM file handles John.C.Harrison
2014-07-02 18:20 ` Jesse Barnes
2014-07-23 15:10 ` John Harrison
2014-07-23 15:39 ` Jesse Barnes
2014-06-26 17:24 ` [RFC 14/44] drm/i915: Added getparam for GPU scheduler John.C.Harrison
2014-07-02 18:21 ` Jesse Barnes
2014-07-07 19:11 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 15/44] drm/i915: Added deferred work handler for scheduler John.C.Harrison
2014-07-07 19:14 ` Daniel Vetter
2014-07-23 15:37 ` John Harrison
2014-07-23 18:50 ` Daniel Vetter
2014-07-24 15:42 ` John Harrison
2014-07-25 7:18 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 16/44] drm/i915: Alloc early seqno John.C.Harrison
2014-07-02 18:29 ` Jesse Barnes
2014-07-23 15:11 ` John Harrison
2014-06-26 17:24 ` [RFC 17/44] drm/i915: Prelude to splitting i915_gem_do_execbuffer in two John.C.Harrison
2014-07-02 18:34 ` Jesse Barnes
2014-07-07 19:21 ` Daniel Vetter
2014-07-23 16:33 ` John Harrison
2014-07-23 18:14 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 18/44] drm/i915: Added scheduler debug macro John.C.Harrison
2014-07-02 18:37 ` Jesse Barnes
2014-07-07 19:23 ` Daniel Vetter
2014-06-26 17:24 ` [RFC 19/44] drm/i915: Split i915_dem_do_execbuffer() in half John.C.Harrison
2014-06-26 17:24 ` [RFC 20/44] drm/i915: Redirect execbuffer_final() via scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 21/44] drm/i915: Added tracking/locking of batch buffer objects John.C.Harrison
2014-06-26 17:24 ` [RFC 22/44] drm/i915: Ensure OLS & PLR are always in sync John.C.Harrison
2014-06-26 17:24 ` [RFC 23/44] drm/i915: Added manipulation of OLS/PLR John.C.Harrison
2014-06-26 17:24 ` [RFC 24/44] drm/i915: Added scheduler interrupt handler hook John.C.Harrison
2014-06-26 17:24 ` [RFC 25/44] drm/i915: Added hook to catch 'unexpected' ring submissions John.C.Harrison
2014-06-26 17:24 ` [RFC 26/44] drm/i915: Added scheduler support to __wait_seqno() calls John.C.Harrison
2014-06-26 17:24 ` [RFC 27/44] drm/i915: Added scheduler support to page fault handler John.C.Harrison
2014-06-26 17:24 ` [RFC 28/44] drm/i915: Added scheduler flush calls to ring throttle and idle functions John.C.Harrison
2014-06-26 17:24 ` [RFC 29/44] drm/i915: Hook scheduler into intel_ring_idle() John.C.Harrison
2014-06-26 17:24 ` [RFC 30/44] drm/i915: Added a module parameter for allowing scheduler overrides John.C.Harrison
2014-06-26 17:24 ` [RFC 31/44] drm/i915: Implemented the GPU scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 32/44] drm/i915: Added immediate submission override to scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 33/44] drm/i915: Added trace points " John.C.Harrison
2014-06-26 17:24 ` [RFC 34/44] drm/i915: Added scheduler queue throttling by DRM file handle John.C.Harrison
2014-06-26 17:24 ` [RFC 35/44] drm/i915: Added debugfs interface to scheduler tuning parameters John.C.Harrison
2014-06-26 17:24 ` [RFC 36/44] drm/i915: Added debug state dump facilities to scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 37/44] drm/i915: Added facility for cancelling an outstanding request John.C.Harrison
2014-06-26 17:24 ` [RFC 38/44] drm/i915: Add early exit to execbuff_final() if insufficient ring space John.C.Harrison
2014-06-26 17:24 ` [RFC 39/44] drm/i915: Added support for pre-emptive scheduling John.C.Harrison
2014-06-26 17:24 ` [RFC 40/44] drm/i915: REVERTME Hack to allow IGT to test pre-emption John.C.Harrison
2014-06-26 17:24 ` [RFC 41/44] drm/i915: Added validation callback to trace points John.C.Harrison
2014-06-26 17:24 ` [RFC 42/44] drm/i915: Added scheduler statistic reporting to debugfs John.C.Harrison
2014-06-26 17:24 ` [RFC 43/44] drm/i915: Added support for submitting out-of-batch ring commands John.C.Harrison
2014-06-26 17:24 ` [RFC 44/44] drm/i915: Fake batch support for page flips John.C.Harrison
2014-07-07 19:25 ` Daniel Vetter
2014-06-26 20:44 ` [RFC 00/44] GPU scheduler for i915 driver Dave Airlie
2014-07-07 15:57 ` Daniel Vetter
2014-10-10 10:35 ` Steven Newbury
2014-10-20 10:31 ` John Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403803475-16337-6-git-send-email-John.C.Harrison@Intel.com \
--to=john.c.harrison@intel.com \
--cc=Intel-GFX@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox