From: Sasha Levin Date: Sun, 25 Aug 2024 23:46:19 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v6.1.107~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2df1289fcc73f60bc5b90d027012038bfee3b88b;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/drm-msm-dp-fix-the-max-supported-bpp-logic.patch b/queue-6.1/drm-msm-dp-fix-the-max-supported-bpp-logic.patch new file mode 100644 index 00000000000..3e2d6f5039c --- /dev/null +++ b/queue-6.1/drm-msm-dp-fix-the-max-supported-bpp-logic.patch @@ -0,0 +1,91 @@ +From b0f05544e80cc9fd6598483f7487bc40e259de30 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Aug 2024 13:20:08 -0700 +Subject: drm/msm/dp: fix the max supported bpp logic + +From: Abhinav Kumar + +[ Upstream commit d19d5b8d8f6dab942ce5ddbcf34bf7275e778250 ] + +Fix the dp_panel_get_supported_bpp() API to return the minimum +supported bpp correctly for relevant cases and use this API +to correct the behavior of DP driver which hard-codes the max supported +bpp to 30. + +This is incorrect because the number of lanes and max data rate +supported by the lanes need to be taken into account. + +Replace the hardcoded limit with the appropriate math which accounts +for the accurate number of lanes and max data rate. + +changes in v2: + - Fix the dp_panel_get_supported_bpp() and use it + - Drop the max_t usage as dp_panel_get_supported_bpp() already + returns the min_bpp correctly now + +changes in v3: + - replace min_t with just min as all params are u32 + +Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support") +Reported-by: Dmitry Baryshkov +Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/43 +Tested-by: Dmitry Baryshkov # SM8350-HDK +Reviewed-by: Stephen Boyd +Patchwork: https://patchwork.freedesktop.org/patch/607073/ +Link: https://lore.kernel.org/r/20240805202009.1120981-1-quic_abhinavk@quicinc.com +Signed-off-by: Stephen Boyd +Signed-off-by: Abhinav Kumar +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/dp/dp_panel.c | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c +index d38086650fcf7..f2cc0cc0b66b7 100644 +--- a/drivers/gpu/drm/msm/dp/dp_panel.c ++++ b/drivers/gpu/drm/msm/dp/dp_panel.c +@@ -113,22 +113,22 @@ static int dp_panel_read_dpcd(struct dp_panel *dp_panel) + static u32 dp_panel_get_supported_bpp(struct dp_panel *dp_panel, + u32 mode_edid_bpp, u32 mode_pclk_khz) + { +- struct dp_link_info *link_info; ++ const struct dp_link_info *link_info; + const u32 max_supported_bpp = 30, min_supported_bpp = 18; +- u32 bpp = 0, data_rate_khz = 0; ++ u32 bpp, data_rate_khz; + +- bpp = min_t(u32, mode_edid_bpp, max_supported_bpp); ++ bpp = min(mode_edid_bpp, max_supported_bpp); + + link_info = &dp_panel->link_info; + data_rate_khz = link_info->num_lanes * link_info->rate * 8; + +- while (bpp > min_supported_bpp) { ++ do { + if (mode_pclk_khz * bpp <= data_rate_khz) +- break; ++ return bpp; + bpp -= 6; +- } ++ } while (bpp > min_supported_bpp); + +- return bpp; ++ return min_supported_bpp; + } + + static int dp_panel_update_modes(struct drm_connector *connector, +@@ -421,8 +421,9 @@ int dp_panel_init_panel_info(struct dp_panel *dp_panel) + drm_mode->clock); + drm_dbg_dp(panel->drm_dev, "bpp = %d\n", dp_panel->dp_mode.bpp); + +- dp_panel->dp_mode.bpp = max_t(u32, 18, +- min_t(u32, dp_panel->dp_mode.bpp, 30)); ++ dp_panel->dp_mode.bpp = dp_panel_get_mode_bpp(dp_panel, dp_panel->dp_mode.bpp, ++ dp_panel->dp_mode.drm_mode.clock); ++ + drm_dbg_dp(panel->drm_dev, "updated bpp = %d\n", + dp_panel->dp_mode.bpp); + +-- +2.43.0 + diff --git a/queue-6.1/drm-msm-dp-reset-the-link-phy-params-before-link-tra.patch b/queue-6.1/drm-msm-dp-reset-the-link-phy-params-before-link-tra.patch new file mode 100644 index 00000000000..f5a0daac95c --- /dev/null +++ b/queue-6.1/drm-msm-dp-reset-the-link-phy-params-before-link-tra.patch @@ -0,0 +1,42 @@ +From b039b3ed5ebc705be4aea874e09dfe769f45215e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jul 2024 15:04:50 -0700 +Subject: drm/msm/dp: reset the link phy params before link training + +From: Abhinav Kumar + +[ Upstream commit 319aca883bfa1b85ee08411541b51b9a934ac858 ] + +Before re-starting link training reset the link phy params namely +the pre-emphasis and voltage swing levels otherwise the next +link training begins at the previously cached levels which can result +in link training failures. + +Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets") +Reviewed-by: Dmitry Baryshkov +Tested-by: Dmitry Baryshkov # SM8350-HDK +Reviewed-by: Stephen Boyd +Patchwork: https://patchwork.freedesktop.org/patch/605946/ +Link: https://lore.kernel.org/r/20240725220450.131245-1-quic_abhinavk@quicinc.com +Signed-off-by: Abhinav Kumar +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/dp/dp_ctrl.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c +index bd1343602f553..3c001b792423b 100644 +--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c ++++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c +@@ -1248,6 +1248,8 @@ static int dp_ctrl_link_train(struct dp_ctrl_private *ctrl, + link_info.rate = ctrl->link->link_params.rate; + link_info.capabilities = DP_LINK_CAP_ENHANCED_FRAMING; + ++ dp_link_reset_phy_params_vx_px(ctrl->link); ++ + dp_aux_link_configure(ctrl->aux, &link_info); + + if (drm_dp_max_downspread(dpcd)) +-- +2.43.0 + diff --git a/queue-6.1/drm-msm-dpu-cleanup-fb-if-dpu_format_populate_layout.patch b/queue-6.1/drm-msm-dpu-cleanup-fb-if-dpu_format_populate_layout.patch new file mode 100644 index 00000000000..cb8392a5ec5 --- /dev/null +++ b/queue-6.1/drm-msm-dpu-cleanup-fb-if-dpu_format_populate_layout.patch @@ -0,0 +1,70 @@ +From f3c8b562d762cfced32f7252b4f8345d9ab58dd3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jun 2024 00:13:41 +0300 +Subject: drm/msm/dpu: cleanup FB if dpu_format_populate_layout fails + +From: Dmitry Baryshkov + +[ Upstream commit bfa1a6283be390947d3649c482e5167186a37016 ] + +If the dpu_format_populate_layout() fails, then FB is prepared, but not +cleaned up. This ends up leaking the pin_count on the GEM object and +causes a splat during DRM file closure: + +msm_obj->pin_count +WARNING: CPU: 2 PID: 569 at drivers/gpu/drm/msm/msm_gem.c:121 update_lru_locked+0xc4/0xcc +[...] +Call trace: + update_lru_locked+0xc4/0xcc + put_pages+0xac/0x100 + msm_gem_free_object+0x138/0x180 + drm_gem_object_free+0x1c/0x30 + drm_gem_object_handle_put_unlocked+0x108/0x10c + drm_gem_object_release_handle+0x58/0x70 + idr_for_each+0x68/0xec + drm_gem_release+0x28/0x40 + drm_file_free+0x174/0x234 + drm_release+0xb0/0x160 + __fput+0xc0/0x2c8 + __fput_sync+0x50/0x5c + __arm64_sys_close+0x38/0x7c + invoke_syscall+0x48/0x118 + el0_svc_common.constprop.0+0x40/0xe0 + do_el0_svc+0x1c/0x28 + el0_svc+0x4c/0x120 + el0t_64_sync_handler+0x100/0x12c + el0t_64_sync+0x190/0x194 +irq event stamp: 129818 +hardirqs last enabled at (129817): [] console_unlock+0x118/0x124 +hardirqs last disabled at (129818): [] el1_dbg+0x24/0x8c +softirqs last enabled at (129808): [] handle_softirqs+0x4c8/0x4e8 +softirqs last disabled at (129785): [] __do_softirq+0x14/0x20 + +Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/600714/ +Link: https://lore.kernel.org/r/20240625-dpu-mode-config-width-v5-1-501d984d634f@linaro.org +Signed-off-by: Abhinav Kumar +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +index 62d48c0f905e4..61c456c5015a5 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +@@ -889,6 +889,9 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, + new_state->fb, &layout); + if (ret) { + DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); ++ if (pstate->aspace) ++ msm_framebuffer_cleanup(new_state->fb, pstate->aspace, ++ pstate->needs_dirtyfb); + return ret; + } + +-- +2.43.0 + diff --git a/queue-6.1/drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch b/queue-6.1/drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch new file mode 100644 index 00000000000..53a64752848 --- /dev/null +++ b/queue-6.1/drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch @@ -0,0 +1,66 @@ +From d649cddc48110353e49dd674b9c9fcb273370f0d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2024 22:47:34 +0300 +Subject: drm/msm/dpu: don't play tricks with debug macros + +From: Dmitry Baryshkov + +[ Upstream commit df24373435f5899a2a98b7d377479c8d4376613b ] + +DPU debugging macros need to be converted to a proper drm_debug_* +macros, however this is a going an intrusive patch, not suitable for a +fix. Wire DPU_DEBUG and DPU_DEBUG_DRIVER to always use DRM_DEBUG_DRIVER +to make sure that DPU debugging messages always end up in the drm debug +messages and are controlled via the usual drm.debug mask. + +I don't think that it is a good idea for a generic DPU_DEBUG macro to be +tied to DRM_UT_KMS. It is used to report a debug message from driver, so by +default it should go to the DRM_UT_DRIVER channel. While refactoring +debug macros later on we might end up with particular messages going to +ATOMIC or KMS, but DRIVER should be the default. + +Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/606932/ +Link: https://lore.kernel.org/r/20240802-dpu-fix-wb-v2-2-7eac9eb8e895@linaro.org +Signed-off-by: Abhinav Kumar +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 ++------------ + 1 file changed, 2 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +index bb35aa5f5709f..41e44a77c2beb 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +@@ -31,24 +31,14 @@ + * @fmt: Pointer to format string + */ + #define DPU_DEBUG(fmt, ...) \ +- do { \ +- if (drm_debug_enabled(DRM_UT_KMS)) \ +- DRM_DEBUG(fmt, ##__VA_ARGS__); \ +- else \ +- pr_debug(fmt, ##__VA_ARGS__); \ +- } while (0) ++ DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) + + /** + * DPU_DEBUG_DRIVER - macro for hardware driver logging + * @fmt: Pointer to format string + */ + #define DPU_DEBUG_DRIVER(fmt, ...) \ +- do { \ +- if (drm_debug_enabled(DRM_UT_DRIVER)) \ +- DRM_ERROR(fmt, ##__VA_ARGS__); \ +- else \ +- pr_debug(fmt, ##__VA_ARGS__); \ +- } while (0) ++ DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) + + #define DPU_ERROR(fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) + #define DPU_ERROR_RATELIMITED(fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__) +-- +2.43.0 + diff --git a/queue-6.1/mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch b/queue-6.1/mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch new file mode 100644 index 00000000000..f3fe074daf0 --- /dev/null +++ b/queue-6.1/mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch @@ -0,0 +1,55 @@ +From 49f568080e48c16939b6d1f6540338278a34aa78 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Aug 2024 11:44:08 +0300 +Subject: mmc: mmc_test: Fix NULL dereference on allocation failure + +From: Dan Carpenter + +[ Upstream commit a1e627af32ed60713941cbfc8075d44cad07f6dd ] + +If the "test->highmem = alloc_pages()" allocation fails then calling +__free_pages(test->highmem) will result in a NULL dereference. Also +change the error code to -ENOMEM instead of returning success. + +Fixes: 2661081f5ab9 ("mmc_test: highmem tests") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/8c90be28-67b4-4b0d-a105-034dc72a0b31@stanley.mountain +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/core/mmc_test.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c +index 155ce2bdfe622..dbbcbdeab6c51 100644 +--- a/drivers/mmc/core/mmc_test.c ++++ b/drivers/mmc/core/mmc_test.c +@@ -3109,13 +3109,13 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, + test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL); + #ifdef CONFIG_HIGHMEM + test->highmem = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, BUFFER_ORDER); ++ if (!test->highmem) { ++ count = -ENOMEM; ++ goto free_test_buffer; ++ } + #endif + +-#ifdef CONFIG_HIGHMEM +- if (test->buffer && test->highmem) { +-#else + if (test->buffer) { +-#endif + mutex_lock(&mmc_test_lock); + mmc_test_run(test, testcase); + mutex_unlock(&mmc_test_lock); +@@ -3123,6 +3123,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, + + #ifdef CONFIG_HIGHMEM + __free_pages(test->highmem, BUFFER_ORDER); ++free_test_buffer: + #endif + kfree(test->buffer); + kfree(test); +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index 5f4984b2d45..bb3b7c9cedb 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -256,3 +256,8 @@ netfilter-flowtable-validate-vlan-header.patch octeontx2-af-fix-cpt-af-register-offset-calculation.patch net-xilinx-axienet-always-disable-promiscuous-mode.patch net-xilinx-axienet-fix-dangling-multicast-addresses.patch +drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch +drm-msm-dp-fix-the-max-supported-bpp-logic.patch +drm-msm-dp-reset-the-link-phy-params-before-link-tra.patch +drm-msm-dpu-cleanup-fb-if-dpu_format_populate_layout.patch +mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch