From: Sasha Levin Date: Mon, 19 Feb 2024 20:58:53 +0000 (-0500) Subject: Fixes for 5.10 X-Git-Tag: v4.19.307~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99345b214cf1b9313a3f88a0700b73f09186b79e;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/bus-moxtet-add-spi-device-table.patch b/queue-5.10/bus-moxtet-add-spi-device-table.patch new file mode 100644 index 00000000000..14f2d20615d --- /dev/null +++ b/queue-5.10/bus-moxtet-add-spi-device-table.patch @@ -0,0 +1,52 @@ +From 4705641a4de38aeaff4563e76a6930a41555c821 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 22:35:05 +0100 +Subject: bus: moxtet: Add spi device table +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Sjoerd Simons + +[ Upstream commit aaafe88d5500ba18b33be72458439367ef878788 ] + +The moxtet module fails to auto-load on. Add a SPI id table to +allow it to do so. + +Signed-off-by: Sjoerd Simons +Cc: +Reviewed-by: Marek Behún +Signed-off-by: Gregory CLEMENT +Signed-off-by: Sasha Levin +--- + drivers/bus/moxtet.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/bus/moxtet.c b/drivers/bus/moxtet.c +index b20fdcbd035b..34377195bf87 100644 +--- a/drivers/bus/moxtet.c ++++ b/drivers/bus/moxtet.c +@@ -832,6 +832,12 @@ static int moxtet_remove(struct spi_device *spi) + return 0; + } + ++static const struct spi_device_id moxtet_spi_ids[] = { ++ { "moxtet" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(spi, moxtet_spi_ids); ++ + static const struct of_device_id moxtet_dt_ids[] = { + { .compatible = "cznic,moxtet" }, + {}, +@@ -843,6 +849,7 @@ static struct spi_driver moxtet_spi_driver = { + .name = "moxtet", + .of_match_table = moxtet_dt_ids, + }, ++ .id_table = moxtet_spi_ids, + .probe = moxtet_probe, + .remove = moxtet_remove, + }; +-- +2.43.0 + diff --git a/queue-5.10/crypto-lib-mpi-fix-unexpected-pointer-access-in-mpi_.patch b/queue-5.10/crypto-lib-mpi-fix-unexpected-pointer-access-in-mpi_.patch new file mode 100644 index 00000000000..ad61867b49e --- /dev/null +++ b/queue-5.10/crypto-lib-mpi-fix-unexpected-pointer-access-in-mpi_.patch @@ -0,0 +1,42 @@ +From 9a5baf5bf67c5df9ce1c44e848dbc54e4cdc7135 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Dec 2023 11:08:34 +0800 +Subject: crypto: lib/mpi - Fix unexpected pointer access in mpi_ec_init + +From: Tianjia Zhang + +[ Upstream commit ba3c5574203034781ac4231acf117da917efcd2a ] + +When the mpi_ec_ctx structure is initialized, some fields are not +cleared, causing a crash when referencing the field when the +structure was released. Initially, this issue was ignored because +memory for mpi_ec_ctx is allocated with the __GFP_ZERO flag. +For example, this error will be triggered when calculating the +Za value for SM2 separately. + +Fixes: d58bb7e55a8a ("lib/mpi: Introduce ec implementation to MPI library") +Cc: stable@vger.kernel.org # v6.5 +Signed-off-by: Tianjia Zhang +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + lib/mpi/ec.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/mpi/ec.c b/lib/mpi/ec.c +index c21470122dfc..941ba0b0067e 100644 +--- a/lib/mpi/ec.c ++++ b/lib/mpi/ec.c +@@ -584,6 +584,9 @@ void mpi_ec_init(struct mpi_ec_ctx *ctx, enum gcry_mpi_ec_models model, + ctx->a = mpi_copy(a); + ctx->b = mpi_copy(b); + ++ ctx->d = NULL; ++ ctx->t.two_inv_p = NULL; ++ + ctx->t.p_barrett = use_barrett > 0 ? mpi_barrett_init(ctx->p, 0) : NULL; + + mpi_ec_get_reset(ctx); +-- +2.43.0 + diff --git a/queue-5.10/mips-fix-max_mapnr-being-uninitialized-on-early-stag.patch b/queue-5.10/mips-fix-max_mapnr-being-uninitialized-on-early-stag.patch new file mode 100644 index 00000000000..a592b000ec7 --- /dev/null +++ b/queue-5.10/mips-fix-max_mapnr-being-uninitialized-on-early-stag.patch @@ -0,0 +1,94 @@ +From 301cb6150a66b37ec3293d30460880681a8e8c93 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 2 Dec 2023 14:14:20 +0300 +Subject: mips: Fix max_mapnr being uninitialized on early stages + +From: Serge Semin + +[ Upstream commit e1a9ae45736989c972a8d1c151bc390678ae6205 ] + +max_mapnr variable is utilized in the pfn_valid() method in order to +determine the upper PFN space boundary. Having it uninitialized +effectively makes any PFN passed to that method invalid. That in its turn +causes the kernel mm-subsystem occasion malfunctions even after the +max_mapnr variable is actually properly updated. For instance, +pfn_valid() is called in the init_unavailable_range() method in the +framework of the calls-chain on MIPS: +setup_arch() ++-> paging_init() + +-> free_area_init() + +-> memmap_init() + +-> memmap_init_zone_range() + +-> init_unavailable_range() + +Since pfn_valid() always returns "false" value before max_mapnr is +initialized in the mem_init() method, any flatmem page-holes will be left +in the poisoned/uninitialized state including the IO-memory pages. Thus +any further attempts to map/remap the IO-memory by using MMU may fail. +In particular it happened in my case on attempt to map the SRAM region. +The kernel bootup procedure just crashed on the unhandled unaligned access +bug raised in the __update_cache() method: + +> Unhandled kernel unaligned access[#1]: +> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc1-XXX-dirty #2056 +> ... +> Call Trace: +> [<8011ef9c>] __update_cache+0x88/0x1bc +> [<80385944>] ioremap_page_range+0x110/0x2a4 +> [<80126948>] ioremap_prot+0x17c/0x1f4 +> [<80711b80>] __devm_ioremap+0x8c/0x120 +> [<80711e0c>] __devm_ioremap_resource+0xf4/0x218 +> [<808bf244>] sram_probe+0x4f4/0x930 +> [<80889d20>] platform_probe+0x68/0xec +> ... + +Let's fix the problem by initializing the max_mapnr variable as soon as +the required data is available. In particular it can be done right in the +paging_init() method before free_area_init() is called since all the PFN +zone boundaries have already been calculated by that time. + +Cc: stable@vger.kernel.org +Signed-off-by: Serge Semin +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/mm/init.c | 15 +++++---------- + 1 file changed, 5 insertions(+), 10 deletions(-) + +diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c +index 07e84a774938..32e7b869a291 100644 +--- a/arch/mips/mm/init.c ++++ b/arch/mips/mm/init.c +@@ -421,7 +421,12 @@ void __init paging_init(void) + (highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10)); + max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn; + } ++ ++ max_mapnr = highend_pfn ? highend_pfn : max_low_pfn; ++#else ++ max_mapnr = max_low_pfn; + #endif ++ high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); + + free_area_init(max_zone_pfns); + } +@@ -457,16 +462,6 @@ void __init mem_init(void) + */ + BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT)); + +-#ifdef CONFIG_HIGHMEM +-#ifdef CONFIG_DISCONTIGMEM +-#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet" +-#endif +- max_mapnr = highend_pfn ? highend_pfn : max_low_pfn; +-#else +- max_mapnr = max_low_pfn; +-#endif +- high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); +- + maar_init(); + memblock_free_all(); + setup_zero_pages(); /* Setup zeroed pages. */ +-- +2.43.0 + diff --git a/queue-5.10/mwifiex-select-firmware-based-on-strapping.patch b/queue-5.10/mwifiex-select-firmware-based-on-strapping.patch new file mode 100644 index 00000000000..1b543e65019 --- /dev/null +++ b/queue-5.10/mwifiex-select-firmware-based-on-strapping.patch @@ -0,0 +1,132 @@ +From 07c2ebab869c87011d2a3f99451742a774216948 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 22 Apr 2022 11:03:12 +0200 +Subject: mwifiex: Select firmware based on strapping +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Andrejs Cainikovs + +[ Upstream commit 255ca28a659d3cfb069f73c7644853ed93aecdb0 ] + +Some WiFi/Bluetooth modules might have different host connection +options, allowing to either use SDIO for both WiFi and Bluetooth, +or SDIO for WiFi and UART for Bluetooth. It is possible to detect +whether a module has SDIO-SDIO or SDIO-UART connection by reading +its host strap register. + +This change introduces a way to automatically select appropriate +firmware depending of the connection method, and removes a need +of symlinking or overwriting the original firmware file with a +required one. + +Host strap register used in this commit comes from the NXP driver [1] +hosted at Code Aurora. + +[1] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/net/wireless/nxp/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c?h=rel_imx_5.4.70_2.3.2&id=688b67b2c7220b01521ffe560da7eee33042c7bd#n1274 + +Signed-off-by: Andrejs Cainikovs +Reviewed-by: Alvin Šipraga +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220422090313.125857-2-andrejs.cainikovs@toradex.com +Stable-dep-of: 1c5d463c0770 ("wifi: mwifiex: add extra delay for firmware ready") +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/marvell/mwifiex/sdio.c | 21 ++++++++++++++++++++- + drivers/net/wireless/marvell/mwifiex/sdio.h | 5 +++++ + 2 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c +index b09e60fedeb1..016065a56e6c 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.c ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.c +@@ -182,6 +182,9 @@ static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8997 = { + .host_int_rsr_reg = 0x4, + .host_int_status_reg = 0x0C, + .host_int_mask_reg = 0x08, ++ .host_strap_reg = 0xF4, ++ .host_strap_mask = 0x01, ++ .host_strap_value = 0x00, + .status_reg_0 = 0xE8, + .status_reg_1 = 0xE9, + .sdio_int_mask = 0xff, +@@ -283,6 +286,9 @@ static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8987 = { + .host_int_rsr_reg = 0x4, + .host_int_status_reg = 0x0C, + .host_int_mask_reg = 0x08, ++ .host_strap_reg = 0xF4, ++ .host_strap_mask = 0x01, ++ .host_strap_value = 0x00, + .status_reg_0 = 0xE8, + .status_reg_1 = 0xE9, + .sdio_int_mask = 0xff, +@@ -537,6 +543,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) + struct mwifiex_sdio_device *data = (void *)id->driver_data; + + card->firmware = data->firmware; ++ card->firmware_sdiouart = data->firmware_sdiouart; + card->reg = data->reg; + card->max_ports = data->max_ports; + card->mp_agg_pkt_limit = data->mp_agg_pkt_limit; +@@ -2440,6 +2447,7 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) + int ret; + struct sdio_mmc_card *card = adapter->card; + struct sdio_func *func = card->func; ++ const char *firmware = card->firmware; + + /* save adapter pointer in card */ + card->adapter = adapter; +@@ -2456,7 +2464,18 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) + return ret; + } + +- strcpy(adapter->fw_name, card->firmware); ++ /* Select correct firmware (sdsd or sdiouart) firmware based on the strapping ++ * option ++ */ ++ if (card->firmware_sdiouart) { ++ u8 val; ++ ++ mwifiex_read_reg(adapter, card->reg->host_strap_reg, &val); ++ if ((val & card->reg->host_strap_mask) == card->reg->host_strap_value) ++ firmware = card->firmware_sdiouart; ++ } ++ strcpy(adapter->fw_name, firmware); ++ + if (card->fw_dump_enh) { + adapter->mem_type_mapping_tbl = generic_mem_type_map; + adapter->num_mem_types = 1; +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h +index dec534a6ddb1..5ff33ee53bb3 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.h ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.h +@@ -198,6 +198,9 @@ struct mwifiex_sdio_card_reg { + u8 host_int_rsr_reg; + u8 host_int_status_reg; + u8 host_int_mask_reg; ++ u8 host_strap_reg; ++ u8 host_strap_mask; ++ u8 host_strap_value; + u8 status_reg_0; + u8 status_reg_1; + u8 sdio_int_mask; +@@ -243,6 +246,7 @@ struct sdio_mmc_card { + + struct completion fw_done; + const char *firmware; ++ const char *firmware_sdiouart; + const struct mwifiex_sdio_card_reg *reg; + u8 max_ports; + u8 mp_agg_pkt_limit; +@@ -276,6 +280,7 @@ struct sdio_mmc_card { + + struct mwifiex_sdio_device { + const char *firmware; ++ const char *firmware_sdiouart; + const struct mwifiex_sdio_card_reg *reg; + u8 max_ports; + u8 mp_agg_pkt_limit; +-- +2.43.0 + diff --git a/queue-5.10/pci-dwc-endpoint-fix-dw_pcie_ep_raise_msix_irq-align.patch b/queue-5.10/pci-dwc-endpoint-fix-dw_pcie_ep_raise_msix_irq-align.patch new file mode 100644 index 00000000000..9db669f78d5 --- /dev/null +++ b/queue-5.10/pci-dwc-endpoint-fix-dw_pcie_ep_raise_msix_irq-align.patch @@ -0,0 +1,53 @@ +From 5663dea8a175b8aececce6151cc6bdead1ac5e23 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 14:22:30 +0100 +Subject: PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Niklas Cassel + +[ Upstream commit 2217fffcd63f86776c985d42e76daa43a56abdf1 ] + +Commit 6f5e193bfb55 ("PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get +correct MSI-X table address") modified dw_pcie_ep_raise_msix_irq() to +support iATUs which require a specific alignment. + +However, this support cannot have been properly tested. + +The whole point is for the iATU to map an address that is aligned, +using dw_pcie_ep_map_addr(), and then let the writel() write to +ep->msi_mem + aligned_offset. + +Thus, modify the address that is mapped such that it is aligned. +With this change, dw_pcie_ep_raise_msix_irq() matches the logic in +dw_pcie_ep_raise_msi_irq(). + +Link: https://lore.kernel.org/linux-pci/20231128132231.2221614-1-nks@flawful.org +Fixes: 6f5e193bfb55 ("PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get correct MSI-X table address") +Signed-off-by: Niklas Cassel +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Manivannan Sadhasivam +Cc: stable@vger.kernel.org # 5.7 +Cc: Kishon Vijay Abraham I +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pcie-designware-ep.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c +index 95ed719402d7..e27bac623684 100644 +--- a/drivers/pci/controller/dwc/pcie-designware-ep.c ++++ b/drivers/pci/controller/dwc/pcie-designware-ep.c +@@ -593,6 +593,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, + } + + aligned_offset = msg_addr & (epc->mem->window.page_size - 1); ++ msg_addr &= ~aligned_offset; + ret = dw_pcie_ep_map_addr(epc, func_no, ep->msi_mem_phys, msg_addr, + epc->mem->window.page_size); + if (ret) +-- +2.43.0 + diff --git a/queue-5.10/revert-md-raid5-wait-for-md_sb_change_pending-in-rai.patch b/queue-5.10/revert-md-raid5-wait-for-md_sb_change_pending-in-rai.patch new file mode 100644 index 00000000000..762b7f9546a --- /dev/null +++ b/queue-5.10/revert-md-raid5-wait-for-md_sb_change_pending-in-rai.patch @@ -0,0 +1,72 @@ +From 186524cb925c7077ac1dcb2868f8cbbb5a2808dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Nov 2023 10:22:16 -0800 +Subject: Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d" + +From: Junxiao Bi + +[ Upstream commit bed9e27baf52a09b7ba2a3714f1e24e17ced386d ] + +This reverts commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74. + +That commit introduced the following race and can cause system hung. + + md_write_start: raid5d: + // mddev->in_sync == 1 + set "MD_SB_CHANGE_PENDING" + // running before md_write_start wakeup it + waiting "MD_SB_CHANGE_PENDING" cleared + >>>>>>>>> hung + wakeup mddev->thread + ... + waiting "MD_SB_CHANGE_PENDING" cleared + >>>> hung, raid5d should clear this flag + but get hung by same flag. + +The issue reverted commit fixing is fixed by last patch in a new way. + +Fixes: 5e2cf333b7bd ("md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d") +Cc: stable@vger.kernel.org # v5.19+ +Signed-off-by: Junxiao Bi +Reviewed-by: Yu Kuai +Signed-off-by: Song Liu +Link: https://lore.kernel.org/r/20231108182216.73611-2-junxiao.bi@oracle.com +Signed-off-by: Sasha Levin +--- + drivers/md/raid5.c | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c +index 9f114b9d8dc6..00995e60d46b 100644 +--- a/drivers/md/raid5.c ++++ b/drivers/md/raid5.c +@@ -36,7 +36,6 @@ + */ + + #include +-#include + #include + #include + #include +@@ -6520,18 +6519,7 @@ static void raid5d(struct md_thread *thread) + spin_unlock_irq(&conf->device_lock); + md_check_recovery(mddev); + spin_lock_irq(&conf->device_lock); +- +- /* +- * Waiting on MD_SB_CHANGE_PENDING below may deadlock +- * seeing md_check_recovery() is needed to clear +- * the flag when using mdmon. +- */ +- continue; + } +- +- wait_event_lock_irq(mddev->sb_wait, +- !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), +- conf->device_lock); + } + pr_debug("%d stripes handled\n", handled); + +-- +2.43.0 + diff --git a/queue-5.10/scripts-decode_stacktrace-demangle-rust-symbols.patch b/queue-5.10/scripts-decode_stacktrace-demangle-rust-symbols.patch new file mode 100644 index 00000000000..f957a66a1b8 --- /dev/null +++ b/queue-5.10/scripts-decode_stacktrace-demangle-rust-symbols.patch @@ -0,0 +1,60 @@ +From 01b910a6abf07b34fdf408233421de267fb784dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Dec 2021 19:00:43 +0100 +Subject: scripts: decode_stacktrace: demangle Rust symbols + +From: Miguel Ojeda + +[ Upstream commit 99115db4ecc87af73415939439ec604ea0531e6f ] + +Recent versions of both Binutils (`c++filt`) and LLVM (`llvm-cxxfilt`) +provide Rust v0 mangling support. + +Reviewed-by: Kees Cook +Reviewed-by: Greg Kroah-Hartman +Co-developed-by: Alex Gaynor +Signed-off-by: Alex Gaynor +Co-developed-by: Wedson Almeida Filho +Signed-off-by: Wedson Almeida Filho +Signed-off-by: Miguel Ojeda +Stable-dep-of: efbd63983533 ("scripts/decode_stacktrace.sh: optionally use LLVM utilities") +Signed-off-by: Sasha Levin +--- + scripts/decode_stacktrace.sh | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh +index 51d48bf65fd7..2157332750d5 100755 +--- a/scripts/decode_stacktrace.sh ++++ b/scripts/decode_stacktrace.sh +@@ -9,6 +9,14 @@ if [[ $# < 1 ]]; then + exit 1 + fi + ++# Try to find a Rust demangler ++if type llvm-cxxfilt >/dev/null 2>&1 ; then ++ cppfilt=llvm-cxxfilt ++elif type c++filt >/dev/null 2>&1 ; then ++ cppfilt=c++filt ++ cppfilt_opts=-i ++fi ++ + if [[ $1 == "-r" ]] ; then + vmlinux="" + basepath="auto" +@@ -157,6 +165,12 @@ parse_symbol() { + # In the case of inlines, move everything to same line + code=${code//$'\n'/' '} + ++ # Demangle if the name looks like a Rust symbol and if ++ # we got a Rust demangler ++ if [[ $name =~ ^_R && $cppfilt != "" ]] ; then ++ name=$("$cppfilt" "$cppfilt_opts" "$name") ++ fi ++ + # Replace old address with pretty line numbers + symbol="$segment$name ($code)" + } +-- +2.43.0 + diff --git a/queue-5.10/scripts-decode_stacktrace.sh-optionally-use-llvm-uti.patch b/queue-5.10/scripts-decode_stacktrace.sh-optionally-use-llvm-uti.patch new file mode 100644 index 00000000000..9785774292c --- /dev/null +++ b/queue-5.10/scripts-decode_stacktrace.sh-optionally-use-llvm-uti.patch @@ -0,0 +1,102 @@ +From b6e76d4fbf32488ac9fb2548e01fae07ff9e95d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Sep 2023 03:48:17 +0000 +Subject: scripts/decode_stacktrace.sh: optionally use LLVM utilities + +From: Carlos Llamas + +[ Upstream commit efbd6398353315b7018e6943e41fee9ec35e875f ] + +GNU's addr2line can have problems parsing a vmlinux built with LLVM, +particularly when LTO was used. In order to decode the traces correctly +this patch adds the ability to switch to LLVM's utilities readelf and +addr2line. The same approach is followed by Will in [1]. + +Before: + $ scripts/decode_stacktrace.sh vmlinux < kernel.log + [17716.240635] Call trace: + [17716.240646] skb_cow_data (??:?) + [17716.240654] esp6_input (ld-temp.o:?) + [17716.240666] xfrm_input (ld-temp.o:?) + [17716.240674] xfrm6_rcv (??:?) + [...] + +After: + $ LLVM=1 scripts/decode_stacktrace.sh vmlinux < kernel.log + [17716.240635] Call trace: + [17716.240646] skb_cow_data (include/linux/skbuff.h:2172 net/core/skbuff.c:4503) + [17716.240654] esp6_input (net/ipv6/esp6.c:977) + [17716.240666] xfrm_input (net/xfrm/xfrm_input.c:659) + [17716.240674] xfrm6_rcv (net/ipv6/xfrm6_input.c:172) + [...] + +Note that one could set CROSS_COMPILE=llvm- instead to hack around this +issue. However, doing so can break the decodecode routine as it will +force the selection of other LLVM utilities down the line e.g. llvm-as. + +[1] https://lore.kernel.org/all/20230914131225.13415-3-will@kernel.org/ + +Link: https://lkml.kernel.org/r/20230929034836.403735-1-cmllamas@google.com +Signed-off-by: Carlos Llamas +Reviewed-by: Nick Desaulniers +Reviewed-by: Elliot Berman +Tested-by: Justin Stitt +Cc: Will Deacon +Cc: John Stultz +Cc: Masahiro Yamada +Cc: Nathan Chancellor +Cc: Tom Rix +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Sasha Levin +--- + scripts/decode_stacktrace.sh | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh +index 2157332750d5..3463f0f6c3f4 100755 +--- a/scripts/decode_stacktrace.sh ++++ b/scripts/decode_stacktrace.sh +@@ -17,6 +17,21 @@ elif type c++filt >/dev/null 2>&1 ; then + cppfilt_opts=-i + fi + ++UTIL_SUFFIX= ++if [[ -z ${LLVM:-} ]]; then ++ UTIL_PREFIX=${CROSS_COMPILE:-} ++else ++ UTIL_PREFIX=llvm- ++ if [[ ${LLVM} == */ ]]; then ++ UTIL_PREFIX=${LLVM}${UTIL_PREFIX} ++ elif [[ ${LLVM} == -* ]]; then ++ UTIL_SUFFIX=${LLVM} ++ fi ++fi ++ ++READELF=${UTIL_PREFIX}readelf${UTIL_SUFFIX} ++ADDR2LINE=${UTIL_PREFIX}addr2line${UTIL_SUFFIX} ++ + if [[ $1 == "-r" ]] ; then + vmlinux="" + basepath="auto" +@@ -52,7 +67,7 @@ fi + find_module() { + if [[ "$modpath" != "" ]] ; then + for fn in $(find "$modpath" -name "${module//_/[-_]}.ko*") ; do +- if readelf -WS "$fn" | grep -qwF .debug_line ; then ++ if ${READELF} -WS "$fn" | grep -qwF .debug_line ; then + echo $fn + return + fi +@@ -146,7 +161,7 @@ parse_symbol() { + if [[ $aarray_support == true && "${cache[$module,$address]+isset}" == "isset" ]]; then + local code=${cache[$module,$address]} + else +- local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null) ++ local code=$(${ADDR2LINE} -i -e "$objfile" "$address" 2>/dev/null) + if [[ $aarray_support == true ]]; then + cache[$module,$address]=$code + fi +-- +2.43.0 + diff --git a/queue-5.10/scripts-decode_stacktrace.sh-silence-stderr-messages.patch b/queue-5.10/scripts-decode_stacktrace.sh-silence-stderr-messages.patch new file mode 100644 index 00000000000..7824ff89275 --- /dev/null +++ b/queue-5.10/scripts-decode_stacktrace.sh-silence-stderr-messages.patch @@ -0,0 +1,80 @@ +From 5e2e842cb647d96b4877f7807335a47a5963d8ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jul 2021 18:09:35 -0700 +Subject: scripts/decode_stacktrace.sh: silence stderr messages from + addr2line/nm + +From: Stephen Boyd + +[ Upstream commit 5bf0f3bc377e5f87bfd61ccc9c1efb3c6261f2c3 ] + +Sometimes if you're using tools that have linked things improperly or have +new features/sections that older tools don't expect you'll see warnings +printed to stderr. We don't really care about these warnings, so let's +just silence these messages to cleanup output of this script. + +Link: https://lkml.kernel.org/r/20210511003845.2429846-10-swboyd@chromium.org +Signed-off-by: Stephen Boyd +Cc: Jiri Olsa +Cc: Alexei Starovoitov +Cc: Jessica Yu +Cc: Evan Green +Cc: Hsin-Yi Wang +Cc: Konstantin Khlebnikov +Cc: Sasha Levin +Cc: Andy Shevchenko +Cc: Baoquan He +Cc: Borislav Petkov +Cc: Catalin Marinas +Cc: Dave Young +Cc: Ingo Molnar +Cc: Matthew Wilcox +Cc: Petr Mladek +Cc: Rasmus Villemoes +Cc: Sergey Senozhatsky +Cc: Steven Rostedt +Cc: Thomas Gleixner +Cc: Vivek Goyal +Cc: Will Deacon +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Stable-dep-of: efbd63983533 ("scripts/decode_stacktrace.sh: optionally use LLVM utilities") +Signed-off-by: Sasha Levin +--- + scripts/decode_stacktrace.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh +index 90398347e366..5bdf610f33d2 100755 +--- a/scripts/decode_stacktrace.sh ++++ b/scripts/decode_stacktrace.sh +@@ -51,7 +51,7 @@ find_module() { + find_module && return + + if [[ $release == "" ]] ; then +- release=$(gdb -ex 'print init_uts_ns.name.release' -ex 'quit' -quiet -batch "$vmlinux" | sed -n 's/\$1 = "\(.*\)".*/\1/p') ++ release=$(gdb -ex 'print init_uts_ns.name.release' -ex 'quit' -quiet -batch "$vmlinux" 2>/dev/null | sed -n 's/\$1 = "\(.*\)".*/\1/p') + fi + + for dn in {/usr/lib/debug,}/lib/modules/$release ; do +@@ -105,7 +105,7 @@ parse_symbol() { + if [[ "${cache[$module,$name]+isset}" == "isset" ]]; then + local base_addr=${cache[$module,$name]} + else +- local base_addr=$(nm "$objfile" | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {print $1; exit}') ++ local base_addr=$(nm "$objfile" 2>/dev/null | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {print $1; exit}') + if [[ $base_addr == "" ]] ; then + # address not found + return +@@ -129,7 +129,7 @@ parse_symbol() { + if [[ "${cache[$module,$address]+isset}" == "isset" ]]; then + local code=${cache[$module,$address]} + else +- local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address") ++ local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null) + cache[$module,$address]=$code + fi + +-- +2.43.0 + diff --git a/queue-5.10/scripts-decode_stacktrace.sh-support-old-bash-versio.patch b/queue-5.10/scripts-decode_stacktrace.sh-support-old-bash-versio.patch new file mode 100644 index 00000000000..57bac7f4bf6 --- /dev/null +++ b/queue-5.10/scripts-decode_stacktrace.sh-support-old-bash-versio.patch @@ -0,0 +1,108 @@ +From 4beb7b9d7489d0bb0123819b23c0a0feb4b66b33 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Apr 2022 14:37:57 -0700 +Subject: scripts/decode_stacktrace.sh: support old bash version + +From: Schspa Shi + +[ Upstream commit 3af8acf6aff2a98731522b52927429760f0b8006 ] + +Old bash version don't support associative array variables. Avoid to use +associative array variables to avoid error. + +Without this, old bash version will report error as fellowing +[ 15.954042] Kernel panic - not syncing: sysrq triggered crash +[ 15.955252] CPU: 1 PID: 167 Comm: sh Not tainted 5.18.0-rc1-00208-gb7d075db2fd5 #4 +[ 15.956472] Hardware name: Hobot J5 Virtual development board (DT) +[ 15.957856] Call trace: +./scripts/decode_stacktrace.sh: line 128: ,dump_backtrace: syntax error: operand expected (error token is ",dump_backtrace") + +Link: https://lkml.kernel.org/r/20220409180331.24047-1-schspa@gmail.com +Signed-off-by: Schspa Shi +Cc: Stephen Boyd +Signed-off-by: Andrew Morton +Stable-dep-of: efbd63983533 ("scripts/decode_stacktrace.sh: optionally use LLVM utilities") +Signed-off-by: Sasha Levin +--- + scripts/decode_stacktrace.sh | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh +index 5bdf610f33d2..51d48bf65fd7 100755 +--- a/scripts/decode_stacktrace.sh ++++ b/scripts/decode_stacktrace.sh +@@ -33,8 +33,13 @@ else + release="" + fi + +-declare -A cache +-declare -A modcache ++declare aarray_support=true ++declare -A cache 2>/dev/null ++if [[ $? != 0 ]]; then ++ aarray_support=false ++else ++ declare -A modcache ++fi + + find_module() { + if [[ "$modpath" != "" ]] ; then +@@ -74,7 +79,7 @@ parse_symbol() { + + if [[ $module == "" ]] ; then + local objfile=$vmlinux +- elif [[ "${modcache[$module]+isset}" == "isset" ]]; then ++ elif [[ $aarray_support == true && "${modcache[$module]+isset}" == "isset" ]]; then + local objfile=${modcache[$module]} + else + local objfile=$(find_module) +@@ -82,7 +87,9 @@ parse_symbol() { + echo "WARNING! Modules path isn't set, but is needed to parse this symbol" >&2 + return + fi +- modcache[$module]=$objfile ++ if [[ $aarray_support == true ]]; then ++ modcache[$module]=$objfile ++ fi + fi + + # Remove the englobing parenthesis +@@ -102,7 +109,7 @@ parse_symbol() { + # Use 'nm vmlinux' to figure out the base address of said symbol. + # It's actually faster to call it every time than to load it + # all into bash. +- if [[ "${cache[$module,$name]+isset}" == "isset" ]]; then ++ if [[ $aarray_support == true && "${cache[$module,$name]+isset}" == "isset" ]]; then + local base_addr=${cache[$module,$name]} + else + local base_addr=$(nm "$objfile" 2>/dev/null | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {print $1; exit}') +@@ -110,7 +117,9 @@ parse_symbol() { + # address not found + return + fi +- cache[$module,$name]="$base_addr" ++ if [[ $aarray_support == true ]]; then ++ cache[$module,$name]="$base_addr" ++ fi + fi + # Let's start doing the math to get the exact address into the + # symbol. First, strip out the symbol total length. +@@ -126,11 +135,13 @@ parse_symbol() { + + # Pass it to addr2line to get filename and line number + # Could get more than one result +- if [[ "${cache[$module,$address]+isset}" == "isset" ]]; then ++ if [[ $aarray_support == true && "${cache[$module,$address]+isset}" == "isset" ]]; then + local code=${cache[$module,$address]} + else + local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null) +- cache[$module,$address]=$code ++ if [[ $aarray_support == true ]]; then ++ cache[$module,$address]=$code ++ fi + fi + + # addr2line doesn't return a proper error code if it fails, so +-- +2.43.0 + diff --git a/queue-5.10/serial-8250_exar-fill-in-rs485_supported.patch b/queue-5.10/serial-8250_exar-fill-in-rs485_supported.patch new file mode 100644 index 00000000000..de37e3cfe09 --- /dev/null +++ b/queue-5.10/serial-8250_exar-fill-in-rs485_supported.patch @@ -0,0 +1,80 @@ +From 1910a9007d9f9e54ef6cc575ea48e8b7f47a54e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 13:04:04 +0300 +Subject: serial: 8250_exar: Fill in rs485_supported +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +[ Upstream commit 59c221f8e1269278161313048c71929c9950b2c4 ] + +Add information on supported serial_rs485 features. + +Signed-off-by: Ilpo Järvinen +Link: https://lore.kernel.org/r/20220606100433.13793-8-ilpo.jarvinen@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 0c2a5f471ce5 ("serial: 8250_exar: Set missing rs485_supported flag") +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/8250_exar.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c +index 5c2adf14049b..19de9f535c67 100644 +--- a/drivers/tty/serial/8250/8250_exar.c ++++ b/drivers/tty/serial/8250/8250_exar.c +@@ -123,6 +123,7 @@ struct exar8250; + + struct exar8250_platform { + int (*rs485_config)(struct uart_port *, struct serial_rs485 *); ++ const struct serial_rs485 *rs485_supported; + int (*register_gpio)(struct pci_dev *, struct uart_8250_port *); + }; + +@@ -423,9 +424,14 @@ static int generic_rs485_config(struct uart_port *port, + return 0; + } + ++static const struct serial_rs485 generic_rs485_supported = { ++ .flags = SER_RS485_ENABLED, ++}; ++ + static const struct exar8250_platform exar8250_default_platform = { + .register_gpio = xr17v35x_register_gpio, + .rs485_config = generic_rs485_config, ++ .rs485_supported = &generic_rs485_supported, + }; + + static int iot2040_rs485_config(struct uart_port *port, +@@ -461,6 +467,10 @@ static int iot2040_rs485_config(struct uart_port *port, + return generic_rs485_config(port, rs485); + } + ++static const struct serial_rs485 iot2040_rs485_supported = { ++ .flags = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS, ++}; ++ + static const struct property_entry iot2040_gpio_properties[] = { + PROPERTY_ENTRY_U32("exar,first-pin", 10), + PROPERTY_ENTRY_U32("ngpios", 1), +@@ -485,6 +495,7 @@ static int iot2040_register_gpio(struct pci_dev *pcidev, + + static const struct exar8250_platform iot2040_platform = { + .rs485_config = iot2040_rs485_config, ++ .rs485_supported = &iot2040_rs485_supported, + .register_gpio = iot2040_register_gpio, + }; + +@@ -522,6 +533,7 @@ pci_xr17v35x_setup(struct exar8250 *priv, struct pci_dev *pcidev, + + port->port.uartclk = baud * 16; + port->port.rs485_config = platform->rs485_config; ++ port->port.rs485_supported = platform->rs485_supported; + + /* + * Setup the UART clock for the devices on expansion slot to +-- +2.43.0 + diff --git a/queue-5.10/serial-8250_exar-set-missing-rs485_supported-flag.patch b/queue-5.10/serial-8250_exar-set-missing-rs485_supported-flag.patch new file mode 100644 index 00000000000..83e50058f78 --- /dev/null +++ b/queue-5.10/serial-8250_exar-set-missing-rs485_supported-flag.patch @@ -0,0 +1,59 @@ +From e11401133e5ca6e646dac894df2b19b0731b478b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jan 2024 07:18:18 +0100 +Subject: serial: 8250_exar: Set missing rs485_supported flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lino Sanfilippo + +[ Upstream commit 0c2a5f471ce58bca8f8ab5fcb911aff91eaaa5eb ] + +The UART supports an auto-RTS mode in which the RTS pin is automatically +activated during transmission. So mark this mode as being supported even +if RTS is not controlled by the driver but the UART. + +Also the serial core expects now at least one of both modes rts-on-send or +rts-after-send to be supported. This is since during sanitization +unsupported flags are deleted from a RS485 configuration set by userspace. +However if the configuration ends up with both flags unset, the core prints +a warning since it considers such a configuration invalid (see +uart_sanitize_serial_rs485()). + +Cc: +Reviewed-by: Ilpo Järvinen +Signed-off-by: Lino Sanfilippo +Link: https://lore.kernel.org/r/20240103061818.564-8-l.sanfilippo@kunbus.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/8250_exar.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c +index 19de9f535c67..6e33c74e569f 100644 +--- a/drivers/tty/serial/8250/8250_exar.c ++++ b/drivers/tty/serial/8250/8250_exar.c +@@ -425,7 +425,7 @@ static int generic_rs485_config(struct uart_port *port, + } + + static const struct serial_rs485 generic_rs485_supported = { +- .flags = SER_RS485_ENABLED, ++ .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND, + }; + + static const struct exar8250_platform exar8250_default_platform = { +@@ -468,7 +468,8 @@ static int iot2040_rs485_config(struct uart_port *port, + } + + static const struct serial_rs485 iot2040_rs485_supported = { +- .flags = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS, ++ .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | ++ SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS, + }; + + static const struct property_entry iot2040_gpio_properties[] = { +-- +2.43.0 + diff --git a/queue-5.10/serial-add-rs485_supported-to-uart_port.patch b/queue-5.10/serial-add-rs485_supported-to-uart_port.patch new file mode 100644 index 00000000000..0e461bd64c2 --- /dev/null +++ b/queue-5.10/serial-add-rs485_supported-to-uart_port.patch @@ -0,0 +1,53 @@ +From 2644c0f4608f22a803469660fc125f2ee4f4c0b2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 13:04:00 +0300 +Subject: serial: Add rs485_supported to uart_port +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +[ Upstream commit 8925c31c1ac2f1e05da988581f2a70a2a8c4d638 ] + +Preparing to move serial_rs485 struct sanitization into serial core, +each driver has to provide what fields/flags it supports. This +information is pointed into by rs485_supported. + +Signed-off-by: Ilpo Järvinen +Link: https://lore.kernel.org/r/20220606100433.13793-4-ilpo.jarvinen@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 0c2a5f471ce5 ("serial: 8250_exar: Set missing rs485_supported flag") +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/8250_core.c | 1 + + include/linux/serial_core.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c +index 43f2eed6df78..355ee338d752 100644 +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -1026,6 +1026,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up) + uart->port.throttle = up->port.throttle; + uart->port.unthrottle = up->port.unthrottle; + uart->port.rs485_config = up->port.rs485_config; ++ uart->port.rs485_supported = up->port.rs485_supported; + uart->port.rs485 = up->port.rs485; + uart->rs485_start_tx = up->rs485_start_tx; + uart->rs485_stop_tx = up->rs485_stop_tx; +diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h +index 6df4c3356ae6..46a21984c0b2 100644 +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -254,6 +254,7 @@ struct uart_port { + struct attribute_group *attr_group; /* port specific attributes */ + const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ + struct serial_rs485 rs485; ++ const struct serial_rs485 *rs485_supported; /* Supported mask for serial_rs485 */ + struct gpio_desc *rs485_term_gpio; /* enable RS485 bus termination */ + struct serial_iso7816 iso7816; + void *private_data; /* generic platform data pointer */ +-- +2.43.0 + diff --git a/queue-5.10/series b/queue-5.10/series index 7267225166a..4a97977d293 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -348,3 +348,19 @@ of-property-fix-typo-in-io-channels.patch can-j1939-fix-uaf-in-j1939_sk_match_filter-during-setsockopt-so_j1939_filter.patch pmdomain-core-move-the-unused-cleanup-to-a-_sync-initcall.patch tracing-inform-kmemleak-of-saved_cmdlines-allocation.patch +revert-md-raid5-wait-for-md_sb_change_pending-in-rai.patch +mwifiex-select-firmware-based-on-strapping.patch +wifi-mwifiex-support-sd8978-chipset.patch +wifi-mwifiex-add-extra-delay-for-firmware-ready.patch +bus-moxtet-add-spi-device-table.patch +pci-dwc-endpoint-fix-dw_pcie_ep_raise_msix_irq-align.patch +mips-fix-max_mapnr-being-uninitialized-on-early-stag.patch +wifi-mwifiex-fix-uninitialized-firmware_stat.patch +crypto-lib-mpi-fix-unexpected-pointer-access-in-mpi_.patch +serial-add-rs485_supported-to-uart_port.patch +serial-8250_exar-fill-in-rs485_supported.patch +serial-8250_exar-set-missing-rs485_supported-flag.patch +scripts-decode_stacktrace.sh-silence-stderr-messages.patch +scripts-decode_stacktrace.sh-support-old-bash-versio.patch +scripts-decode_stacktrace-demangle-rust-symbols.patch +scripts-decode_stacktrace.sh-optionally-use-llvm-uti.patch diff --git a/queue-5.10/wifi-mwifiex-add-extra-delay-for-firmware-ready.patch b/queue-5.10/wifi-mwifiex-add-extra-delay-for-firmware-ready.patch new file mode 100644 index 00000000000..cc90870bbaf --- /dev/null +++ b/queue-5.10/wifi-mwifiex-add-extra-delay-for-firmware-ready.patch @@ -0,0 +1,163 @@ +From f0b614635792cf579271b83afbee3de650c8654e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 07:40:29 +0800 +Subject: wifi: mwifiex: add extra delay for firmware ready + +From: David Lin + +[ Upstream commit 1c5d463c0770c6fa2037511a24fb17966fd07d97 ] + +For SDIO IW416, due to a bug, FW may return ready before complete full +initialization. Command timeout may occur at driver load after reboot. +Workaround by adding 100ms delay at checking FW status. + +Signed-off-by: David Lin +Cc: stable@vger.kernel.org +Reviewed-by: Francesco Dolcini +Acked-by: Brian Norris +Tested-by: Marcel Ziswiler # Verdin AM62 (IW416) +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231208234029.2197-1-yu-hao.lin@nxp.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/marvell/mwifiex/sdio.c | 19 +++++++++++++++++++ + drivers/net/wireless/marvell/mwifiex/sdio.h | 2 ++ + 2 files changed, 21 insertions(+) + +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c +index 919f1bae61dc..dd4bfb7d71ee 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.c ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.c +@@ -343,6 +343,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { + .can_dump_fw = false, + .can_auto_tdls = false, + .can_ext_scan = false, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { +@@ -358,6 +359,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { + .can_dump_fw = false, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { +@@ -373,6 +375,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { + .can_dump_fw = false, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { +@@ -388,6 +391,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { + .can_dump_fw = true, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { +@@ -404,6 +408,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { + .fw_dump_enh = true, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { +@@ -420,6 +425,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { + .fw_dump_enh = true, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = true, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { +@@ -436,6 +442,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { + .fw_dump_enh = true, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { +@@ -451,6 +458,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { + .can_dump_fw = false, + .can_auto_tdls = true, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { +@@ -467,6 +475,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { + .fw_dump_enh = true, + .can_auto_tdls = true, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { +@@ -482,6 +491,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { + .can_dump_fw = false, + .can_auto_tdls = false, + .can_ext_scan = true, ++ .fw_ready_extra_delay = false, + }; + + static struct memory_type_mapping generic_mem_type_map[] = { +@@ -574,6 +584,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) + card->fw_dump_enh = data->fw_dump_enh; + card->can_auto_tdls = data->can_auto_tdls; + card->can_ext_scan = data->can_ext_scan; ++ card->fw_ready_extra_delay = data->fw_ready_extra_delay; + INIT_WORK(&card->work, mwifiex_sdio_work); + } + +@@ -777,6 +788,7 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) + static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, + u32 poll_num) + { ++ struct sdio_mmc_card *card = adapter->card; + int ret = 0; + u16 firmware_stat; + u32 tries; +@@ -794,6 +806,13 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, + ret = -1; + } + ++ if (card->fw_ready_extra_delay && ++ firmware_stat == FIRMWARE_READY_SDIO) ++ /* firmware might pretend to be ready, when it's not. ++ * Wait a little bit more as a workaround. ++ */ ++ msleep(100); ++ + return ret; + } + +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h +index 4ed3988fa7d1..5fef84da4cbd 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.h ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.h +@@ -271,6 +271,7 @@ struct sdio_mmc_card { + bool fw_dump_enh; + bool can_auto_tdls; + bool can_ext_scan; ++ bool fw_ready_extra_delay; + + struct mwifiex_sdio_mpa_tx mpa_tx; + struct mwifiex_sdio_mpa_rx mpa_rx; +@@ -294,6 +295,7 @@ struct mwifiex_sdio_device { + bool fw_dump_enh; + bool can_auto_tdls; + bool can_ext_scan; ++ bool fw_ready_extra_delay; + }; + + /* +-- +2.43.0 + diff --git a/queue-5.10/wifi-mwifiex-fix-uninitialized-firmware_stat.patch b/queue-5.10/wifi-mwifiex-fix-uninitialized-firmware_stat.patch new file mode 100644 index 00000000000..442ecd89b8b --- /dev/null +++ b/queue-5.10/wifi-mwifiex-fix-uninitialized-firmware_stat.patch @@ -0,0 +1,41 @@ +From fa657732baa106161ffe6508e9e762107daa2e1e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Dec 2023 09:55:11 +0800 +Subject: wifi: mwifiex: fix uninitialized firmware_stat + +From: David Lin + +[ Upstream commit 3df95e265924ac898c1a38a0c01846dd0bd3b354 ] + +Variable firmware_stat is possible to be used without initialization. + +Signed-off-by: David Lin +Fixes: 1c5d463c0770 ("wifi: mwifiex: add extra delay for firmware ready") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202312192236.ZflaWYCw-lkp@intel.com/ +Acked-by: Brian Norris +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231221015511.1032128-1-yu-hao.lin@nxp.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/marvell/mwifiex/sdio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c +index dd4bfb7d71ee..45f46a445a6c 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.c ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.c +@@ -790,7 +790,7 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, + { + struct sdio_mmc_card *card = adapter->card; + int ret = 0; +- u16 firmware_stat; ++ u16 firmware_stat = 0; + u32 tries; + + for (tries = 0; tries < poll_num; tries++) { +-- +2.43.0 + diff --git a/queue-5.10/wifi-mwifiex-support-sd8978-chipset.patch b/queue-5.10/wifi-mwifiex-support-sd8978-chipset.patch new file mode 100644 index 00000000000..869632e7c5f --- /dev/null +++ b/queue-5.10/wifi-mwifiex-support-sd8978-chipset.patch @@ -0,0 +1,177 @@ +From 5b666d1b9c78f49d5bdc55236a86ddff91ac109b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Jan 2023 15:02:00 +0100 +Subject: wifi: mwifiex: Support SD8978 chipset + +From: Lukas Wunner + +[ Upstream commit bba047f15851c8b053221f1b276eb7682d59f755 ] + +The Marvell SD8978 (aka NXP IW416) uses identical registers as SD8987, +so reuse the existing mwifiex_reg_sd8987 definition. + +Note that mwifiex_reg_sd8977 and mwifiex_reg_sd8997 are likewise +identical, save for the fw_dump_ctrl register: They define it as 0xf0 +whereas mwifiex_reg_sd8987 defines it as 0xf9. I've verified that +0xf9 is the correct value on SD8978. NXP's out-of-tree driver uses +0xf9 for all of them, so there's a chance that 0xf0 is not correct +in the mwifiex_reg_sd8977 and mwifiex_reg_sd8997 definitions. I cannot +test that for lack of hardware, hence am leaving it as is. + +NXP has only released a firmware which runs Bluetooth over UART. +Perhaps Bluetooth over SDIO is unsupported by this chipset. +Consequently, only an "sdiouart" firmware image is referenced, not an +alternative "sdsd" image. + +Signed-off-by: Lukas Wunner +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/536b4f17a72ca460ad1b07045757043fb0778988.1674827105.git.lukas@wunner.de +Stable-dep-of: 1c5d463c0770 ("wifi: mwifiex: add extra delay for firmware ready") +Signed-off-by: Sasha Levin +--- + .../bindings/net/wireless/marvell-8xxx.txt | 4 ++- + drivers/net/wireless/marvell/mwifiex/Kconfig | 5 ++-- + drivers/net/wireless/marvell/mwifiex/sdio.c | 25 +++++++++++++++++-- + drivers/net/wireless/marvell/mwifiex/sdio.h | 1 + + include/linux/mmc/sdio_ids.h | 1 + + 5 files changed, 31 insertions(+), 5 deletions(-) + +diff --git a/Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt b/Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt +index 9bf9bbac16e2..cdc303caf5f4 100644 +--- a/Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt ++++ b/Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt +@@ -1,4 +1,4 @@ +-Marvell 8787/8897/8997 (sd8787/sd8897/sd8997/pcie8997) SDIO/PCIE devices ++Marvell 8787/8897/8978/8997 (sd8787/sd8897/sd8978/sd8997/pcie8997) SDIO/PCIE devices + ------ + + This node provides properties for controlling the Marvell SDIO/PCIE wireless device. +@@ -10,7 +10,9 @@ Required properties: + - compatible : should be one of the following: + * "marvell,sd8787" + * "marvell,sd8897" ++ * "marvell,sd8978" + * "marvell,sd8997" ++ * "nxp,iw416" + * "pci11ab,2b42" + * "pci1b4b,2b42" + +diff --git a/drivers/net/wireless/marvell/mwifiex/Kconfig b/drivers/net/wireless/marvell/mwifiex/Kconfig +index 2b4ff2b78a7e..b182f7155d66 100644 +--- a/drivers/net/wireless/marvell/mwifiex/Kconfig ++++ b/drivers/net/wireless/marvell/mwifiex/Kconfig +@@ -10,13 +10,14 @@ config MWIFIEX + mwifiex. + + config MWIFIEX_SDIO +- tristate "Marvell WiFi-Ex Driver for SD8786/SD8787/SD8797/SD8887/SD8897/SD8977/SD8987/SD8997" ++ tristate "Marvell WiFi-Ex Driver for SD8786/SD8787/SD8797/SD8887/SD8897/SD8977/SD8978/SD8987/SD8997" + depends on MWIFIEX && MMC + select FW_LOADER + select WANT_DEV_COREDUMP + help + This adds support for wireless adapters based on Marvell +- 8786/8787/8797/8887/8897/8977/8987/8997 chipsets with SDIO interface. ++ 8786/8787/8797/8887/8897/8977/8978/8987/8997 chipsets with ++ SDIO interface. SD8978 is also known as NXP IW416. + + If you choose to build it as a module, it will be called + mwifiex_sdio. +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c +index 016065a56e6c..919f1bae61dc 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.c ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.c +@@ -275,7 +275,7 @@ static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8887 = { + 0x68, 0x69, 0x6a}, + }; + +-static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8987 = { ++static const struct mwifiex_sdio_card_reg mwifiex_reg_sd89xx = { + .start_rd_port = 0, + .start_wr_port = 0, + .base_0_reg = 0xF8, +@@ -406,6 +406,22 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { + .can_ext_scan = true, + }; + ++static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { ++ .firmware_sdiouart = SD8978_SDIOUART_FW_NAME, ++ .reg = &mwifiex_reg_sd89xx, ++ .max_ports = 32, ++ .mp_agg_pkt_limit = 16, ++ .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, ++ .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_MAX, ++ .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_MAX, ++ .supports_sdio_new_mode = true, ++ .has_control_mask = false, ++ .can_dump_fw = true, ++ .fw_dump_enh = true, ++ .can_auto_tdls = false, ++ .can_ext_scan = true, ++}; ++ + static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { + .firmware = SD8997_DEFAULT_FW_NAME, + .reg = &mwifiex_reg_sd8997, +@@ -439,7 +455,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { + + static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { + .firmware = SD8987_DEFAULT_FW_NAME, +- .reg = &mwifiex_reg_sd8987, ++ .reg = &mwifiex_reg_sd89xx, + .max_ports = 32, + .mp_agg_pkt_limit = 16, + .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, +@@ -493,7 +509,9 @@ static struct memory_type_mapping mem_type_mapping_tbl[] = { + static const struct of_device_id mwifiex_sdio_of_match_table[] __maybe_unused = { + { .compatible = "marvell,sd8787" }, + { .compatible = "marvell,sd8897" }, ++ { .compatible = "marvell,sd8978" }, + { .compatible = "marvell,sd8997" }, ++ { .compatible = "nxp,iw416" }, + { } + }; + +@@ -931,6 +949,8 @@ static const struct sdio_device_id mwifiex_ids[] = { + .driver_data = (unsigned long)&mwifiex_sdio_sd8801}, + {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8977_WLAN), + .driver_data = (unsigned long)&mwifiex_sdio_sd8977}, ++ {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8978_WLAN), ++ .driver_data = (unsigned long)&mwifiex_sdio_sd8978}, + {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8987_WLAN), + .driver_data = (unsigned long)&mwifiex_sdio_sd8987}, + {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8997_WLAN), +@@ -3175,5 +3195,6 @@ MODULE_FIRMWARE(SD8797_DEFAULT_FW_NAME); + MODULE_FIRMWARE(SD8897_DEFAULT_FW_NAME); + MODULE_FIRMWARE(SD8887_DEFAULT_FW_NAME); + MODULE_FIRMWARE(SD8977_DEFAULT_FW_NAME); ++MODULE_FIRMWARE(SD8978_SDIOUART_FW_NAME); + MODULE_FIRMWARE(SD8987_DEFAULT_FW_NAME); + MODULE_FIRMWARE(SD8997_DEFAULT_FW_NAME); +diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h +index 5ff33ee53bb3..4ed3988fa7d1 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sdio.h ++++ b/drivers/net/wireless/marvell/mwifiex/sdio.h +@@ -37,6 +37,7 @@ + #define SD8887_DEFAULT_FW_NAME "mrvl/sd8887_uapsta.bin" + #define SD8801_DEFAULT_FW_NAME "mrvl/sd8801_uapsta.bin" + #define SD8977_DEFAULT_FW_NAME "mrvl/sdsd8977_combo_v2.bin" ++#define SD8978_SDIOUART_FW_NAME "mrvl/sdiouartiw416_combo_v0.bin" + #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin" + #define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin" + +diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h +index 12036619346c..c26fd094e097 100644 +--- a/include/linux/mmc/sdio_ids.h ++++ b/include/linux/mmc/sdio_ids.h +@@ -100,6 +100,7 @@ + #define SDIO_DEVICE_ID_MARVELL_8977_BT 0x9146 + #define SDIO_DEVICE_ID_MARVELL_8987_WLAN 0x9149 + #define SDIO_DEVICE_ID_MARVELL_8987_BT 0x914a ++#define SDIO_DEVICE_ID_MARVELL_8978_WLAN 0x9159 + + #define SDIO_VENDOR_ID_MEDIATEK 0x037a + #define SDIO_DEVICE_ID_MEDIATEK_MT7663 0x7663 +-- +2.43.0 +