--- /dev/null
+From 05af800704ee7187d9edd461ec90f3679b1c4aba Mon Sep 17 00:00:00 2001
+From: Alex Hung <alex.hung@amd.com>
+Date: Fri, 6 Sep 2024 11:39:18 -0600
+Subject: drm/amd/display: Add HDR workaround for specific eDP
+
+From: Alex Hung <alex.hung@amd.com>
+
+commit 05af800704ee7187d9edd461ec90f3679b1c4aba upstream.
+
+[WHY & HOW]
+Some eDP panels suffer from flicking when HDR is enabled in KDE. This
+quirk works around it by skipping VSC that is incompatible with eDP
+panels.
+
+Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3151
+Cc: Mario Limonciello <mario.limonciello@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
+Signed-off-by: Alex Hung <alex.hung@amd.com>
+Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 4d4257280d7957727998ef90ccc7b69c7cca8376)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++++++++-
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 ++++
+ drivers/gpu/drm/amd/display/dc/dc_types.h | 1 +
+ 3 files changed, 15 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -6713,12 +6713,21 @@ create_stream_for_sink(struct drm_connec
+ if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT ||
+ stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST ||
+ stream->signal == SIGNAL_TYPE_EDP) {
++ const struct dc_edid_caps *edid_caps;
++ unsigned int disable_colorimetry = 0;
++
++ if (aconnector->dc_sink) {
++ edid_caps = &aconnector->dc_sink->edid_caps;
++ disable_colorimetry = edid_caps->panel_patch.disable_colorimetry;
++ }
++
+ //
+ // should decide stream support vsc sdp colorimetry capability
+ // before building vsc info packet
+ //
+ stream->use_vsc_sdp_for_colorimetry = stream->link->dpcd_caps.dpcd_rev.raw >= 0x14 &&
+- stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED;
++ stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED &&
++ !disable_colorimetry;
+
+ if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22)
+ tf = TRANSFER_FUNC_GAMMA_22;
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+@@ -73,6 +73,10 @@ static void apply_edid_quirks(struct edi
+ DRM_DEBUG_DRIVER("Clearing DPCD 0x317 on monitor with panel id %X\n", panel_id);
+ edid_caps->panel_patch.remove_sink_ext_caps = true;
+ break;
++ case drm_edid_encode_panel_id('S', 'D', 'C', 0x4154):
++ DRM_DEBUG_DRIVER("Disabling VSC on monitor with panel id %X\n", panel_id);
++ edid_caps->panel_patch.disable_colorimetry = true;
++ break;
+ default:
+ return;
+ }
+--- a/drivers/gpu/drm/amd/display/dc/dc_types.h
++++ b/drivers/gpu/drm/amd/display/dc/dc_types.h
+@@ -178,6 +178,7 @@ struct dc_panel_patch {
+ unsigned int skip_avmute;
+ unsigned int mst_start_top_delay;
+ unsigned int remove_sink_ext_caps;
++ unsigned int disable_colorimetry;
+ };
+
+ struct dc_edid_caps {
--- /dev/null
+From ef785ca7f7c80891580cafd36c8dd86375684310 Mon Sep 17 00:00:00 2001
+From: Leo Li <sunpeng.li@amd.com>
+Date: Wed, 11 Sep 2024 17:27:08 -0400
+Subject: drm/amd/display: Enable idle workqueue for more IPS modes
+
+From: Leo Li <sunpeng.li@amd.com>
+
+commit ef785ca7f7c80891580cafd36c8dd86375684310 upstream.
+
+[Why]
+
+There are more IPS modes other than DMUB_IPS_ENABLE that enables IPS. We
+need to enable the hotplug detect idle workqueue for those modes as
+well.
+
+[How]
+
+Modify the if condition to initialize the workqueue in all IPS modes
+except for DMUB_IPS_DISABLE_ALL.
+
+Fixes: 65444581a4ae ("drm/amd/display: Determine IPS mode by ASIC and PMFW versions")
+Signed-off-by: Leo Li <sunpeng.li@amd.com>
+Reviewed-by: Roman Li <roman.li@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 181db30bcfed097ecc680539b1eabe935c11f57f)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -2005,7 +2005,8 @@ static int amdgpu_dm_init(struct amdgpu_
+ DRM_ERROR("amdgpu: failed to initialize vblank_workqueue.\n");
+ }
+
+- if (adev->dm.dc->caps.ips_support && adev->dm.dc->config.disable_ips == DMUB_IPS_ENABLE)
++ if (adev->dm.dc->caps.ips_support &&
++ adev->dm.dc->config.disable_ips != DMUB_IPS_DISABLE_ALL)
+ adev->dm.idle_workqueue = idle_create_workqueue(adev);
+
+ if (adev->dm.dc->caps.max_links > 0 && adev->family >= AMDGPU_FAMILY_RV) {
--- /dev/null
+From 52d4e3fb3d340447dcdac0e14ff21a764f326907 Mon Sep 17 00:00:00 2001
+From: Tom Chung <chiahsuan.chung@amd.com>
+Date: Fri, 13 Sep 2024 15:44:40 +0800
+Subject: drm/amd/display: Fix system hang while resume with TBT monitor
+
+From: Tom Chung <chiahsuan.chung@amd.com>
+
+commit 52d4e3fb3d340447dcdac0e14ff21a764f326907 upstream.
+
+[Why]
+Connected with a Thunderbolt monitor and do the suspend and the system
+may hang while resume.
+
+The TBT monitor HPD will be triggered during the resume procedure
+and call the drm_client_modeset_probe() while
+struct drm_connector connector->dev->master is NULL.
+
+It will mess up the pipe topology after resume.
+
+[How]
+Skip the TBT monitor HPD during the resume procedure because we
+currently will probe the connectors after resume by default.
+
+Reviewed-by: Wayne Lin <wayne.lin@amd.com>
+Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
+Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 453f86a26945207a16b8f66aaed5962dc2b95b85)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -770,6 +770,12 @@ static void dmub_hpd_callback(struct amd
+ return;
+ }
+
++ /* Skip DMUB HPD IRQ in suspend/resume. We will probe them later. */
++ if (notify->type == DMUB_NOTIFICATION_HPD && adev->in_suspend) {
++ DRM_INFO("Skip DMUB HPD IRQ callback in suspend/resume\n");
++ return;
++ }
++
+ link_index = notify->link_index;
+ link = adev->dm.dc->links[link_index];
+ dev = adev->dm.ddev;
--- /dev/null
+From d51160ab00969ee6758ed2dcbc0f81dd476a181c Mon Sep 17 00:00:00 2001
+From: Fangzhi Zuo <Jerry.Zuo@amd.com>
+Date: Wed, 4 Sep 2024 15:29:24 -0400
+Subject: drm/amd/display: Restore Optimized pbn Value if Failed to Disable DSC
+
+From: Fangzhi Zuo <Jerry.Zuo@amd.com>
+
+commit d51160ab00969ee6758ed2dcbc0f81dd476a181c upstream.
+
+Existing last step of dsc policy is to restore pbn value under minimum compression
+when try to greedily disable dsc for a stream failed to fit in MST bw.
+Optimized dsc params result from optimization step is not necessarily the minimum compression,
+therefore it is not correct to restore the pbn under minimum compression rate.
+
+Restore the pbn under minimum compression instead of the value from optimized pbn could result
+in the dsc params not correct at the modeset where atomic_check failed due to not
+enough bw. One or more monitors connected could not light up in such case.
+
+Restore the optimized pbn value, instead of using the pbn value under minimum
+compression.
+
+Cc: Mario Limonciello <mario.limonciello@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Wayne Lin <wayne.lin@amd.com>
+Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
+Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 352c3165d2b75030169e012461a16bcf97f392fc)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 17 +++++++++---
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+@@ -1027,6 +1027,7 @@ static int try_disable_dsc(struct drm_at
+ int remaining_to_try = 0;
+ int ret;
+ uint16_t fec_overhead_multiplier_x1000 = get_fec_overhead_multiplier(dc_link);
++ int var_pbn;
+
+ for (i = 0; i < count; i++) {
+ if (vars[i + k].dsc_enabled
+@@ -1057,13 +1058,18 @@ static int try_disable_dsc(struct drm_at
+ break;
+
+ DRM_DEBUG_DRIVER("MST_DSC index #%d, try no compression\n", next_index);
++ var_pbn = vars[next_index].pbn;
+ vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps, fec_overhead_multiplier_x1000);
+ ret = drm_dp_atomic_find_time_slots(state,
+ params[next_index].port->mgr,
+ params[next_index].port,
+ vars[next_index].pbn);
+- if (ret < 0)
++ if (ret < 0) {
++ DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n",
++ __func__, __LINE__, next_index, ret);
++ vars[next_index].pbn = var_pbn;
+ return ret;
++ }
+
+ ret = drm_dp_mst_atomic_check(state);
+ if (ret == 0) {
+@@ -1071,14 +1077,17 @@ static int try_disable_dsc(struct drm_at
+ vars[next_index].dsc_enabled = false;
+ vars[next_index].bpp_x16 = 0;
+ } else {
+- DRM_DEBUG_DRIVER("MST_DSC index #%d, restore minimum compression\n", next_index);
+- vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps, fec_overhead_multiplier_x1000);
++ DRM_DEBUG_DRIVER("MST_DSC index #%d, restore optimized pbn value\n", next_index);
++ vars[next_index].pbn = var_pbn;
+ ret = drm_dp_atomic_find_time_slots(state,
+ params[next_index].port->mgr,
+ params[next_index].port,
+ vars[next_index].pbn);
+- if (ret < 0)
++ if (ret < 0) {
++ DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n",
++ __func__, __LINE__, next_index, ret);
+ return ret;
++ }
+ }
+
+ tried[next_index] = true;
--- /dev/null
+From 0d5e5e8a0aa49ea2163abf128da3b509a6c58286 Mon Sep 17 00:00:00 2001
+From: Yihan Zhu <Yihan.Zhu@amd.com>
+Date: Sat, 7 Sep 2024 13:25:19 -0400
+Subject: drm/amd/display: update DML2 policy EnhancedPrefetchScheduleAccelerationFinal DCN35
+
+From: Yihan Zhu <Yihan.Zhu@amd.com>
+
+commit 0d5e5e8a0aa49ea2163abf128da3b509a6c58286 upstream.
+
+[WHY & HOW]
+Mismatch in DCN35 DML2 cause bw validation failed to acquire unexpected DPP pipe to cause
+grey screen and system hang. Remove EnhancedPrefetchScheduleAccelerationFinal value override
+to match HW spec.
+
+Cc: Mario Limonciello <mario.limonciello@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Charlene Liu <charlene.liu@amd.com>
+Signed-off-by: Yihan Zhu <Yihan.Zhu@amd.com>
+Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 9dad21f910fcea2bdcff4af46159101d7f9cd8ba)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c
++++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c
+@@ -303,7 +303,6 @@ void build_unoptimized_policy_settings(e
+ if (project == dml_project_dcn35 ||
+ project == dml_project_dcn351) {
+ policy->DCCProgrammingAssumesScanDirectionUnknownFinal = false;
+- policy->EnhancedPrefetchScheduleAccelerationFinal = 0;
+ policy->AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter_if_possible; /*new*/
+ policy->UseOnlyMaxPrefetchModes = 1;
+ }
--- /dev/null
+From 394b52462020b6cceff1f7f47fdebd03589574f3 Mon Sep 17 00:00:00 2001
+From: Jani Nikula <jani.nikula@intel.com>
+Date: Wed, 18 Sep 2024 20:35:43 +0300
+Subject: drm/i915/gem: fix bitwise and logical AND mixup
+
+From: Jani Nikula <jani.nikula@intel.com>
+
+commit 394b52462020b6cceff1f7f47fdebd03589574f3 upstream.
+
+CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND is an int, defaulting to 250. When
+the wakeref is non-zero, it's either -1 or a dynamically allocated
+pointer, depending on CONFIG_DRM_I915_DEBUG_RUNTIME_PM. It's likely that
+the code works by coincidence with the bitwise AND, but with
+CONFIG_DRM_I915_DEBUG_RUNTIME_PM=y, there's the off chance that the
+condition evaluates to false, and intel_wakeref_auto() doesn't get
+called. Switch to the intended logical AND.
+
+v2: Use != to avoid clang -Wconstant-logical-operand (Nathan)
+
+Fixes: ad74457a6b5a ("drm/i915/dgfx: Release mmap on rpm suspend")
+Cc: Matthew Auld <matthew.auld@intel.com>
+Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Cc: Anshuman Gupta <anshuman.gupta@intel.com>
+Cc: Andi Shyti <andi.shyti@linux.intel.com>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Cc: stable@vger.kernel.org # v6.1+
+Reviewed-by: Matthew Auld <matthew.auld@intel.com>
+Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> # v1
+Link: https://patchwork.freedesktop.org/patch/msgid/643cc0a4d12f47fd8403d42581e83b1e9c4543c7.1726680898.git.jani.nikula@intel.com
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+(cherry picked from commit 4c1bfe259ed1d2ade826f95d437e1c41b274df04)
+Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
++++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+@@ -1131,7 +1131,7 @@ static vm_fault_t vm_fault_ttm(struct vm
+ GEM_WARN_ON(!i915_ttm_cpu_maps_iomem(bo->resource));
+ }
+
+- if (wakeref & CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
++ if (wakeref && CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND != 0)
+ intel_wakeref_auto(&to_i915(obj->base.dev)->runtime_pm.userfault_wakeref,
+ msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
+
--- /dev/null
+From f9e7ac6e2e9986c2ee63224992cb5c8276e46b2a Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon@collabora.com>
+Date: Thu, 5 Sep 2024 09:01:54 +0200
+Subject: drm/panthor: Don't add write fences to the shared BOs
+
+From: Boris Brezillon <boris.brezillon@collabora.com>
+
+commit f9e7ac6e2e9986c2ee63224992cb5c8276e46b2a upstream.
+
+The only user (the mesa gallium driver) is already assuming explicit
+synchronization and doing the export/import dance on shared BOs. The
+only reason we were registering ourselves as writers on external BOs
+is because Xe, which was the reference back when we developed Panthor,
+was doing so. Turns out Xe was wrong, and we really want bookkeep on
+all registered fences, so userspace can explicitly upgrade those to
+read/write when needed.
+
+Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block")
+Cc: Matthew Brost <matthew.brost@intel.com>
+Cc: Simona Vetter <simona.vetter@ffwll.ch>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
+Reviewed-by: Steven Price <steven.price@arm.com>
+Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240905070155.3254011-1-boris.brezillon@collabora.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/panthor/panthor_sched.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+--- a/drivers/gpu/drm/panthor/panthor_sched.c
++++ b/drivers/gpu/drm/panthor/panthor_sched.c
+@@ -3436,13 +3436,8 @@ void panthor_job_update_resvs(struct drm
+ {
+ struct panthor_job *job = container_of(sched_job, struct panthor_job, base);
+
+- /* Still not sure why we want USAGE_WRITE for external objects, since I
+- * was assuming this would be handled through explicit syncs being imported
+- * to external BOs with DMA_BUF_IOCTL_IMPORT_SYNC_FILE, but other drivers
+- * seem to pass DMA_RESV_USAGE_WRITE, so there must be a good reason.
+- */
+ panthor_vm_update_resvs(job->group->vm, exec, &sched_job->s_fence->finished,
+- DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_WRITE);
++ DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_BOOKKEEP);
+ }
+
+ void panthor_sched_unplug(struct panthor_device *ptdev)
--- /dev/null
+From 7a1f30afe97294281a2ba05977688385744f9844 Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon@collabora.com>
+Date: Thu, 5 Sep 2024 09:19:14 +0200
+Subject: drm/panthor: Don't declare a queue blocked if deferred operations are pending
+
+From: Boris Brezillon <boris.brezillon@collabora.com>
+
+commit 7a1f30afe97294281a2ba05977688385744f9844 upstream.
+
+If deferred operations are pending, we want to wait for those to
+land before declaring the queue blocked on a SYNC_WAIT. We need
+this to deal with the case where the sync object is signalled through
+a deferred SYNC_{ADD,SET} from the same queue. If we don't do that
+and the group gets scheduled out before the deferred SYNC_{SET,ADD}
+is executed, we'll end up with a timeout, because no external
+SYNC_{SET,ADD} will make the scheduler reconsider the group for
+execution.
+
+Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
+Reviewed-by: Steven Price <steven.price@arm.com>
+Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240905071914.3278599-1-boris.brezillon@collabora.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/panthor/panthor_sched.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/panthor/panthor_sched.c
++++ b/drivers/gpu/drm/panthor/panthor_sched.c
+@@ -1103,7 +1103,13 @@ cs_slot_sync_queue_state_locked(struct p
+ list_move_tail(&group->wait_node,
+ &group->ptdev->scheduler->groups.waiting);
+ }
+- group->blocked_queues |= BIT(cs_id);
++
++ /* The queue is only blocked if there's no deferred operation
++ * pending, which can be checked through the scoreboard status.
++ */
++ if (!cs_iface->output->status_scoreboards)
++ group->blocked_queues |= BIT(cs_id);
++
+ queue->syncwait.gpu_va = cs_iface->output->status_wait_sync_ptr;
+ queue->syncwait.ref = cs_iface->output->status_wait_sync_value;
+ status_wait_cond = cs_iface->output->status_wait & CS_STATUS_WAIT_SYNC_COND_MASK;
--- /dev/null
+From 282864cc5d3f144af0cdea1868ee2dc2c5110f0d Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon@collabora.com>
+Date: Mon, 30 Sep 2024 18:37:42 +0200
+Subject: drm/panthor: Fix access to uninitialized variable in tick_ctx_cleanup()
+
+From: Boris Brezillon <boris.brezillon@collabora.com>
+
+commit 282864cc5d3f144af0cdea1868ee2dc2c5110f0d upstream.
+
+The group variable can't be used to retrieve ptdev in our second loop,
+because it points to the previously iterated list_head, not a valid
+group. Get the ptdev object from the scheduler instead.
+
+Cc: <stable@vger.kernel.org>
+Fixes: d72f049087d4 ("drm/panthor: Allow driver compilation")
+Reported-by: kernel test robot <lkp@intel.com>
+Reported-by: Julia Lawall <julia.lawall@inria.fr>
+Closes: https://lore.kernel.org/r/202409302306.UDikqa03-lkp@intel.com/
+Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
+Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240930163742.87036-1-boris.brezillon@collabora.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/panthor/panthor_sched.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/panthor/panthor_sched.c
++++ b/drivers/gpu/drm/panthor/panthor_sched.c
+@@ -2046,6 +2046,7 @@ static void
+ tick_ctx_cleanup(struct panthor_scheduler *sched,
+ struct panthor_sched_tick_ctx *ctx)
+ {
++ struct panthor_device *ptdev = sched->ptdev;
+ struct panthor_group *group, *tmp;
+ u32 i;
+
+@@ -2054,7 +2055,7 @@ tick_ctx_cleanup(struct panthor_schedule
+ /* If everything went fine, we should only have groups
+ * to be terminated in the old_groups lists.
+ */
+- drm_WARN_ON(&group->ptdev->base, !ctx->csg_upd_failed_mask &&
++ drm_WARN_ON(&ptdev->base, !ctx->csg_upd_failed_mask &&
+ group_can_run(group));
+
+ if (!group_can_run(group)) {
+@@ -2077,7 +2078,7 @@ tick_ctx_cleanup(struct panthor_schedule
+ /* If everything went fine, the groups to schedule lists should
+ * be empty.
+ */
+- drm_WARN_ON(&group->ptdev->base,
++ drm_WARN_ON(&ptdev->base,
+ !ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i]));
+
+ list_for_each_entry_safe(group, tmp, &ctx->groups[i], run_node) {
--- /dev/null
+From 4286cc2c953983d44d248c9de1c81d3a9643345c Mon Sep 17 00:00:00 2001
+From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+Date: Fri, 13 Sep 2024 17:05:52 +0100
+Subject: drm/sched: Add locking to drm_sched_entity_modify_sched
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+
+commit 4286cc2c953983d44d248c9de1c81d3a9643345c upstream.
+
+Without the locking amdgpu currently can race between
+amdgpu_ctx_set_entity_priority() (via drm_sched_entity_modify_sched()) and
+drm_sched_job_arm(), leading to the latter accesing potentially
+inconsitent entity->sched_list and entity->num_sched_list pair.
+
+v2:
+ * Improve commit message. (Philipp)
+
+Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+Fixes: b37aced31eb0 ("drm/scheduler: implement a function to modify sched list")
+Cc: Christian König <christian.koenig@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Cc: Luben Tuikov <ltuikov89@gmail.com>
+Cc: Matthew Brost <matthew.brost@intel.com>
+Cc: David Airlie <airlied@gmail.com>
+Cc: Daniel Vetter <daniel@ffwll.ch>
+Cc: dri-devel@lists.freedesktop.org
+Cc: Philipp Stanner <pstanner@redhat.com>
+Cc: <stable@vger.kernel.org> # v5.7+
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240913160559.49054-2-tursulin@igalia.com
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/scheduler/sched_entity.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/scheduler/sched_entity.c
++++ b/drivers/gpu/drm/scheduler/sched_entity.c
+@@ -133,8 +133,10 @@ void drm_sched_entity_modify_sched(struc
+ {
+ WARN_ON(!num_sched_list || !sched_list);
+
++ spin_lock(&entity->rq_lock);
+ entity->sched_list = sched_list;
+ entity->num_sched_list = num_sched_list;
++ spin_unlock(&entity->rq_lock);
+ }
+ EXPORT_SYMBOL(drm_sched_entity_modify_sched);
+
--- /dev/null
+From 087913e0ba2b3b9d7ccbafb2acf5dab9e35ae1d5 Mon Sep 17 00:00:00 2001
+From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+Date: Tue, 24 Sep 2024 11:19:09 +0100
+Subject: drm/sched: Always increment correct scheduler score
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+
+commit 087913e0ba2b3b9d7ccbafb2acf5dab9e35ae1d5 upstream.
+
+Entities run queue can change during drm_sched_entity_push_job() so make
+sure to update the score consistently.
+
+Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+Fixes: d41a39dda140 ("drm/scheduler: improve job distribution with multiple queues")
+Cc: Nirmoy Das <nirmoy.das@amd.com>
+Cc: Christian König <christian.koenig@amd.com>
+Cc: Luben Tuikov <ltuikov89@gmail.com>
+Cc: Matthew Brost <matthew.brost@intel.com>
+Cc: David Airlie <airlied@gmail.com>
+Cc: Daniel Vetter <daniel@ffwll.ch>
+Cc: dri-devel@lists.freedesktop.org
+Cc: <stable@vger.kernel.org> # v5.9+
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240924101914.2713-4-tursulin@igalia.com
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/scheduler/sched_entity.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/scheduler/sched_entity.c
++++ b/drivers/gpu/drm/scheduler/sched_entity.c
+@@ -586,7 +586,6 @@ void drm_sched_entity_push_job(struct dr
+ ktime_t submit_ts;
+
+ trace_drm_sched_job(sched_job, entity);
+- atomic_inc(entity->rq->sched->score);
+ WRITE_ONCE(entity->last_user, current->group_leader);
+
+ /*
+@@ -614,6 +613,7 @@ void drm_sched_entity_push_job(struct dr
+ rq = entity->rq;
+ sched = rq->sched;
+
++ atomic_inc(sched->score);
+ drm_sched_rq_add_entity(rq, entity);
+ spin_unlock(&entity->rq_lock);
+
--- /dev/null
+From cbc8764e29c2318229261a679b2aafd0f9072885 Mon Sep 17 00:00:00 2001
+From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+Date: Tue, 24 Sep 2024 11:19:08 +0100
+Subject: drm/sched: Always wake up correct scheduler in drm_sched_entity_push_job
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+
+commit cbc8764e29c2318229261a679b2aafd0f9072885 upstream.
+
+Since drm_sched_entity_modify_sched() can modify the entities run queue,
+lets make sure to only dereference the pointer once so both adding and
+waking up are guaranteed to be consistent.
+
+Alternative of moving the spin_unlock to after the wake up would for now
+be more problematic since the same lock is taken inside
+drm_sched_rq_update_fifo().
+
+v2:
+ * Improve commit message. (Philipp)
+ * Cache the scheduler pointer directly. (Christian)
+
+Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
+Fixes: b37aced31eb0 ("drm/scheduler: implement a function to modify sched list")
+Cc: Christian König <christian.koenig@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Cc: Luben Tuikov <ltuikov89@gmail.com>
+Cc: Matthew Brost <matthew.brost@intel.com>
+Cc: David Airlie <airlied@gmail.com>
+Cc: Daniel Vetter <daniel@ffwll.ch>
+Cc: Philipp Stanner <pstanner@redhat.com>
+Cc: dri-devel@lists.freedesktop.org
+Cc: <stable@vger.kernel.org> # v5.7+
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240924101914.2713-3-tursulin@igalia.com
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/scheduler/sched_entity.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/scheduler/sched_entity.c
++++ b/drivers/gpu/drm/scheduler/sched_entity.c
+@@ -599,6 +599,9 @@ void drm_sched_entity_push_job(struct dr
+
+ /* first job wakes up scheduler */
+ if (first) {
++ struct drm_gpu_scheduler *sched;
++ struct drm_sched_rq *rq;
++
+ /* Add the entity to the run queue */
+ spin_lock(&entity->rq_lock);
+ if (entity->stopped) {
+@@ -608,13 +611,16 @@ void drm_sched_entity_push_job(struct dr
+ return;
+ }
+
+- drm_sched_rq_add_entity(entity->rq, entity);
++ rq = entity->rq;
++ sched = rq->sched;
++
++ drm_sched_rq_add_entity(rq, entity);
+ spin_unlock(&entity->rq_lock);
+
+ if (drm_sched_policy == DRM_SCHED_POLICY_FIFO)
+ drm_sched_rq_update_fifo(entity, submit_ts);
+
+- drm_sched_wakeup(entity->rq->sched);
++ drm_sched_wakeup(sched);
+ }
+ }
+ EXPORT_SYMBOL(drm_sched_entity_push_job);
--- /dev/null
+From 440d52b370b03b366fd26ace36bab20552116145 Mon Sep 17 00:00:00 2001
+From: Rob Clark <robdclark@chromium.org>
+Date: Fri, 13 Sep 2024 13:23:01 -0700
+Subject: drm/sched: Fix dynamic job-flow control race
+
+From: Rob Clark <robdclark@chromium.org>
+
+commit 440d52b370b03b366fd26ace36bab20552116145 upstream.
+
+Fixes a race condition reported here: https://github.com/AsahiLinux/linux/issues/309#issuecomment-2238968609
+
+The whole premise of lockless access to a single-producer-single-
+consumer queue is that there is just a single producer and single
+consumer. That means we can't call drm_sched_can_queue() (which is
+about queueing more work to the hw, not to the spsc queue) from
+anywhere other than the consumer (wq).
+
+This call in the producer is just an optimization to avoid scheduling
+the consuming worker if it cannot yet queue more work to the hw. It
+is safe to drop this optimization to avoid the race condition.
+
+Suggested-by: Asahi Lina <lina@asahilina.net>
+Fixes: a78422e9dff3 ("drm/sched: implement dynamic job-flow control")
+Closes: https://github.com/AsahiLinux/linux/issues/309
+Cc: stable@vger.kernel.org
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+Reviewed-by: Danilo Krummrich <dakr@kernel.org>
+Tested-by: Janne Grunau <j@jannau.net>
+Signed-off-by: Danilo Krummrich <dakr@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240913202301.16772-1-robdclark@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/scheduler/sched_entity.c | 4 ++--
+ drivers/gpu/drm/scheduler/sched_main.c | 7 ++-----
+ include/drm/gpu_scheduler.h | 2 +-
+ 3 files changed, 5 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/scheduler/sched_entity.c
++++ b/drivers/gpu/drm/scheduler/sched_entity.c
+@@ -380,7 +380,7 @@ static void drm_sched_entity_wakeup(stru
+ container_of(cb, struct drm_sched_entity, cb);
+
+ drm_sched_entity_clear_dep(f, cb);
+- drm_sched_wakeup(entity->rq->sched, entity);
++ drm_sched_wakeup(entity->rq->sched);
+ }
+
+ /**
+@@ -612,7 +612,7 @@ void drm_sched_entity_push_job(struct dr
+ if (drm_sched_policy == DRM_SCHED_POLICY_FIFO)
+ drm_sched_rq_update_fifo(entity, submit_ts);
+
+- drm_sched_wakeup(entity->rq->sched, entity);
++ drm_sched_wakeup(entity->rq->sched);
+ }
+ }
+ EXPORT_SYMBOL(drm_sched_entity_push_job);
+--- a/drivers/gpu/drm/scheduler/sched_main.c
++++ b/drivers/gpu/drm/scheduler/sched_main.c
+@@ -1022,15 +1022,12 @@ EXPORT_SYMBOL(drm_sched_job_cleanup);
+ /**
+ * drm_sched_wakeup - Wake up the scheduler if it is ready to queue
+ * @sched: scheduler instance
+- * @entity: the scheduler entity
+ *
+ * Wake up the scheduler if we can queue jobs.
+ */
+-void drm_sched_wakeup(struct drm_gpu_scheduler *sched,
+- struct drm_sched_entity *entity)
++void drm_sched_wakeup(struct drm_gpu_scheduler *sched)
+ {
+- if (drm_sched_can_queue(sched, entity))
+- drm_sched_run_job_queue(sched);
++ drm_sched_run_job_queue(sched);
+ }
+
+ /**
+--- a/include/drm/gpu_scheduler.h
++++ b/include/drm/gpu_scheduler.h
+@@ -574,7 +574,7 @@ void drm_sched_entity_modify_sched(struc
+
+ void drm_sched_tdr_queue_imm(struct drm_gpu_scheduler *sched);
+ void drm_sched_job_cleanup(struct drm_sched_job *job);
+-void drm_sched_wakeup(struct drm_gpu_scheduler *sched, struct drm_sched_entity *entity);
++void drm_sched_wakeup(struct drm_gpu_scheduler *sched);
+ bool drm_sched_wqueue_ready(struct drm_gpu_scheduler *sched);
+ void drm_sched_wqueue_stop(struct drm_gpu_scheduler *sched);
+ void drm_sched_wqueue_start(struct drm_gpu_scheduler *sched);
rtla-fix-the-help-text-in-osnoise-and-timerlat-top-tools.patch
firmware-sysfb-disable-sysfb-for-firmware-buffers-with-unknown-parent.patch
close_range-fix-the-logics-in-descriptor-table-trimming.patch
+drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch
+drm-panthor-don-t-add-write-fences-to-the-shared-bos.patch
+drm-panthor-fix-access-to-uninitialized-variable-in-tick_ctx_cleanup.patch
+drm-panthor-don-t-declare-a-queue-blocked-if-deferred-operations-are-pending.patch
+drm-sched-fix-dynamic-job-flow-control-race.patch
+drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch
+drm-sched-always-wake-up-correct-scheduler-in-drm_sched_entity_push_job.patch
+drm-sched-always-increment-correct-scheduler-score.patch
+drm-amd-display-restore-optimized-pbn-value-if-failed-to-disable-dsc.patch
+drm-amd-display-add-hdr-workaround-for-specific-edp.patch
+drm-amd-display-enable-idle-workqueue-for-more-ips-modes.patch
+drm-amd-display-update-dml2-policy-enhancedprefetchscheduleaccelerationfinal-dcn35.patch
+drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch