aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-lts
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2020-01-20 10:32:16 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2020-01-20 11:44:17 +0000
commit3f3e223c0b11885671d570a90fd820619e894945 (patch)
treeec6f5a47d2ce4d3c5576256f9c521a50b8b81d4e /main/linux-lts
parent87ce4b3cafafed5b4364803183cbf07e231e3fed (diff)
downloadaports-3f3e223c0b11885671d570a90fd820619e894945.tar.bz2
aports-3f3e223c0b11885671d570a90fd820619e894945.tar.xz
main/linux-lts: backport patch for i915 gpu
ref #11026 upstream bug: https://gitlab.freedesktop.org/drm/intel/issues/674
Diffstat (limited to 'main/linux-lts')
-rw-r--r--main/linux-lts/0001-drm-i915-gt-Detect-if-we-miss-WaIdleLiteRestore.patch138
-rw-r--r--main/linux-lts/APKBUILD2
2 files changed, 140 insertions, 0 deletions
diff --git a/main/linux-lts/0001-drm-i915-gt-Detect-if-we-miss-WaIdleLiteRestore.patch b/main/linux-lts/0001-drm-i915-gt-Detect-if-we-miss-WaIdleLiteRestore.patch
new file mode 100644
index 0000000000..c95fc026a5
--- /dev/null
+++ b/main/linux-lts/0001-drm-i915-gt-Detect-if-we-miss-WaIdleLiteRestore.patch
@@ -0,0 +1,138 @@
+From 3d91696e92a354b7e23402ad9f38329f8853dde7 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Mon, 9 Dec 2019 02:32:15 +0000
+Subject: [PATCH] drm/i915/gt: Detect if we miss WaIdleLiteRestore
+
+In order to avoid confusing the HW, we must never submit an empty ring
+during lite-restore, that is we should always advance the RING_TAIL
+before submitting to stay ahead of the RING_HEAD.
+
+Normally this is prevented by keeping a couple of spare NOPs in the
+request->wa_tail so that on resubmission we can advance the tail. This
+relies on the request only being resubmitted once, which is the normal
+condition as it is seen once for ELSP[1] and then later in ELSP[0]. On
+preemption, the requests are unwound and the tail reset back to the
+normal end point (as we know the request is incomplete and therefore its
+RING_HEAD is even earlier).
+
+However, if this w/a should fail we would try and resubmit the request
+with the RING_TAIL already set to the location of this request's wa_tail
+potentially causing a GPU hang. We can spot when we do try and
+incorrectly resubmit without advancing the RING_TAIL and spare any
+embarrassment by forcing the context restore.
+
+In the case of preempt-to-busy, we leave the requests running on the HW
+while we unwind. As the ring is still live, we cannot rewind our
+rq->tail without forcing a reload so leave it set to rq->wa_tail and
+only force a reload if we resubmit after a lite-restore. (Normally, the
+forced reload will be a part of the preemption event.)
+
+Fixes: 22b7a426bbe1 ("drm/i915/execlists: Preempt-to-busy")
+Closes: https://gitlab.freedesktop.org/drm/intel/issues/673
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
+Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+Cc: stable@kernel.vger.org
+Link: https://patchwork.freedesktop.org/patch/msgid/20191209023215.3519970-1-chris@chris-wilson.co.uk
+(cherry picked from commit 82c69bf58650e644c61aa2bf5100b63a1070fd2f)
+Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+(cherry picked from commit f26a9e959a7b1588c59f7a919b41b67175b211d8)
+---
+ drivers/gpu/drm/i915/gt/intel_lrc.c | 44 +++++++++++++----------------
+ 1 file changed, 20 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
+index 4949b5ad860f..3ceaa4d70c5b 100644
+--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
++++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
+@@ -471,12 +471,6 @@ lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
+ return desc;
+ }
+
+-static void unwind_wa_tail(struct i915_request *rq)
+-{
+- rq->tail = intel_ring_wrap(rq->ring, rq->wa_tail - WA_TAIL_BYTES);
+- assert_ring_tail_valid(rq->ring, rq->tail);
+-}
+-
+ static struct i915_request *
+ __unwind_incomplete_requests(struct intel_engine_cs *engine)
+ {
+@@ -490,12 +484,10 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
+ &engine->active.requests,
+ sched.link) {
+ struct intel_engine_cs *owner;
+-
+ if (i915_request_completed(rq))
+ continue; /* XXX */
+
+ __i915_request_unsubmit(rq);
+- unwind_wa_tail(rq);
+
+ /*
+ * Push the request back into the queue for later resubmission.
+@@ -650,13 +642,29 @@ execlists_schedule_out(struct i915_request *rq)
+ i915_request_put(rq);
+ }
+
+-static u64 execlists_update_context(const struct i915_request *rq)
++static u64 execlists_update_context(struct i915_request *rq)
+ {
+ struct intel_context *ce = rq->hw_context;
+- u64 desc;
++ u64 desc = ce->lrc_desc;
++ u32 tail;
+
+- ce->lrc_reg_state[CTX_RING_TAIL + 1] =
+- intel_ring_set_tail(rq->ring, rq->tail);
++ /*
++ * WaIdleLiteRestore:bdw,skl
++ *
++ * We should never submit the context with the same RING_TAIL twice
++ * just in case we submit an empty ring, which confuses the HW.
++ *
++ * We append a couple of NOOPs (gen8_emit_wa_tail) after the end of
++ * the normal request to be able to always advance the RING_TAIL on
++ * subsequent resubmissions (for lite restore). Should that fail us,
++ * and we try and submit the same tail again, force the context
++ * reload.
++ */
++ tail = intel_ring_set_tail(rq->ring, rq->tail);
++ if (unlikely(ce->lrc_reg_state[CTX_RING_TAIL + 1] == tail))
++ desc |= CTX_DESC_FORCE_RESTORE;
++ ce->lrc_reg_state[CTX_RING_TAIL + 1] = tail;
++ rq->tail = rq->wa_tail;
+
+ /*
+ * Make sure the context image is complete before we submit it to HW.
+@@ -675,9 +683,7 @@ static u64 execlists_update_context(const struct i915_request *rq)
+ */
+ mb();
+
+- desc = ce->lrc_desc;
+ ce->lrc_desc &= ~CTX_DESC_FORCE_RESTORE;
+-
+ return desc;
+ }
+
+@@ -1150,16 +1156,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
+ if (!list_is_last(&last->sched.link,
+ &engine->active.requests))
+ return;
+-
+- /*
+- * WaIdleLiteRestore:bdw,skl
+- * Apply the wa NOOPs to prevent
+- * ring:HEAD == rq:TAIL as we resubmit the
+- * request. See gen8_emit_fini_breadcrumb() for
+- * where we prepare the padding after the
+- * end of the request.
+- */
+- last->tail = last->wa_tail;
+ }
+ }
+
+--
+2.25.0
+
diff --git a/main/linux-lts/APKBUILD b/main/linux-lts/APKBUILD
index 144b3d5598..a534a360fd 100644
--- a/main/linux-lts/APKBUILD
+++ b/main/linux-lts/APKBUILD
@@ -18,6 +18,7 @@ options="!strip"
_config=${config:-config-lts.${CARCH}}
install=
source="https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
+ 0001-drm-i915-gt-Detect-if-we-miss-WaIdleLiteRestore.patch
config-lts.aarch64
config-lts.armv7
config-lts.x86
@@ -220,6 +221,7 @@ _dev() {
}
sha512sums="9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f linux-5.4.tar.xz
+dc0acb47b68c60bede649524fd7429b888df2e1aa16a93f445700d1ffacada8b870a4a75d6aeb33d0e2f2c427efbc80e24a3670c5c539e0fca5b754e7f2a4df3 0001-drm-i915-gt-Detect-if-we-miss-WaIdleLiteRestore.patch
ea4eb2086b0e0e0d8a4fd6bd6ef6a2d752990f4cbf21a2d571eeae0b419b61abed8c91a1d353ebc98d4963845e2b8ee2df6e5c28859f6b3a604a39dfe7fc1125 config-lts.aarch64
0235e5af7d73f89dc66f97f1808744c52ded83d6281e455d08e1edfae02ca067715accf14f6cc8890b87941abcbad5a7cfd6025f427af694b52bb6d8420d89cf config-lts.armv7
fbb89cbafd267caecdfd641eb19eff0d636141bea072c420bd020121dacf0b2942787cee4ed2d01978947d15da9642303a0942715aa1973322cb3e154013b06b config-lts.x86