From: Greg Kroah-Hartman Date: Sat, 18 Sep 2021 13:04:05 +0000 (+0200) Subject: 5.14-stable patches X-Git-Tag: v4.4.284~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8afec67b06ef011e2a1942904b303d2ffb7eb6e8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.14-stable patches added patches: drm-etnaviv-add-missing-mmu-context-put-when-reaping-mmu-mapping.patch drm-etnaviv-exec-and-mmu-state-is-lost-when-resetting-the-gpu.patch drm-etnaviv-fix-mmu-context-leak-on-gpu-reset.patch drm-etnaviv-keep-mmu-context-across-runtime-suspend-resume.patch drm-etnaviv-put-submit-prev-mmu-context-when-it-exists.patch drm-etnaviv-reference-mmu-context-when-setting-up-hardware-state.patch drm-etnaviv-return-context-from-etnaviv_iommu_context_get.patch drm-etnaviv-stop-abusing-mmu_context-as-fe-running-marker.patch drm-i915-dp-use-max-params-for-panels-edp-1.4.patch --- diff --git a/queue-5.14/drm-etnaviv-add-missing-mmu-context-put-when-reaping-mmu-mapping.patch b/queue-5.14/drm-etnaviv-add-missing-mmu-context-put-when-reaping-mmu-mapping.patch new file mode 100644 index 00000000000..c324adf5942 --- /dev/null +++ b/queue-5.14/drm-etnaviv-add-missing-mmu-context-put-when-reaping-mmu-mapping.patch @@ -0,0 +1,34 @@ +From f2faea8b64125852fa9acc6771c07fc0311a039b Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:30 +0200 +Subject: drm/etnaviv: add missing MMU context put when reaping MMU mapping + +From: Lucas Stach + +commit f2faea8b64125852fa9acc6771c07fc0311a039b upstream. + +When we forcefully evict a mapping from the the address space and thus the +MMU context, the MMU context is leaked, as the mapping no longer points to +it, so it doesn't get freed when the GEM object is destroyed. Add the +mssing context put to fix the leak. + +Cc: stable@vger.kernel.org # 5.4 +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +@@ -199,6 +199,7 @@ static int etnaviv_iommu_find_iova(struc + */ + list_for_each_entry_safe(m, n, &list, scan_node) { + etnaviv_iommu_remove_mapping(context, m); ++ etnaviv_iommu_context_put(m->context); + m->context = NULL; + list_del_init(&m->mmu_node); + list_del_init(&m->scan_node); diff --git a/queue-5.14/drm-etnaviv-exec-and-mmu-state-is-lost-when-resetting-the-gpu.patch b/queue-5.14/drm-etnaviv-exec-and-mmu-state-is-lost-when-resetting-the-gpu.patch new file mode 100644 index 00000000000..a0c0b82b434 --- /dev/null +++ b/queue-5.14/drm-etnaviv-exec-and-mmu-state-is-lost-when-resetting-the-gpu.patch @@ -0,0 +1,51 @@ +From 725cbc7884c37f3b4f1777bc1aea6432cded8ca5 Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:27 +0200 +Subject: drm/etnaviv: exec and MMU state is lost when resetting the GPU + +From: Lucas Stach + +commit 725cbc7884c37f3b4f1777bc1aea6432cded8ca5 upstream. + +When the GPU is reset both the current exec state, as well as all MMU +state is lost. Move the driver side state tracking into the reset function +to keep hardware and software state from diverging. + +Cc: stable@vger.kernel.org # 5.4 +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -570,6 +570,8 @@ static int etnaviv_hw_reset(struct etnav + etnaviv_gpu_update_clock(gpu); + + gpu->fe_running = false; ++ gpu->exec_state = -1; ++ gpu->mmu_context = NULL; + + return 0; + } +@@ -830,7 +832,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu + /* Now program the hardware */ + mutex_lock(&gpu->lock); + etnaviv_gpu_hw_init(gpu); +- gpu->exec_state = -1; + mutex_unlock(&gpu->lock); + + pm_runtime_mark_last_busy(gpu->dev); +@@ -1055,8 +1056,6 @@ void etnaviv_gpu_recover_hang(struct etn + spin_unlock(&gpu->event_spinlock); + + etnaviv_gpu_hw_init(gpu); +- gpu->exec_state = -1; +- gpu->mmu_context = NULL; + + mutex_unlock(&gpu->lock); + pm_runtime_mark_last_busy(gpu->dev); diff --git a/queue-5.14/drm-etnaviv-fix-mmu-context-leak-on-gpu-reset.patch b/queue-5.14/drm-etnaviv-fix-mmu-context-leak-on-gpu-reset.patch new file mode 100644 index 00000000000..b3d113ea46f --- /dev/null +++ b/queue-5.14/drm-etnaviv-fix-mmu-context-leak-on-gpu-reset.patch @@ -0,0 +1,35 @@ +From f978a5302f5566480c58ffae64a16d34456801bd Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:28 +0200 +Subject: drm/etnaviv: fix MMU context leak on GPU reset + +From: Lucas Stach + +commit f978a5302f5566480c58ffae64a16d34456801bd upstream. + +After a reset the GPU is no longer using the MMU context and may be +restarted with a different context. While the mmu_state proeprly was +cleared, the context wasn't unreferenced, leading to a memory leak. + +Cc: stable@vger.kernel.org # 5.4 +Reported-by: Michael Walle +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -571,6 +571,8 @@ static int etnaviv_hw_reset(struct etnav + + gpu->fe_running = false; + gpu->exec_state = -1; ++ if (gpu->mmu_context) ++ etnaviv_iommu_context_put(gpu->mmu_context); + gpu->mmu_context = NULL; + + return 0; diff --git a/queue-5.14/drm-etnaviv-keep-mmu-context-across-runtime-suspend-resume.patch b/queue-5.14/drm-etnaviv-keep-mmu-context-across-runtime-suspend-resume.patch new file mode 100644 index 00000000000..b24c174351f --- /dev/null +++ b/queue-5.14/drm-etnaviv-keep-mmu-context-across-runtime-suspend-resume.patch @@ -0,0 +1,50 @@ +From 8f3eea9d01d7b0f95b0fe04187c0059019ada85b Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:26 +0200 +Subject: drm/etnaviv: keep MMU context across runtime suspend/resume + +From: Lucas Stach + +commit 8f3eea9d01d7b0f95b0fe04187c0059019ada85b upstream. + +The MMU state may be kept across a runtime suspend/resume cycle, as we +avoid a full hardware reset to keep the latency of the runtime PM small. + +Don't pretend that the MMU state is lost in driver state. The MMU +context is pushed out when new HW jobs with a different context are +coming in. The only exception to this is when the GPU is unbound, in +which case we need to make sure to also free the last active context. + +Cc: stable@vger.kernel.org # 5.4 +Reported-by: Michael Walle +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -1590,9 +1590,6 @@ static int etnaviv_gpu_hw_suspend(struct + */ + etnaviv_gpu_wait_idle(gpu, 100); + +- etnaviv_iommu_context_put(gpu->mmu_context); +- gpu->mmu_context = NULL; +- + gpu->fe_running = false; + } + +@@ -1741,6 +1738,9 @@ static void etnaviv_gpu_unbind(struct de + etnaviv_gpu_hw_suspend(gpu); + #endif + ++ if (gpu->mmu_context) ++ etnaviv_iommu_context_put(gpu->mmu_context); ++ + if (gpu->initialized) { + etnaviv_cmdbuf_free(&gpu->buffer); + etnaviv_iommu_global_fini(gpu); diff --git a/queue-5.14/drm-etnaviv-put-submit-prev-mmu-context-when-it-exists.patch b/queue-5.14/drm-etnaviv-put-submit-prev-mmu-context-when-it-exists.patch new file mode 100644 index 00000000000..e5fd68804de --- /dev/null +++ b/queue-5.14/drm-etnaviv-put-submit-prev-mmu-context-when-it-exists.patch @@ -0,0 +1,36 @@ +From cda7532916f7bc860b36a1806cb8352e6f63dacb Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:24 +0200 +Subject: drm/etnaviv: put submit prev MMU context when it exists + +From: Lucas Stach + +commit cda7532916f7bc860b36a1806cb8352e6f63dacb upstream. + +The prev context is the MMU context at the time of the job +queueing in hardware. As a job might be queued multiple times +due to recovery after a GPU hang, we need to make sure to put +the stale prev MMU context from a prior queuing, to avoid the +reference and thus the MMU context leaking. + +Cc: stable@vger.kernel.org # 5.4 +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -1368,6 +1368,8 @@ struct dma_fence *etnaviv_gpu_submit(str + gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); + etnaviv_gpu_start_fe_idleloop(gpu); + } else { ++ if (submit->prev_mmu_context) ++ etnaviv_iommu_context_put(submit->prev_mmu_context); + submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); + } + diff --git a/queue-5.14/drm-etnaviv-reference-mmu-context-when-setting-up-hardware-state.patch b/queue-5.14/drm-etnaviv-reference-mmu-context-when-setting-up-hardware-state.patch new file mode 100644 index 00000000000..f918d042d2a --- /dev/null +++ b/queue-5.14/drm-etnaviv-reference-mmu-context-when-setting-up-hardware-state.patch @@ -0,0 +1,110 @@ +From d6408538f091fb22d47f792d4efa58143d56c3fb Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:29 +0200 +Subject: drm/etnaviv: reference MMU context when setting up hardware state + +From: Lucas Stach + +commit d6408538f091fb22d47f792d4efa58143d56c3fb upstream. + +Move the refcount manipulation of the MMU context to the point where the +hardware state is programmed. At that point it is also known if a previous +MMU state is still there, or the state needs to be reprogrammed with a +potentially different context. + +Cc: stable@vger.kernel.org # 5.4 +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 24 ++++++++++++------------ + drivers/gpu/drm/etnaviv/etnaviv_iommu.c | 4 ++++ + drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c | 8 ++++++++ + 3 files changed, 24 insertions(+), 12 deletions(-) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -641,17 +641,19 @@ void etnaviv_gpu_start_fe(struct etnaviv + gpu->fe_running = true; + } + +-static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu) ++static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu, ++ struct etnaviv_iommu_context *context) + { +- u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer, +- &gpu->mmu_context->cmdbuf_mapping); + u16 prefetch; ++ u32 address; + + /* setup the MMU */ +- etnaviv_iommu_restore(gpu, gpu->mmu_context); ++ etnaviv_iommu_restore(gpu, context); + + /* Start command processor */ + prefetch = etnaviv_buffer_init(gpu); ++ address = etnaviv_cmdbuf_get_va(&gpu->buffer, ++ &gpu->mmu_context->cmdbuf_mapping); + + etnaviv_gpu_start_fe(gpu, address, prefetch); + } +@@ -1369,14 +1371,12 @@ struct dma_fence *etnaviv_gpu_submit(str + goto out_unlock; + } + +- if (!gpu->fe_running) { +- gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); +- etnaviv_gpu_start_fe_idleloop(gpu); +- } else { +- if (submit->prev_mmu_context) +- etnaviv_iommu_context_put(submit->prev_mmu_context); +- submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); +- } ++ if (!gpu->fe_running) ++ etnaviv_gpu_start_fe_idleloop(gpu, submit->mmu_context); ++ ++ if (submit->prev_mmu_context) ++ etnaviv_iommu_context_put(submit->prev_mmu_context); ++ submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); + + if (submit->nr_pmrs) { + gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre; +--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c +@@ -92,6 +92,10 @@ static void etnaviv_iommuv1_restore(stru + struct etnaviv_iommuv1_context *v1_context = to_v1_context(context); + u32 pgtable; + ++ if (gpu->mmu_context) ++ etnaviv_iommu_context_put(gpu->mmu_context); ++ gpu->mmu_context = etnaviv_iommu_context_get(context); ++ + /* set base addresses */ + gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_RA, context->global->memory_base); + gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_FE, context->global->memory_base); +--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c +@@ -172,6 +172,10 @@ static void etnaviv_iommuv2_restore_nons + if (gpu_read(gpu, VIVS_MMUv2_CONTROL) & VIVS_MMUv2_CONTROL_ENABLE) + return; + ++ if (gpu->mmu_context) ++ etnaviv_iommu_context_put(gpu->mmu_context); ++ gpu->mmu_context = etnaviv_iommu_context_get(context); ++ + prefetch = etnaviv_buffer_config_mmuv2(gpu, + (u32)v2_context->mtlb_dma, + (u32)context->global->bad_page_dma); +@@ -192,6 +196,10 @@ static void etnaviv_iommuv2_restore_sec( + if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) & VIVS_MMUv2_SEC_CONTROL_ENABLE) + return; + ++ if (gpu->mmu_context) ++ etnaviv_iommu_context_put(gpu->mmu_context); ++ gpu->mmu_context = etnaviv_iommu_context_get(context); ++ + gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_LOW, + lower_32_bits(context->global->v2.pta_dma)); + gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_HIGH, diff --git a/queue-5.14/drm-etnaviv-return-context-from-etnaviv_iommu_context_get.patch b/queue-5.14/drm-etnaviv-return-context-from-etnaviv_iommu_context_get.patch new file mode 100644 index 00000000000..59591ae97a2 --- /dev/null +++ b/queue-5.14/drm-etnaviv-return-context-from-etnaviv_iommu_context_get.patch @@ -0,0 +1,94 @@ +From 78edefc05e41352099ffb8f06f8d9b2d091e29cd Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:23 +0200 +Subject: drm/etnaviv: return context from etnaviv_iommu_context_get + +From: Lucas Stach + +commit 78edefc05e41352099ffb8f06f8d9b2d091e29cd upstream. + +Being able to have the refcount manipulation in an assignment makes +it much easier to parse the code. + +Cc: stable@vger.kernel.org # 5.4 +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 3 +-- + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 +-- + drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 3 +-- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 6 ++---- + drivers/gpu/drm/etnaviv/etnaviv_mmu.h | 4 +++- + 5 files changed, 8 insertions(+), 11 deletions(-) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c +@@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv + if (switch_mmu_context) { + struct etnaviv_iommu_context *old_context = gpu->mmu_context; + +- etnaviv_iommu_context_get(mmu_context); +- gpu->mmu_context = mmu_context; ++ gpu->mmu_context = etnaviv_iommu_context_get(mmu_context); + etnaviv_iommu_context_put(old_context); + } + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +@@ -303,8 +303,7 @@ struct etnaviv_vram_mapping *etnaviv_gem + list_del(&mapping->obj_node); + } + +- etnaviv_iommu_context_get(mmu_context); +- mapping->context = mmu_context; ++ mapping->context = etnaviv_iommu_context_get(mmu_context); + mapping->use = 1; + + ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj, +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +@@ -532,8 +532,7 @@ int etnaviv_ioctl_gem_submit(struct drm_ + goto err_submit_objects; + + submit->ctx = file->driver_priv; +- etnaviv_iommu_context_get(submit->ctx->mmu); +- submit->mmu_context = submit->ctx->mmu; ++ submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu); + submit->exec_state = args->exec_state; + submit->flags = args->flags; + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -1365,12 +1365,10 @@ struct dma_fence *etnaviv_gpu_submit(str + } + + if (!gpu->mmu_context) { +- etnaviv_iommu_context_get(submit->mmu_context); +- gpu->mmu_context = submit->mmu_context; ++ gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); + etnaviv_gpu_start_fe_idleloop(gpu); + } else { +- etnaviv_iommu_context_get(gpu->mmu_context); +- submit->prev_mmu_context = gpu->mmu_context; ++ submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); + } + + if (submit->nr_pmrs) { +--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h ++++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h +@@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_i + struct etnaviv_iommu_context * + etnaviv_iommu_context_init(struct etnaviv_iommu_global *global, + struct etnaviv_cmdbuf_suballoc *suballoc); +-static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) ++static inline struct etnaviv_iommu_context * ++etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) + { + kref_get(&ctx->refcount); ++ return ctx; + } + void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx); + void etnaviv_iommu_restore(struct etnaviv_gpu *gpu, diff --git a/queue-5.14/drm-etnaviv-stop-abusing-mmu_context-as-fe-running-marker.patch b/queue-5.14/drm-etnaviv-stop-abusing-mmu_context-as-fe-running-marker.patch new file mode 100644 index 00000000000..0fa8b3f8522 --- /dev/null +++ b/queue-5.14/drm-etnaviv-stop-abusing-mmu_context-as-fe-running-marker.patch @@ -0,0 +1,82 @@ +From 23e0f5a57d0ecec86e1fc82194acd94aede21a46 Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 20 Aug 2021 22:18:25 +0200 +Subject: drm/etnaviv: stop abusing mmu_context as FE running marker + +From: Lucas Stach + +commit 23e0f5a57d0ecec86e1fc82194acd94aede21a46 upstream. + +While the DMA frontend can only be active when the MMU context is set, the +reverse isn't necessarily true, as the frontend can be stopped while the +MMU state is kept. Stop treating mmu_context being set as a indication that +the frontend is running and instead add a explicit property. + +Cc: stable@vger.kernel.org # 5.4 +Signed-off-by: Lucas Stach +Tested-by: Michael Walle +Tested-by: Marek Vasut +Reviewed-by: Christian Gmeiner +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 10 ++++++++-- + drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 + + 2 files changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +@@ -569,6 +569,8 @@ static int etnaviv_hw_reset(struct etnav + /* We rely on the GPU running, so program the clock */ + etnaviv_gpu_update_clock(gpu); + ++ gpu->fe_running = false; ++ + return 0; + } + +@@ -631,6 +633,8 @@ void etnaviv_gpu_start_fe(struct etnaviv + VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE | + VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch)); + } ++ ++ gpu->fe_running = true; + } + + static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu) +@@ -1364,7 +1368,7 @@ struct dma_fence *etnaviv_gpu_submit(str + goto out_unlock; + } + +- if (!gpu->mmu_context) { ++ if (!gpu->fe_running) { + gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); + etnaviv_gpu_start_fe_idleloop(gpu); + } else { +@@ -1573,7 +1577,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv + + static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) + { +- if (gpu->initialized && gpu->mmu_context) { ++ if (gpu->initialized && gpu->fe_running) { + /* Replace the last WAIT with END */ + mutex_lock(&gpu->lock); + etnaviv_buffer_end(gpu); +@@ -1588,6 +1592,8 @@ static int etnaviv_gpu_hw_suspend(struct + + etnaviv_iommu_context_put(gpu->mmu_context); + gpu->mmu_context = NULL; ++ ++ gpu->fe_running = false; + } + + gpu->exec_state = -1; +--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +@@ -101,6 +101,7 @@ struct etnaviv_gpu { + struct workqueue_struct *wq; + struct drm_gpu_scheduler sched; + bool initialized; ++ bool fe_running; + + /* 'ring'-buffer: */ + struct etnaviv_cmdbuf buffer; diff --git a/queue-5.14/drm-i915-dp-use-max-params-for-panels-edp-1.4.patch b/queue-5.14/drm-i915-dp-use-max-params-for-panels-edp-1.4.patch new file mode 100644 index 00000000000..e73cd601319 --- /dev/null +++ b/queue-5.14/drm-i915-dp-use-max-params-for-panels-edp-1.4.patch @@ -0,0 +1,62 @@ +From c8dead5751b81dfa6b10449b740ed1062ff670c5 Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Fri, 20 Aug 2021 15:52:59 +0800 +Subject: drm/i915/dp: Use max params for panels < eDP 1.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kai-Heng Feng + +commit c8dead5751b81dfa6b10449b740ed1062ff670c5 upstream. + +Users reported that after commit 2bbd6dba84d4 ("drm/i915: Try to use +fast+narrow link on eDP again and fall back to the old max strategy on +failure"), the screen starts to have wobbly effect. + +Commit a5c936add6a2 ("drm/i915/dp: Use slow and wide link training for +everything") doesn't help either, that means the affected eDP 1.2 panels +only work with max params. + +So use max params for panels < eDP 1.4 as Windows does to solve the +issue. + +v3: + - Do the eDP rev check in intel_edp_init_dpcd() + +v2: + - Check eDP 1.4 instead of DPCD 1.1 to apply max params + +Cc: stable@vger.kernel.org +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/3714 +Fixes: 2bbd6dba84d4 ("drm/i915: Try to use fast+narrow link on eDP again and fall back to the old max strategy on failure") +Fixes: a5c936add6a2 ("drm/i915/dp: Use slow and wide link training for everything") +Suggested-by: Ville Syrjälä +Signed-off-by: Kai-Heng Feng +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20210820075301.693099-1-kai.heng.feng@canonical.com +(cherry picked from commit d7f213c131adf0bec8b731553eb82990cdac265d) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/display/intel_dp.c ++++ b/drivers/gpu/drm/i915/display/intel_dp.c +@@ -2453,11 +2453,14 @@ intel_edp_init_dpcd(struct intel_dp *int + */ + if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, + intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) == +- sizeof(intel_dp->edp_dpcd)) ++ sizeof(intel_dp->edp_dpcd)) { + drm_dbg_kms(&dev_priv->drm, "eDP DPCD: %*ph\n", + (int)sizeof(intel_dp->edp_dpcd), + intel_dp->edp_dpcd); + ++ intel_dp->use_max_params = intel_dp->edp_dpcd[0] < DP_EDP_14; ++ } ++ + /* + * This has to be called after intel_dp->edp_dpcd is filled, PSR checks + * for SET_POWER_CAPABLE bit in intel_dp->edp_dpcd[1] diff --git a/queue-5.14/series b/queue-5.14/series index abfb34aca70..0405a50d7f8 100644 --- a/queue-5.14/series +++ b/queue-5.14/series @@ -20,3 +20,12 @@ drm-amd-pm-fix-the-issue-of-uploading-powerplay-table.patch drm-amdkfd-separate-kfd_iommu_resume-from-kfd_resume.patch drm-radeon-pass-drm-dev-radeon_agp_head_init-directly.patch io_uring-allow-retry-for-o_nonblock-if-async-is-supported.patch +drm-i915-dp-use-max-params-for-panels-edp-1.4.patch +drm-etnaviv-return-context-from-etnaviv_iommu_context_get.patch +drm-etnaviv-put-submit-prev-mmu-context-when-it-exists.patch +drm-etnaviv-stop-abusing-mmu_context-as-fe-running-marker.patch +drm-etnaviv-keep-mmu-context-across-runtime-suspend-resume.patch +drm-etnaviv-exec-and-mmu-state-is-lost-when-resetting-the-gpu.patch +drm-etnaviv-fix-mmu-context-leak-on-gpu-reset.patch +drm-etnaviv-reference-mmu-context-when-setting-up-hardware-state.patch +drm-etnaviv-add-missing-mmu-context-put-when-reaping-mmu-mapping.patch