From: Greg Kroah-Hartman Date: Tue, 23 Nov 2021 12:01:52 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v5.15.5~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18a6295f06d4f28bf7d9cd9b4db5588b3659be7c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: drm-amdgpu-fix-set-scaling-mode-full-full-aspect-center-not-works-on-vga-and-dvi-connectors.patch drm-i915-dp-ensure-sink-rate-values-are-always-valid.patch drm-nouveau-use-drm_dev_unplug-during-device-removal.patch drm-udl-fix-control-message-timeout.patch --- diff --git a/queue-5.4/drm-amdgpu-fix-set-scaling-mode-full-full-aspect-center-not-works-on-vga-and-dvi-connectors.patch b/queue-5.4/drm-amdgpu-fix-set-scaling-mode-full-full-aspect-center-not-works-on-vga-and-dvi-connectors.patch new file mode 100644 index 00000000000..a41b190ce4f --- /dev/null +++ b/queue-5.4/drm-amdgpu-fix-set-scaling-mode-full-full-aspect-center-not-works-on-vga-and-dvi-connectors.patch @@ -0,0 +1,38 @@ +From bf552083916a7f8800477b5986940d1c9a31b953 Mon Sep 17 00:00:00 2001 +From: hongao +Date: Thu, 11 Nov 2021 11:32:07 +0800 +Subject: drm/amdgpu: fix set scaling mode Full/Full aspect/Center not works on vga and dvi connectors + +From: hongao + +commit bf552083916a7f8800477b5986940d1c9a31b953 upstream. + +amdgpu_connector_vga_get_modes missed function amdgpu_get_native_mode +which assign amdgpu_encoder->native_mode with *preferred_mode result in +amdgpu_encoder->native_mode.clock always be 0. That will cause +amdgpu_connector_set_property returned early on: +if ((rmx_type != DRM_MODE_SCALE_NONE) && + (amdgpu_encoder->native_mode.clock == 0)) +when we try to set scaling mode Full/Full aspect/Center. +Add the missing function to amdgpu_connector_vga_get_mode can fix this. +It also works on dvi connectors because +amdgpu_connector_dvi_helper_funcs.get_mode use the same method. + +Signed-off-by: hongao +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +@@ -829,6 +829,7 @@ static int amdgpu_connector_vga_get_mode + + amdgpu_connector_get_edid(connector); + ret = amdgpu_connector_ddc_get_modes(connector); ++ amdgpu_get_native_mode(connector); + + return ret; + } diff --git a/queue-5.4/drm-i915-dp-ensure-sink-rate-values-are-always-valid.patch b/queue-5.4/drm-i915-dp-ensure-sink-rate-values-are-always-valid.patch new file mode 100644 index 00000000000..bcff0abd582 --- /dev/null +++ b/queue-5.4/drm-i915-dp-ensure-sink-rate-values-are-always-valid.patch @@ -0,0 +1,97 @@ +From 6c34bd4532a3f39952952ddc102737595729afc4 Mon Sep 17 00:00:00 2001 +From: Imre Deak +Date: Mon, 18 Oct 2021 17:34:17 +0300 +Subject: drm/i915/dp: Ensure sink rate values are always valid +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Imre Deak + +commit 6c34bd4532a3f39952952ddc102737595729afc4 upstream. + +Atm, there are no sink rate values set for DP (vs. eDP) sinks until the +DPCD capabilities are successfully read from the sink. During this time +intel_dp->num_common_rates is 0 which can lead to a + +intel_dp->common_rates[-1] (*) + +access, which is an undefined behaviour, in the following cases: + +- In intel_dp_sync_state(), if the encoder is enabled without a sink + connected to the encoder's connector (BIOS enabled a monitor, but the + user unplugged the monitor until the driver loaded). +- In intel_dp_sync_state() if the encoder is enabled with a sink + connected, but for some reason the DPCD read has failed. +- In intel_dp_compute_link_config() if modesetting a connector without + a sink connected on it. +- In intel_dp_compute_link_config() if modesetting a connector with a + a sink connected on it, but before probing the connector first. + +To avoid the (*) access in all the above cases, make sure that the sink +rate table - and hence the common rate table - is always valid, by +setting a default minimum sink rate when registering the connector +before anything could use it. + +I also considered setting all the DP link rates by default, so that +modesetting with higher resolution modes also succeeds in the last two +cases above. However in case a sink is not connected that would stop +working after the first modeset, due to the LT fallback logic. So this +would need more work, beyond the scope of this fix. + +As I mentioned in the previous patch, I don't think the issue this patch +fixes is user visible, however it is an undefined behaviour by +definition and triggers a BUG() in CONFIG_UBSAN builds, hence CC:stable. + +v2: Clear the default sink rates, before initializing these for eDP. + +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4297 +References: https://gitlab.freedesktop.org/drm/intel/-/issues/4298 +Suggested-by: Ville Syrjälä +Cc: Ville Syrjälä +Cc: +Signed-off-by: Imre Deak +Reviewed-by: Ville Syrjälä +Acked-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20211018143417.1452632-1-imre.deak@intel.com +(cherry picked from commit 3f61ef9777c0ab0f03f4af0ed6fd3e5250537a8d) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/intel_dp.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/gpu/drm/i915/display/intel_dp.c ++++ b/drivers/gpu/drm/i915/display/intel_dp.c +@@ -166,6 +166,12 @@ static void vlv_steal_power_sequencer(st + enum pipe pipe); + static void intel_dp_unset_edid(struct intel_dp *intel_dp); + ++static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp) ++{ ++ intel_dp->sink_rates[0] = 162000; ++ intel_dp->num_sink_rates = 1; ++} ++ + /* update sink rates from dpcd */ + static void intel_dp_set_sink_rates(struct intel_dp *intel_dp) + { +@@ -4261,6 +4267,9 @@ intel_edp_init_dpcd(struct intel_dp *int + */ + intel_psr_init_dpcd(intel_dp); + ++ /* Clear the default sink rates */ ++ intel_dp->num_sink_rates = 0; ++ + /* Read the eDP 1.4+ supported link rates. */ + if (intel_dp->edp_dpcd[0] >= DP_EDP_14) { + __le16 sink_rates[DP_MAX_SUPPORTED_RATES]; +@@ -7167,6 +7176,8 @@ intel_dp_init_connector(struct intel_dig + return false; + + intel_dp_set_source_rates(intel_dp); ++ intel_dp_set_default_sink_rates(intel_dp); ++ intel_dp_set_common_rates(intel_dp); + + intel_dp->reset_link_params = true; + intel_dp->pps_pipe = INVALID_PIPE; diff --git a/queue-5.4/drm-nouveau-use-drm_dev_unplug-during-device-removal.patch b/queue-5.4/drm-nouveau-use-drm_dev_unplug-during-device-removal.patch new file mode 100644 index 00000000000..07675e4cae0 --- /dev/null +++ b/queue-5.4/drm-nouveau-use-drm_dev_unplug-during-device-removal.patch @@ -0,0 +1,46 @@ +From aff2299e0d81b26304ccc6a1ec0170e437f38efc Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Wed, 25 Nov 2020 15:26:46 -0500 +Subject: drm/nouveau: use drm_dev_unplug() during device removal + +From: Jeremy Cline + +commit aff2299e0d81b26304ccc6a1ec0170e437f38efc upstream. + +Nouveau does not currently support hot-unplugging, but it still makes +sense to switch from drm_dev_unregister() to drm_dev_unplug(). +drm_dev_unplug() calls drm_dev_unregister() after marking the device as +unplugged, but only after any device critical sections are finished. + +Since nouveau isn't using drm_dev_enter() and drm_dev_exit(), there are +no critical sections so this is nearly functionally equivalent. However, +the DRM layer does check to see if the device is unplugged, and if it is +returns appropriate error codes. + +In the future nouveau can add critical sections in order to truly +support hot-unplugging. + +Cc: stable@vger.kernel.org # 5.4+ +Signed-off-by: Jeremy Cline +Reviewed-by: Lyude Paul +Reviewed-by: Ben Skeggs +Tested-by: Karol Herbst +Signed-off-by: Karol Herbst +Link: https://patchwork.freedesktop.org/patch/msgid/20201125202648.5220-2-jcline@redhat.com +Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/14 +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/nouveau_drm.c ++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c +@@ -779,7 +779,7 @@ nouveau_drm_device_remove(struct drm_dev + struct nvkm_client *client; + struct nvkm_device *device; + +- drm_dev_unregister(dev); ++ drm_dev_unplug(dev); + + dev->irq_enabled = false; + client = nvxx_client(&drm->client.base); diff --git a/queue-5.4/drm-udl-fix-control-message-timeout.patch b/queue-5.4/drm-udl-fix-control-message-timeout.patch new file mode 100644 index 00000000000..494d1814514 --- /dev/null +++ b/queue-5.4/drm-udl-fix-control-message-timeout.patch @@ -0,0 +1,33 @@ +From 5591c8f79db1729d9c5ac7f5b4d3a5c26e262d93 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 25 Oct 2021 13:53:53 +0200 +Subject: drm/udl: fix control-message timeout + +From: Johan Hovold + +commit 5591c8f79db1729d9c5ac7f5b4d3a5c26e262d93 upstream. + +USB control-message timeouts are specified in milliseconds and should +specifically not vary with CONFIG_HZ. + +Fixes: 5320918b9a87 ("drm/udl: initial UDL driver (v4)") +Cc: stable@vger.kernel.org # 3.4 +Signed-off-by: Johan Hovold +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20211025115353.5089-1-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/udl/udl_connector.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/udl/udl_connector.c ++++ b/drivers/gpu/drm/udl/udl_connector.c +@@ -29,7 +29,7 @@ static int udl_get_edid_block(void *data + ret = usb_control_msg(udl->udev, + usb_rcvctrlpipe(udl->udev, 0), + (0x02), (0x80 | (0x02 << 5)), bval, +- 0xA1, read_buff, 2, HZ); ++ 0xA1, read_buff, 2, 1000); + if (ret < 1) { + DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret); + kfree(read_buff); diff --git a/queue-5.4/series b/queue-5.4/series index 2cfbb0cd3fb..ff759cbe167 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -84,3 +84,7 @@ udf-fix-crash-after-seekdir.patch btrfs-fix-memory-ordering-between-normal-and-ordered-work-functions.patch parisc-sticon-fix-reverse-colors.patch cfg80211-call-cfg80211_stop_ap-when-switch-from-p2p_go-type.patch +drm-udl-fix-control-message-timeout.patch +drm-nouveau-use-drm_dev_unplug-during-device-removal.patch +drm-i915-dp-ensure-sink-rate-values-are-always-valid.patch +drm-amdgpu-fix-set-scaling-mode-full-full-aspect-center-not-works-on-vga-and-dvi-connectors.patch