From 76f74bc602efefc865f7b0a7d87c5a851f1af4c2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 27 Jan 2024 15:47:31 -0800 Subject: [PATCH] 6.1-stable patches added patches: drm-amd-display-port-dentist-hang-and-tdr-fixes-to-otg-disable-w-a.patch drm-amdgpu-pm-fix-the-power-source-flag-error.patch drm-bridge-nxp-ptn3460-simplify-some-error-checking.patch --- ...ang-and-tdr-fixes-to-otg-disable-w-a.patch | 83 ++++++++++ ...u-pm-fix-the-power-source-flag-error.patch | 84 ++++++++++ ...ptn3460-simplify-some-error-checking.patch | 62 ++++++++ queue-6.1/nfsd-fix-release_lockowner.patch | 144 ------------------ queue-6.1/series | 4 +- 5 files changed, 232 insertions(+), 145 deletions(-) create mode 100644 queue-6.1/drm-amd-display-port-dentist-hang-and-tdr-fixes-to-otg-disable-w-a.patch create mode 100644 queue-6.1/drm-amdgpu-pm-fix-the-power-source-flag-error.patch create mode 100644 queue-6.1/drm-bridge-nxp-ptn3460-simplify-some-error-checking.patch delete mode 100644 queue-6.1/nfsd-fix-release_lockowner.patch diff --git a/queue-6.1/drm-amd-display-port-dentist-hang-and-tdr-fixes-to-otg-disable-w-a.patch b/queue-6.1/drm-amd-display-port-dentist-hang-and-tdr-fixes-to-otg-disable-w-a.patch new file mode 100644 index 00000000000..19229d20c06 --- /dev/null +++ b/queue-6.1/drm-amd-display-port-dentist-hang-and-tdr-fixes-to-otg-disable-w-a.patch @@ -0,0 +1,83 @@ +From 4b56f7d47be87cde5f368b67bc7fac53a2c3e8d2 Mon Sep 17 00:00:00 2001 +From: Nicholas Kazlauskas +Date: Fri, 15 Dec 2023 11:01:42 -0500 +Subject: drm/amd/display: Port DENTIST hang and TDR fixes to OTG disable W/A + +From: Nicholas Kazlauskas + +commit 4b56f7d47be87cde5f368b67bc7fac53a2c3e8d2 upstream. + +[Why] +We can experience DENTIST hangs during optimize_bandwidth or TDRs if +FIFO is toggled and hangs. + +[How] +Port the DCN35 fixes to DCN314. + +Cc: Mario Limonciello +Cc: Alex Deucher +Cc: stable@vger.kernel.org +Reviewed-by: Charlene Liu +Acked-by: Alex Hung +Signed-off-by: Nicholas Kazlauskas +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 21 ++++------ + 1 file changed, 9 insertions(+), 12 deletions(-) + +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c +@@ -131,30 +131,27 @@ static int dcn314_get_active_display_cnt + return display_count; + } + +-static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable) ++static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, ++ bool safe_to_lower, bool disable) + { + struct dc *dc = clk_mgr_base->ctx->dc; + int i; + + for (i = 0; i < dc->res_pool->pipe_count; ++i) { +- struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i]; ++ struct pipe_ctx *pipe = safe_to_lower ++ ? &context->res_ctx.pipe_ctx[i] ++ : &dc->current_state->res_ctx.pipe_ctx[i]; + + if (pipe->top_pipe || pipe->prev_odm_pipe) + continue; + if (pipe->stream && (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal))) { +- struct stream_encoder *stream_enc = pipe->stream_res.stream_enc; +- + if (disable) { +- if (stream_enc && stream_enc->funcs->disable_fifo) +- pipe->stream_res.stream_enc->funcs->disable_fifo(stream_enc); ++ if (pipe->stream_res.tg && pipe->stream_res.tg->funcs->immediate_disable_crtc) ++ pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg); + +- pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg); + reset_sync_context_for_pipe(dc, context, i); + } else { + pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg); +- +- if (stream_enc && stream_enc->funcs->enable_fifo) +- pipe->stream_res.stream_enc->funcs->enable_fifo(stream_enc); + } + } + } +@@ -254,11 +251,11 @@ void dcn314_update_clocks(struct clk_mgr + } + + if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { +- dcn314_disable_otg_wa(clk_mgr_base, context, true); ++ dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, true); + + clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; + dcn314_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz); +- dcn314_disable_otg_wa(clk_mgr_base, context, false); ++ dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, false); + + update_dispclk = true; + } diff --git a/queue-6.1/drm-amdgpu-pm-fix-the-power-source-flag-error.patch b/queue-6.1/drm-amdgpu-pm-fix-the-power-source-flag-error.patch new file mode 100644 index 00000000000..ee95b289b48 --- /dev/null +++ b/queue-6.1/drm-amdgpu-pm-fix-the-power-source-flag-error.patch @@ -0,0 +1,84 @@ +From ca1ffb174f16b699c536734fc12a4162097c49f4 Mon Sep 17 00:00:00 2001 +From: Ma Jun +Date: Wed, 17 Jan 2024 14:35:29 +0800 +Subject: drm/amdgpu/pm: Fix the power source flag error + +From: Ma Jun + +commit ca1ffb174f16b699c536734fc12a4162097c49f4 upstream. + +The power source flag should be updated when +[1] System receives an interrupt indicating that the power source +has changed. +[2] System resumes from suspend or runtime suspend + +Signed-off-by: Ma Jun +Reviewed-by: Lijo Lazar +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 13 +++---------- + drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 ++ + drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 ++ + 3 files changed, 7 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +@@ -24,6 +24,7 @@ + + #include + #include ++#include + #include + + #include "amdgpu.h" +@@ -731,16 +732,8 @@ static int smu_late_init(void *handle) + * handle the switch automatically. Driver involvement + * is unnecessary. + */ +- if (!smu->dc_controlled_by_gpio) { +- ret = smu_set_power_source(smu, +- adev->pm.ac_power ? SMU_POWER_SOURCE_AC : +- SMU_POWER_SOURCE_DC); +- if (ret) { +- dev_err(adev->dev, "Failed to switch to %s mode!\n", +- adev->pm.ac_power ? "AC" : "DC"); +- return ret; +- } +- } ++ adev->pm.ac_power = power_supply_is_system_supplied() > 0; ++ smu_set_ac_dc(smu); + + if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 1)) || + (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 3))) +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +@@ -1467,10 +1467,12 @@ static int smu_v11_0_irq_process(struct + case 0x3: + dev_dbg(adev->dev, "Switched to AC mode!\n"); + schedule_work(&smu->interrupt_work); ++ adev->pm.ac_power = true; + break; + case 0x4: + dev_dbg(adev->dev, "Switched to DC mode!\n"); + schedule_work(&smu->interrupt_work); ++ adev->pm.ac_power = false; + break; + case 0x7: + /* +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +@@ -1415,10 +1415,12 @@ static int smu_v13_0_irq_process(struct + case 0x3: + dev_dbg(adev->dev, "Switched to AC mode!\n"); + smu_v13_0_ack_ac_dc_interrupt(smu); ++ adev->pm.ac_power = true; + break; + case 0x4: + dev_dbg(adev->dev, "Switched to DC mode!\n"); + smu_v13_0_ack_ac_dc_interrupt(smu); ++ adev->pm.ac_power = false; + break; + case 0x7: + /* diff --git a/queue-6.1/drm-bridge-nxp-ptn3460-simplify-some-error-checking.patch b/queue-6.1/drm-bridge-nxp-ptn3460-simplify-some-error-checking.patch new file mode 100644 index 00000000000..508d06dcfc0 --- /dev/null +++ b/queue-6.1/drm-bridge-nxp-ptn3460-simplify-some-error-checking.patch @@ -0,0 +1,62 @@ +From 28d3d0696688154cc04983f343011d07bf0508e4 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 6 Dec 2023 18:05:15 +0300 +Subject: drm/bridge: nxp-ptn3460: simplify some error checking + +From: Dan Carpenter + +commit 28d3d0696688154cc04983f343011d07bf0508e4 upstream. + +The i2c_master_send/recv() functions return negative error codes or +they return "len" on success. So the error handling here can be written +as just normal checks for "if (ret < 0) return ret;". No need to +complicate things. + +Btw, in this code the "len" parameter can never be zero, but even if +it were, then I feel like this would still be the best way to write it. + +Fixes: 914437992876 ("drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking") +Suggested-by: Neil Armstrong +Signed-off-by: Dan Carpenter +Reviewed-by: Robert Foss +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/04242630-42d8-4920-8c67-24ac9db6b3c9@moroto.mountain +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/bridge/nxp-ptn3460.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c ++++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c +@@ -54,15 +54,15 @@ static int ptn3460_read_bytes(struct ptn + int ret; + + ret = i2c_master_send(ptn_bridge->client, &addr, 1); +- if (ret <= 0) { ++ if (ret < 0) { + DRM_ERROR("Failed to send i2c command, ret=%d\n", ret); +- return ret ?: -EIO; ++ return ret; + } + + ret = i2c_master_recv(ptn_bridge->client, buf, len); +- if (ret != len) { ++ if (ret < 0) { + DRM_ERROR("Failed to recv i2c data, ret=%d\n", ret); +- return ret < 0 ? ret : -EIO; ++ return ret; + } + + return 0; +@@ -78,9 +78,9 @@ static int ptn3460_write_byte(struct ptn + buf[1] = val; + + ret = i2c_master_send(ptn_bridge->client, buf, ARRAY_SIZE(buf)); +- if (ret != ARRAY_SIZE(buf)) { ++ if (ret < 0) { + DRM_ERROR("Failed to send i2c command, ret=%d\n", ret); +- return ret < 0 ? ret : -EIO; ++ return ret; + } + + return 0; diff --git a/queue-6.1/nfsd-fix-release_lockowner.patch b/queue-6.1/nfsd-fix-release_lockowner.patch deleted file mode 100644 index 726e6d8fc4a..00000000000 --- a/queue-6.1/nfsd-fix-release_lockowner.patch +++ /dev/null @@ -1,144 +0,0 @@ -From edcf9725150e42beeca42d085149f4c88fa97afd Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Mon, 22 Jan 2024 14:58:16 +1100 -Subject: nfsd: fix RELEASE_LOCKOWNER - -From: NeilBrown - -commit edcf9725150e42beeca42d085149f4c88fa97afd upstream. - -The test on so_count in nfsd4_release_lockowner() is nonsense and -harmful. Revert to using check_for_locks(), changing that to not sleep. - -First: harmful. -As is documented in the kdoc comment for nfsd4_release_lockowner(), the -test on so_count can transiently return a false positive resulting in a -return of NFS4ERR_LOCKS_HELD when in fact no locks are held. This is -clearly a protocol violation and with the Linux NFS client it can cause -incorrect behaviour. - -If RELEASE_LOCKOWNER is sent while some other thread is still -processing a LOCK request which failed because, at the time that request -was received, the given owner held a conflicting lock, then the nfsd -thread processing that LOCK request can hold a reference (conflock) to -the lock owner that causes nfsd4_release_lockowner() to return an -incorrect error. - -The Linux NFS client ignores that NFS4ERR_LOCKS_HELD error because it -never sends NFS4_RELEASE_LOCKOWNER without first releasing any locks, so -it knows that the error is impossible. It assumes the lock owner was in -fact released so it feels free to use the same lock owner identifier in -some later locking request. - -When it does reuse a lock owner identifier for which a previous RELEASE -failed, it will naturally use a lock_seqid of zero. However the server, -which didn't release the lock owner, will expect a larger lock_seqid and -so will respond with NFS4ERR_BAD_SEQID. - -So clearly it is harmful to allow a false positive, which testing -so_count allows. - -The test is nonsense because ... well... it doesn't mean anything. - -so_count is the sum of three different counts. -1/ the set of states listed on so_stateids -2/ the set of active vfs locks owned by any of those states -3/ various transient counts such as for conflicting locks. - -When it is tested against '2' it is clear that one of these is the -transient reference obtained by find_lockowner_str_locked(). It is not -clear what the other one is expected to be. - -In practice, the count is often 2 because there is precisely one state -on so_stateids. If there were more, this would fail. - -In my testing I see two circumstances when RELEASE_LOCKOWNER is called. -In one case, CLOSE is called before RELEASE_LOCKOWNER. That results in -all the lock states being removed, and so the lockowner being discarded -(it is removed when there are no more references which usually happens -when the lock state is discarded). When nfsd4_release_lockowner() finds -that the lock owner doesn't exist, it returns success. - -The other case shows an so_count of '2' and precisely one state listed -in so_stateid. It appears that the Linux client uses a separate lock -owner for each file resulting in one lock state per lock owner, so this -test on '2' is safe. For another client it might not be safe. - -So this patch changes check_for_locks() to use the (newish) -find_any_file_locked() so that it doesn't take a reference on the -nfs4_file and so never calls nfsd_file_put(), and so never sleeps. With -this check is it safe to restore the use of check_for_locks() rather -than testing so_count against the mysterious '2'. - -Fixes: ce3c4ad7f4ce ("NFSD: Fix possible sleep during nfsd4_release_lockowner()") -Signed-off-by: NeilBrown -Reviewed-by: Jeff Layton -Cc: stable@vger.kernel.org # v6.2+ -Signed-off-by: Chuck Lever -Signed-off-by: Greg Kroah-Hartman ---- - fs/nfsd/nfs4state.c | 26 +++++++++++++++----------- - 1 file changed, 15 insertions(+), 11 deletions(-) - ---- a/fs/nfsd/nfs4state.c -+++ b/fs/nfsd/nfs4state.c -@@ -7736,14 +7736,16 @@ check_for_locks(struct nfs4_file *fp, st - { - struct file_lock *fl; - int status = false; -- struct nfsd_file *nf = find_any_file(fp); -+ struct nfsd_file *nf; - struct inode *inode; - struct file_lock_context *flctx; - -+ spin_lock(&fp->fi_lock); -+ nf = find_any_file_locked(fp); - if (!nf) { - /* Any valid lock stateid should have some sort of access */ - WARN_ON_ONCE(1); -- return status; -+ goto out; - } - - inode = locks_inode(nf->nf_file); -@@ -7759,7 +7761,8 @@ check_for_locks(struct nfs4_file *fp, st - } - spin_unlock(&flctx->flc_lock); - } -- nfsd_file_put(nf); -+out: -+ spin_unlock(&fp->fi_lock); - return status; - } - -@@ -7769,10 +7772,8 @@ check_for_locks(struct nfs4_file *fp, st - * @cstate: NFSv4 COMPOUND state - * @u: RELEASE_LOCKOWNER arguments - * -- * The lockowner's so_count is bumped when a lock record is added -- * or when copying a conflicting lock. The latter case is brief, -- * but can lead to fleeting false positives when looking for -- * locks-in-use. -+ * Check if theree are any locks still held and if not - free the lockowner -+ * and any lock state that is owned. - * - * Return values: - * %nfs_ok: lockowner released or not found -@@ -7808,10 +7809,13 @@ nfsd4_release_lockowner(struct svc_rqst - spin_unlock(&clp->cl_lock); - return nfs_ok; - } -- if (atomic_read(&lo->lo_owner.so_count) != 2) { -- spin_unlock(&clp->cl_lock); -- nfs4_put_stateowner(&lo->lo_owner); -- return nfserr_locks_held; -+ -+ list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) { -+ if (check_for_locks(stp->st_stid.sc_file, lo)) { -+ spin_unlock(&clp->cl_lock); -+ nfs4_put_stateowner(&lo->lo_owner); -+ return nfserr_locks_held; -+ } - } - unhash_lockowner_locked(lo); - while (!list_empty(&lo->lo_owner.so_stateids)) { diff --git a/queue-6.1/series b/queue-6.1/series index fb8ad869424..00eb9a1c4e8 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -123,7 +123,6 @@ btrfs-don-t-abort-filesystem-when-attempting-to-snapshot-deleted-subvolume.patch rbd-don-t-move-requests-to-the-running-list-on-errors.patch exec-fix-error-handling-in-begin_new_exec.patch wifi-iwlwifi-fix-a-memory-corruption.patch -nfsd-fix-release_lockowner.patch hv_netvsc-calculate-correct-ring-size-when-page_size-is-not-4-kbytes.patch netfilter-nft_chain_filter-handle-netdev_unregister-for-inet-ingress-basechain.patch netfilter-nf_tables-reject-queue-drop-verdict-parameters.patch @@ -138,3 +137,6 @@ drm-bridge-nxp-ptn3460-fix-i2c_master_send-error-checking.patch drm-tidss-fix-atomic_flush-check.patch drm-amd-display-disable-psr-su-on-parade-0803-tcon-again.patch platform-x86-intel-uncore-freq-fix-types-in-sysfs-callbacks.patch +drm-bridge-nxp-ptn3460-simplify-some-error-checking.patch +drm-amd-display-port-dentist-hang-and-tdr-fixes-to-otg-disable-w-a.patch +drm-amdgpu-pm-fix-the-power-source-flag-error.patch -- 2.47.3