From: Sasha Levin Date: Sun, 12 Feb 2023 19:48:35 +0000 (-0500) Subject: Fixes for 5.4 X-Git-Tag: v6.1.12~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfefbef81fd83cbe54dd1c3449683c3d2fd1c954;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/alsa-pci-lx6464es-fix-a-debug-loop.patch b/queue-5.4/alsa-pci-lx6464es-fix-a-debug-loop.patch new file mode 100644 index 00000000000..b43b0a47823 --- /dev/null +++ b/queue-5.4/alsa-pci-lx6464es-fix-a-debug-loop.patch @@ -0,0 +1,52 @@ +From 0109dbe3ae15ac5c860af8fb7e35961522548827 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Jan 2023 13:02:13 +0300 +Subject: ALSA: pci: lx6464es: fix a debug loop + +From: Dan Carpenter + +[ Upstream commit 5dac9f8dc25fefd9d928b98f6477ff3daefd73e3 ] + +This loop accidentally reuses the "i" iterator for both the inside and +the outside loop. The value of MAX_STREAM_BUFFER is 5. I believe that +chip->rmh.stat_len is in the 2-12 range. If the value of .stat_len is +4 or more then it will loop exactly one time, but if it's less then it +is a forever loop. + +It looks like it was supposed to combined into one loop where +conditions are checked. + +Fixes: 8e6320064c33 ("ALSA: lx_core: Remove useless #if 0 .. #endif") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/Y9jnJTis/mRFJAQp@kili +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/lx6464es/lx_core.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c +index dd3a873777eb5..00975e86473c5 100644 +--- a/sound/pci/lx6464es/lx_core.c ++++ b/sound/pci/lx6464es/lx_core.c +@@ -493,12 +493,11 @@ int lx_buffer_ask(struct lx6464es *chip, u32 pipe, int is_capture, + dev_dbg(chip->card->dev, + "CMD_08_ASK_BUFFERS: needed %d, freed %d\n", + *r_needed, *r_freed); +- for (i = 0; i < MAX_STREAM_BUFFER; ++i) { +- for (i = 0; i != chip->rmh.stat_len; ++i) +- dev_dbg(chip->card->dev, +- " stat[%d]: %x, %x\n", i, +- chip->rmh.stat[i], +- chip->rmh.stat[i] & MASK_DATA_SIZE); ++ for (i = 0; i < MAX_STREAM_BUFFER && i < chip->rmh.stat_len; ++ ++i) { ++ dev_dbg(chip->card->dev, " stat[%d]: %x, %x\n", i, ++ chip->rmh.stat[i], ++ chip->rmh.stat[i] & MASK_DATA_SIZE); + } + } + +-- +2.39.0 + diff --git a/queue-5.4/bonding-fix-error-checking-in-bond_debug_reregister.patch b/queue-5.4/bonding-fix-error-checking-in-bond_debug_reregister.patch new file mode 100644 index 00000000000..04bab523839 --- /dev/null +++ b/queue-5.4/bonding-fix-error-checking-in-bond_debug_reregister.patch @@ -0,0 +1,40 @@ +From 732fb8c4b5cefe0bf7e01d950bf0d11640c5c39e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Feb 2023 17:32:55 +0800 +Subject: bonding: fix error checking in bond_debug_reregister() + +From: Qi Zheng + +[ Upstream commit cbe83191d40d8925b7a99969d037d2a0caf69294 ] + +Since commit ff9fb72bc077 ("debugfs: return error values, +not NULL") changed return value of debugfs_rename() in +error cases from %NULL to %ERR_PTR(-ERROR), we should +also check error values instead of NULL. + +Fixes: ff9fb72bc077 ("debugfs: return error values, not NULL") +Signed-off-by: Qi Zheng +Acked-by: Jay Vosburgh +Link: https://lore.kernel.org/r/20230202093256.32458-1-zhengqi.arch@bytedance.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/bonding/bond_debugfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c +index f3f86ef68ae0c..8b6cf2bf9025a 100644 +--- a/drivers/net/bonding/bond_debugfs.c ++++ b/drivers/net/bonding/bond_debugfs.c +@@ -76,7 +76,7 @@ void bond_debug_reregister(struct bonding *bond) + + d = debugfs_rename(bonding_debug_root, bond->debug_dir, + bonding_debug_root, bond->dev->name); +- if (d) { ++ if (!IS_ERR(d)) { + bond->debug_dir = d; + } else { + netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n"); +-- +2.39.0 + diff --git a/queue-5.4/ib-hfi1-restore-allocated-resources-on-failed-copyou.patch b/queue-5.4/ib-hfi1-restore-allocated-resources-on-failed-copyou.patch new file mode 100644 index 00000000000..803f9a6e847 --- /dev/null +++ b/queue-5.4/ib-hfi1-restore-allocated-resources-on-failed-copyou.patch @@ -0,0 +1,46 @@ +From 9516b2ea4865d770fcf14e9a8d89a7d9c257d1f9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Jan 2023 13:16:02 -0500 +Subject: IB/hfi1: Restore allocated resources on failed copyout + +From: Dean Luick + +[ Upstream commit 6601fc0d15ffc20654e39486f9bef35567106d68 ] + +Fix a resource leak if an error occurs. + +Fixes: f404ca4c7ea8 ("IB/hfi1: Refactor hfi_user_exp_rcv_setup() IOCTL") +Signed-off-by: Dean Luick +Signed-off-by: Dennis Dalessandro +Link: https://lore.kernel.org/r/167354736291.2132367.10894218740150168180.stgit@awfm-02.cornelisnetworks.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/hfi1/file_ops.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c +index efd977f70f9ea..607e2636a6d16 100644 +--- a/drivers/infiniband/hw/hfi1/file_ops.c ++++ b/drivers/infiniband/hw/hfi1/file_ops.c +@@ -1363,12 +1363,15 @@ static int user_exp_rcv_setup(struct hfi1_filedata *fd, unsigned long arg, + addr = arg + offsetof(struct hfi1_tid_info, tidcnt); + if (copy_to_user((void __user *)addr, &tinfo.tidcnt, + sizeof(tinfo.tidcnt))) +- return -EFAULT; ++ ret = -EFAULT; + + addr = arg + offsetof(struct hfi1_tid_info, length); +- if (copy_to_user((void __user *)addr, &tinfo.length, ++ if (!ret && copy_to_user((void __user *)addr, &tinfo.length, + sizeof(tinfo.length))) + ret = -EFAULT; ++ ++ if (ret) ++ hfi1_user_exp_rcv_invalid(fd, &tinfo); + } + + return ret; +-- +2.39.0 + diff --git a/queue-5.4/ib-ipoib-fix-legacy-ipoib-due-to-wrong-number-of-que.patch b/queue-5.4/ib-ipoib-fix-legacy-ipoib-due-to-wrong-number-of-que.patch new file mode 100644 index 00000000000..f43f2e01a1e --- /dev/null +++ b/queue-5.4/ib-ipoib-fix-legacy-ipoib-due-to-wrong-number-of-que.patch @@ -0,0 +1,98 @@ +From b964b48303e4b8444b8d55809e58dbc4c1ed2a66 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Jan 2023 20:24:18 +0200 +Subject: IB/IPoIB: Fix legacy IPoIB due to wrong number of queues + +From: Dragos Tatulea + +[ Upstream commit e632291a2dbce45a24cddeb5fe28fe71d724ba43 ] + +The cited commit creates child PKEY interfaces over netlink will +multiple tx and rx queues, but some devices doesn't support more than 1 +tx and 1 rx queues. This causes to a crash when traffic is sent over the +PKEY interface due to the parent having a single queue but the child +having multiple queues. + +This patch fixes the number of queues to 1 for legacy IPoIB at the +earliest possible point in time. + +BUG: kernel NULL pointer dereference, address: 000000000000036b +PGD 0 P4D 0 +Oops: 0000 [#1] SMP +CPU: 4 PID: 209665 Comm: python3 Not tainted 6.1.0_for_upstream_min_debug_2022_12_12_17_02 #1 +Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 +RIP: 0010:kmem_cache_alloc+0xcb/0x450 +Code: ce 7e 49 8b 50 08 49 83 78 10 00 4d 8b 28 0f 84 cb 02 00 00 4d 85 ed 0f 84 c2 02 00 00 41 8b 44 24 28 48 8d 4a +01 49 8b 3c 24 <49> 8b 5c 05 00 4c 89 e8 65 48 0f c7 0f 0f 94 c0 84 c0 74 b8 41 8b +RSP: 0018:ffff88822acbbab8 EFLAGS: 00010202 +RAX: 0000000000000070 RBX: ffff8881c28e3e00 RCX: 00000000064f8dae +RDX: 00000000064f8dad RSI: 0000000000000a20 RDI: 0000000000030d00 +RBP: 0000000000000a20 R08: ffff8882f5d30d00 R09: ffff888104032f40 +R10: ffff88810fade828 R11: 736f6d6570736575 R12: ffff88810081c000 +R13: 00000000000002fb R14: ffffffff817fc865 R15: 0000000000000000 +FS: 00007f9324ff9700(0000) GS:ffff8882f5d00000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 000000000000036b CR3: 00000001125af004 CR4: 0000000000370ea0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +Call Trace: + + skb_clone+0x55/0xd0 + ip6_finish_output2+0x3fe/0x690 + ip6_finish_output+0xfa/0x310 + ip6_send_skb+0x1e/0x60 + udp_v6_send_skb+0x1e5/0x420 + udpv6_sendmsg+0xb3c/0xe60 + ? ip_mc_finish_output+0x180/0x180 + ? __switch_to_asm+0x3a/0x60 + ? __switch_to_asm+0x34/0x60 + sock_sendmsg+0x33/0x40 + __sys_sendto+0x103/0x160 + ? _copy_to_user+0x21/0x30 + ? kvm_clock_get_cycles+0xd/0x10 + ? ktime_get_ts64+0x49/0xe0 + __x64_sys_sendto+0x25/0x30 + do_syscall_64+0x3d/0x90 + entry_SYSCALL_64_after_hwframe+0x46/0xb0 +RIP: 0033:0x7f9374f1ed14 +Code: 42 41 f8 ff 44 8b 4c 24 2c 4c 8b 44 24 20 89 c5 44 8b 54 24 28 48 8b 54 24 18 b8 2c 00 00 00 48 8b 74 24 10 8b +7c 24 08 0f 05 <48> 3d 00 f0 ff ff 77 34 89 ef 48 89 44 24 08 e8 68 41 f8 ff 48 8b +RSP: 002b:00007f9324ff7bd0 EFLAGS: 00000293 ORIG_RAX: 000000000000002c +RAX: ffffffffffffffda RBX: 00007f9324ff7cc8 RCX: 00007f9374f1ed14 +RDX: 00000000000002fb RSI: 00007f93000052f0 RDI: 0000000000000030 +RBP: 0000000000000000 R08: 00007f9324ff7d40 R09: 000000000000001c +R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000 +R13: 000000012a05f200 R14: 0000000000000001 R15: 00007f9374d57bdc + + +Fixes: dbc94a0fb817 ("IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces") +Signed-off-by: Dragos Tatulea +Link: https://lore.kernel.org/r/95eb6b74c7cf49fa46281f9d056d685c9fa11d38.1674584576.git.leon@kernel.org +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c +index 69ecf37053a81..3c3cc6af0a1ef 100644 +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c +@@ -2171,6 +2171,14 @@ int ipoib_intf_init(struct ib_device *hca, u8 port, const char *name, + rn->attach_mcast = ipoib_mcast_attach; + rn->detach_mcast = ipoib_mcast_detach; + rn->hca = hca; ++ ++ rc = netif_set_real_num_tx_queues(dev, 1); ++ if (rc) ++ goto out; ++ ++ rc = netif_set_real_num_rx_queues(dev, 1); ++ if (rc) ++ goto out; + } + + priv->rn_ops = dev->netdev_ops; +-- +2.39.0 + diff --git a/queue-5.4/ice-do-not-use-wq_mem_reclaim-flag-for-workqueue.patch b/queue-5.4/ice-do-not-use-wq_mem_reclaim-flag-for-workqueue.patch new file mode 100644 index 00000000000..5b1c222654e --- /dev/null +++ b/queue-5.4/ice-do-not-use-wq_mem_reclaim-flag-for-workqueue.patch @@ -0,0 +1,111 @@ +From c9201d82a79c6bf3d7082f93702388a3a8bb0445 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Jan 2023 14:06:40 -0800 +Subject: ice: Do not use WQ_MEM_RECLAIM flag for workqueue + +From: Anirudh Venkataramanan + +[ Upstream commit 4d159f7884f78b1aacb99b4fc37d1e3cb1194e39 ] + +When both ice and the irdma driver are loaded, a warning in +check_flush_dependency is being triggered. This is due to ice driver +workqueue being allocated with the WQ_MEM_RECLAIM flag and the irdma one +is not. + +According to kernel documentation, this flag should be set if the +workqueue will be involved in the kernel's memory reclamation flow. +Since it is not, there is no need for the ice driver's WQ to have this +flag set so remove it. + +Example trace: + +[ +0.000004] workqueue: WQ_MEM_RECLAIM ice:ice_service_task [ice] is flushing !WQ_MEM_RECLAIM infiniband:0x0 +[ +0.000139] WARNING: CPU: 0 PID: 728 at kernel/workqueue.c:2632 check_flush_dependency+0x178/0x1a0 +[ +0.000011] Modules linked in: bonding tls xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_cha +in_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink bridge stp llc rfkill vfat fat intel_rapl_msr intel +_rapl_common isst_if_common skx_edac nfit libnvdimm x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct1 +0dif_pclmul crc32_pclmul ghash_clmulni_intel rapl intel_cstate rpcrdma sunrpc rdma_ucm ib_srpt ib_isert iscsi_target_mod target_ +core_mod ib_iser libiscsi scsi_transport_iscsi rdma_cm ib_cm iw_cm iTCO_wdt iTCO_vendor_support ipmi_ssif irdma mei_me ib_uverbs +ib_core intel_uncore joydev pcspkr i2c_i801 acpi_ipmi mei lpc_ich i2c_smbus intel_pch_thermal ioatdma ipmi_si acpi_power_meter +acpi_pad xfs libcrc32c sd_mod t10_pi crc64_rocksoft crc64 sg ahci ixgbe libahci ice i40e igb crc32c_intel mdio i2c_algo_bit liba +ta dca wmi dm_mirror dm_region_hash dm_log dm_mod ipmi_devintf ipmi_msghandler fuse +[ +0.000161] [last unloaded: bonding] +[ +0.000006] CPU: 0 PID: 728 Comm: kworker/0:2 Tainted: G S 6.2.0-rc2_next-queue-13jan-00458-gc20aabd57164 #1 +[ +0.000006] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0010.010620200716 01/06/2020 +[ +0.000003] Workqueue: ice ice_service_task [ice] +[ +0.000127] RIP: 0010:check_flush_dependency+0x178/0x1a0 +[ +0.000005] Code: 89 8e 02 01 e8 49 3d 40 00 49 8b 55 18 48 8d 8d d0 00 00 00 48 8d b3 d0 00 00 00 4d 89 e0 48 c7 c7 e0 3b 08 +9f e8 bb d3 07 01 <0f> 0b e9 be fe ff ff 80 3d 24 89 8e 02 00 0f 85 6b ff ff ff e9 06 +[ +0.000004] RSP: 0018:ffff88810a39f990 EFLAGS: 00010282 +[ +0.000005] RAX: 0000000000000000 RBX: ffff888141bc2400 RCX: 0000000000000000 +[ +0.000004] RDX: 0000000000000001 RSI: dffffc0000000000 RDI: ffffffffa1213a80 +[ +0.000003] RBP: ffff888194bf3400 R08: ffffed117b306112 R09: ffffed117b306112 +[ +0.000003] R10: ffff888bd983088b R11: ffffed117b306111 R12: 0000000000000000 +[ +0.000003] R13: ffff888111f84d00 R14: ffff88810a3943ac R15: ffff888194bf3400 +[ +0.000004] FS: 0000000000000000(0000) GS:ffff888bd9800000(0000) knlGS:0000000000000000 +[ +0.000003] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ +0.000003] CR2: 000056035b208b60 CR3: 000000017795e005 CR4: 00000000007706f0 +[ +0.000003] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ +0.000003] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +[ +0.000002] PKRU: 55555554 +[ +0.000003] Call Trace: +[ +0.000002] +[ +0.000003] __flush_workqueue+0x203/0x840 +[ +0.000006] ? mutex_unlock+0x84/0xd0 +[ +0.000008] ? __pfx_mutex_unlock+0x10/0x10 +[ +0.000004] ? __pfx___flush_workqueue+0x10/0x10 +[ +0.000006] ? mutex_lock+0xa3/0xf0 +[ +0.000005] ib_cache_cleanup_one+0x39/0x190 [ib_core] +[ +0.000174] __ib_unregister_device+0x84/0xf0 [ib_core] +[ +0.000094] ib_unregister_device+0x25/0x30 [ib_core] +[ +0.000093] irdma_ib_unregister_device+0x97/0xc0 [irdma] +[ +0.000064] ? __pfx_irdma_ib_unregister_device+0x10/0x10 [irdma] +[ +0.000059] ? up_write+0x5c/0x90 +[ +0.000005] irdma_remove+0x36/0x90 [irdma] +[ +0.000062] auxiliary_bus_remove+0x32/0x50 +[ +0.000007] device_release_driver_internal+0xfa/0x1c0 +[ +0.000005] bus_remove_device+0x18a/0x260 +[ +0.000007] device_del+0x2e5/0x650 +[ +0.000005] ? __pfx_device_del+0x10/0x10 +[ +0.000003] ? mutex_unlock+0x84/0xd0 +[ +0.000004] ? __pfx_mutex_unlock+0x10/0x10 +[ +0.000004] ? _raw_spin_unlock+0x18/0x40 +[ +0.000005] ice_unplug_aux_dev+0x52/0x70 [ice] +[ +0.000160] ice_service_task+0x1309/0x14f0 [ice] +[ +0.000134] ? __pfx___schedule+0x10/0x10 +[ +0.000006] process_one_work+0x3b1/0x6c0 +[ +0.000008] worker_thread+0x69/0x670 +[ +0.000005] ? __kthread_parkme+0xec/0x110 +[ +0.000007] ? __pfx_worker_thread+0x10/0x10 +[ +0.000005] kthread+0x17f/0x1b0 +[ +0.000005] ? __pfx_kthread+0x10/0x10 +[ +0.000004] ret_from_fork+0x29/0x50 +[ +0.000009] + +Fixes: 940b61af02f4 ("ice: Initialize PF and setup miscellaneous interrupt") +Signed-off-by: Anirudh Venkataramanan +Signed-off-by: Marcin Szycik +Tested-by: Jakub Andrysiak +Signed-off-by: Tony Nguyen +Reviewed-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index 7d28563ab7946..ae1d305672259 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -3211,7 +3211,7 @@ static int __init ice_module_init(void) + pr_info("%s - version %s\n", ice_driver_string, ice_drv_ver); + pr_info("%s\n", ice_copyright); + +- ice_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, KBUILD_MODNAME); ++ ice_wq = alloc_workqueue("%s", 0, 0, KBUILD_MODNAME); + if (!ice_wq) { + pr_err("Failed to create workqueue\n"); + return -ENOMEM; +-- +2.39.0 + diff --git a/queue-5.4/iommu-add-gfp-parameter-to-iommu_ops-map.patch b/queue-5.4/iommu-add-gfp-parameter-to-iommu_ops-map.patch new file mode 100644 index 00000000000..66f379888e6 --- /dev/null +++ b/queue-5.4/iommu-add-gfp-parameter-to-iommu_ops-map.patch @@ -0,0 +1,447 @@ +From f8bd463c608c0970d33b0a77fae325d3eaa3519a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 8 Sep 2019 09:56:38 -0700 +Subject: iommu: Add gfp parameter to iommu_ops::map + +From: Tom Murphy + +[ Upstream commit 781ca2de89bae1b1d2c96df9ef33e9a324415995 ] + +Add a gfp_t parameter to the iommu_ops::map function. +Remove the needless locking in the AMD iommu driver. + +The iommu_ops::map function (or the iommu_map function which calls it) +was always supposed to be sleepable (according to Joerg's comment in +this thread: https://lore.kernel.org/patchwork/patch/977520/ ) and so +should probably have had a "might_sleep()" since it was written. However +currently the dma-iommu api can call iommu_map in an atomic context, +which it shouldn't do. This doesn't cause any problems because any iommu +driver which uses the dma-iommu api uses gfp_atomic in it's +iommu_ops::map function. But doing this wastes the memory allocators +atomic pools. + +Signed-off-by: Tom Murphy +Reviewed-by: Robin Murphy +Reviewed-by: Christoph Hellwig +Signed-off-by: Joerg Roedel +Stable-dep-of: b7e08a5a63a1 ("RDMA/usnic: use iommu_map_atomic() under spin_lock()") +Signed-off-by: Sasha Levin +--- + drivers/iommu/amd_iommu.c | 3 ++- + drivers/iommu/arm-smmu-v3.c | 2 +- + drivers/iommu/arm-smmu.c | 2 +- + drivers/iommu/dma-iommu.c | 6 ++--- + drivers/iommu/exynos-iommu.c | 2 +- + drivers/iommu/intel-iommu.c | 2 +- + drivers/iommu/iommu.c | 43 +++++++++++++++++++++++++++++----- + drivers/iommu/ipmmu-vmsa.c | 2 +- + drivers/iommu/msm_iommu.c | 2 +- + drivers/iommu/mtk_iommu.c | 2 +- + drivers/iommu/mtk_iommu_v1.c | 2 +- + drivers/iommu/omap-iommu.c | 2 +- + drivers/iommu/qcom_iommu.c | 2 +- + drivers/iommu/rockchip-iommu.c | 2 +- + drivers/iommu/s390-iommu.c | 2 +- + drivers/iommu/tegra-gart.c | 2 +- + drivers/iommu/tegra-smmu.c | 2 +- + drivers/iommu/virtio-iommu.c | 2 +- + include/linux/iommu.h | 21 ++++++++++++++++- + 19 files changed, 77 insertions(+), 26 deletions(-) + +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c +index c392930253a30..5e269f3dca3dd 100644 +--- a/drivers/iommu/amd_iommu.c ++++ b/drivers/iommu/amd_iommu.c +@@ -3098,7 +3098,8 @@ static int amd_iommu_attach_device(struct iommu_domain *dom, + } + + static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, +- phys_addr_t paddr, size_t page_size, int iommu_prot) ++ phys_addr_t paddr, size_t page_size, int iommu_prot, ++ gfp_t gfp) + { + struct protection_domain *domain = to_pdomain(dom); + int prot = 0; +diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c +index 02c2fb551f381..4f64c3a9ee88d 100644 +--- a/drivers/iommu/arm-smmu-v3.c ++++ b/drivers/iommu/arm-smmu-v3.c +@@ -2451,7 +2451,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) + } + + static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops; + +diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c +index 2185ea5191c15..775acae84d7d2 100644 +--- a/drivers/iommu/arm-smmu.c ++++ b/drivers/iommu/arm-smmu.c +@@ -1160,7 +1160,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) + } + + static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops; + struct arm_smmu_device *smmu = to_smmu_domain(domain)->smmu; +diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c +index 9c3e630c6c4c8..4fc8fb92d45ef 100644 +--- a/drivers/iommu/dma-iommu.c ++++ b/drivers/iommu/dma-iommu.c +@@ -477,7 +477,7 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys, + if (!iova) + return DMA_MAPPING_ERROR; + +- if (iommu_map(domain, iova, phys - iova_off, size, prot)) { ++ if (iommu_map_atomic(domain, iova, phys - iova_off, size, prot)) { + iommu_dma_free_iova(cookie, iova, size); + return DMA_MAPPING_ERROR; + } +@@ -612,7 +612,7 @@ static void *iommu_dma_alloc_remap(struct device *dev, size_t size, + arch_dma_prep_coherent(sg_page(sg), sg->length); + } + +- if (iommu_map_sg(domain, iova, sgt.sgl, sgt.orig_nents, ioprot) ++ if (iommu_map_sg_atomic(domain, iova, sgt.sgl, sgt.orig_nents, ioprot) + < size) + goto out_free_sg; + +@@ -872,7 +872,7 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg, + * We'll leave any physical concatenation to the IOMMU driver's + * implementation - it knows better than we do. + */ +- if (iommu_map_sg(domain, iova, sg, nents, prot) < iova_len) ++ if (iommu_map_sg_atomic(domain, iova, sg, nents, prot) < iova_len) + goto out_free_iova; + + return __finalise_sg(dev, sg, nents, iova); +diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c +index 31a9b9885653f..acf21e4237949 100644 +--- a/drivers/iommu/exynos-iommu.c ++++ b/drivers/iommu/exynos-iommu.c +@@ -1077,7 +1077,7 @@ static int lv2set_page(sysmmu_pte_t *pent, phys_addr_t paddr, size_t size, + */ + static int exynos_iommu_map(struct iommu_domain *iommu_domain, + unsigned long l_iova, phys_addr_t paddr, size_t size, +- int prot) ++ int prot, gfp_t gfp) + { + struct exynos_iommu_domain *domain = to_exynos_domain(iommu_domain); + sysmmu_pte_t *entry; +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index ff120d7ed3424..2a53fa7d2b47d 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -5458,7 +5458,7 @@ static void intel_iommu_aux_detach_device(struct iommu_domain *domain, + + static int intel_iommu_map(struct iommu_domain *domain, + unsigned long iova, phys_addr_t hpa, +- size_t size, int iommu_prot) ++ size_t size, int iommu_prot, gfp_t gfp) + { + struct dmar_domain *dmar_domain = to_dmar_domain(domain); + u64 max_addr; +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index c5758fb696cc8..ef8f0d1ac5ab1 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -1858,8 +1858,8 @@ static size_t iommu_pgsize(struct iommu_domain *domain, + return pgsize; + } + +-int iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++int __iommu_map(struct iommu_domain *domain, unsigned long iova, ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + const struct iommu_ops *ops = domain->ops; + unsigned long orig_iova = iova; +@@ -1896,8 +1896,8 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, + + pr_debug("mapping: iova 0x%lx pa %pa pgsize 0x%zx\n", + iova, &paddr, pgsize); ++ ret = ops->map(domain, iova, paddr, pgsize, prot, gfp); + +- ret = ops->map(domain, iova, paddr, pgsize, prot); + if (ret) + break; + +@@ -1917,8 +1917,22 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, + + return ret; + } ++ ++int iommu_map(struct iommu_domain *domain, unsigned long iova, ++ phys_addr_t paddr, size_t size, int prot) ++{ ++ might_sleep(); ++ return __iommu_map(domain, iova, paddr, size, prot, GFP_KERNEL); ++} + EXPORT_SYMBOL_GPL(iommu_map); + ++int iommu_map_atomic(struct iommu_domain *domain, unsigned long iova, ++ phys_addr_t paddr, size_t size, int prot) ++{ ++ return __iommu_map(domain, iova, paddr, size, prot, GFP_ATOMIC); ++} ++EXPORT_SYMBOL_GPL(iommu_map_atomic); ++ + static size_t __iommu_unmap(struct iommu_domain *domain, + unsigned long iova, size_t size, + struct iommu_iotlb_gather *iotlb_gather) +@@ -1995,8 +2009,9 @@ size_t iommu_unmap_fast(struct iommu_domain *domain, + } + EXPORT_SYMBOL_GPL(iommu_unmap_fast); + +-size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, +- struct scatterlist *sg, unsigned int nents, int prot) ++size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova, ++ struct scatterlist *sg, unsigned int nents, int prot, ++ gfp_t gfp) + { + size_t len = 0, mapped = 0; + phys_addr_t start; +@@ -2007,7 +2022,9 @@ size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, + phys_addr_t s_phys = sg_phys(sg); + + if (len && s_phys != start + len) { +- ret = iommu_map(domain, iova + mapped, start, len, prot); ++ ret = __iommu_map(domain, iova + mapped, start, ++ len, prot, gfp); ++ + if (ret) + goto out_err; + +@@ -2035,8 +2052,22 @@ size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, + return 0; + + } ++ ++size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, ++ struct scatterlist *sg, unsigned int nents, int prot) ++{ ++ might_sleep(); ++ return __iommu_map_sg(domain, iova, sg, nents, prot, GFP_KERNEL); ++} + EXPORT_SYMBOL_GPL(iommu_map_sg); + ++size_t iommu_map_sg_atomic(struct iommu_domain *domain, unsigned long iova, ++ struct scatterlist *sg, unsigned int nents, int prot) ++{ ++ return __iommu_map_sg(domain, iova, sg, nents, prot, GFP_ATOMIC); ++} ++EXPORT_SYMBOL_GPL(iommu_map_sg_atomic); ++ + int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, + phys_addr_t paddr, u64 size, int prot) + { +diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c +index 584eefab1dbcd..33874c7aea42c 100644 +--- a/drivers/iommu/ipmmu-vmsa.c ++++ b/drivers/iommu/ipmmu-vmsa.c +@@ -724,7 +724,7 @@ static void ipmmu_detach_device(struct iommu_domain *io_domain, + } + + static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain); + +diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c +index cba0097eba39c..696a6c53a69fd 100644 +--- a/drivers/iommu/msm_iommu.c ++++ b/drivers/iommu/msm_iommu.c +@@ -504,7 +504,7 @@ static void msm_iommu_detach_dev(struct iommu_domain *domain, + } + + static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t pa, size_t len, int prot) ++ phys_addr_t pa, size_t len, int prot, gfp_t gfp) + { + struct msm_priv *priv = to_msm_priv(domain); + unsigned long flags; +diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c +index 18d7c818a174c..dad44e10b3314 100644 +--- a/drivers/iommu/mtk_iommu.c ++++ b/drivers/iommu/mtk_iommu.c +@@ -427,7 +427,7 @@ static void mtk_iommu_detach_device(struct iommu_domain *domain, + } + + static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct mtk_iommu_domain *dom = to_mtk_domain(domain); + struct mtk_iommu_data *data = mtk_iommu_get_m4u_data(); +diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c +index e31bd281e59d6..fa602bfe69512 100644 +--- a/drivers/iommu/mtk_iommu_v1.c ++++ b/drivers/iommu/mtk_iommu_v1.c +@@ -295,7 +295,7 @@ static void mtk_iommu_detach_device(struct iommu_domain *domain, + } + + static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct mtk_iommu_domain *dom = to_mtk_domain(domain); + unsigned int page_num = size >> MT2701_IOMMU_PAGE_SHIFT; +diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c +index 09c6e1c680db9..be551cc34be45 100644 +--- a/drivers/iommu/omap-iommu.c ++++ b/drivers/iommu/omap-iommu.c +@@ -1339,7 +1339,7 @@ static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, int pgsz) + } + + static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, +- phys_addr_t pa, size_t bytes, int prot) ++ phys_addr_t pa, size_t bytes, int prot, gfp_t gfp) + { + struct omap_iommu_domain *omap_domain = to_omap_domain(domain); + struct device *dev = omap_domain->dev; +diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c +index b6e546b62a7cb..e377f7771e30b 100644 +--- a/drivers/iommu/qcom_iommu.c ++++ b/drivers/iommu/qcom_iommu.c +@@ -419,7 +419,7 @@ static void qcom_iommu_detach_dev(struct iommu_domain *domain, struct device *de + } + + static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + int ret; + unsigned long flags; +diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c +index 0df091934361b..96f37d9d4d93c 100644 +--- a/drivers/iommu/rockchip-iommu.c ++++ b/drivers/iommu/rockchip-iommu.c +@@ -758,7 +758,7 @@ static int rk_iommu_map_iova(struct rk_iommu_domain *rk_domain, u32 *pte_addr, + } + + static int rk_iommu_map(struct iommu_domain *domain, unsigned long _iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct rk_iommu_domain *rk_domain = to_rk_domain(domain); + unsigned long flags; +diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c +index 3b0b18e23187c..1137f3ddcb851 100644 +--- a/drivers/iommu/s390-iommu.c ++++ b/drivers/iommu/s390-iommu.c +@@ -265,7 +265,7 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain, + } + + static int s390_iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct s390_domain *s390_domain = to_s390_domain(domain); + int flags = ZPCI_PTE_VALID, rc = 0; +diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c +index 3924f7c055440..3fb7ba72507de 100644 +--- a/drivers/iommu/tegra-gart.c ++++ b/drivers/iommu/tegra-gart.c +@@ -178,7 +178,7 @@ static inline int __gart_iommu_map(struct gart_device *gart, unsigned long iova, + } + + static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t pa, size_t bytes, int prot) ++ phys_addr_t pa, size_t bytes, int prot, gfp_t gfp) + { + struct gart_device *gart = gart_handle; + int ret; +diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c +index dd486233e2828..576be3f245daa 100644 +--- a/drivers/iommu/tegra-smmu.c ++++ b/drivers/iommu/tegra-smmu.c +@@ -651,7 +651,7 @@ static void tegra_smmu_set_pte(struct tegra_smmu_as *as, unsigned long iova, + } + + static int tegra_smmu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + struct tegra_smmu_as *as = to_smmu_as(domain); + dma_addr_t pte_dma; +diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c +index 60e659a24f90b..37e2267acf295 100644 +--- a/drivers/iommu/virtio-iommu.c ++++ b/drivers/iommu/virtio-iommu.c +@@ -715,7 +715,7 @@ static int viommu_attach_dev(struct iommu_domain *domain, struct device *dev) + } + + static int viommu_map(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot) ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp) + { + int ret; + u32 flags; +diff --git a/include/linux/iommu.h b/include/linux/iommu.h +index 29bac5345563a..6ca3fb2873d7d 100644 +--- a/include/linux/iommu.h ++++ b/include/linux/iommu.h +@@ -256,7 +256,7 @@ struct iommu_ops { + int (*attach_dev)(struct iommu_domain *domain, struct device *dev); + void (*detach_dev)(struct iommu_domain *domain, struct device *dev); + int (*map)(struct iommu_domain *domain, unsigned long iova, +- phys_addr_t paddr, size_t size, int prot); ++ phys_addr_t paddr, size_t size, int prot, gfp_t gfp); + size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, + size_t size, struct iommu_iotlb_gather *iotlb_gather); + void (*flush_iotlb_all)(struct iommu_domain *domain); +@@ -421,6 +421,8 @@ extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); + extern struct iommu_domain *iommu_get_dma_domain(struct device *dev); + extern int iommu_map(struct iommu_domain *domain, unsigned long iova, + phys_addr_t paddr, size_t size, int prot); ++extern int iommu_map_atomic(struct iommu_domain *domain, unsigned long iova, ++ phys_addr_t paddr, size_t size, int prot); + extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, + size_t size); + extern size_t iommu_unmap_fast(struct iommu_domain *domain, +@@ -428,6 +430,9 @@ extern size_t iommu_unmap_fast(struct iommu_domain *domain, + struct iommu_iotlb_gather *iotlb_gather); + extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, + struct scatterlist *sg,unsigned int nents, int prot); ++extern size_t iommu_map_sg_atomic(struct iommu_domain *domain, ++ unsigned long iova, struct scatterlist *sg, ++ unsigned int nents, int prot); + extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); + extern void iommu_set_fault_handler(struct iommu_domain *domain, + iommu_fault_handler_t handler, void *token); +@@ -662,6 +667,13 @@ static inline int iommu_map(struct iommu_domain *domain, unsigned long iova, + return -ENODEV; + } + ++static inline int iommu_map_atomic(struct iommu_domain *domain, ++ unsigned long iova, phys_addr_t paddr, ++ size_t size, int prot) ++{ ++ return -ENODEV; ++} ++ + static inline size_t iommu_unmap(struct iommu_domain *domain, + unsigned long iova, size_t size) + { +@@ -682,6 +694,13 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain, + return 0; + } + ++static inline size_t iommu_map_sg_atomic(struct iommu_domain *domain, ++ unsigned long iova, struct scatterlist *sg, ++ unsigned int nents, int prot) ++{ ++ return 0; ++} ++ + static inline void iommu_flush_tlb_all(struct iommu_domain *domain) + { + } +-- +2.39.0 + diff --git a/queue-5.4/ionic-clean-interrupt-before-enabling-queue-to-avoid.patch b/queue-5.4/ionic-clean-interrupt-before-enabling-queue-to-avoid.patch new file mode 100644 index 00000000000..e45eeae70b8 --- /dev/null +++ b/queue-5.4/ionic-clean-interrupt-before-enabling-queue-to-avoid.patch @@ -0,0 +1,67 @@ +From 367758ac450bc1a67c6ec7838b695486f90aa379 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Feb 2023 13:55:35 -0800 +Subject: ionic: clean interrupt before enabling queue to avoid credit race + +From: Neel Patel + +[ Upstream commit e8797a058466b60fc5a3291b92430c93ba90eaff ] + +Clear the interrupt credits before enabling the queue rather +than after to be sure that the enabled queue starts at 0 and +that we don't wipe away possible credits after enabling the +queue. + +Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling") +Signed-off-by: Neel Patel +Signed-off-by: Shannon Nelson +Reviewed-by: Leon Romanovsky +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/pensando/ionic/ionic_lif.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +index f9c303d76658a..d0841836cf705 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +@@ -190,6 +190,7 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq) + .oper = IONIC_Q_ENABLE, + }, + }; ++ int ret; + + idev = &lif->ionic->idev; + dev = lif->ionic->dev; +@@ -197,16 +198,24 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq) + dev_dbg(dev, "q_enable.index %d q_enable.qtype %d\n", + ctx.cmd.q_control.index, ctx.cmd.q_control.type); + ++ if (qcq->flags & IONIC_QCQ_F_INTR) ++ ionic_intr_clean(idev->intr_ctrl, qcq->intr.index); ++ ++ ret = ionic_adminq_post_wait(lif, &ctx); ++ if (ret) ++ return ret; ++ ++ if (qcq->napi.poll) ++ napi_enable(&qcq->napi); ++ + if (qcq->flags & IONIC_QCQ_F_INTR) { + irq_set_affinity_hint(qcq->intr.vector, + &qcq->intr.affinity_mask); +- napi_enable(&qcq->napi); +- ionic_intr_clean(idev->intr_ctrl, qcq->intr.index); + ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, + IONIC_INTR_MASK_CLEAR); + } + +- return ionic_adminq_post_wait(lif, &ctx); ++ return 0; + } + + static int ionic_qcq_disable(struct ionic_qcq *qcq) +-- +2.39.0 + diff --git a/queue-5.4/net-phy-meson-gxl-use-mmd-access-dummy-stubs-for-gxl.patch b/queue-5.4/net-phy-meson-gxl-use-mmd-access-dummy-stubs-for-gxl.patch new file mode 100644 index 00000000000..960374e0b30 --- /dev/null +++ b/queue-5.4/net-phy-meson-gxl-use-mmd-access-dummy-stubs-for-gxl.patch @@ -0,0 +1,40 @@ +From 71c0e4f6c91d3a9f9da616770e0ff5fac39457e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Feb 2023 21:45:36 +0100 +Subject: net: phy: meson-gxl: use MMD access dummy stubs for GXL, internal PHY + +From: Heiner Kallweit + +[ Upstream commit 69ff53e4a4c9498eeed7d1441f68a1481dc69251 ] + +Jerome provided the information that also the GXL internal PHY doesn't +support MMD register access and EEE. MMD reads return 0xffff, what +results in e.g. completely wrong ethtool --show-eee output. +Therefore use the MMD dummy stubs. + +Fixes: d853d145ea3e ("net: phy: add an option to disable EEE advertisement") +Suggested-by: Jerome Brunet +Signed-off-by: Heiner Kallweit +Link: https://lore.kernel.org/r/84432fe4-0be4-bc82-4e5c-557206b40f56@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/phy/meson-gxl.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c +index f7a9e6599a642..39151ec6f65e2 100644 +--- a/drivers/net/phy/meson-gxl.c ++++ b/drivers/net/phy/meson-gxl.c +@@ -235,6 +235,8 @@ static struct phy_driver meson_gxl_phy[] = { + .config_intr = meson_gxl_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .read_mmd = genphy_read_mmd_unsupported, ++ .write_mmd = genphy_write_mmd_unsupported, + }, { + PHY_ID_MATCH_EXACT(0x01803301), + .name = "Meson G12A Internal PHY", +-- +2.39.0 + diff --git a/queue-5.4/rdma-usnic-use-iommu_map_atomic-under-spin_lock.patch b/queue-5.4/rdma-usnic-use-iommu_map_atomic-under-spin_lock.patch new file mode 100644 index 00000000000..e590edf3d2d --- /dev/null +++ b/queue-5.4/rdma-usnic-use-iommu_map_atomic-under-spin_lock.patch @@ -0,0 +1,51 @@ +From 9b7b25204438ccefa6a2f7021c8acac91f829242 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 29 Jan 2023 17:37:57 +0800 +Subject: RDMA/usnic: use iommu_map_atomic() under spin_lock() + +From: Yang Yingliang + +[ Upstream commit b7e08a5a63a11627601915473c3b569c1f6c6c06 ] + +usnic_uiom_map_sorted_intervals() is called under spin_lock(), iommu_map() +might sleep, use iommu_map_atomic() to avoid potential sleep in atomic +context. + +Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver") +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20230129093757.637354-1-yangyingliang@huawei.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/usnic/usnic_uiom.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c +index 62e6ffa9ad78e..1d060ae47933e 100644 +--- a/drivers/infiniband/hw/usnic/usnic_uiom.c ++++ b/drivers/infiniband/hw/usnic/usnic_uiom.c +@@ -281,8 +281,8 @@ static int usnic_uiom_map_sorted_intervals(struct list_head *intervals, + size = pa_end - pa_start + PAGE_SIZE; + usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x", + va_start, &pa_start, size, flags); +- err = iommu_map(pd->domain, va_start, pa_start, +- size, flags); ++ err = iommu_map_atomic(pd->domain, va_start, ++ pa_start, size, flags); + if (err) { + usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n", + va_start, &pa_start, size, err); +@@ -298,8 +298,8 @@ static int usnic_uiom_map_sorted_intervals(struct list_head *intervals, + size = pa - pa_start + PAGE_SIZE; + usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x\n", + va_start, &pa_start, size, flags); +- err = iommu_map(pd->domain, va_start, pa_start, +- size, flags); ++ err = iommu_map_atomic(pd->domain, va_start, ++ pa_start, size, flags); + if (err) { + usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n", + va_start, &pa_start, size, err); +-- +2.39.0 + diff --git a/queue-5.4/rds-rds_rm_zerocopy_callback-use-list_first_entry.patch b/queue-5.4/rds-rds_rm_zerocopy_callback-use-list_first_entry.patch new file mode 100644 index 00000000000..85d85e3c7d2 --- /dev/null +++ b/queue-5.4/rds-rds_rm_zerocopy_callback-use-list_first_entry.patch @@ -0,0 +1,44 @@ +From e0d30089a78f20d41db70fd4219b2bd061774d35 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Feb 2023 18:26:34 +0000 +Subject: rds: rds_rm_zerocopy_callback() use list_first_entry() + +From: Pietro Borrello + +[ Upstream commit f753a68980cf4b59a80fe677619da2b1804f526d ] + +rds_rm_zerocopy_callback() uses list_entry() on the head of a list +causing a type confusion. +Use list_first_entry() to actually access the first element of the +rs_zcookie_queue list. + +Fixes: 9426bbc6de99 ("rds: use list structure to track information for zerocopy completion notification") +Reviewed-by: Willem de Bruijn +Signed-off-by: Pietro Borrello +Link: https://lore.kernel.org/r/20230202-rds-zerocopy-v3-1-83b0df974f9a@diag.uniroma1.it +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/rds/message.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/net/rds/message.c b/net/rds/message.c +index 92b6b22884d4c..be6a0a073b12a 100644 +--- a/net/rds/message.c ++++ b/net/rds/message.c +@@ -104,9 +104,9 @@ static void rds_rm_zerocopy_callback(struct rds_sock *rs, + spin_lock_irqsave(&q->lock, flags); + head = &q->zcookie_head; + if (!list_empty(head)) { +- info = list_entry(head, struct rds_msg_zcopy_info, +- rs_zcookie_next); +- if (info && rds_zcookie_add(info, cookie)) { ++ info = list_first_entry(head, struct rds_msg_zcopy_info, ++ rs_zcookie_next); ++ if (rds_zcookie_add(info, cookie)) { + spin_unlock_irqrestore(&q->lock, flags); + kfree(rds_info_from_znotifier(znotif)); + /* caller invokes rds_wake_sk_sleep() */ +-- +2.39.0 + diff --git a/queue-5.4/selftests-forwarding-lib-quote-the-sysctl-values.patch b/queue-5.4/selftests-forwarding-lib-quote-the-sysctl-values.patch new file mode 100644 index 00000000000..e445f5f89c4 --- /dev/null +++ b/queue-5.4/selftests-forwarding-lib-quote-the-sysctl-values.patch @@ -0,0 +1,46 @@ +From d42a779d50ab921e0f58c7562946e6d9e6bac23e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Feb 2023 11:21:10 +0800 +Subject: selftests: forwarding: lib: quote the sysctl values + +From: Hangbin Liu + +[ Upstream commit 3a082086aa200852545cf15159213582c0c80eba ] + +When set/restore sysctl value, we should quote the value as some keys +may have multi values, e.g. net.ipv4.ping_group_range + +Fixes: f5ae57784ba8 ("selftests: forwarding: lib: Add sysctl_set(), sysctl_restore()") +Signed-off-by: Hangbin Liu +Reviewed-by: Petr Machata +Link: https://lore.kernel.org/r/20230208032110.879205-1-liuhangbin@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/forwarding/lib.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh +index f190ad58e00d4..4d8845a68cf28 100644 +--- a/tools/testing/selftests/net/forwarding/lib.sh ++++ b/tools/testing/selftests/net/forwarding/lib.sh +@@ -562,14 +562,14 @@ sysctl_set() + local value=$1; shift + + SYSCTL_ORIG[$key]=$(sysctl -n $key) +- sysctl -qw $key=$value ++ sysctl -qw $key="$value" + } + + sysctl_restore() + { + local key=$1; shift + +- sysctl -qw $key=${SYSCTL_ORIG["$key"]} ++ sysctl -qw $key="${SYSCTL_ORIG[$key]}" + } + + forwarding_enable() +-- +2.39.0 + diff --git a/queue-5.4/series b/queue-5.4/series index 6169a28d401..5aabe98da1d 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -62,3 +62,15 @@ btrfs-zlib-zero-initialize-zlib-workspace.patch alsa-emux-avoid-potential-array-out-of-bound-in-snd_emux_xg_control.patch tracing-fix-poll-and-select-do-not-work-on-per_cpu-trace_pipe-and-trace_pipe_raw.patch can-j1939-do-not-wait-250-ms-if-the-same-addr-was-already-claimed.patch +ib-hfi1-restore-allocated-resources-on-failed-copyou.patch +ib-ipoib-fix-legacy-ipoib-due-to-wrong-number-of-que.patch +iommu-add-gfp-parameter-to-iommu_ops-map.patch +rdma-usnic-use-iommu_map_atomic-under-spin_lock.patch +xfrm-fix-bug-with-dscp-copy-to-v6-from-v4-tunnel.patch +bonding-fix-error-checking-in-bond_debug_reregister.patch +net-phy-meson-gxl-use-mmd-access-dummy-stubs-for-gxl.patch +ionic-clean-interrupt-before-enabling-queue-to-avoid.patch +ice-do-not-use-wq_mem_reclaim-flag-for-workqueue.patch +rds-rds_rm_zerocopy_callback-use-list_first_entry.patch +selftests-forwarding-lib-quote-the-sysctl-values.patch +alsa-pci-lx6464es-fix-a-debug-loop.patch diff --git a/queue-5.4/xfrm-fix-bug-with-dscp-copy-to-v6-from-v4-tunnel.patch b/queue-5.4/xfrm-fix-bug-with-dscp-copy-to-v6-from-v4-tunnel.patch new file mode 100644 index 00000000000..57c086840d8 --- /dev/null +++ b/queue-5.4/xfrm-fix-bug-with-dscp-copy-to-v6-from-v4-tunnel.patch @@ -0,0 +1,39 @@ +From 7a4b448600ca4289d9c88174d93c213ed0fc6cf1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Jan 2023 11:33:50 -0500 +Subject: xfrm: fix bug with DSCP copy to v6 from v4 tunnel + +From: Christian Hopps + +[ Upstream commit 6028da3f125fec34425dbd5fec18e85d372b2af6 ] + +When copying the DSCP bits for decap-dscp into IPv6 don't assume the +outer encap is always IPv6. Instead, as with the inner IPv4 case, copy +the DSCP bits from the correctly saved "tos" value in the control block. + +Fixes: 227620e29509 ("[IPSEC]: Separate inner/outer mode processing on input") +Signed-off-by: Christian Hopps +Acked-by: Herbert Xu +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +--- + net/xfrm/xfrm_input.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c +index e120df0a6da13..4d8d7cf3d1994 100644 +--- a/net/xfrm/xfrm_input.c ++++ b/net/xfrm/xfrm_input.c +@@ -274,8 +274,7 @@ static int xfrm6_remove_tunnel_encap(struct xfrm_state *x, struct sk_buff *skb) + goto out; + + if (x->props.flags & XFRM_STATE_DECAP_DSCP) +- ipv6_copy_dscp(ipv6_get_dsfield(ipv6_hdr(skb)), +- ipipv6_hdr(skb)); ++ ipv6_copy_dscp(XFRM_MODE_SKB_CB(skb)->tos, ipipv6_hdr(skb)); + if (!(x->props.flags & XFRM_STATE_NOECN)) + ipip6_ecn_decapsulate(skb); + +-- +2.39.0 +