From: Greg Kroah-Hartman Date: Wed, 13 Feb 2019 15:02:38 +0000 (+0100) Subject: 4.20-stable patches X-Git-Tag: v4.9.157~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06b14078bd9febc66124288f71fde0fd48d3795e;p=thirdparty%2Fkernel%2Fstable-queue.git 4.20-stable patches added patches: drm-i915-try-to-sanitize-bogus-dpll-state-left-over-by-broken-snb-biosen.patch xfrm-make-set-mark-default-behavior-backward-compatible.patch --- diff --git a/queue-4.20/drm-i915-try-to-sanitize-bogus-dpll-state-left-over-by-broken-snb-biosen.patch b/queue-4.20/drm-i915-try-to-sanitize-bogus-dpll-state-left-over-by-broken-snb-biosen.patch new file mode 100644 index 00000000000..a0574a07ee8 --- /dev/null +++ b/queue-4.20/drm-i915-try-to-sanitize-bogus-dpll-state-left-over-by-broken-snb-biosen.patch @@ -0,0 +1,134 @@ +From d028a646e84b9b131e4ff2cb5bbdd3825d141028 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Tue, 5 Feb 2019 16:18:46 +0200 +Subject: drm/i915: Try to sanitize bogus DPLL state left over by broken SNB BIOSen +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit d028a646e84b9b131e4ff2cb5bbdd3825d141028 upstream. + +Certain SNB machines (eg. ASUS K53SV) seem to have a broken BIOS +which misprograms the hardware badly when encountering a suitably +high resolution display. The programmed pipe timings are somewhat +bonkers and the DPLL is totally misprogrammed (P divider == 0). +That will result in atomic commit timeouts as apparently the pipe +is sufficiently stuck to not signal vblank interrupts. + +IIRC something like this was also observed on some other SNB +machine years ago (might have been a Dell XPS 8300) but a BIOS +update cured it. Sadly looks like this was never fixed for the +ASUS K53SV as the latest BIOS (K53SV.320 11/11/2011) is still +broken. + +The quickest way to deal with this seems to be to shut down +the pipe+ports+DPLL. Unfortunately doing this during the +normal sanitization phase isn't quite soon enough as we +already spew several WARNs about the bogus hardware state. +But it's better than hanging the boot for a few dozen seconds. +Since this is limited to a few old machines it doesn't seem +entirely worthwile to try and rework the readout+sanitization +code to handle it more gracefully. + +v2: Fix potential NULL deref (kbuild test robot) + Constify has_bogus_dpll_config() + +Cc: stable@vger.kernel.org # v4.20+ +Cc: Daniel Kamil Kozar +Reported-by: Daniel Kamil Kozar +Tested-by: Daniel Kamil Kozar +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109245 +Fixes: 516a49cc1946 ("drm/i915: Fix assert_plane() warning on bootup with external display") +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20190111174950.10681-1-ville.syrjala@linux.intel.com +Reviewed-by: Mika Kahola +(cherry picked from commit 7bed8adcd9f86231bb69bbc02f88ad89330f99e3) +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20190205141846.6053-1-ville.syrjala@linux.intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++++++++----- + 1 file changed, 45 insertions(+), 6 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -15684,15 +15684,44 @@ static void intel_sanitize_crtc(struct i + } + } + ++static bool has_bogus_dpll_config(const struct intel_crtc_state *crtc_state) ++{ ++ struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); ++ ++ /* ++ * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram ++ * the hardware when a high res displays plugged in. DPLL P ++ * divider is zero, and the pipe timings are bonkers. We'll ++ * try to disable everything in that case. ++ * ++ * FIXME would be nice to be able to sanitize this state ++ * without several WARNs, but for now let's take the easy ++ * road. ++ */ ++ return IS_GEN6(dev_priv) && ++ crtc_state->base.active && ++ crtc_state->shared_dpll && ++ crtc_state->port_clock == 0; ++} ++ + static void intel_sanitize_encoder(struct intel_encoder *encoder) + { + struct intel_connector *connector; ++ struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); ++ struct intel_crtc_state *crtc_state = crtc ? ++ to_intel_crtc_state(crtc->base.state) : NULL; + + /* We need to check both for a crtc link (meaning that the + * encoder is active and trying to read from a pipe) and the + * pipe itself being active. */ +- bool has_active_crtc = encoder->base.crtc && +- to_intel_crtc(encoder->base.crtc)->active; ++ bool has_active_crtc = crtc_state && ++ crtc_state->base.active; ++ ++ if (crtc_state && has_bogus_dpll_config(crtc_state)) { ++ DRM_DEBUG_KMS("BIOS has misprogrammed the hardware. Disabling pipe %c\n", ++ pipe_name(crtc->pipe)); ++ has_active_crtc = false; ++ } + + connector = intel_encoder_find_connector(encoder); + if (connector && !has_active_crtc) { +@@ -15703,15 +15732,25 @@ static void intel_sanitize_encoder(struc + /* Connector is active, but has no active pipe. This is + * fallout from our resume register restoring. Disable + * the encoder manually again. */ +- if (encoder->base.crtc) { +- struct drm_crtc_state *crtc_state = encoder->base.crtc->state; ++ if (crtc_state) { ++ struct drm_encoder *best_encoder; + + DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n", + encoder->base.base.id, + encoder->base.name); +- encoder->disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state); ++ ++ /* avoid oopsing in case the hooks consult best_encoder */ ++ best_encoder = connector->base.state->best_encoder; ++ connector->base.state->best_encoder = &encoder->base; ++ ++ if (encoder->disable) ++ encoder->disable(encoder, crtc_state, ++ connector->base.state); + if (encoder->post_disable) +- encoder->post_disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state); ++ encoder->post_disable(encoder, crtc_state, ++ connector->base.state); ++ ++ connector->base.state->best_encoder = best_encoder; + } + encoder->base.crtc = NULL; + diff --git a/queue-4.20/series b/queue-4.20/series index c2a9173fd4b..c0adb9cf794 100644 --- a/queue-4.20/series +++ b/queue-4.20/series @@ -41,3 +41,5 @@ drm-i915-always-return-something-on-ddi-clock-selection.patch drm-vmwgfx-fix-setting-of-dma-masks.patch drm-vmwgfx-fix-an-uninitialized-fence-handle-value.patch drm-vmwgfx-return-error-code-from-vmw_execbuf_copy_fence_user.patch +xfrm-make-set-mark-default-behavior-backward-compatible.patch +drm-i915-try-to-sanitize-bogus-dpll-state-left-over-by-broken-snb-biosen.patch diff --git a/queue-4.20/xfrm-make-set-mark-default-behavior-backward-compatible.patch b/queue-4.20/xfrm-make-set-mark-default-behavior-backward-compatible.patch new file mode 100644 index 00000000000..7c58f0c63e4 --- /dev/null +++ b/queue-4.20/xfrm-make-set-mark-default-behavior-backward-compatible.patch @@ -0,0 +1,48 @@ +From e2612cd496e7b465711d219ea6118893d7253f52 Mon Sep 17 00:00:00 2001 +From: Benedict Wong +Date: Mon, 14 Jan 2019 11:24:38 -0800 +Subject: xfrm: Make set-mark default behavior backward compatible +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Benedict Wong + +commit e2612cd496e7b465711d219ea6118893d7253f52 upstream. + +Fixes 9b42c1f179a6, which changed the default route lookup behavior for +tunnel mode SAs in the outbound direction to use the skb mark, whereas +previously mark=0 was used if the output mark was unspecified. In +mark-based routing schemes such as Android’s, this change in default +behavior causes routing loops or lookup failures. + +This patch restores the default behavior of using a 0 mark while still +incorporating the skb mark if the SET_MARK (and SET_MARK_MASK) is +specified. + +Tested with additions to Android's kernel unit test suite: +https://android-review.googlesource.com/c/kernel/tests/+/860150 + +Fixes: 9b42c1f179a6 ("xfrm: Extend the output_mark to support input direction and masking") +Signed-off-by: Benedict Wong +Signed-off-by: Steffen Klassert +Signed-off-by: Greg Kroah-Hartman + +--- + net/xfrm/xfrm_policy.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/net/xfrm/xfrm_policy.c ++++ b/net/xfrm/xfrm_policy.c +@@ -1628,7 +1628,10 @@ static struct dst_entry *xfrm_bundle_cre + dst_copy_metrics(dst1, dst); + + if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { +- __u32 mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); ++ __u32 mark = 0; ++ ++ if (xfrm[i]->props.smark.v || xfrm[i]->props.smark.m) ++ mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); + + family = xfrm[i]->props.family; + dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif,