From: Greg Kroah-Hartman Date: Wed, 12 Sep 2018 08:53:37 +0000 (+0200) Subject: 4.18-stable patches X-Git-Tag: v4.4.156~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8b1c53632392ae085337da896501c81c74aa797;p=thirdparty%2Fkernel%2Fstable-queue.git 4.18-stable patches added patches: drm-amdgpu-fix-a-reversed-condition.patch drm-amdgpu-fix-rlc-safe-mode-test-in-gfx_v9_0_enter_rlc_safe_mode.patch drm-amdgpu-update-uvd_v6_0_ring_vm_funcs-to-use-new-nop-packet.patch drm-i915-free-write_buf-that-we-allocated-with-kzalloc.patch drm-i915-glk-add-quirk-for-glk-nuc-hdmi-port-issues.patch drm-i915-increase-lspcon-timeout.patch drm-i915-lpe-mark-lpe-audio-runtime-pm-as-no-callbacks.patch drm-i915-nuke-the-lvds-lid-notifier.patch --- diff --git a/queue-4.18/drm-amdgpu-fix-a-reversed-condition.patch b/queue-4.18/drm-amdgpu-fix-a-reversed-condition.patch new file mode 100644 index 00000000000..ea304e5c403 --- /dev/null +++ b/queue-4.18/drm-amdgpu-fix-a-reversed-condition.patch @@ -0,0 +1,34 @@ +From ccf9ef0b0d10434dec5046bcfc4e834a7b1830fd Mon Sep 17 00:00:00 2001 +From: Rex Zhu +Date: Wed, 25 Jul 2018 11:51:46 +0800 +Subject: drm/amdgpu: fix a reversed condition + +From: Rex Zhu + +commit ccf9ef0b0d10434dec5046bcfc4e834a7b1830fd upstream. + +This test was reversed so it would end up leading to vddnb value +can't be read via hwmon on APU. + +Reviewed-by: Evan Quan +Reviewed-by: Alex Deucher +Signed-off-by: Rex Zhu +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +@@ -1157,7 +1157,7 @@ static ssize_t amdgpu_hwmon_show_vddnb(s + int r, size = sizeof(vddnb); + + /* only APUs have vddnb */ +- if (adev->flags & AMD_IS_APU) ++ if (!(adev->flags & AMD_IS_APU)) + return -EINVAL; + + /* Can't get voltage when the card is off */ diff --git a/queue-4.18/drm-amdgpu-fix-rlc-safe-mode-test-in-gfx_v9_0_enter_rlc_safe_mode.patch b/queue-4.18/drm-amdgpu-fix-rlc-safe-mode-test-in-gfx_v9_0_enter_rlc_safe_mode.patch new file mode 100644 index 00000000000..e27aad74fc9 --- /dev/null +++ b/queue-4.18/drm-amdgpu-fix-rlc-safe-mode-test-in-gfx_v9_0_enter_rlc_safe_mode.patch @@ -0,0 +1,42 @@ +From 226127a67e31a9518d9516d3e4890759b379d874 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Thu, 19 Jul 2018 18:33:39 +0200 +Subject: drm/amdgpu: Fix RLC safe mode test in gfx_v9_0_enter_rlc_safe_mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michel Dänzer + +commit 226127a67e31a9518d9516d3e4890759b379d874 upstream. + +We were testing the register offset, instead of the value stored in the +register, therefore always timing out the loop. + +This reduces suspend time of the system in the bug report below by ~600 +ms. + +Cc: stable@vger.kernel.org +Bugzilla: https://bugs.freedesktop.org/107277 +Tested-by: Paul Menzel +Reviewed-by: Alex Deucher +Reviewed-by: Junwei Zhang +Signed-off-by: Michel Dänzer +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +@@ -3433,7 +3433,7 @@ static void gfx_v9_0_enter_rlc_safe_mode + + /* wait for RLC_SAFE_MODE */ + for (i = 0; i < adev->usec_timeout; i++) { +- if (!REG_GET_FIELD(SOC15_REG_OFFSET(GC, 0, mmRLC_SAFE_MODE), RLC_SAFE_MODE, CMD)) ++ if (!REG_GET_FIELD(RREG32_SOC15(GC, 0, mmRLC_SAFE_MODE), RLC_SAFE_MODE, CMD)) + break; + udelay(1); + } diff --git a/queue-4.18/drm-amdgpu-update-uvd_v6_0_ring_vm_funcs-to-use-new-nop-packet.patch b/queue-4.18/drm-amdgpu-update-uvd_v6_0_ring_vm_funcs-to-use-new-nop-packet.patch new file mode 100644 index 00000000000..6133bb4a1f4 --- /dev/null +++ b/queue-4.18/drm-amdgpu-update-uvd_v6_0_ring_vm_funcs-to-use-new-nop-packet.patch @@ -0,0 +1,40 @@ +From afb1436c7b44ab928e6369a4d48e3abb8215241e Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 28 Jun 2018 12:32:27 -0500 +Subject: drm/amdgpu: update uvd_v6_0_ring_vm_funcs to use new nop packet + +From: Alex Deucher + +commit afb1436c7b44ab928e6369a4d48e3abb8215241e upstream. + +Was missed when updating the uvd 6 module. + +Fixes: 1aac3c9180 (drm/amdgpu: fix insert nop for UVD6 ring) +Reviewed-by: Leo Liu +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +@@ -1569,7 +1569,6 @@ static const struct amdgpu_ring_funcs uv + static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = { + .type = AMDGPU_RING_TYPE_UVD, + .align_mask = 0xf, +- .nop = PACKET0(mmUVD_NO_OP, 0), + .support_64bit_ptrs = false, + .get_rptr = uvd_v6_0_ring_get_rptr, + .get_wptr = uvd_v6_0_ring_get_wptr, +@@ -1587,7 +1586,7 @@ static const struct amdgpu_ring_funcs uv + .emit_hdp_flush = uvd_v6_0_ring_emit_hdp_flush, + .test_ring = uvd_v6_0_ring_test_ring, + .test_ib = amdgpu_uvd_ring_test_ib, +- .insert_nop = amdgpu_ring_insert_nop, ++ .insert_nop = uvd_v6_0_ring_insert_nop, + .pad_ib = amdgpu_ring_generic_pad_ib, + .begin_use = amdgpu_uvd_ring_begin_use, + .end_use = amdgpu_uvd_ring_end_use, diff --git a/queue-4.18/drm-i915-free-write_buf-that-we-allocated-with-kzalloc.patch b/queue-4.18/drm-i915-free-write_buf-that-we-allocated-with-kzalloc.patch new file mode 100644 index 00000000000..996cf1b5bcd --- /dev/null +++ b/queue-4.18/drm-i915-free-write_buf-that-we-allocated-with-kzalloc.patch @@ -0,0 +1,49 @@ +From 1b1b1162745e5f9e5c6c095afc8081df3edabc50 Mon Sep 17 00:00:00 2001 +From: Rodrigo Vivi +Date: Thu, 23 Aug 2018 13:51:36 -0700 +Subject: drm/i915: Free write_buf that we allocated with kzalloc. + +From: Rodrigo Vivi + +commit 1b1b1162745e5f9e5c6c095afc8081df3edabc50 upstream. + +We use kzalloc to allocate the write_buf that we use for +i2c transfer on hdcp write. But it seems that we are forgetting +to free the memory that is not needed after i2c transfer is +completed. + +Reported-by: Brian J Wood +Fixes: 2320175feb74 ("drm/i915: Implement HDCP for HDMI") +Cc: Ramalingam C +Cc: Sean Paul +Cc: Jani Nikula +Cc: Rodrigo Vivi +Cc: # v4.17+ +Signed-off-by: Rodrigo Vivi +Reviewed-by: Chris Wilson +Link: https://patchwork.freedesktop.org/patch/msgid/20180823205136.31310-1-rodrigo.vivi@intel.com +(cherry picked from commit 62d3a8deaa10b8346d979d0dabde56c33b742afa) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_hdmi.c ++++ b/drivers/gpu/drm/i915/intel_hdmi.c +@@ -933,8 +933,12 @@ static int intel_hdmi_hdcp_write(struct + + ret = i2c_transfer(adapter, &msg, 1); + if (ret == 1) +- return 0; +- return ret >= 0 ? -EIO : ret; ++ ret = 0; ++ else if (ret >= 0) ++ ret = -EIO; ++ ++ kfree(write_buf); ++ return ret; + } + + static diff --git a/queue-4.18/drm-i915-glk-add-quirk-for-glk-nuc-hdmi-port-issues.patch b/queue-4.18/drm-i915-glk-add-quirk-for-glk-nuc-hdmi-port-issues.patch new file mode 100644 index 00000000000..d5e4209746e --- /dev/null +++ b/queue-4.18/drm-i915-glk-add-quirk-for-glk-nuc-hdmi-port-issues.patch @@ -0,0 +1,139 @@ +From 90c3e2198777aaa355b6994a31a79c636c8d4306 Mon Sep 17 00:00:00 2001 +From: Clint Taylor +Date: Tue, 10 Jul 2018 13:02:05 -0700 +Subject: drm/i915/glk: Add Quirk for GLK NUC HDMI port issues. + +From: Clint Taylor + +commit 90c3e2198777aaa355b6994a31a79c636c8d4306 upstream. + +On GLK NUC platforms the HDMI retiming buffer needs additional disabled +time to correctly sync to a faster incoming signal. + +When measured on a scope the highspeed lines of the HDMI clock turn off + for ~400uS during a normal resolution change. The HDMI retimer on the + GLK NUC appears to require at least a full frame of quiet time before a +new faster clock can be correctly sync'd. Wait 100ms due to msleep +inaccuracies while waiting for a completed frame. Add a quirk to the +driver for GLK boards that use ITE66317 HDMI retimers. + +V2: Add more devices to the quirk list +V3: Delay increased to 100ms, check to confirm crtc type is HDMI. +V4: crtc type check extended to include _DDI and whitespace fixes +v5: Fix white spaces, remove the macro for delay. Revert the crtc type + check introduced in v4. + +Cc: Imre Deak +Cc: # v4.14+ +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105887 +Signed-off-by: Clint Taylor +Tested-by: Daniel Scheller +Signed-off-by: Radhakrishna Sripada +Signed-off-by: Imre Deak +Reviewed-by: Imre Deak +Link: https://patchwork.freedesktop.org/patch/msgid/20180710200205.1478-1-radhakrishna.sripada@intel.com +Signed-off-by: Greg Kroah-Hartman + +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h +index 1616e994b9a5..f519485fcd73 100644 +--- a/drivers/gpu/drm/i915/i915_drv.h ++++ b/drivers/gpu/drm/i915/i915_drv.h +@@ -650,6 +650,7 @@ enum intel_sbi_destination { + #define QUIRK_BACKLIGHT_PRESENT (1<<3) + #define QUIRK_PIN_SWIZZLED_PAGES (1<<5) + #define QUIRK_INCREASE_T12_DELAY (1<<6) ++#define QUIRK_INCREASE_DDI_DISABLED_TIME (1<<7) + + struct intel_fbdev; + struct intel_fbc_work; +diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c +index 32838ed89ee7..e4caa902d88e 100644 +--- a/drivers/gpu/drm/i915/intel_ddi.c ++++ b/drivers/gpu/drm/i915/intel_ddi.c +@@ -1808,15 +1808,24 @@ void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state) + I915_WRITE(TRANS_DDI_FUNC_CTL(cpu_transcoder), temp); + } + +-void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv, +- enum transcoder cpu_transcoder) ++void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state) + { ++ struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); ++ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); ++ enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; + i915_reg_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder); + uint32_t val = I915_READ(reg); + + val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_PORT_MASK | TRANS_DDI_DP_VC_PAYLOAD_ALLOC); + val |= TRANS_DDI_PORT_NONE; + I915_WRITE(reg, val); ++ ++ if (dev_priv->quirks & QUIRK_INCREASE_DDI_DISABLED_TIME && ++ intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) { ++ DRM_DEBUG_KMS("Quirk Increase DDI disabled time\n"); ++ /* Quirk time at 100ms for reliable operation */ ++ msleep(100); ++ } + } + + int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c +index 694975afe394..8bd9080fce34 100644 +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -5838,7 +5838,7 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state, + intel_ddi_set_vc_payload_alloc(old_crtc_state, false); + + if (!transcoder_is_dsi(cpu_transcoder)) +- intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); ++ intel_ddi_disable_transcoder_func(old_crtc_state); + + if (INTEL_GEN(dev_priv) >= 9) + skylake_scaler_disable(intel_crtc); +@@ -14806,6 +14806,18 @@ static void quirk_increase_t12_delay(struct drm_device *dev) + DRM_INFO("Applying T12 delay quirk\n"); + } + ++/* ++ * GeminiLake NUC HDMI outputs require additional off time ++ * this allows the onboard retimer to correctly sync to signal ++ */ ++static void quirk_increase_ddi_disabled_time(struct drm_device *dev) ++{ ++ struct drm_i915_private *dev_priv = to_i915(dev); ++ ++ dev_priv->quirks |= QUIRK_INCREASE_DDI_DISABLED_TIME; ++ DRM_INFO("Applying Increase DDI Disabled quirk\n"); ++} ++ + struct intel_quirk { + int device; + int subsystem_vendor; +@@ -14892,6 +14904,13 @@ static struct intel_quirk intel_quirks[] = { + + /* Toshiba Satellite P50-C-18C */ + { 0x191B, 0x1179, 0xF840, quirk_increase_t12_delay }, ++ ++ /* GeminiLake NUC */ ++ { 0x3185, 0x8086, 0x2072, quirk_increase_ddi_disabled_time }, ++ { 0x3184, 0x8086, 0x2072, quirk_increase_ddi_disabled_time }, ++ /* ASRock ITX*/ ++ { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, ++ { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, + }; + + static void intel_init_quirks(struct drm_device *dev) +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h +index 1375cad8bf83..a0e9a35b5658 100644 +--- a/drivers/gpu/drm/i915/intel_drv.h ++++ b/drivers/gpu/drm/i915/intel_drv.h +@@ -1384,8 +1384,7 @@ void hsw_fdi_link_train(struct intel_crtc *crtc, + void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port); + bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe); + void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state); +-void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv, +- enum transcoder cpu_transcoder); ++void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state); + void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state); + void intel_ddi_disable_pipe_clock(const struct intel_crtc_state *crtc_state); + void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state); diff --git a/queue-4.18/drm-i915-increase-lspcon-timeout.patch b/queue-4.18/drm-i915-increase-lspcon-timeout.patch new file mode 100644 index 00000000000..ee1ffed8004 --- /dev/null +++ b/queue-4.18/drm-i915-increase-lspcon-timeout.patch @@ -0,0 +1,55 @@ +From 299c2a904b1e8d5096d4813df6371357d97a6cd1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fredrik=20Sch=C3=B6n?= +Date: Fri, 17 Aug 2018 22:07:28 +0200 +Subject: drm/i915: Increase LSPCON timeout +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Fredrik Schön + +commit 299c2a904b1e8d5096d4813df6371357d97a6cd1 upstream. + +100 ms is not enough time for the LSPCON adapter on Intel NUC devices to +settle. This causes dropped display modes at boot or screen reconfiguration. +Empirical testing can reproduce the error up to a timeout of 190 ms. Basic +boot and stress testing at 200 ms has not (yet) failed. + +Increase timeout to 400 ms to get some margin of error. + +Changes from v1: +The initial suggestion of 1000 ms was lowered due to concerns about delaying +valid timeout cases. +Update patch metadata. + +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107503 +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1570392 +Fixes: 357c0ae9198a ("drm/i915/lspcon: Wait for expected LSPCON mode to settle") +Cc: Shashank Sharma +Cc: Imre Deak +Cc: Jani Nikula +Cc: # v4.11+ +Reviewed-by: Rodrigo Vivi +Reviewed-by: Shashank Sharma +Signed-off-by: Fredrik Schön +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20180817200728.8154-1-fredrik.schon@gmail.com +(cherry picked from commit 59f1c8ab30d6f9042562949f42cbd3f3cf69de94) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_lspcon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/intel_lspcon.c ++++ b/drivers/gpu/drm/i915/intel_lspcon.c +@@ -74,7 +74,7 @@ static enum drm_lspcon_mode lspcon_wait_ + DRM_DEBUG_KMS("Waiting for LSPCON mode %s to settle\n", + lspcon_mode_name(mode)); + +- wait_for((current_mode = lspcon_get_current_mode(lspcon)) == mode, 100); ++ wait_for((current_mode = lspcon_get_current_mode(lspcon)) == mode, 400); + if (current_mode != mode) + DRM_ERROR("LSPCON mode hasn't settled\n"); + diff --git a/queue-4.18/drm-i915-lpe-mark-lpe-audio-runtime-pm-as-no-callbacks.patch b/queue-4.18/drm-i915-lpe-mark-lpe-audio-runtime-pm-as-no-callbacks.patch new file mode 100644 index 00000000000..c78c064756e --- /dev/null +++ b/queue-4.18/drm-i915-lpe-mark-lpe-audio-runtime-pm-as-no-callbacks.patch @@ -0,0 +1,48 @@ +From 75eef0f1ed478284911b8723a5bdb659499a7aac Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Thu, 2 Aug 2018 15:04:16 +0100 +Subject: drm/i915/lpe: Mark LPE audio runtime pm as "no callbacks" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Chris Wilson + +commit 75eef0f1ed478284911b8723a5bdb659499a7aac upstream. + +The LPE audio is a child device of i915, it is powered up and down +alongside the igfx and presents no independent runtime interface. This +aptly fulfils the description of a "No-Callback" Device, so mark it +thus. + +Fixes: 183c00350ccd ("drm/i915: Fix runtime PM for LPE audio") +Testcase: igt/pm_rpm/basic-pci-d3-state +Testcase: igt/pm_rpm/basic-rte +Signed-off-by: Chris Wilson +Cc: Takashi Iwai +Cc: Pierre-Louis Bossart +Cc: Ville Syrjälä +Cc: stable@vger.kernel.org +Reviewed-by: Joonas Lahtinen +Link: https://patchwork.freedesktop.org/patch/msgid/20180802140416.6062-1-chris@chris-wilson.co.uk +(cherry picked from commit 46e831abe864a6b59fa3de253a681c0f2ee1bf2f) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_lpe_audio.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_lpe_audio.c ++++ b/drivers/gpu/drm/i915/intel_lpe_audio.c +@@ -127,9 +127,7 @@ lpe_audio_platdev_create(struct drm_i915 + return platdev; + } + +- pm_runtime_forbid(&platdev->dev); +- pm_runtime_set_active(&platdev->dev); +- pm_runtime_enable(&platdev->dev); ++ pm_runtime_no_callbacks(&platdev->dev); + + return platdev; + } diff --git a/queue-4.18/drm-i915-nuke-the-lvds-lid-notifier.patch b/queue-4.18/drm-i915-nuke-the-lvds-lid-notifier.patch new file mode 100644 index 00000000000..4b4f48baa53 --- /dev/null +++ b/queue-4.18/drm-i915-nuke-the-lvds-lid-notifier.patch @@ -0,0 +1,292 @@ +From 05c72e77ccda89ff624108b1b59a0fc43843f343 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Tue, 17 Jul 2018 20:42:14 +0300 +Subject: drm/i915: Nuke the LVDS lid notifier +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit 05c72e77ccda89ff624108b1b59a0fc43843f343 upstream. + +We broke the LVDS notifier resume thing in (presumably) commit +e2c8b8701e2d ("drm/i915: Use atomic helpers for suspend, v2.") as +we no longer duplicate the current state in the LVDS notifier and +thus we never resume it properly either. + +Instead of trying to fix it again let's just kill off the lid +notifier entirely. None of the machines tested thus far have +apparently needed it. Originally the lid notifier was added to +work around cases where the VBIOS was clobbering some of the +hardware state behind the driver's back, mostly on Thinkpads. +We now have a few report of Thinkpads working just fine without +the notifier. So maybe it was misdiagnosed originally, or +something else has changed (ACPI video stuff perhaps?). + +If we do end up finding a machine where the VBIOS is still causing +problems I would suggest that we first try setting various bits in +the VBIOS scratch registers. There are several to choose from that +may instruct the VBIOS to steer clear. + +With the notifier gone we'll also stop looking at the panel status +in ->detect(). + +v2: Nuke enum modeset_restore (Rodrigo) + +Cc: stable@vger.kernel.org +Cc: Wolfgang Draxinger +Cc: Vito Caputo +Cc: kitsunyan +Cc: Joonas Saarinen +Tested-by: Vito Caputo # Thinkapd X61s +Tested-by: kitsunyan # ThinkPad X200 +Tested-by: Joonas Saarinen # Fujitsu Siemens U9210 +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105902 +References: https://lists.freedesktop.org/archives/intel-gfx/2018-June/169315.html +References: https://bugs.freedesktop.org/show_bug.cgi?id=21230 +Fixes: e2c8b8701e2d ("drm/i915: Use atomic helpers for suspend, v2.") +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20180717174216.22252-1-ville.syrjala@linux.intel.com +Reviewed-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/i915_drv.c | 10 -- + drivers/gpu/drm/i915/i915_drv.h | 8 -- + drivers/gpu/drm/i915/intel_lvds.c | 136 -------------------------------------- + 3 files changed, 2 insertions(+), 152 deletions(-) + +--- a/drivers/gpu/drm/i915/i915_drv.c ++++ b/drivers/gpu/drm/i915/i915_drv.c +@@ -919,7 +919,6 @@ static int i915_driver_init_early(struct + spin_lock_init(&dev_priv->uncore.lock); + + mutex_init(&dev_priv->sb_lock); +- mutex_init(&dev_priv->modeset_restore_lock); + mutex_init(&dev_priv->av_mutex); + mutex_init(&dev_priv->wm.wm_mutex); + mutex_init(&dev_priv->pps_mutex); +@@ -1560,11 +1559,6 @@ static int i915_drm_suspend(struct drm_d + pci_power_t opregion_target_state; + int error; + +- /* ignore lid events during suspend */ +- mutex_lock(&dev_priv->modeset_restore_lock); +- dev_priv->modeset_restore = MODESET_SUSPENDED; +- mutex_unlock(&dev_priv->modeset_restore_lock); +- + disable_rpm_wakeref_asserts(dev_priv); + + /* We do a lot of poking in a lot of registers, make sure they work +@@ -1764,10 +1758,6 @@ static int i915_drm_resume(struct drm_de + + intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false); + +- mutex_lock(&dev_priv->modeset_restore_lock); +- dev_priv->modeset_restore = MODESET_DONE; +- mutex_unlock(&dev_priv->modeset_restore_lock); +- + intel_opregion_notify_adapter(dev_priv, PCI_D0); + + enable_rpm_wakeref_asserts(dev_priv); +--- a/drivers/gpu/drm/i915/i915_drv.h ++++ b/drivers/gpu/drm/i915/i915_drv.h +@@ -1003,12 +1003,6 @@ struct i915_gem_mm { + #define I915_ENGINE_DEAD_TIMEOUT (4 * HZ) /* Seqno, head and subunits dead */ + #define I915_SEQNO_DEAD_TIMEOUT (12 * HZ) /* Seqno dead with active head */ + +-enum modeset_restore { +- MODESET_ON_LID_OPEN, +- MODESET_DONE, +- MODESET_SUSPENDED, +-}; +- + #define DP_AUX_A 0x40 + #define DP_AUX_B 0x10 + #define DP_AUX_C 0x20 +@@ -1740,8 +1734,6 @@ struct drm_i915_private { + + unsigned long quirks; + +- enum modeset_restore modeset_restore; +- struct mutex modeset_restore_lock; + struct drm_atomic_state *modeset_restore_state; + struct drm_modeset_acquire_ctx reset_ctx; + +--- a/drivers/gpu/drm/i915/intel_lvds.c ++++ b/drivers/gpu/drm/i915/intel_lvds.c +@@ -44,8 +44,6 @@ + /* Private structure for the integrated LVDS support */ + struct intel_lvds_connector { + struct intel_connector base; +- +- struct notifier_block lid_notifier; + }; + + struct intel_lvds_pps { +@@ -454,26 +452,9 @@ static bool intel_lvds_compute_config(st + return true; + } + +-/* +- * Detect the LVDS connection. +- * +- * Since LVDS doesn't have hotlug, we use the lid as a proxy. Open means +- * connected and closed means disconnected. We also send hotplug events as +- * needed, using lid status notification from the input layer. +- */ + static enum drm_connector_status + intel_lvds_detect(struct drm_connector *connector, bool force) + { +- struct drm_i915_private *dev_priv = to_i915(connector->dev); +- enum drm_connector_status status; +- +- DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", +- connector->base.id, connector->name); +- +- status = intel_panel_detect(dev_priv); +- if (status != connector_status_unknown) +- return status; +- + return connector_status_connected; + } + +@@ -498,117 +479,6 @@ static int intel_lvds_get_modes(struct d + return 1; + } + +-static int intel_no_modeset_on_lid_dmi_callback(const struct dmi_system_id *id) +-{ +- DRM_INFO("Skipping forced modeset for %s\n", id->ident); +- return 1; +-} +- +-/* The GPU hangs up on these systems if modeset is performed on LID open */ +-static const struct dmi_system_id intel_no_modeset_on_lid[] = { +- { +- .callback = intel_no_modeset_on_lid_dmi_callback, +- .ident = "Toshiba Tecra A11", +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), +- DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A11"), +- }, +- }, +- +- { } /* terminating entry */ +-}; +- +-/* +- * Lid events. Note the use of 'modeset': +- * - we set it to MODESET_ON_LID_OPEN on lid close, +- * and set it to MODESET_DONE on open +- * - we use it as a "only once" bit (ie we ignore +- * duplicate events where it was already properly set) +- * - the suspend/resume paths will set it to +- * MODESET_SUSPENDED and ignore the lid open event, +- * because they restore the mode ("lid open"). +- */ +-static int intel_lid_notify(struct notifier_block *nb, unsigned long val, +- void *unused) +-{ +- struct intel_lvds_connector *lvds_connector = +- container_of(nb, struct intel_lvds_connector, lid_notifier); +- struct drm_connector *connector = &lvds_connector->base.base; +- struct drm_device *dev = connector->dev; +- struct drm_i915_private *dev_priv = to_i915(dev); +- +- if (dev->switch_power_state != DRM_SWITCH_POWER_ON) +- return NOTIFY_OK; +- +- mutex_lock(&dev_priv->modeset_restore_lock); +- if (dev_priv->modeset_restore == MODESET_SUSPENDED) +- goto exit; +- /* +- * check and update the status of LVDS connector after receiving +- * the LID nofication event. +- */ +- connector->status = connector->funcs->detect(connector, false); +- +- /* Don't force modeset on machines where it causes a GPU lockup */ +- if (dmi_check_system(intel_no_modeset_on_lid)) +- goto exit; +- if (!acpi_lid_open()) { +- /* do modeset on next lid open event */ +- dev_priv->modeset_restore = MODESET_ON_LID_OPEN; +- goto exit; +- } +- +- if (dev_priv->modeset_restore == MODESET_DONE) +- goto exit; +- +- /* +- * Some old platform's BIOS love to wreak havoc while the lid is closed. +- * We try to detect this here and undo any damage. The split for PCH +- * platforms is rather conservative and a bit arbitrary expect that on +- * those platforms VGA disabling requires actual legacy VGA I/O access, +- * and as part of the cleanup in the hw state restore we also redisable +- * the vga plane. +- */ +- if (!HAS_PCH_SPLIT(dev_priv)) +- intel_display_resume(dev); +- +- dev_priv->modeset_restore = MODESET_DONE; +- +-exit: +- mutex_unlock(&dev_priv->modeset_restore_lock); +- return NOTIFY_OK; +-} +- +-static int +-intel_lvds_connector_register(struct drm_connector *connector) +-{ +- struct intel_lvds_connector *lvds = to_lvds_connector(connector); +- int ret; +- +- ret = intel_connector_register(connector); +- if (ret) +- return ret; +- +- lvds->lid_notifier.notifier_call = intel_lid_notify; +- if (acpi_lid_notifier_register(&lvds->lid_notifier)) { +- DRM_DEBUG_KMS("lid notifier registration failed\n"); +- lvds->lid_notifier.notifier_call = NULL; +- } +- +- return 0; +-} +- +-static void +-intel_lvds_connector_unregister(struct drm_connector *connector) +-{ +- struct intel_lvds_connector *lvds = to_lvds_connector(connector); +- +- if (lvds->lid_notifier.notifier_call) +- acpi_lid_notifier_unregister(&lvds->lid_notifier); +- +- intel_connector_unregister(connector); +-} +- + /** + * intel_lvds_destroy - unregister and free LVDS structures + * @connector: connector to free +@@ -641,8 +511,8 @@ static const struct drm_connector_funcs + .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_get_property = intel_digital_connector_atomic_get_property, + .atomic_set_property = intel_digital_connector_atomic_set_property, +- .late_register = intel_lvds_connector_register, +- .early_unregister = intel_lvds_connector_unregister, ++ .late_register = intel_connector_register, ++ .early_unregister = intel_connector_unregister, + .destroy = intel_lvds_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, + .atomic_duplicate_state = intel_digital_connector_duplicate_state, +@@ -1108,8 +978,6 @@ void intel_lvds_init(struct drm_i915_pri + * 2) check for VBT data + * 3) check to see if LVDS is already on + * if none of the above, no panel +- * 4) make sure lid is open +- * if closed, act like it's not there for now + */ + + /* diff --git a/queue-4.18/series b/queue-4.18/series index 1eb3ec2616e..76acba4a268 100644 --- a/queue-4.18/series +++ b/queue-4.18/series @@ -151,3 +151,11 @@ btrfs-lift-uuid_mutex-to-callers-of-btrfs_scan_one_device.patch btrfs-lift-uuid_mutex-to-callers-of-btrfs_parse_early_options.patch btrfs-reorder-initialization-before-the-mount-locks-uuid_mutex.patch btrfs-fix-mount-and-ioctl-device-scan-ioctl-race.patch +drm-i915-lpe-mark-lpe-audio-runtime-pm-as-no-callbacks.patch +drm-i915-nuke-the-lvds-lid-notifier.patch +drm-i915-increase-lspcon-timeout.patch +drm-i915-free-write_buf-that-we-allocated-with-kzalloc.patch +drm-amdgpu-update-uvd_v6_0_ring_vm_funcs-to-use-new-nop-packet.patch +drm-amdgpu-fix-a-reversed-condition.patch +drm-amdgpu-fix-rlc-safe-mode-test-in-gfx_v9_0_enter_rlc_safe_mode.patch +drm-i915-glk-add-quirk-for-glk-nuc-hdmi-port-issues.patch