From 619fb71f0ec5772a5ed24436d993764fcd548aa6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 20 Jul 2023 19:09:00 +0200 Subject: [PATCH] 5.15-stable patches added patches: net-lan743x-don-t-sleep-in-atomic-context.patch --- ...an743x-don-t-sleep-in-atomic-context.patch | 72 +++++++++++++++++++ queue-5.15/series | 1 + 2 files changed, 73 insertions(+) create mode 100644 queue-5.15/net-lan743x-don-t-sleep-in-atomic-context.patch diff --git a/queue-5.15/net-lan743x-don-t-sleep-in-atomic-context.patch b/queue-5.15/net-lan743x-don-t-sleep-in-atomic-context.patch new file mode 100644 index 00000000000..1b98e591ff2 --- /dev/null +++ b/queue-5.15/net-lan743x-don-t-sleep-in-atomic-context.patch @@ -0,0 +1,72 @@ +From 7a8227b2e76be506b2ac64d2beac950ca04892a5 Mon Sep 17 00:00:00 2001 +From: Moritz Fischer +Date: Tue, 27 Jun 2023 03:50:00 +0000 +Subject: net: lan743x: Don't sleep in atomic context + +From: Moritz Fischer + +commit 7a8227b2e76be506b2ac64d2beac950ca04892a5 upstream. + +dev_set_rx_mode() grabs a spin_lock, and the lan743x implementation +proceeds subsequently to go to sleep using readx_poll_timeout(). + +Introduce a helper wrapping the readx_poll_timeout_atomic() function +and use it to replace the calls to readx_polL_timeout(). + +Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver") +Cc: stable@vger.kernel.org +Cc: Bryan Whitehead +Cc: UNGLinuxDriver@microchip.com +Signed-off-by: Moritz Fischer +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20230627035000.1295254-1-moritzf@google.com +Signed-off-by: Paolo Abeni +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/microchip/lan743x_main.c | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/microchip/lan743x_main.c ++++ b/drivers/net/ethernet/microchip/lan743x_main.c +@@ -83,6 +83,18 @@ static int lan743x_csr_light_reset(struc + !(data & HW_CFG_LRST_), 100000, 10000000); + } + ++static int lan743x_csr_wait_for_bit_atomic(struct lan743x_adapter *adapter, ++ int offset, u32 bit_mask, ++ int target_value, int udelay_min, ++ int udelay_max, int count) ++{ ++ u32 data; ++ ++ return readx_poll_timeout_atomic(LAN743X_CSR_READ_OP, offset, data, ++ target_value == !!(data & bit_mask), ++ udelay_max, udelay_min * count); ++} ++ + static int lan743x_csr_wait_for_bit(struct lan743x_adapter *adapter, + int offset, u32 bit_mask, + int target_value, int usleep_min, +@@ -671,8 +683,8 @@ static int lan743x_dp_write(struct lan74 + u32 dp_sel; + int i; + +- if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, +- 1, 40, 100, 100)) ++ if (lan743x_csr_wait_for_bit_atomic(adapter, DP_SEL, DP_SEL_DPRDY_, ++ 1, 40, 100, 100)) + return -EIO; + dp_sel = lan743x_csr_read(adapter, DP_SEL); + dp_sel &= ~DP_SEL_MASK_; +@@ -683,8 +695,9 @@ static int lan743x_dp_write(struct lan74 + lan743x_csr_write(adapter, DP_ADDR, addr + i); + lan743x_csr_write(adapter, DP_DATA_0, buf[i]); + lan743x_csr_write(adapter, DP_CMD, DP_CMD_WRITE_); +- if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, +- 1, 40, 100, 100)) ++ if (lan743x_csr_wait_for_bit_atomic(adapter, DP_SEL, ++ DP_SEL_DPRDY_, ++ 1, 40, 100, 100)) + return -EIO; + } + diff --git a/queue-5.15/series b/queue-5.15/series index f67d81bf1e5..08920a2dd0a 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -386,3 +386,4 @@ tty-serial-fsl_lpuart-add-earlycon-for-imx8ulp-platform.patch block-partition-fix-signedness-issue-for-amiga-partitions.patch io_uring-use-io_schedule-in-cqring-wait.patch io_uring-add-reschedule-point-to-handle_tw_list.patch +net-lan743x-don-t-sleep-in-atomic-context.patch -- 2.47.3