diff options
23 files changed, 2465 insertions, 0 deletions
diff --git a/queue-6.15/arm64-ptrace-fix-stack-out-of-bounds-read-in-regs_ge.patch b/queue-6.15/arm64-ptrace-fix-stack-out-of-bounds-read-in-regs_ge.patch new file mode 100644 index 0000000000..bc87b49f04 --- /dev/null +++ b/queue-6.15/arm64-ptrace-fix-stack-out-of-bounds-read-in-regs_ge.patch @@ -0,0 +1,107 @@ +From 8cdf5d6cd7a4af28b31675abdd1a205e3f0cf5f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Wed, 4 Jun 2025 00:55:33 +0000 +Subject: arm64/ptrace: Fix stack-out-of-bounds read in + regs_get_kernel_stack_nth() + +From: Tengda Wu <wutengda@huaweicloud.com> + +[ Upstream commit 39dfc971e42d886e7df01371cd1bef505076d84c ] + +KASAN reports a stack-out-of-bounds read in regs_get_kernel_stack_nth(). + +Call Trace: +[ 97.283505] BUG: KASAN: stack-out-of-bounds in regs_get_kernel_stack_nth+0xa8/0xc8 +[ 97.284677] Read of size 8 at addr ffff800089277c10 by task 1.sh/2550 +[ 97.285732] +[ 97.286067] CPU: 7 PID: 2550 Comm: 1.sh Not tainted 6.6.0+ #11 +[ 97.287032] Hardware name: linux,dummy-virt (DT) +[ 97.287815] Call trace: +[ 97.288279] dump_backtrace+0xa0/0x128 +[ 97.288946] show_stack+0x20/0x38 +[ 97.289551] dump_stack_lvl+0x78/0xc8 +[ 97.290203] print_address_description.constprop.0+0x84/0x3c8 +[ 97.291159] print_report+0xb0/0x280 +[ 97.291792] kasan_report+0x84/0xd0 +[ 97.292421] __asan_load8+0x9c/0xc0 +[ 97.293042] regs_get_kernel_stack_nth+0xa8/0xc8 +[ 97.293835] process_fetch_insn+0x770/0xa30 +[ 97.294562] kprobe_trace_func+0x254/0x3b0 +[ 97.295271] kprobe_dispatcher+0x98/0xe0 +[ 97.295955] kprobe_breakpoint_handler+0x1b0/0x210 +[ 97.296774] call_break_hook+0xc4/0x100 +[ 97.297451] brk_handler+0x24/0x78 +[ 97.298073] do_debug_exception+0xac/0x178 +[ 97.298785] el1_dbg+0x70/0x90 +[ 97.299344] el1h_64_sync_handler+0xcc/0xe8 +[ 97.300066] el1h_64_sync+0x78/0x80 +[ 97.300699] kernel_clone+0x0/0x500 +[ 97.301331] __arm64_sys_clone+0x70/0x90 +[ 97.302084] invoke_syscall+0x68/0x198 +[ 97.302746] el0_svc_common.constprop.0+0x11c/0x150 +[ 97.303569] do_el0_svc+0x38/0x50 +[ 97.304164] el0_svc+0x44/0x1d8 +[ 97.304749] el0t_64_sync_handler+0x100/0x130 +[ 97.305500] el0t_64_sync+0x188/0x190 +[ 97.306151] +[ 97.306475] The buggy address belongs to stack of task 1.sh/2550 +[ 97.307461] and is located at offset 0 in frame: +[ 97.308257] __se_sys_clone+0x0/0x138 +[ 97.308910] +[ 97.309241] This frame has 1 object: +[ 97.309873] [48, 184) 'args' +[ 97.309876] +[ 97.310749] The buggy address belongs to the virtual mapping at +[ 97.310749] [ffff800089270000, ffff800089279000) created by: +[ 97.310749] dup_task_struct+0xc0/0x2e8 +[ 97.313347] +[ 97.313674] The buggy address belongs to the physical page: +[ 97.314604] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14f69a +[ 97.315885] flags: 0x15ffffe00000000(node=1|zone=2|lastcpupid=0xfffff) +[ 97.316957] raw: 015ffffe00000000 0000000000000000 dead000000000122 0000000000000000 +[ 97.318207] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 +[ 97.319445] page dumped because: kasan: bad access detected +[ 97.320371] +[ 97.320694] Memory state around the buggy address: +[ 97.321511] ffff800089277b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[ 97.322681] ffff800089277b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[ 97.323846] >ffff800089277c00: 00 00 f1 f1 f1 f1 f1 f1 00 00 00 00 00 00 00 00 +[ 97.325023] ^ +[ 97.325683] ffff800089277c80: 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 f3 f3 +[ 97.326856] ffff800089277d00: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +This issue seems to be related to the behavior of some gcc compilers and +was also fixed on the s390 architecture before: + + commit d93a855c31b7 ("s390/ptrace: Avoid KASAN false positives in regs_get_kernel_stack_nth()") + +As described in that commit, regs_get_kernel_stack_nth() has confirmed that +`addr` is on the stack, so reading the value at `*addr` should be allowed. +Use READ_ONCE_NOCHECK() helper to silence the KASAN check for this case. + +Fixes: 0a8ea52c3eb1 ("arm64: Add HAVE_REGS_AND_STACK_ACCESS_API feature") +Signed-off-by: Tengda Wu <wutengda@huaweicloud.com> +Link: https://lore.kernel.org/r/20250604005533.1278992-1-wutengda@huaweicloud.com +[will: Use '*addr' as the argument to READ_ONCE_NOCHECK()] +Signed-off-by: Will Deacon <will@kernel.org> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + arch/arm64/kernel/ptrace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c +index f79b0d5f71ac9..f8345c39c7054 100644 +--- a/arch/arm64/kernel/ptrace.c ++++ b/arch/arm64/kernel/ptrace.c +@@ -141,7 +141,7 @@ unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n) + + addr += n; + if (regs_within_kernel_stack(regs, (unsigned long)addr)) +- return *addr; ++ return READ_ONCE_NOCHECK(*addr); + else + return 0; + } +-- +2.39.5 + diff --git a/queue-6.15/cifs-remove-duplicate-fattr-cf_dtype-assignment-from.patch b/queue-6.15/cifs-remove-duplicate-fattr-cf_dtype-assignment-from.patch new file mode 100644 index 0000000000..818edda7b5 --- /dev/null +++ b/queue-6.15/cifs-remove-duplicate-fattr-cf_dtype-assignment-from.patch @@ -0,0 +1,41 @@ +From d0ec59007ff42a49117644ae411d02d9915181a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Sun, 8 Jun 2025 16:10:33 +0200 +Subject: cifs: Remove duplicate fattr->cf_dtype assignment from wsl_to_fattr() + function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár <pali@kernel.org> + +[ Upstream commit 840738eae94864993a735ab677b9795bb8f3b961 ] + +Commit 8bd25b61c5a5 ("smb: client: set correct d_type for reparse DFS/DFSR +and mount point") deduplicated assignment of fattr->cf_dtype member from +all places to end of the function cifs_reparse_point_to_fattr(). The only +one missing place which was not deduplicated is wsl_to_fattr(). Fix it. + +Fixes: 8bd25b61c5a5 ("smb: client: set correct d_type for reparse DFS/DFSR and mount point") +Signed-off-by: Pali Rohár <pali@kernel.org> +Signed-off-by: Steve French <stfrench@microsoft.com> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + fs/smb/client/reparse.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c +index bb25e77c5540c..511611206dab4 100644 +--- a/fs/smb/client/reparse.c ++++ b/fs/smb/client/reparse.c +@@ -1172,7 +1172,6 @@ static bool wsl_to_fattr(struct cifs_open_info_data *data, + if (!have_xattr_dev && (tag == IO_REPARSE_TAG_LX_CHR || tag == IO_REPARSE_TAG_LX_BLK)) + return false; + +- fattr->cf_dtype = S_DT(fattr->cf_mode); + return true; + } + +-- +2.39.5 + diff --git a/queue-6.15/erofs-refuse-crafted-out-of-file-range-encoded-exten.patch b/queue-6.15/erofs-refuse-crafted-out-of-file-range-encoded-exten.patch new file mode 100644 index 0000000000..b3ba4cf1a4 --- /dev/null +++ b/queue-6.15/erofs-refuse-crafted-out-of-file-range-encoded-exten.patch @@ -0,0 +1,44 @@ +From af6ae64468708f397fcd30ed40dc5e816202695d Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 19 Jun 2025 11:28:39 +0800 +Subject: erofs: refuse crafted out-of-file-range encoded extents + +From: Gao Xiang <hsiangkao@linux.alibaba.com> + +[ Upstream commit 7869738b6908eec7755818aaf6f3aa068b2f0e1b ] + +Crafted encoded extents could record out-of-range `lstart`, which should +not happen in normal cases. + +It caused an iomap_iter_done() complaint [1] reported by syzbot. + +[1] https://lore.kernel.org/r/684cb499.a00a0220.c6bd7.0010.GAE@google.com + +Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata") +Reported-and-tested-by: syzbot+d8f000c609f05f52d9b5@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5 +Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> +Link: https://lore.kernel.org/r/20250619032839.2642193-1-hsiangkao@linux.alibaba.com +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + fs/erofs/zmap.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c +index 14ea47f954f55..6afcb054780d4 100644 +--- a/fs/erofs/zmap.c ++++ b/fs/erofs/zmap.c +@@ -597,6 +597,10 @@ static int z_erofs_map_blocks_ext(struct inode *inode, + + if (la > map->m_la) { + r = mid; ++ if (la > lend) { ++ DBG_BUGON(1); ++ return -EFSCORRUPTED; ++ } + lend = la; + } else { + l = mid + 1; +-- +2.39.5 + diff --git a/queue-6.15/erofs-remove-a-superfluous-check-for-encoded-extents.patch b/queue-6.15/erofs-remove-a-superfluous-check-for-encoded-extents.patch new file mode 100644 index 0000000000..3fb697eb79 --- /dev/null +++ b/queue-6.15/erofs-remove-a-superfluous-check-for-encoded-extents.patch @@ -0,0 +1,40 @@ +From 0129e7edcfbb9709a0c90abf3824a27167867ab1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Fri, 20 Jun 2025 23:31:08 +0800 +Subject: erofs: remove a superfluous check for encoded extents + +From: Gao Xiang <hsiangkao@linux.alibaba.com> + +[ Upstream commit 417b8af2e30d7f131682a893ad79c506fd39c624 ] + +It is possible when an inode is split into segments for multi-threaded +compression, and the tail extent of a segment could also be small. + +Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata") +Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> +Link: https://lore.kernel.org/r/20250620153108.1368029-1-hsiangkao@linux.alibaba.com +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + fs/erofs/zmap.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c +index 6afcb054780d4..0bebc6e3a4d7d 100644 +--- a/fs/erofs/zmap.c ++++ b/fs/erofs/zmap.c +@@ -639,12 +639,6 @@ static int z_erofs_map_blocks_ext(struct inode *inode, + } + } + map->m_llen = lend - map->m_la; +- if (!last && map->m_llen < sb->s_blocksize) { +- erofs_err(sb, "extent too small %llu @ offset %llu of nid %llu", +- map->m_llen, map->m_la, vi->nid); +- DBG_BUGON(1); +- return -EFSCORRUPTED; +- } + return 0; + } + +-- +2.39.5 + diff --git a/queue-6.15/gpio-mlxbf3-only-get-irq-for-device-instance-0.patch b/queue-6.15/gpio-mlxbf3-only-get-irq-for-device-instance-0.patch new file mode 100644 index 0000000000..a8bd855183 --- /dev/null +++ b/queue-6.15/gpio-mlxbf3-only-get-irq-for-device-instance-0.patch @@ -0,0 +1,103 @@ +From 1b92dc1464255ddb6837f1642c9c134ec58609b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Fri, 13 Jun 2025 16:34:43 +0000 +Subject: gpio: mlxbf3: only get IRQ for device instance 0 + +From: David Thompson <davthompson@nvidia.com> + +[ Upstream commit 10af0273a35ab4513ca1546644b8c853044da134 ] + +The gpio-mlxbf3 driver interfaces with two GPIO controllers, +device instance 0 and 1. There is a single IRQ resource shared +between the two controllers, and it is found in the ACPI table for +device instance 0. The driver should not attempt to get an IRQ +resource when probing device instance 1, otherwise the following +error is logged: + mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found + +Signed-off-by: David Thompson <davthompson@nvidia.com> +Reviewed-by: Shravan Kumar Ramani <shravankr@nvidia.com> +Fixes: cd33f216d241 ("gpio: mlxbf3: Add gpio driver support") +Link: https://lore.kernel.org/r/20250613163443.1065217-1-davthompson@nvidia.com +Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/gpio/gpio-mlxbf3.c | 54 ++++++++++++++++++++++++-------------- + 1 file changed, 35 insertions(+), 19 deletions(-) + +diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c +index 10ea71273c891..9875e34bde72a 100644 +--- a/drivers/gpio/gpio-mlxbf3.c ++++ b/drivers/gpio/gpio-mlxbf3.c +@@ -190,7 +190,9 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev) + struct mlxbf3_gpio_context *gs; + struct gpio_irq_chip *girq; + struct gpio_chip *gc; ++ char *colon_ptr; + int ret, irq; ++ long num; + + gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL); + if (!gs) +@@ -227,25 +229,39 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev) + gc->owner = THIS_MODULE; + gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges; + +- irq = platform_get_irq(pdev, 0); +- if (irq >= 0) { +- girq = &gs->gc.irq; +- gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); +- girq->default_type = IRQ_TYPE_NONE; +- /* This will let us handle the parent IRQ in the driver */ +- girq->num_parents = 0; +- girq->parents = NULL; +- girq->parent_handler = NULL; +- girq->handler = handle_bad_irq; +- +- /* +- * Directly request the irq here instead of passing +- * a flow-handler because the irq is shared. +- */ +- ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler, +- IRQF_SHARED, dev_name(dev), gs); +- if (ret) +- return dev_err_probe(dev, ret, "failed to request IRQ"); ++ colon_ptr = strchr(dev_name(dev), ':'); ++ if (!colon_ptr) { ++ dev_err(dev, "invalid device name format\n"); ++ return -EINVAL; ++ } ++ ++ ret = kstrtol(++colon_ptr, 16, &num); ++ if (ret) { ++ dev_err(dev, "invalid device instance\n"); ++ return ret; ++ } ++ ++ if (!num) { ++ irq = platform_get_irq(pdev, 0); ++ if (irq >= 0) { ++ girq = &gs->gc.irq; ++ gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); ++ girq->default_type = IRQ_TYPE_NONE; ++ /* This will let us handle the parent IRQ in the driver */ ++ girq->num_parents = 0; ++ girq->parents = NULL; ++ girq->parent_handler = NULL; ++ girq->handler = handle_bad_irq; ++ ++ /* ++ * Directly request the irq here instead of passing ++ * a flow-handler because the irq is shared. ++ */ ++ ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler, ++ IRQF_SHARED, dev_name(dev), gs); ++ if (ret) ++ return dev_err_probe(dev, ret, "failed to request IRQ"); ++ } + } + + platform_set_drvdata(pdev, gs); +-- +2.39.5 + diff --git a/queue-6.15/gpio-pca953x-fix-wrong-error-probe-return-value.patch b/queue-6.15/gpio-pca953x-fix-wrong-error-probe-return-value.patch new file mode 100644 index 0000000000..9962942e8c --- /dev/null +++ b/queue-6.15/gpio-pca953x-fix-wrong-error-probe-return-value.patch @@ -0,0 +1,38 @@ +From 4e6d2885d2434469411b103de1f6853ffde90374 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Mon, 16 Jun 2025 15:45:03 +0200 +Subject: gpio: pca953x: fix wrong error probe return value + +From: Sascha Hauer <s.hauer@pengutronix.de> + +[ Upstream commit 0a1db19f66c0960eb00e1f2ccd40708b6747f5b1 ] + +The second argument to dev_err_probe() is the error value. Pass the +return value of devm_request_threaded_irq() there instead of the irq +number. + +Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> +Fixes: c47f7ff0fe61 ("gpio: pca953x: Utilise dev_err_probe() where it makes sense") +Link: https://lore.kernel.org/r/20250616134503.1201138-1-s.hauer@pengutronix.de +Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/gpio/gpio-pca953x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index 13cc120cf11f1..02da81ff1c0f1 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -952,7 +952,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) + IRQF_ONESHOT | IRQF_SHARED, dev_name(dev), + chip); + if (ret) +- return dev_err_probe(dev, client->irq, "failed to request irq\n"); ++ return dev_err_probe(dev, ret, "failed to request irq\n"); + + return 0; + } +-- +2.39.5 + diff --git a/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-dual-io.patch b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-dual-io.patch new file mode 100644 index 0000000000..6343a016b3 --- /dev/null +++ b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-dual-io.patch @@ -0,0 +1,225 @@ +From fc2108137ee4d671b28441d497e0e9fb181975e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 3 Apr 2025 11:19:19 +0200 +Subject: mtd: spinand: Use more specific naming for the (dual IO) read from + cache ops + +From: Miquel Raynal <miquel.raynal@bootlin.com> + +[ Upstream commit d9de177996d74c0cc44220003953ba2d2bece0ac ] + +SPI operations have been initially described through macros implicitly +implying the use of a single SPI SDR bus. Macros for supporting dual and +quad I/O transfers have been added on top, generally inspired by vendor +naming, followed by DTR operations. Soon we might see octal +and even octal DTR operations as well (including the opcode byte). + +Let's clarify what the macro really mean by describing the expected bus +topology in the (dual IO) read from cache macro names. While at +modifying them, better reordering the macros to group them all by bus +topology which now feels more intuitive. + +Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org> +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Stable-dep-of: dba90f5a79c1 ("mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad I/O variants") +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/mtd/nand/spi/alliancememory.c | 2 +- + drivers/mtd/nand/spi/gigadevice.c | 8 +++--- + drivers/mtd/nand/spi/micron.c | 2 +- + drivers/mtd/nand/spi/paragon.c | 2 +- + drivers/mtd/nand/spi/skyhigh.c | 2 +- + drivers/mtd/nand/spi/winbond.c | 6 ++--- + drivers/mtd/nand/spi/xtx.c | 2 +- + include/linux/mtd/spinand.h | 38 +++++++++++++-------------- + 8 files changed, 31 insertions(+), 31 deletions(-) + +diff --git a/drivers/mtd/nand/spi/alliancememory.c b/drivers/mtd/nand/spi/alliancememory.c +index 9709774dcf30b..c83e83d85d5b2 100644 +--- a/drivers/mtd/nand/spi/alliancememory.c ++++ b/drivers/mtd/nand/spi/alliancememory.c +@@ -19,7 +19,7 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c +index ad8502b84544c..e389a47e8812d 100644 +--- a/drivers/mtd/nand/spi/gigadevice.c ++++ b/drivers/mtd/nand/spi/gigadevice.c +@@ -26,7 +26,7 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +@@ -34,7 +34,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + static SPINAND_OP_VARIANTS(read_cache_variants_f, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_3A_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_1S_OP(0, 0, NULL, 0)); +@@ -42,7 +42,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f, + static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +@@ -50,7 +50,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + static SPINAND_OP_VARIANTS(read_cache_variants_2gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c +index d62344e1dbee6..988cab77f11ad 100644 +--- a/drivers/mtd/nand/spi/micron.c ++++ b/drivers/mtd/nand/spi/micron.c +@@ -37,7 +37,7 @@ + static SPINAND_OP_VARIANTS(quadio_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/paragon.c b/drivers/mtd/nand/spi/paragon.c +index b4daee6c9b2f4..f3545b28124b3 100644 +--- a/drivers/mtd/nand/spi/paragon.c ++++ b/drivers/mtd/nand/spi/paragon.c +@@ -24,7 +24,7 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c +index e03343f0c404a..2f414815a035e 100644 +--- a/drivers/mtd/nand/spi/skyhigh.c ++++ b/drivers/mtd/nand/spi/skyhigh.c +@@ -19,7 +19,7 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c +index 2a8fd9427424b..09fa63cf79985 100644 +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -28,9 +28,9 @@ static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_DTR_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_DTR_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2D_2D_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_1D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +@@ -39,7 +39,7 @@ static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/xtx.c b/drivers/mtd/nand/spi/xtx.c +index 08dc4a3efbb02..d4c7cbd4c9851 100644 +--- a/drivers/mtd/nand/spi/xtx.c ++++ b/drivers/mtd/nand/spi/xtx.c +@@ -25,7 +25,7 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h +index c4ac12b77a3b8..78c966aeb3c11 100644 +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -113,6 +113,25 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 2), \ + SPI_MEM_OP_MAX_FREQ(freq)) + ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(addr, ndummy, buf, len) \ ++ SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ ++ SPI_MEM_OP_ADDR(2, addr, 2), \ ++ SPI_MEM_OP_DUMMY(ndummy, 2), \ ++ SPI_MEM_OP_DATA_IN(len, buf, 2)) ++ ++#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_2S_2S_OP(addr, ndummy, buf, len) \ ++ SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ ++ SPI_MEM_OP_ADDR(3, addr, 2), \ ++ SPI_MEM_OP_DUMMY(ndummy, 2), \ ++ SPI_MEM_OP_DATA_IN(len, buf, 2)) ++ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_2D_2D_OP(addr, ndummy, buf, len, freq) \ ++ SPI_MEM_OP(SPI_MEM_OP_CMD(0xbd, 1), \ ++ SPI_MEM_DTR_OP_ADDR(2, addr, 2), \ ++ SPI_MEM_DTR_OP_DUMMY(ndummy, 2), \ ++ SPI_MEM_DTR_OP_DATA_IN(len, buf, 2), \ ++ SPI_MEM_OP_MAX_FREQ(freq)) ++ + #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ + SPI_MEM_OP_ADDR(2, addr, 1), \ +@@ -132,25 +151,6 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 4), \ + SPI_MEM_OP_MAX_FREQ(freq)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \ +- SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ +- SPI_MEM_OP_ADDR(2, addr, 2), \ +- SPI_MEM_OP_DUMMY(ndummy, 2), \ +- SPI_MEM_OP_DATA_IN(len, buf, 2)) +- +-#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP_3A(addr, ndummy, buf, len) \ +- SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ +- SPI_MEM_OP_ADDR(3, addr, 2), \ +- SPI_MEM_OP_DUMMY(ndummy, 2), \ +- SPI_MEM_OP_DATA_IN(len, buf, 2)) +- +-#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_DTR_OP(addr, ndummy, buf, len, freq) \ +- SPI_MEM_OP(SPI_MEM_OP_CMD(0xbd, 1), \ +- SPI_MEM_DTR_OP_ADDR(2, addr, 2), \ +- SPI_MEM_DTR_OP_DUMMY(ndummy, 2), \ +- SPI_MEM_DTR_OP_DATA_IN(len, buf, 2), \ +- SPI_MEM_OP_MAX_FREQ(freq)) +- + #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ + SPI_MEM_OP_ADDR(2, addr, 4), \ +-- +2.39.5 + diff --git a/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-dual-ou.patch b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-dual-ou.patch new file mode 100644 index 0000000000..f8ea143ba9 --- /dev/null +++ b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-dual-ou.patch @@ -0,0 +1,259 @@ +From 5eed2726ffd0a123e000df9288c76efdd0dfe89b Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 3 Apr 2025 11:19:18 +0200 +Subject: mtd: spinand: Use more specific naming for the (dual output) read + from cache ops + +From: Miquel Raynal <miquel.raynal@bootlin.com> + +[ Upstream commit 684f7105e8534f6500de389c089ba204cb1c8058 ] + +SPI operations have been initially described through macros implicitly +implying the use of a single SPI SDR bus. Macros for supporting dual and +quad I/O transfers have been added on top, generally inspired by vendor +naming, followed by DTR operations. Soon we might see octal +and even octal DTR operations as well (including the opcode byte). + +Let's clarify what the macro really mean by describing the expected bus +topology in the (dual output) read from cache macro names. + +Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org> +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Stable-dep-of: dba90f5a79c1 ("mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad I/O variants") +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/mtd/nand/spi/alliancememory.c | 2 +- + drivers/mtd/nand/spi/esmt.c | 2 +- + drivers/mtd/nand/spi/foresee.c | 2 +- + drivers/mtd/nand/spi/gigadevice.c | 8 ++++---- + drivers/mtd/nand/spi/macronix.c | 2 +- + drivers/mtd/nand/spi/micron.c | 4 ++-- + drivers/mtd/nand/spi/paragon.c | 2 +- + drivers/mtd/nand/spi/skyhigh.c | 2 +- + drivers/mtd/nand/spi/toshiba.c | 2 +- + drivers/mtd/nand/spi/winbond.c | 6 +++--- + drivers/mtd/nand/spi/xtx.c | 2 +- + include/linux/mtd/spinand.h | 6 +++--- + 12 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/drivers/mtd/nand/spi/alliancememory.c b/drivers/mtd/nand/spi/alliancememory.c +index 723c740308d26..9709774dcf30b 100644 +--- a/drivers/mtd/nand/spi/alliancememory.c ++++ b/drivers/mtd/nand/spi/alliancememory.c +@@ -20,7 +20,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/esmt.c b/drivers/mtd/nand/spi/esmt.c +index 1cba83651afb7..f8e8c23949cb0 100644 +--- a/drivers/mtd/nand/spi/esmt.c ++++ b/drivers/mtd/nand/spi/esmt.c +@@ -19,7 +19,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/foresee.c b/drivers/mtd/nand/spi/foresee.c +index 8a9725ea29bac..729dfde429210 100644 +--- a/drivers/mtd/nand/spi/foresee.c ++++ b/drivers/mtd/nand/spi/foresee.c +@@ -13,7 +13,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c +index cb03472682492..ad8502b84544c 100644 +--- a/drivers/mtd/nand/spi/gigadevice.c ++++ b/drivers/mtd/nand/spi/gigadevice.c +@@ -27,7 +27,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +@@ -35,7 +35,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_3A_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_1S_OP(0, 0, NULL, 0)); + +@@ -43,7 +43,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +@@ -51,7 +51,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_2gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c +index b885e62a57535..c2ec42f2c53cf 100644 +--- a/drivers/mtd/nand/spi/macronix.c ++++ b/drivers/mtd/nand/spi/macronix.c +@@ -29,7 +29,7 @@ struct macronix_priv { + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c +index daa396a7c39a2..d62344e1dbee6 100644 +--- a/drivers/mtd/nand/spi/micron.c ++++ b/drivers/mtd/nand/spi/micron.c +@@ -38,7 +38,7 @@ static SPINAND_OP_VARIANTS(quadio_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +@@ -53,7 +53,7 @@ static SPINAND_OP_VARIANTS(x4_update_cache_variants, + /* Micron MT29F2G01AAAED Device */ + static SPINAND_OP_VARIANTS(x4_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/paragon.c b/drivers/mtd/nand/spi/paragon.c +index ae3527d6d5fa3..b4daee6c9b2f4 100644 +--- a/drivers/mtd/nand/spi/paragon.c ++++ b/drivers/mtd/nand/spi/paragon.c +@@ -25,7 +25,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c +index ffbedb8d92f65..e03343f0c404a 100644 +--- a/drivers/mtd/nand/spi/skyhigh.c ++++ b/drivers/mtd/nand/spi/skyhigh.c +@@ -20,7 +20,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c +index 398e391bf2d7d..e8a0452b573f8 100644 +--- a/drivers/mtd/nand/spi/toshiba.c ++++ b/drivers/mtd/nand/spi/toshiba.c +@@ -16,7 +16,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c +index 1630c14f8ecd5..2a8fd9427424b 100644 +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -29,9 +29,9 @@ static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_DTR_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_X2_DTR_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_1D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0, 54 * HZ_PER_MHZ)); +@@ -40,7 +40,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/xtx.c b/drivers/mtd/nand/spi/xtx.c +index a0003f52ae8f5..08dc4a3efbb02 100644 +--- a/drivers/mtd/nand/spi/xtx.c ++++ b/drivers/mtd/nand/spi/xtx.c +@@ -26,7 +26,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h +index dd30a7beb9c63..c4ac12b77a3b8 100644 +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -94,19 +94,19 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 1), \ + SPI_MEM_OP_MAX_FREQ(freq)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ + SPI_MEM_OP_ADDR(2, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 2)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_2S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ + SPI_MEM_OP_ADDR(3, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 2)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_X2_DTR_OP(addr, ndummy, buf, len, freq) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(addr, ndummy, buf, len, freq) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x3d, 1), \ + SPI_MEM_DTR_OP_ADDR(2, addr, 1), \ + SPI_MEM_DTR_OP_DUMMY(ndummy, 1), \ +-- +2.39.5 + diff --git a/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-quad-io.patch b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-quad-io.patch new file mode 100644 index 0000000000..433335bdbc --- /dev/null +++ b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-quad-io.patch @@ -0,0 +1,194 @@ +From 36566268859c3d3ea21ff38f22570cf027348e35 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 3 Apr 2025 11:19:21 +0200 +Subject: mtd: spinand: Use more specific naming for the (quad IO) read from + cache ops + +From: Miquel Raynal <miquel.raynal@bootlin.com> + +[ Upstream commit 9c6911072c6e8b128ccdb7dd00efa13c47513074 ] + +SPI operations have been initially described through macros implicitly +implying the use of a single SPI SDR bus. Macros for supporting dual and +quad I/O transfers have been added on top, generally inspired by vendor +naming, followed by DTR operations. Soon we might see octal +and even octal DTR operations as well (including the opcode byte). + +Let's clarify what the macro really mean by describing the expected bus +topology in the (quad IO) read from cache macro names. + +Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org> +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Stable-dep-of: dba90f5a79c1 ("mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad I/O variants") +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/mtd/nand/spi/alliancememory.c | 2 +- + drivers/mtd/nand/spi/gigadevice.c | 8 ++++---- + drivers/mtd/nand/spi/micron.c | 2 +- + drivers/mtd/nand/spi/paragon.c | 2 +- + drivers/mtd/nand/spi/skyhigh.c | 2 +- + drivers/mtd/nand/spi/winbond.c | 6 +++--- + drivers/mtd/nand/spi/xtx.c | 2 +- + include/linux/mtd/spinand.h | 6 +++--- + 8 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/drivers/mtd/nand/spi/alliancememory.c b/drivers/mtd/nand/spi/alliancememory.c +index 66df707c8370b..0f9522009843b 100644 +--- a/drivers/mtd/nand/spi/alliancememory.c ++++ b/drivers/mtd/nand/spi/alliancememory.c +@@ -17,7 +17,7 @@ + #define AM_STATUS_ECC_MAX_CORRECTED (3 << 4) + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c +index 22c13a727f0f4..3ce79ae1bac4e 100644 +--- a/drivers/mtd/nand/spi/gigadevice.c ++++ b/drivers/mtd/nand/spi/gigadevice.c +@@ -24,7 +24,7 @@ + #define GD5FXGQ4UXFXXG_STATUS_ECC_UNCOR_ERROR (7 << 4) + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +@@ -32,7 +32,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(read_cache_variants_f, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_2S_OP(0, 1, NULL, 0), +@@ -40,7 +40,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f, + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_1S_OP(0, 0, NULL, 0)); + + static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +@@ -48,7 +48,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(read_cache_variants_2gq5, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c +index aec09df353eb4..f92c28b8d5571 100644 +--- a/drivers/mtd/nand/spi/micron.c ++++ b/drivers/mtd/nand/spi/micron.c +@@ -35,7 +35,7 @@ + (CFG_OTP_ENABLE | MICRON_MT29F2G01ABAGD_CFG_OTP_STATE) + + static SPINAND_OP_VARIANTS(quadio_read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/paragon.c b/drivers/mtd/nand/spi/paragon.c +index dc84e70bb1323..b5ea248618036 100644 +--- a/drivers/mtd/nand/spi/paragon.c ++++ b/drivers/mtd/nand/spi/paragon.c +@@ -22,7 +22,7 @@ + + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c +index c179a067db809..ac73f43e9365c 100644 +--- a/drivers/mtd/nand/spi/skyhigh.c ++++ b/drivers/mtd/nand/spi/skyhigh.c +@@ -17,7 +17,7 @@ + #define SKYHIGH_CONFIG_PROTECT_EN BIT(1) + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c +index fbe819c972b68..b2297699ff4fa 100644 +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -24,9 +24,9 @@ + */ + + static SPINAND_OP_VARIANTS(read_cache_dtr_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_DTR_OP(0, 8, NULL, 0, 80 * HZ_PER_MHZ), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4D_4D_OP(0, 8, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_4D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2D_2D_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), +@@ -37,7 +37,7 @@ static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0, 54 * HZ_PER_MHZ)); + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/xtx.c b/drivers/mtd/nand/spi/xtx.c +index 4e38b2e0ca732..abbbcd594c2c1 100644 +--- a/drivers/mtd/nand/spi/xtx.c ++++ b/drivers/mtd/nand/spi/xtx.c +@@ -23,7 +23,7 @@ + #define XT26XXXD_STATUS_ECC_UNCOR_ERROR (2) + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), +diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h +index e02454f2f7c9e..392ea3ef73605 100644 +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -151,19 +151,19 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 4), \ + SPI_MEM_OP_MAX_FREQ(freq)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ + SPI_MEM_OP_ADDR(2, addr, 4), \ + SPI_MEM_OP_DUMMY(ndummy, 4), \ + SPI_MEM_OP_DATA_IN(len, buf, 4)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP_3A(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_4S_4S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ + SPI_MEM_OP_ADDR(3, addr, 4), \ + SPI_MEM_OP_DUMMY(ndummy, 4), \ + SPI_MEM_OP_DATA_IN(len, buf, 4)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_DTR_OP(addr, ndummy, buf, len, freq) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_4D_4D_OP(addr, ndummy, buf, len, freq) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xed, 1), \ + SPI_MEM_DTR_OP_ADDR(2, addr, 4), \ + SPI_MEM_DTR_OP_DUMMY(ndummy, 4), \ +-- +2.39.5 + diff --git a/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-quad-ou.patch b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-quad-ou.patch new file mode 100644 index 0000000000..8297a337c6 --- /dev/null +++ b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-quad-ou.patch @@ -0,0 +1,273 @@ +From 49b1a9277897c4d1bf2e7851e51ac43b91ae28aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 3 Apr 2025 11:19:20 +0200 +Subject: mtd: spinand: Use more specific naming for the (quad output) read + from cache ops + +From: Miquel Raynal <miquel.raynal@bootlin.com> + +[ Upstream commit 1deae734cc1c7e976d588e7d8f46af2bb9ef5656 ] + +SPI operations have been initially described through macros implicitly +implying the use of a single SPI SDR bus. Macros for supporting dual and +quad I/O transfers have been added on top, generally inspired by vendor +naming, followed by DTR operations. Soon we might see octal +and even octal DTR operations as well (including the opcode byte). + +Let's clarify what the macro really mean by describing the expected bus +topology in the (quad output) read from cache macro names. + +Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org> +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Stable-dep-of: dba90f5a79c1 ("mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad I/O variants") +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/mtd/nand/spi/alliancememory.c | 2 +- + drivers/mtd/nand/spi/ato.c | 2 +- + drivers/mtd/nand/spi/esmt.c | 2 +- + drivers/mtd/nand/spi/foresee.c | 2 +- + drivers/mtd/nand/spi/gigadevice.c | 8 ++++---- + drivers/mtd/nand/spi/macronix.c | 2 +- + drivers/mtd/nand/spi/micron.c | 4 ++-- + drivers/mtd/nand/spi/paragon.c | 2 +- + drivers/mtd/nand/spi/skyhigh.c | 2 +- + drivers/mtd/nand/spi/toshiba.c | 2 +- + drivers/mtd/nand/spi/winbond.c | 6 +++--- + drivers/mtd/nand/spi/xtx.c | 2 +- + include/linux/mtd/spinand.h | 6 +++--- + 13 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/drivers/mtd/nand/spi/alliancememory.c b/drivers/mtd/nand/spi/alliancememory.c +index c83e83d85d5b2..66df707c8370b 100644 +--- a/drivers/mtd/nand/spi/alliancememory.c ++++ b/drivers/mtd/nand/spi/alliancememory.c +@@ -18,7 +18,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/ato.c b/drivers/mtd/nand/spi/ato.c +index 9026a14aca07c..88dc51308e1b8 100644 +--- a/drivers/mtd/nand/spi/ato.c ++++ b/drivers/mtd/nand/spi/ato.c +@@ -14,7 +14,7 @@ + + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + +diff --git a/drivers/mtd/nand/spi/esmt.c b/drivers/mtd/nand/spi/esmt.c +index f8e8c23949cb0..cda718e385a22 100644 +--- a/drivers/mtd/nand/spi/esmt.c ++++ b/drivers/mtd/nand/spi/esmt.c +@@ -18,7 +18,7 @@ + (CFG_OTP_ENABLE | ESMT_F50L1G41LB_CFG_OTP_PROTECT) + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/foresee.c b/drivers/mtd/nand/spi/foresee.c +index 729dfde429210..21ad44032286f 100644 +--- a/drivers/mtd/nand/spi/foresee.c ++++ b/drivers/mtd/nand/spi/foresee.c +@@ -12,7 +12,7 @@ + #define SPINAND_MFR_FORESEE 0xCD + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c +index e389a47e8812d..22c13a727f0f4 100644 +--- a/drivers/mtd/nand/spi/gigadevice.c ++++ b/drivers/mtd/nand/spi/gigadevice.c +@@ -25,7 +25,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +@@ -33,7 +33,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + + static SPINAND_OP_VARIANTS(read_cache_variants_f, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_3A_1S_1S_1S_OP(0, 1, NULL, 0), +@@ -41,7 +41,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f, + + static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +@@ -49,7 +49,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + + static SPINAND_OP_VARIANTS(read_cache_variants_2gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c +index c2ec42f2c53cf..208db1a215104 100644 +--- a/drivers/mtd/nand/spi/macronix.c ++++ b/drivers/mtd/nand/spi/macronix.c +@@ -28,7 +28,7 @@ struct macronix_priv { + }; + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c +index 988cab77f11ad..aec09df353eb4 100644 +--- a/drivers/mtd/nand/spi/micron.c ++++ b/drivers/mtd/nand/spi/micron.c +@@ -36,7 +36,7 @@ + + static SPINAND_OP_VARIANTS(quadio_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +@@ -52,7 +52,7 @@ static SPINAND_OP_VARIANTS(x4_update_cache_variants, + + /* Micron MT29F2G01AAAED Device */ + static SPINAND_OP_VARIANTS(x4_read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/paragon.c b/drivers/mtd/nand/spi/paragon.c +index f3545b28124b3..dc84e70bb1323 100644 +--- a/drivers/mtd/nand/spi/paragon.c ++++ b/drivers/mtd/nand/spi/paragon.c +@@ -23,7 +23,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c +index 2f414815a035e..c179a067db809 100644 +--- a/drivers/mtd/nand/spi/skyhigh.c ++++ b/drivers/mtd/nand/spi/skyhigh.c +@@ -18,7 +18,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c +index e8a0452b573f8..f3f2c0ed1d0ca 100644 +--- a/drivers/mtd/nand/spi/toshiba.c ++++ b/drivers/mtd/nand/spi/toshiba.c +@@ -15,7 +15,7 @@ + #define TOSH_STATUS_ECC_HAS_BITFLIPS_T (3 << 4) + + static SPINAND_OP_VARIANTS(read_cache_variants, +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c +index 09fa63cf79985..fbe819c972b68 100644 +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -25,9 +25,9 @@ + + static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_DTR_OP(0, 8, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_X4_DTR_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1D_4D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2D_2D_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), +@@ -38,7 +38,7 @@ static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/drivers/mtd/nand/spi/xtx.c b/drivers/mtd/nand/spi/xtx.c +index d4c7cbd4c9851..4e38b2e0ca732 100644 +--- a/drivers/mtd/nand/spi/xtx.c ++++ b/drivers/mtd/nand/spi/xtx.c +@@ -24,7 +24,7 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h +index 78c966aeb3c11..e02454f2f7c9e 100644 +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -132,19 +132,19 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 2), \ + SPI_MEM_OP_MAX_FREQ(freq)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ + SPI_MEM_OP_ADDR(2, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 4)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_4S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ + SPI_MEM_OP_ADDR(3, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 4)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_X4_DTR_OP(addr, ndummy, buf, len, freq) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_1D_4D_OP(addr, ndummy, buf, len, freq) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6d, 1), \ + SPI_MEM_DTR_OP_ADDR(2, addr, 1), \ + SPI_MEM_DTR_OP_DUMMY(ndummy, 1), \ +-- +2.39.5 + diff --git a/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-single-.patch b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-single-.patch new file mode 100644 index 0000000000..270b72f3e8 --- /dev/null +++ b/queue-6.15/mtd-spinand-use-more-specific-naming-for-the-single-.patch @@ -0,0 +1,318 @@ +From dadf231cb233795ee2d8f7db312f0342e55cfc0c Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 3 Apr 2025 11:19:17 +0200 +Subject: mtd: spinand: Use more specific naming for the (single) read from + cache ops + +From: Miquel Raynal <miquel.raynal@bootlin.com> + +[ Upstream commit ea2087d4e66d0b927918cc9048576aca6a0446ad ] + +SPI operations have been initially described through macros implicitly +implying the use of a single SPI SDR bus. Macros for supporting dual and +quad I/O transfers have been added on top, generally inspired by vendor +naming, followed by DTR operations. Soon we might see octal +and even octal DTR operations as well (including the opcode byte). + +Let's clarify what the macro really mean by describing the expected bus +topology in the (single) read from cache macro names. + +Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org> +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Stable-dep-of: dba90f5a79c1 ("mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad I/O variants") +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/mtd/nand/spi/alliancememory.c | 4 ++-- + drivers/mtd/nand/spi/ato.c | 4 ++-- + drivers/mtd/nand/spi/esmt.c | 4 ++-- + drivers/mtd/nand/spi/foresee.c | 4 ++-- + drivers/mtd/nand/spi/gigadevice.c | 16 ++++++++-------- + drivers/mtd/nand/spi/macronix.c | 4 ++-- + drivers/mtd/nand/spi/micron.c | 8 ++++---- + drivers/mtd/nand/spi/paragon.c | 4 ++-- + drivers/mtd/nand/spi/skyhigh.c | 4 ++-- + drivers/mtd/nand/spi/toshiba.c | 4 ++-- + drivers/mtd/nand/spi/winbond.c | 10 +++++----- + drivers/mtd/nand/spi/xtx.c | 4 ++-- + include/linux/mtd/spinand.h | 12 ++++++------ + 13 files changed, 41 insertions(+), 41 deletions(-) + +diff --git a/drivers/mtd/nand/spi/alliancememory.c b/drivers/mtd/nand/spi/alliancememory.c +index 6046c73f8424e..723c740308d26 100644 +--- a/drivers/mtd/nand/spi/alliancememory.c ++++ b/drivers/mtd/nand/spi/alliancememory.c +@@ -21,8 +21,8 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/ato.c b/drivers/mtd/nand/spi/ato.c +index bb5298911137f..9026a14aca07c 100644 +--- a/drivers/mtd/nand/spi/ato.c ++++ b/drivers/mtd/nand/spi/ato.c +@@ -15,8 +15,8 @@ + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/esmt.c b/drivers/mtd/nand/spi/esmt.c +index a164d821464d2..1cba83651afb7 100644 +--- a/drivers/mtd/nand/spi/esmt.c ++++ b/drivers/mtd/nand/spi/esmt.c +@@ -20,8 +20,8 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/foresee.c b/drivers/mtd/nand/spi/foresee.c +index ecd5f6bffa334..8a9725ea29bac 100644 +--- a/drivers/mtd/nand/spi/foresee.c ++++ b/drivers/mtd/nand/spi/foresee.c +@@ -14,8 +14,8 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c +index d620bb02a20a0..cb03472682492 100644 +--- a/drivers/mtd/nand/spi/gigadevice.c ++++ b/drivers/mtd/nand/spi/gigadevice.c +@@ -28,32 +28,32 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(read_cache_variants_f, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP_3A(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP_3A(0, 0, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_3A_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_1S_OP(0, 0, NULL, 0)); + + static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(read_cache_variants_2gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c +index 1ef08ad850a2f..b885e62a57535 100644 +--- a/drivers/mtd/nand/spi/macronix.c ++++ b/drivers/mtd/nand/spi/macronix.c +@@ -30,8 +30,8 @@ struct macronix_priv { + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c +index 691f8a2e0791d..daa396a7c39a2 100644 +--- a/drivers/mtd/nand/spi/micron.c ++++ b/drivers/mtd/nand/spi/micron.c +@@ -39,8 +39,8 @@ static SPINAND_OP_VARIANTS(quadio_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(x4_write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +@@ -54,8 +54,8 @@ static SPINAND_OP_VARIANTS(x4_update_cache_variants, + static SPINAND_OP_VARIANTS(x4_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(x1_write_cache_variants, + SPINAND_PROG_LOAD(true, 0, NULL, 0)); +diff --git a/drivers/mtd/nand/spi/paragon.c b/drivers/mtd/nand/spi/paragon.c +index 6e7cc6995380c..ae3527d6d5fa3 100644 +--- a/drivers/mtd/nand/spi/paragon.c ++++ b/drivers/mtd/nand/spi/paragon.c +@@ -26,8 +26,8 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c +index 961df0d74984a..ffbedb8d92f65 100644 +--- a/drivers/mtd/nand/spi/skyhigh.c ++++ b/drivers/mtd/nand/spi/skyhigh.c +@@ -21,8 +21,8 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c +index 2e2106b2705f0..398e391bf2d7d 100644 +--- a/drivers/mtd/nand/spi/toshiba.c ++++ b/drivers/mtd/nand/spi/toshiba.c +@@ -17,8 +17,8 @@ + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_x4_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c +index 8394a1b1fb0c1..1630c14f8ecd5 100644 +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -32,17 +32,17 @@ static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + SPINAND_PAGE_READ_FROM_CACHE_X2_DTR_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_DTR_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0, 54 * HZ_PER_MHZ)); ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1D_1D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0, 54 * HZ_PER_MHZ)); + + static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/drivers/mtd/nand/spi/xtx.c b/drivers/mtd/nand/spi/xtx.c +index 3f539ca0de861..a0003f52ae8f5 100644 +--- a/drivers/mtd/nand/spi/xtx.c ++++ b/drivers/mtd/nand/spi/xtx.c +@@ -27,8 +27,8 @@ static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(0, 1, NULL, 0), +- SPINAND_PAGE_READ_FROM_CACHE_OP(0, 1, NULL, 0)); ++ SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0)); + + static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h +index 311f145eb4e84..dd30a7beb9c63 100644 +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -62,32 +62,32 @@ + SPI_MEM_OP_NO_DUMMY, \ + SPI_MEM_OP_NO_DATA) + +-#define SPINAND_PAGE_READ_FROM_CACHE_OP(addr, ndummy, buf, len, ...) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(addr, ndummy, buf, len, ...) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x03, 1), \ + SPI_MEM_OP_ADDR(2, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 1), \ + SPI_MEM_OP_MAX_FREQ(__VA_ARGS__ + 0)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_FAST_OP(addr, ndummy, buf, len) \ +- SPI_MEM_OP(SPI_MEM_OP_CMD(0x0b, 1), \ ++#define SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(addr, ndummy, buf, len) \ ++ SPI_MEM_OP(SPI_MEM_OP_CMD(0x0b, 1), \ + SPI_MEM_OP_ADDR(2, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 1)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_OP_3A(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_1S_1S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x03, 1), \ + SPI_MEM_OP_ADDR(3, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 1)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_FAST_OP_3A(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_FAST_3A_1S_1S_1S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x0b, 1), \ + SPI_MEM_OP_ADDR(3, addr, 1), \ + SPI_MEM_OP_DUMMY(ndummy, 1), \ + SPI_MEM_OP_DATA_IN(len, buf, 1)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_DTR_OP(addr, ndummy, buf, len, freq) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_1D_1D_OP(addr, ndummy, buf, len, freq) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0x0d, 1), \ + SPI_MEM_DTR_OP_ADDR(2, addr, 1), \ + SPI_MEM_DTR_OP_DUMMY(ndummy, 1), \ +-- +2.39.5 + diff --git a/queue-6.15/mtd-spinand-winbond-prevent-unsupported-frequencies-.patch b/queue-6.15/mtd-spinand-winbond-prevent-unsupported-frequencies-.patch new file mode 100644 index 0000000000..e3f08eda3f --- /dev/null +++ b/queue-6.15/mtd-spinand-winbond-prevent-unsupported-frequencies-.patch @@ -0,0 +1,83 @@ +From a082f33e535e665800fb674799e90c826fc45ebf Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Wed, 18 Jun 2025 10:48:00 +0200 +Subject: mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad + I/O variants + +From: Miquel Raynal <miquel.raynal@bootlin.com> + +[ Upstream commit dba90f5a79c13936de4273a19e67908a0c296afe ] + +Dual and quad capable chips natively support dual and quad I/O variants +at up to 104MHz (1-2-2 and 1-4-4 operations). Reaching the maximum speed +of 166MHz is theoretically possible (while still unsupported in the +field) by adding a few more dummy cycles. Let's be accurate and clearly +state this limit. + +Setting a maximum frequency implies adding the frequency parameter to +the macro, which is done using a variadic argument to avoid impacting +all the other drivers which already make use of this macro. + +Fixes: 1ea808b4d15b ("mtd: spinand: winbond: Update the *JW chip definitions") +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/mtd/nand/spi/winbond.c | 4 ++-- + include/linux/mtd/spinand.h | 10 ++++++---- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c +index b2297699ff4fa..397c90b745e3a 100644 +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -26,11 +26,11 @@ + static SPINAND_OP_VARIANTS(read_cache_dtr_variants, + SPINAND_PAGE_READ_FROM_CACHE_1S_4D_4D_OP(0, 8, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_4D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0, 104 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2D_2D_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), +- SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0, 104 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1D_1D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0), +diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h +index 392ea3ef73605..aba653207c0f7 100644 +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -113,11 +113,12 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 2), \ + SPI_MEM_OP_MAX_FREQ(freq)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(addr, ndummy, buf, len, ...) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ + SPI_MEM_OP_ADDR(2, addr, 2), \ + SPI_MEM_OP_DUMMY(ndummy, 2), \ +- SPI_MEM_OP_DATA_IN(len, buf, 2)) ++ SPI_MEM_OP_DATA_IN(len, buf, 2), \ ++ SPI_MEM_OP_MAX_FREQ(__VA_ARGS__ + 0)) + + #define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_2S_2S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ +@@ -151,11 +152,12 @@ + SPI_MEM_DTR_OP_DATA_IN(len, buf, 4), \ + SPI_MEM_OP_MAX_FREQ(freq)) + +-#define SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(addr, ndummy, buf, len) \ ++#define SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(addr, ndummy, buf, len, ...) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ + SPI_MEM_OP_ADDR(2, addr, 4), \ + SPI_MEM_OP_DUMMY(ndummy, 4), \ +- SPI_MEM_OP_DATA_IN(len, buf, 4)) ++ SPI_MEM_OP_DATA_IN(len, buf, 4), \ ++ SPI_MEM_OP_MAX_FREQ(__VA_ARGS__ + 0)) + + #define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_4S_4S_OP(addr, ndummy, buf, len) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ +-- +2.39.5 + diff --git a/queue-6.15/pci-pciehp-ignore-belated-presence-detect-changed-ca.patch b/queue-6.15/pci-pciehp-ignore-belated-presence-detect-changed-ca.patch new file mode 100644 index 0000000000..287fd9e54a --- /dev/null +++ b/queue-6.15/pci-pciehp-ignore-belated-presence-detect-changed-ca.patch @@ -0,0 +1,63 @@ +From 72abaf450c0ff495963c04d7665f14be0a4b2aa3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Wed, 18 Jun 2025 16:38:25 +0200 +Subject: PCI: pciehp: Ignore belated Presence Detect Changed caused by DPC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lukas Wunner <lukas@wunner.de> + +[ Upstream commit bbf10cd686835d5a4b8566dc73a3b00b4cd7932a ] + +Commit c3be50f7547c ("PCI: pciehp: Ignore Presence Detect Changed caused by +DPC") sought to ignore Presence Detect Changed events occurring as a side +effect of Downstream Port Containment. + +The commit awaits recovery from DPC and then clears events which occurred +in the meantime. However if the first event seen after DPC is Data Link +Layer State Changed, only that event is cleared and not Presence Detect +Changed. The object of the commit is thus defeated. + +That's because pciehp_ist() computes the events to clear based on the local +"events" variable instead of "ctrl->pending_events". The former contains +the events that had occurred when pciehp_ist() was entered, whereas the +latter also contains events that have accumulated while awaiting DPC +recovery. + +In practice, the order of PDC and DLLSC events is arbitrary and the delay +in-between can be several milliseconds. + +So change the logic to always clear PDC events, even if they come after an +initial DLLSC event. + +Fixes: c3be50f7547c ("PCI: pciehp: Ignore Presence Detect Changed caused by DPC") +Reported-by: Lương Việt Hoàng <tcm4095@gmail.com> +Reported-by: Joel Mathew Thomas <proxy0@tutamail.com> +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219765#c165 +Signed-off-by: Lukas Wunner <lukas@wunner.de> +Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> +Tested-by: Lương Việt Hoàng <tcm4095@gmail.com> +Tested-by: Joel Mathew Thomas <proxy0@tutamail.com> +Link: https://patch.msgid.link/d9c4286a16253af7e93eaf12e076e3ef3546367a.1750257164.git.lukas@wunner.de +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/pci/hotplug/pciehp_hpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c +index ebd342bda235d..91d2d92717d98 100644 +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -771,7 +771,7 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) + u16 ignored_events = PCI_EXP_SLTSTA_DLLSC; + + if (!ctrl->inband_presence_disabled) +- ignored_events |= events & PCI_EXP_SLTSTA_PDC; ++ ignored_events |= PCI_EXP_SLTSTA_PDC; + + events &= ~ignored_events; + pciehp_ignore_link_change(ctrl, pdev, irq, ignored_events); +-- +2.39.5 + diff --git a/queue-6.15/perf-core-fix-warn-in-perf_cgroup_switch.patch b/queue-6.15/perf-core-fix-warn-in-perf_cgroup_switch.patch new file mode 100644 index 0000000000..8a1154f9aa --- /dev/null +++ b/queue-6.15/perf-core-fix-warn-in-perf_cgroup_switch.patch @@ -0,0 +1,104 @@ +From e3288ccc8433ffcba18263811a94b2d2c17d1ddf Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Wed, 4 Jun 2025 03:39:24 +0000 +Subject: perf/core: Fix WARN in perf_cgroup_switch() + +From: Luo Gengkun <luogengkun@huaweicloud.com> + +[ Upstream commit 3172fb986666dfb71bf483b6d3539e1e587fa197 ] + +There may be concurrency between perf_cgroup_switch and +perf_cgroup_event_disable. Consider the following scenario: after a new +perf cgroup event is created on CPU0, the new event may not trigger +a reprogramming, causing ctx->is_active to be 0. In this case, when CPU1 +disables this perf event, it executes __perf_remove_from_context-> +list _del_event->perf_cgroup_event_disable on CPU1, which causes a race +with perf_cgroup_switch running on CPU0. + +The following describes the details of this concurrency scenario: + +CPU0 CPU1 + +perf_cgroup_switch: + ... + # cpuctx->cgrp is not NULL here + if (READ_ONCE(cpuctx->cgrp) == NULL) + return; + + perf_remove_from_context: + ... + raw_spin_lock_irq(&ctx->lock); + ... + # ctx->is_active == 0 because reprogramm is not + # tigger, so CPU1 can do __perf_remove_from_context + # for CPU0 + __perf_remove_from_context: + perf_cgroup_event_disable: + ... + if (--ctx->nr_cgroups) + ... + + # this warning will happened because CPU1 changed + # ctx.nr_cgroups to 0. + WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0); + +[peterz: use guard instead of goto unlock] +Fixes: db4a835601b7 ("perf/core: Set cgroup in CPU contexts for new cgroup events") +Signed-off-by: Luo Gengkun <luogengkun@huaweicloud.com> +Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> +Link: https://lkml.kernel.org/r/20250604033924.3914647-3-luogengkun@huaweicloud.com +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + kernel/events/core.c | 22 ++++++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index d2b548ef075f4..2d1131e2cfc02 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -207,6 +207,19 @@ static void perf_ctx_unlock(struct perf_cpu_context *cpuctx, + __perf_ctx_unlock(&cpuctx->ctx); + } + ++typedef struct { ++ struct perf_cpu_context *cpuctx; ++ struct perf_event_context *ctx; ++} class_perf_ctx_lock_t; ++ ++static inline void class_perf_ctx_lock_destructor(class_perf_ctx_lock_t *_T) ++{ perf_ctx_unlock(_T->cpuctx, _T->ctx); } ++ ++static inline class_perf_ctx_lock_t ++class_perf_ctx_lock_constructor(struct perf_cpu_context *cpuctx, ++ struct perf_event_context *ctx) ++{ perf_ctx_lock(cpuctx, ctx); return (class_perf_ctx_lock_t){ cpuctx, ctx }; } ++ + #define TASK_TOMBSTONE ((void *)-1L) + + static bool is_kernel_event(struct perf_event *event) +@@ -944,7 +957,13 @@ static void perf_cgroup_switch(struct task_struct *task) + if (READ_ONCE(cpuctx->cgrp) == cgrp) + return; + +- perf_ctx_lock(cpuctx, cpuctx->task_ctx); ++ guard(perf_ctx_lock)(cpuctx, cpuctx->task_ctx); ++ /* ++ * Re-check, could've raced vs perf_remove_from_context(). ++ */ ++ if (READ_ONCE(cpuctx->cgrp) == NULL) ++ return; ++ + perf_ctx_disable(&cpuctx->ctx, true); + + ctx_sched_out(&cpuctx->ctx, NULL, EVENT_ALL|EVENT_CGROUP); +@@ -962,7 +981,6 @@ static void perf_cgroup_switch(struct task_struct *task) + ctx_sched_in(&cpuctx->ctx, NULL, EVENT_ALL|EVENT_CGROUP); + + perf_ctx_enable(&cpuctx->ctx, true); +- perf_ctx_unlock(cpuctx, cpuctx->task_ctx); + } + + static int perf_cgroup_ensure_storage(struct perf_event *event, +-- +2.39.5 + diff --git a/queue-6.15/perf-evsel-missed-close-when-probing-hybrid-core-pmu.patch b/queue-6.15/perf-evsel-missed-close-when-probing-hybrid-core-pmu.patch new file mode 100644 index 0000000000..5eff184e7c --- /dev/null +++ b/queue-6.15/perf-evsel-missed-close-when-probing-hybrid-core-pmu.patch @@ -0,0 +1,54 @@ +From 7f45552576b53c91249edeeccbed1f8c1dcddfba Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Fri, 13 Jun 2025 17:41:05 -0700 +Subject: perf evsel: Missed close() when probing hybrid core PMUs + +From: Ian Rogers <irogers@google.com> + +[ Upstream commit ebec62bc7ec435b475722a5467d67c720a1ad79f ] + +Add missing close() to avoid leaking perf events. + +In past perfs this mattered little as the function was just used by 'perf +list'. + +As the function is now used to detect hybrid PMUs leaking the perf event +is somewhat more painful. + +Fixes: b41f1cec91c37eee ("perf list: Skip unsupported events") +Signed-off-by: Ian Rogers <irogers@google.com> +Cc: Adrian Hunter <adrian.hunter@intel.com> +Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> +Cc: Andi Kleen <ak@linux.intel.com> +Cc: Ingo Molnar <mingo@redhat.com> +Cc: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> +Cc: Jiri Olsa <jolsa@kernel.org> +Cc: Kan Liang <kan.liang@linux.intel.com> +Cc: Mark Rutland <mark.rutland@arm.com> +Cc: Michael Petlan <mpetlan@redhat.com> +Cc: Namhyung Kim <namhyung@kernel.org> +Cc: Namhyung Kim <namhyung.kim@lge.com> +Cc: Peter Zijlstra <peterz@infradead.org> +Cc: Tiezhu Yang <yangtiezhu@loongson.cn> +Link: https://lore.kernel.org/r/20250614004108.1650988-2-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + tools/perf/util/print-events.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/perf/util/print-events.c b/tools/perf/util/print-events.c +index a786cbfb0ff56..83aaf7cda6359 100644 +--- a/tools/perf/util/print-events.c ++++ b/tools/perf/util/print-events.c +@@ -268,6 +268,7 @@ bool is_event_supported(u8 type, u64 config) + ret = evsel__open(evsel, NULL, tmap) >= 0; + } + ++ evsel__close(evsel); + evsel__delete(evsel); + } + +-- +2.39.5 + diff --git a/queue-6.15/perf-fix-cgroup-state-vs-error.patch b/queue-6.15/perf-fix-cgroup-state-vs-error.patch new file mode 100644 index 0000000000..13b8fab0c9 --- /dev/null +++ b/queue-6.15/perf-fix-cgroup-state-vs-error.patch @@ -0,0 +1,132 @@ +From 2ead6d6b3e1ba2a56cbe5d9bab9a0c88a02ebac7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 5 Jun 2025 12:37:11 +0200 +Subject: perf: Fix cgroup state vs ERROR + +From: Peter Zijlstra <peterz@infradead.org> + +[ Upstream commit 61988e36dc5457cdff7ae7927e8d9ad1419ee998 ] + +While chasing down a missing perf_cgroup_event_disable() elsewhere, +Leo Yan found that both perf_put_aux_event() and +perf_remove_sibling_event() were also missing one. + +Specifically, the rule is that events that switch to OFF,ERROR need to +call perf_cgroup_event_disable(). + +Unify the disable paths to ensure this. + +Fixes: ab43762ef010 ("perf: Allow normal events to output AUX data") +Fixes: 9f0c4fa111dc ("perf/core: Add a new PERF_EV_CAP_SIBLING event capability") +Reported-by: Leo Yan <leo.yan@arm.com> +Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> +Link: https://lkml.kernel.org/r/20250605123343.GD35970@noisy.programming.kicks-ass.net +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + kernel/events/core.c | 51 ++++++++++++++++++++++++++------------------ + 1 file changed, 30 insertions(+), 21 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index ec77f641089a2..d2b548ef075f4 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -2145,8 +2145,9 @@ perf_aux_output_match(struct perf_event *event, struct perf_event *aux_event) + } + + static void put_event(struct perf_event *event); +-static void event_sched_out(struct perf_event *event, +- struct perf_event_context *ctx); ++static void __event_disable(struct perf_event *event, ++ struct perf_event_context *ctx, ++ enum perf_event_state state); + + static void perf_put_aux_event(struct perf_event *event) + { +@@ -2179,8 +2180,7 @@ static void perf_put_aux_event(struct perf_event *event) + * state so that we don't try to schedule it again. Note + * that perf_event_enable() will clear the ERROR status. + */ +- event_sched_out(iter, ctx); +- perf_event_set_state(event, PERF_EVENT_STATE_ERROR); ++ __event_disable(iter, ctx, PERF_EVENT_STATE_ERROR); + } + } + +@@ -2238,18 +2238,6 @@ static inline struct list_head *get_event_list(struct perf_event *event) + &event->pmu_ctx->flexible_active; + } + +-/* +- * Events that have PERF_EV_CAP_SIBLING require being part of a group and +- * cannot exist on their own, schedule them out and move them into the ERROR +- * state. Also see _perf_event_enable(), it will not be able to recover +- * this ERROR state. +- */ +-static inline void perf_remove_sibling_event(struct perf_event *event) +-{ +- event_sched_out(event, event->ctx); +- perf_event_set_state(event, PERF_EVENT_STATE_ERROR); +-} +- + static void perf_group_detach(struct perf_event *event) + { + struct perf_event *leader = event->group_leader; +@@ -2285,8 +2273,15 @@ static void perf_group_detach(struct perf_event *event) + */ + list_for_each_entry_safe(sibling, tmp, &event->sibling_list, sibling_list) { + ++ /* ++ * Events that have PERF_EV_CAP_SIBLING require being part of ++ * a group and cannot exist on their own, schedule them out ++ * and move them into the ERROR state. Also see ++ * _perf_event_enable(), it will not be able to recover this ++ * ERROR state. ++ */ + if (sibling->event_caps & PERF_EV_CAP_SIBLING) +- perf_remove_sibling_event(sibling); ++ __event_disable(sibling, ctx, PERF_EVENT_STATE_ERROR); + + sibling->group_leader = sibling; + list_del_init(&sibling->sibling_list); +@@ -2545,6 +2540,15 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla + event_function_call(event, __perf_remove_from_context, (void *)flags); + } + ++static void __event_disable(struct perf_event *event, ++ struct perf_event_context *ctx, ++ enum perf_event_state state) ++{ ++ event_sched_out(event, ctx); ++ perf_cgroup_event_disable(event, ctx); ++ perf_event_set_state(event, state); ++} ++ + /* + * Cross CPU call to disable a performance event + */ +@@ -2559,13 +2563,18 @@ static void __perf_event_disable(struct perf_event *event, + perf_pmu_disable(event->pmu_ctx->pmu); + ctx_time_update_event(ctx, event); + ++ /* ++ * When disabling a group leader, the whole group becomes ineligible ++ * to run, so schedule out the full group. ++ */ + if (event == event->group_leader) + group_sched_out(event, ctx); +- else +- event_sched_out(event, ctx); + +- perf_event_set_state(event, PERF_EVENT_STATE_OFF); +- perf_cgroup_event_disable(event, ctx); ++ /* ++ * But only mark the leader OFF; the siblings will remain ++ * INACTIVE. ++ */ ++ __event_disable(event, ctx, PERF_EVENT_STATE_OFF); + + perf_pmu_enable(event->pmu_ctx->pmu); + } +-- +2.39.5 + diff --git a/queue-6.15/perf-fix-sample-vs-do_exit.patch b/queue-6.15/perf-fix-sample-vs-do_exit.patch new file mode 100644 index 0000000000..a4de4368ae --- /dev/null +++ b/queue-6.15/perf-fix-sample-vs-do_exit.patch @@ -0,0 +1,102 @@ +From 9ad7b98dc1f2b08f19b0fc13bfb321f24a5a2b5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 5 Jun 2025 12:31:45 +0200 +Subject: perf: Fix sample vs do_exit() + +From: Peter Zijlstra <peterz@infradead.org> + +[ Upstream commit 4f6fc782128355931527cefe3eb45338abd8ab39 ] + +Baisheng Gao reported an ARM64 crash, which Mark decoded as being a +synchronous external abort -- most likely due to trying to access +MMIO in bad ways. + +The crash further shows perf trying to do a user stack sample while in +exit_mmap()'s tlb_finish_mmu() -- i.e. while tearing down the address +space it is trying to access. + +It turns out that we stop perf after we tear down the userspace mm; a +receipie for disaster, since perf likes to access userspace for +various reasons. + +Flip this order by moving up where we stop perf in do_exit(). + +Additionally, harden PERF_SAMPLE_CALLCHAIN and PERF_SAMPLE_STACK_USER +to abort when the current task does not have an mm (exit_mm() makes +sure to set current->mm = NULL; before commencing with the actual +teardown). Such that CPU wide events don't trip on this same problem. + +Fixes: c5ebcedb566e ("perf: Add ability to attach user stack dump to sample") +Reported-by: Baisheng Gao <baisheng.gao@unisoc.com> +Suggested-by: Mark Rutland <mark.rutland@arm.com> +Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> +Link: https://lkml.kernel.org/r/20250605110815.GQ39944@noisy.programming.kicks-ass.net +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + kernel/events/core.c | 7 +++++++ + kernel/exit.c | 17 +++++++++-------- + 2 files changed, 16 insertions(+), 8 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index e97bc9220fd1a..ec77f641089a2 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -7363,6 +7363,10 @@ perf_sample_ustack_size(u16 stack_size, u16 header_size, + if (!regs) + return 0; + ++ /* No mm, no stack, no dump. */ ++ if (!current->mm) ++ return 0; ++ + /* + * Check if we fit in with the requested stack size into the: + * - TASK_SIZE +@@ -8074,6 +8078,9 @@ perf_callchain(struct perf_event *event, struct pt_regs *regs) + const u32 max_stack = event->attr.sample_max_stack; + struct perf_callchain_entry *callchain; + ++ if (!current->mm) ++ user = false; ++ + if (!kernel && !user) + return &__empty_callchain; + +diff --git a/kernel/exit.c b/kernel/exit.c +index 1b51dc099f1e0..771dd7b226c18 100644 +--- a/kernel/exit.c ++++ b/kernel/exit.c +@@ -937,6 +937,15 @@ void __noreturn do_exit(long code) + tsk->exit_code = code; + taskstats_exit(tsk, group_dead); + ++ /* ++ * Since sampling can touch ->mm, make sure to stop everything before we ++ * tear it down. ++ * ++ * Also flushes inherited counters to the parent - before the parent ++ * gets woken up by child-exit notifications. ++ */ ++ perf_event_exit_task(tsk); ++ + exit_mm(); + + if (group_dead) +@@ -953,14 +962,6 @@ void __noreturn do_exit(long code) + exit_task_work(tsk); + exit_thread(tsk); + +- /* +- * Flush inherited counters to the parent - before the parent +- * gets woken up by child-exit notifications. +- * +- * because of cgroup mode, must be called before cgroup_exit() +- */ +- perf_event_exit_task(tsk); +- + sched_autogroup_exit_task(tsk); + cgroup_exit(tsk); + +-- +2.39.5 + diff --git a/queue-6.15/perf-test-directory-file-descriptor-leak.patch b/queue-6.15/perf-test-directory-file-descriptor-leak.patch new file mode 100644 index 0000000000..72ef1ee3dd --- /dev/null +++ b/queue-6.15/perf-test-directory-file-descriptor-leak.patch @@ -0,0 +1,47 @@ +From e030bcc680811d3f43916548353d78f5f19b0603 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Fri, 13 Jun 2025 17:41:04 -0700 +Subject: perf test: Directory file descriptor leak + +From: Ian Rogers <irogers@google.com> + +[ Upstream commit 19f4422d485b2d0a935117a1a16015328f99be25 ] + +Add missed close when iterating over the script directories. + +Fixes: f3295f5b067d3c26 ("perf tests: Use scandirat for shell script finding") +Signed-off-by: Ian Rogers <irogers@google.com> +Cc: Adrian Hunter <adrian.hunter@intel.com> +Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> +Cc: Andi Kleen <ak@linux.intel.com> +Cc: Ingo Molnar <mingo@redhat.com> +Cc: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> +Cc: Jiri Olsa <jolsa@kernel.org> +Cc: Kan Liang <kan.liang@linux.intel.com> +Cc: Mark Rutland <mark.rutland@arm.com> +Cc: Michael Petlan <mpetlan@redhat.com> +Cc: Namhyung Kim <namhyung@kernel.org> +Cc: Peter Zijlstra <peterz@infradead.org> +Cc: Tiezhu Yang <yangtiezhu@loongson.cn> +Link: https://lore.kernel.org/r/20250614004108.1650988-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + tools/perf/tests/tests-scripts.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/perf/tests/tests-scripts.c b/tools/perf/tests/tests-scripts.c +index 1d5759d081417..3a2a8438f9af1 100644 +--- a/tools/perf/tests/tests-scripts.c ++++ b/tools/perf/tests/tests-scripts.c +@@ -260,6 +260,7 @@ static void append_scripts_in_dir(int dir_fd, + continue; /* Skip scripts that have a separate driver. */ + fd = openat(dir_fd, ent->d_name, O_PATH); + append_scripts_in_dir(fd, result, result_sz); ++ close(fd); + } + for (i = 0; i < n_dirs; i++) /* Clean up */ + zfree(&entlist[i]); +-- +2.39.5 + diff --git a/queue-6.15/risc-v-kvm-don-t-treat-sbi-hfence-calls-as-nops.patch b/queue-6.15/risc-v-kvm-don-t-treat-sbi-hfence-calls-as-nops.patch new file mode 100644 index 0000000000..e48323180b --- /dev/null +++ b/queue-6.15/risc-v-kvm-don-t-treat-sbi-hfence-calls-as-nops.patch @@ -0,0 +1,46 @@ +From 1bbbcd102c1d84e08fd14058b26397b817986cc7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 5 Jun 2025 11:44:47 +0530 +Subject: RISC-V: KVM: Don't treat SBI HFENCE calls as NOPs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Anup Patel <apatel@ventanamicro.com> + +[ Upstream commit 2e7be162996640bbe3b6da694cc064c511b8a5d9 ] + +The SBI specification clearly states that SBI HFENCE calls should +return SBI_ERR_NOT_SUPPORTED when one of the target hart doesn’t +support hypervisor extension (aka nested virtualization in-case +of KVM RISC-V). + +Fixes: c7fa3c48de86 ("RISC-V: KVM: Treat SBI HFENCE calls as NOPs") +Reviewed-by: Atish Patra <atishp@rivosinc.com> +Signed-off-by: Anup Patel <apatel@ventanamicro.com> +Link: https://lore.kernel.org/r/20250605061458.196003-3-apatel@ventanamicro.com +Signed-off-by: Anup Patel <anup@brainfault.org> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + arch/riscv/kvm/vcpu_sbi_replace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/riscv/kvm/vcpu_sbi_replace.c b/arch/riscv/kvm/vcpu_sbi_replace.c +index 9752d2ffff683..b17fad091babd 100644 +--- a/arch/riscv/kvm/vcpu_sbi_replace.c ++++ b/arch/riscv/kvm/vcpu_sbi_replace.c +@@ -127,9 +127,9 @@ static int kvm_sbi_ext_rfence_handler(struct kvm_vcpu *vcpu, struct kvm_run *run + case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID: + /* + * Until nested virtualization is implemented, the +- * SBI HFENCE calls should be treated as NOPs ++ * SBI HFENCE calls should return not supported ++ * hence fallthrough. + */ +- break; + default: + retdata->err_val = SBI_ERR_NOT_SUPPORTED; + } +-- +2.39.5 + diff --git a/queue-6.15/risc-v-kvm-fix-the-size-parameter-check-in-sbi-sfenc.patch b/queue-6.15/risc-v-kvm-fix-the-size-parameter-check-in-sbi-sfenc.patch new file mode 100644 index 0000000000..c231a7b8b5 --- /dev/null +++ b/queue-6.15/risc-v-kvm-fix-the-size-parameter-check-in-sbi-sfenc.patch @@ -0,0 +1,52 @@ +From a243cec83669df8197eee741a000cc9b6e4d46d5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 5 Jun 2025 11:44:46 +0530 +Subject: RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls + +From: Anup Patel <apatel@ventanamicro.com> + +[ Upstream commit 6aba0cb5bba6141158d5449f2cf53187b7f755f9 ] + +As-per the SBI specification, an SBI remote fence operation applies +to the entire address space if either: +1) start_addr and size are both 0 +2) size is equal to 2^XLEN-1 + +>From the above, only #1 is checked by SBI SFENCE calls so fix the +size parameter check in SBI SFENCE calls to cover #2 as well. + +Fixes: 13acfec2dbcc ("RISC-V: KVM: Add remote HFENCE functions based on VCPU requests") +Reviewed-by: Atish Patra <atishp@rivosinc.com> +Signed-off-by: Anup Patel <apatel@ventanamicro.com> +Link: https://lore.kernel.org/r/20250605061458.196003-2-apatel@ventanamicro.com +Signed-off-by: Anup Patel <anup@brainfault.org> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + arch/riscv/kvm/vcpu_sbi_replace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/riscv/kvm/vcpu_sbi_replace.c b/arch/riscv/kvm/vcpu_sbi_replace.c +index 5fbf3f94f1e85..9752d2ffff683 100644 +--- a/arch/riscv/kvm/vcpu_sbi_replace.c ++++ b/arch/riscv/kvm/vcpu_sbi_replace.c +@@ -103,7 +103,7 @@ static int kvm_sbi_ext_rfence_handler(struct kvm_vcpu *vcpu, struct kvm_run *run + kvm_riscv_vcpu_pmu_incr_fw(vcpu, SBI_PMU_FW_FENCE_I_SENT); + break; + case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA: +- if (cp->a2 == 0 && cp->a3 == 0) ++ if ((cp->a2 == 0 && cp->a3 == 0) || cp->a3 == -1UL) + kvm_riscv_hfence_vvma_all(vcpu->kvm, hbase, hmask); + else + kvm_riscv_hfence_vvma_gva(vcpu->kvm, hbase, hmask, +@@ -111,7 +111,7 @@ static int kvm_sbi_ext_rfence_handler(struct kvm_vcpu *vcpu, struct kvm_run *run + kvm_riscv_vcpu_pmu_incr_fw(vcpu, SBI_PMU_FW_HFENCE_VVMA_SENT); + break; + case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID: +- if (cp->a2 == 0 && cp->a3 == 0) ++ if ((cp->a2 == 0 && cp->a3 == 0) || cp->a3 == -1UL) + kvm_riscv_hfence_vvma_asid_all(vcpu->kvm, + hbase, hmask, cp->a4); + else +-- +2.39.5 + diff --git a/queue-6.15/scsi-elx-efct-fix-memory-leak-in-efct_hw_parse_filte.patch b/queue-6.15/scsi-elx-efct-fix-memory-leak-in-efct_hw_parse_filte.patch new file mode 100644 index 0000000000..81a7a27a0e --- /dev/null +++ b/queue-6.15/scsi-elx-efct-fix-memory-leak-in-efct_hw_parse_filte.patch @@ -0,0 +1,61 @@ +From 4d337629a016d0bc46b957f4302534a874af8e9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Thu, 12 Jun 2025 21:35:18 +0500 +Subject: scsi: elx: efct: Fix memory leak in efct_hw_parse_filter() + +From: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru> + +[ Upstream commit 2a8a5a5dd06eef580f9818567773fd75057cb875 ] + +strsep() modifies the address of the pointer passed to it so that it no +longer points to the original address. This means kfree() gets the wrong +pointer. + +Fix this by passing unmodified pointer returned from kstrdup() to +kfree(). + +Found by Linux Verification Center (linuxtesting.org) with Svace. + +Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines") +Signed-off-by: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru> +Link: https://lore.kernel.org/r/20250612163616.24298-1-v.shevtsov@mt-integration.ru +Reviewed-by: Daniel Wagner <dwagner@suse.de> +Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/scsi/elx/efct/efct_hw.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_hw.c +index 5a5525054d71c..5b079b8b7a082 100644 +--- a/drivers/scsi/elx/efct/efct_hw.c ++++ b/drivers/scsi/elx/efct/efct_hw.c +@@ -1120,7 +1120,7 @@ int + efct_hw_parse_filter(struct efct_hw *hw, void *value) + { + int rc = 0; +- char *p = NULL; ++ char *p = NULL, *pp = NULL; + char *token; + u32 idx = 0; + +@@ -1132,6 +1132,7 @@ efct_hw_parse_filter(struct efct_hw *hw, void *value) + efc_log_err(hw->os, "p is NULL\n"); + return -ENOMEM; + } ++ pp = p; + + idx = 0; + while ((token = strsep(&p, ",")) && *token) { +@@ -1144,7 +1145,7 @@ efct_hw_parse_filter(struct efct_hw *hw, void *value) + if (idx == ARRAY_SIZE(hw->config.filter_def)) + break; + } +- kfree(p); ++ kfree(pp); + + return rc; + } +-- +2.39.5 + diff --git a/queue-6.15/series b/queue-6.15/series index 8be2c8eafa..9ebfeea250 100644 --- a/queue-6.15/series +++ b/queue-6.15/series @@ -568,3 +568,25 @@ rust-devres-fix-doctest-build-under-config_pci.patch dm-table-check-blk_feat_atomic_writes-inside-limits_lock.patch tracing-do-not-free-head-on-error-path-of-filter_free_subsystem_filters.patch documentation-nouveau-update-gsp-message-queue-kernel-doc-reference.patch +perf-fix-sample-vs-do_exit.patch +perf-fix-cgroup-state-vs-error.patch +perf-core-fix-warn-in-perf_cgroup_switch.patch +arm64-ptrace-fix-stack-out-of-bounds-read-in-regs_ge.patch +scsi-elx-efct-fix-memory-leak-in-efct_hw_parse_filte.patch +risc-v-kvm-fix-the-size-parameter-check-in-sbi-sfenc.patch +risc-v-kvm-don-t-treat-sbi-hfence-calls-as-nops.patch +gpio-pca953x-fix-wrong-error-probe-return-value.patch +perf-evsel-missed-close-when-probing-hybrid-core-pmu.patch +perf-test-directory-file-descriptor-leak.patch +x86-mm-fix-early-boot-use-of-invplgb.patch +mtd-spinand-use-more-specific-naming-for-the-single-.patch +mtd-spinand-use-more-specific-naming-for-the-dual-ou.patch +mtd-spinand-use-more-specific-naming-for-the-dual-io.patch +mtd-spinand-use-more-specific-naming-for-the-quad-ou.patch +mtd-spinand-use-more-specific-naming-for-the-quad-io.patch +mtd-spinand-winbond-prevent-unsupported-frequencies-.patch +gpio-mlxbf3-only-get-irq-for-device-instance-0.patch +pci-pciehp-ignore-belated-presence-detect-changed-ca.patch +cifs-remove-duplicate-fattr-cf_dtype-assignment-from.patch +erofs-refuse-crafted-out-of-file-range-encoded-exten.patch +erofs-remove-a-superfluous-check-for-encoded-extents.patch diff --git a/queue-6.15/x86-mm-fix-early-boot-use-of-invplgb.patch b/queue-6.15/x86-mm-fix-early-boot-use-of-invplgb.patch new file mode 100644 index 0000000000..63c159ff19 --- /dev/null +++ b/queue-6.15/x86-mm-fix-early-boot-use-of-invplgb.patch @@ -0,0 +1,57 @@ +From da42153efa2967706b1f64fdc0db9e399b65d460 Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Fri, 6 Jun 2025 13:10:34 -0400 +Subject: x86/mm: Fix early boot use of INVPLGB + +From: Rik van Riel <riel@surriel.com> + +[ Upstream commit cb6075bc62dc6a9cd7ab3572758685fdf78e3e20 ] + +The INVLPGB instruction has limits on how many pages it can invalidate +at once. That limit is enumerated in CPUID, read by the kernel, and +stored in 'invpgb_count_max'. Ranged invalidation, like +invlpgb_kernel_range_flush() break up their invalidations so +that they do not exceed the limit. + +However, early boot code currently attempts to do ranged +invalidation before populating 'invlpgb_count_max'. There is a +for loop which is basically: + + for (...; addr < end; addr += invlpgb_count_max*PAGE_SIZE) + +If invlpgb_kernel_range_flush is called before the kernel has read +the value of invlpgb_count_max from the hardware, the normally +bounded loop can become an infinite loop if invlpgb_count_max is +initialized to zero. + +Fix that issue by initializing invlpgb_count_max to 1. + +This way INVPLGB at early boot time will be a little bit slower +than normal (with initialized invplgb_count_max), and not an +instant hang at bootup time. + +Fixes: b7aa05cbdc52 ("x86/mm: Add INVLPGB support code") +Signed-off-by: Rik van Riel <riel@surriel.com> +Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> +Link: https://lore.kernel.org/all/20250606171112.4013261-3-riel%40surriel.com +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + arch/x86/kernel/cpu/amd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c +index 4e06baab40bb3..a59d6d8fc71f9 100644 +--- a/arch/x86/kernel/cpu/amd.c ++++ b/arch/x86/kernel/cpu/amd.c +@@ -29,7 +29,7 @@ + + #include "cpu.h" + +-u16 invlpgb_count_max __ro_after_init; ++u16 invlpgb_count_max __ro_after_init = 1; + + static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) + { +-- +2.39.5 + |