From 2bc9aad94c8516ee87827ff2cb7a159aa14c1821 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 10 Jun 2022 08:34:57 -0400 Subject: [PATCH] Fixes for 4.9 Signed-off-by: Sasha Levin --- ...ease-timeout-per-message-if-necessar.patch | 64 ++++++++++++++++++ ...-fix-undefined-reference-to-_init_sp.patch | 43 ++++++++++++ ...ro_page-to-the-allocated-zeroed-page.patch | 47 +++++++++++++ queue-4.9/series | 5 ++ ...ding-tracer-option-before-update_tra.patch | 66 ++++++++++++++++++ ...xx-gcu-release-the-resources-correct.patch | 67 +++++++++++++++++++ 6 files changed, 292 insertions(+) create mode 100644 queue-4.9/i2c-cadence-increase-timeout-per-message-if-necessar.patch create mode 100644 queue-4.9/m68knommu-fix-undefined-reference-to-_init_sp.patch create mode 100644 queue-4.9/m68knommu-set-zero_page-to-the-allocated-zeroed-page.patch create mode 100644 queue-4.9/tracing-avoid-adding-tracer-option-before-update_tra.patch create mode 100644 queue-4.9/video-fbdev-pxa3xx-gcu-release-the-resources-correct.patch diff --git a/queue-4.9/i2c-cadence-increase-timeout-per-message-if-necessar.patch b/queue-4.9/i2c-cadence-increase-timeout-per-message-if-necessar.patch new file mode 100644 index 00000000000..208e47d30a7 --- /dev/null +++ b/queue-4.9/i2c-cadence-increase-timeout-per-message-if-necessar.patch @@ -0,0 +1,64 @@ +From 049f5beddda932d66b2f6870a308f27cf66f6d00 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Apr 2022 10:14:10 +0100 +Subject: i2c: cadence: Increase timeout per message if necessary + +From: Lucas Tanure + +[ Upstream commit 96789dce043f5bff8b7d62aa28d52a7c59403a84 ] + +Timeout as 1 second sets an upper limit on the length +of the transfer executed, but there is no maximum length +of a write or read message set in i2c_adapter_quirks for +this controller. + +This upper limit affects devices that require sending +large firmware blobs over I2C. + +To remove that limitation, calculate the minimal time +necessary, plus some wiggle room, for every message and +use it instead of the default one second, if more than +one second. + +Signed-off-by: Lucas Tanure +Acked-by: Michal Simek +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-cadence.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c +index 23ee1a423654..a29ac9bae6d5 100644 +--- a/drivers/i2c/busses/i2c-cadence.c ++++ b/drivers/i2c/busses/i2c-cadence.c +@@ -511,7 +511,7 @@ static void cdns_i2c_master_reset(struct i2c_adapter *adap) + static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, + struct i2c_adapter *adap) + { +- unsigned long time_left; ++ unsigned long time_left, msg_timeout; + u32 reg; + + id->p_msg = msg; +@@ -536,8 +536,16 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, + else + cdns_i2c_msend(id); + ++ /* Minimal time to execute this message */ ++ msg_timeout = msecs_to_jiffies((1000 * msg->len * BITS_PER_BYTE) / id->i2c_clk); ++ /* Plus some wiggle room */ ++ msg_timeout += msecs_to_jiffies(500); ++ ++ if (msg_timeout < adap->timeout) ++ msg_timeout = adap->timeout; ++ + /* Wait for the signal of completion */ +- time_left = wait_for_completion_timeout(&id->xfer_done, adap->timeout); ++ time_left = wait_for_completion_timeout(&id->xfer_done, msg_timeout); + if (time_left == 0) { + cdns_i2c_master_reset(adap); + dev_err(id->adap.dev.parent, +-- +2.35.1 + diff --git a/queue-4.9/m68knommu-fix-undefined-reference-to-_init_sp.patch b/queue-4.9/m68knommu-fix-undefined-reference-to-_init_sp.patch new file mode 100644 index 00000000000..2e84073d5aa --- /dev/null +++ b/queue-4.9/m68knommu-fix-undefined-reference-to-_init_sp.patch @@ -0,0 +1,43 @@ +From 3f1942286aef7ef3ef5fe66066ce0ef0f0b991e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 May 2022 17:27:39 +1000 +Subject: m68knommu: fix undefined reference to `_init_sp' + +From: Greg Ungerer + +[ Upstream commit a71b9e66fee47c59b3ec34e652b5c23bc6550794 ] + +When configuring a nommu classic m68k system enabling the uboot parameter +passing support (CONFIG_UBOOT) will produce the following compile error: + + m68k-linux-ld: arch/m68k/kernel/uboot.o: in function `process_uboot_commandline': + uboot.c:(.init.text+0x32): undefined reference to `_init_sp' + +The logic to support this option is only used on ColdFire based platforms +(in its head.S startup code). So make the selection of this option +depend on building for a ColdFire based platform. + +Reported-by: kernel test robot +Reviewed-by: Geert Uytterhoeven +Acked-by: Geert Uytterhoeven +Signed-off-by: Greg Ungerer +Signed-off-by: Sasha Levin +--- + arch/m68k/Kconfig.machine | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine +index f622c3ccafc3..9f2896493ca0 100644 +--- a/arch/m68k/Kconfig.machine ++++ b/arch/m68k/Kconfig.machine +@@ -302,6 +302,7 @@ comment "Machine Options" + + config UBOOT + bool "Support for U-Boot command line parameters" ++ depends on COLDFIRE + help + If you say Y here kernel will try to collect command + line parameters from the initial u-boot stack. +-- +2.35.1 + diff --git a/queue-4.9/m68knommu-set-zero_page-to-the-allocated-zeroed-page.patch b/queue-4.9/m68knommu-set-zero_page-to-the-allocated-zeroed-page.patch new file mode 100644 index 00000000000..a3284679fd7 --- /dev/null +++ b/queue-4.9/m68knommu-set-zero_page-to-the-allocated-zeroed-page.patch @@ -0,0 +1,47 @@ +From 5b7e08f233c555ecb2d932d3479d6f251e5ae9b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Apr 2022 23:27:47 +1000 +Subject: m68knommu: set ZERO_PAGE() to the allocated zeroed page + +From: Greg Ungerer + +[ Upstream commit dc068f46217970d9516f16cd37972a01d50dc055 ] + +The non-MMU m68k pagetable ZERO_PAGE() macro is being set to the +somewhat non-sensical value of "virt_to_page(0)". The zeroth page +is not in any way guaranteed to be a page full of "0". So the result +is that ZERO_PAGE() will almost certainly contain random values. + +We already allocate a real "empty_zero_page" in the mm setup code shared +between MMU m68k and non-MMU m68k. It is just not hooked up to the +ZERO_PAGE() macro for the non-MMU m68k case. + +Fix ZERO_PAGE() to use the allocated "empty_zero_page" pointer. + +I am not aware of any specific issues caused by the old code. + +Link: https://lore.kernel.org/linux-m68k/2a462b23-5b8e-bbf4-ec7d-778434a3b9d7@google.com/T/#t +Reported-by: Hugh Dickens +Signed-off-by: Greg Ungerer +Signed-off-by: Sasha Levin +--- + arch/m68k/include/asm/pgtable_no.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h +index ac7d87a02335..269443e1084b 100644 +--- a/arch/m68k/include/asm/pgtable_no.h ++++ b/arch/m68k/include/asm/pgtable_no.h +@@ -41,7 +41,8 @@ extern void paging_init(void); + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +-#define ZERO_PAGE(vaddr) (virt_to_page(0)) ++extern void *empty_zero_page; ++#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + + /* + * No page table caches to initialise. +-- +2.35.1 + diff --git a/queue-4.9/series b/queue-4.9/series index 3be06bf6801..fd4565128ab 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -125,3 +125,8 @@ net-ethernet-mtk_eth_soc-out-of-bounds-read-in-mtk_h.patch modpost-fix-removing-numeric-suffixes.patch jffs2-fix-memory-leak-in-jffs2_do_fill_super.patch tcp-tcp_rtx_synack-can-be-called-from-process-contex.patch +tracing-avoid-adding-tracer-option-before-update_tra.patch +i2c-cadence-increase-timeout-per-message-if-necessar.patch +m68knommu-set-zero_page-to-the-allocated-zeroed-page.patch +m68knommu-fix-undefined-reference-to-_init_sp.patch +video-fbdev-pxa3xx-gcu-release-the-resources-correct.patch diff --git a/queue-4.9/tracing-avoid-adding-tracer-option-before-update_tra.patch b/queue-4.9/tracing-avoid-adding-tracer-option-before-update_tra.patch new file mode 100644 index 00000000000..97b39499153 --- /dev/null +++ b/queue-4.9/tracing-avoid-adding-tracer-option-before-update_tra.patch @@ -0,0 +1,66 @@ +From 3141ed2864d849d400e179a0daf241f44a68b34f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Apr 2022 20:24:06 +0800 +Subject: tracing: Avoid adding tracer option before update_tracer_options + +From: Mark-PK Tsai + +[ Upstream commit ef9188bcc6ca1d8a2ad83e826b548e6820721061 ] + +To prepare for support asynchronous tracer_init_tracefs initcall, +avoid calling create_trace_option_files before __update_tracer_options. +Otherwise, create_trace_option_files will show warning because +some tracers in trace_types list are already in tr->topts. + +For example, hwlat_tracer call register_tracer in late_initcall, +and global_trace.dir is already created in tracing_init_dentry, +hwlat_tracer will be put into tr->topts. +Then if the __update_tracer_options is executed after hwlat_tracer +registered, create_trace_option_files find that hwlat_tracer is +already in tr->topts. + +Link: https://lkml.kernel.org/r/20220426122407.17042-2-mark-pk.tsai@mediatek.com + +Link: https://lore.kernel.org/lkml/20220322133339.GA32582@xsang-OptiPlex-9020/ +Reported-by: kernel test robot +Signed-off-by: Mark-PK Tsai +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Sasha Levin +--- + kernel/trace/trace.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index 90e0fd5621da..de1638df2b09 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -4798,12 +4798,18 @@ static void tracing_set_nop(struct trace_array *tr) + tr->current_trace = &nop_trace; + } + ++static bool tracer_options_updated; ++ + static void add_tracer_options(struct trace_array *tr, struct tracer *t) + { + /* Only enable if the directory has been created already. */ + if (!tr->dir) + return; + ++ /* Only create trace option files after update_tracer_options finish */ ++ if (!tracer_options_updated) ++ return; ++ + create_trace_option_files(tr, t); + } + +@@ -7082,6 +7088,7 @@ static void __update_tracer_options(struct trace_array *tr) + static void update_tracer_options(struct trace_array *tr) + { + mutex_lock(&trace_types_lock); ++ tracer_options_updated = true; + __update_tracer_options(tr); + mutex_unlock(&trace_types_lock); + } +-- +2.35.1 + diff --git a/queue-4.9/video-fbdev-pxa3xx-gcu-release-the-resources-correct.patch b/queue-4.9/video-fbdev-pxa3xx-gcu-release-the-resources-correct.patch new file mode 100644 index 00000000000..b8916716fff --- /dev/null +++ b/queue-4.9/video-fbdev-pxa3xx-gcu-release-the-resources-correct.patch @@ -0,0 +1,67 @@ +From c5a9cbf7e452bd0fa721b02a64795cd099e3054b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 May 2022 18:05:41 +0800 +Subject: video: fbdev: pxa3xx-gcu: release the resources correctly in + pxa3xx_gcu_probe/remove() + +From: Yang Yingliang + +[ Upstream commit d87ad457f7e1b8d2492ca5b1531eb35030a1cc8f ] + +In pxa3xx_gcu_probe(), the sequence of error lable is wrong, it will +leads some resource leaked, so adjust the sequence to handle the error +correctly, and if pxa3xx_gcu_add_buffer() fails, pxa3xx_gcu_free_buffers() +need be called. +In pxa3xx_gcu_remove(), add missing clk_disable_unpreprare(). + +Signed-off-by: Yang Yingliang +Signed-off-by: Helge Deller +Signed-off-by: Sasha Levin +--- + drivers/video/fbdev/pxa3xx-gcu.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c +index 50bce45e7f3d..184773b6b9e4 100644 +--- a/drivers/video/fbdev/pxa3xx-gcu.c ++++ b/drivers/video/fbdev/pxa3xx-gcu.c +@@ -662,6 +662,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) + for (i = 0; i < 8; i++) { + ret = pxa3xx_gcu_add_buffer(dev, priv); + if (ret) { ++ pxa3xx_gcu_free_buffers(dev, priv); + dev_err(dev, "failed to allocate DMA memory\n"); + goto err_disable_clk; + } +@@ -677,15 +678,15 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) + SHARED_SIZE, irq); + return 0; + +-err_free_dma: +- dma_free_coherent(dev, SHARED_SIZE, +- priv->shared, priv->shared_phys); ++err_disable_clk: ++ clk_disable_unprepare(priv->clk); + + err_misc_deregister: + misc_deregister(&priv->misc_dev); + +-err_disable_clk: +- clk_disable_unprepare(priv->clk); ++err_free_dma: ++ dma_free_coherent(dev, SHARED_SIZE, ++ priv->shared, priv->shared_phys); + + return ret; + } +@@ -698,6 +699,7 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev) + pxa3xx_gcu_wait_idle(priv); + misc_deregister(&priv->misc_dev); + dma_free_coherent(dev, SHARED_SIZE, priv->shared, priv->shared_phys); ++ clk_disable_unprepare(priv->clk); + pxa3xx_gcu_free_buffers(dev, priv); + + return 0; +-- +2.35.1 + -- 2.47.3