]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2024 12:35:33 +0000 (14:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2024 12:35:33 +0000 (14:35 +0200)
added patches:
mmc-sdhci-brcmstb-check-r1_status-for-erase-trim-discard.patch
mmc-sdhci-do-not-invert-write-protect-twice.patch
mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch
mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch
nfs-drop-the-incorrect-assertion-in-nfs_swap_rw.patch
ocfs2-fix-dio-failure-due-to-insufficient-transaction-credits.patch
pinctrl-qcom-spmi-gpio-drop-broken-pm8008-support.patch
revert-mips-pci-lantiq-restore-reset-gpio-polarity.patch

queue-6.1/mmc-sdhci-brcmstb-check-r1_status-for-erase-trim-discard.patch [new file with mode: 0644]
queue-6.1/mmc-sdhci-do-not-invert-write-protect-twice.patch [new file with mode: 0644]
queue-6.1/mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch [new file with mode: 0644]
queue-6.1/mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch [new file with mode: 0644]
queue-6.1/nfs-drop-the-incorrect-assertion-in-nfs_swap_rw.patch [new file with mode: 0644]
queue-6.1/ocfs2-fix-dio-failure-due-to-insufficient-transaction-credits.patch [new file with mode: 0644]
queue-6.1/pinctrl-qcom-spmi-gpio-drop-broken-pm8008-support.patch [new file with mode: 0644]
queue-6.1/revert-mips-pci-lantiq-restore-reset-gpio-polarity.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/mmc-sdhci-brcmstb-check-r1_status-for-erase-trim-discard.patch b/queue-6.1/mmc-sdhci-brcmstb-check-r1_status-for-erase-trim-discard.patch
new file mode 100644 (file)
index 0000000..a9b35ef
--- /dev/null
@@ -0,0 +1,94 @@
+From d77dc388cd61dfdafe30b98025fa827498378199 Mon Sep 17 00:00:00 2001
+From: Kamal Dasu <kamal.dasu@broadcom.com>
+Date: Mon, 3 Jun 2024 18:08:34 -0400
+Subject: mmc: sdhci-brcmstb: check R1_STATUS for erase/trim/discard
+
+From: Kamal Dasu <kamal.dasu@broadcom.com>
+
+commit d77dc388cd61dfdafe30b98025fa827498378199 upstream.
+
+When erase/trim/discard completion was converted to mmc_poll_for_busy(),
+optional support to poll with the host_ops->card_busy() callback was also
+added.
+
+The common sdhci's ->card_busy() turns out not to be working as expected
+for the sdhci-brcmstb variant, as it keeps returning busy beyond the card's
+busy period. In particular, this leads to the below splat for
+mmc_do_erase() when running a discard (BLKSECDISCARD) operation during
+mkfs.f2fs:
+
+    Info: [/dev/mmcblk1p9] Discarding device
+    [   39.597258] sysrq: Show Blocked State
+    [   39.601183] task:mkfs.f2fs       state:D stack:0     pid:1561  tgid:1561  ppid:1542   flags:0x0000000d
+    [   39.610609] Call trace:
+    [   39.613098]  __switch_to+0xd8/0xf4
+    [   39.616582]  __schedule+0x440/0x4f4
+    [   39.620137]  schedule+0x2c/0x48
+    [   39.623341]  schedule_hrtimeout_range_clock+0xe0/0x114
+    [   39.628562]  schedule_hrtimeout_range+0x10/0x18
+    [   39.633169]  usleep_range_state+0x5c/0x90
+    [   39.637253]  __mmc_poll_for_busy+0xec/0x128
+    [   39.641514]  mmc_poll_for_busy+0x48/0x70
+    [   39.645511]  mmc_do_erase+0x1ec/0x210
+    [   39.649237]  mmc_erase+0x1b4/0x1d4
+    [   39.652701]  mmc_blk_mq_issue_rq+0x35c/0x6ac
+    [   39.657037]  mmc_mq_queue_rq+0x18c/0x214
+    [   39.661022]  blk_mq_dispatch_rq_list+0x3a8/0x528
+    [   39.665722]  __blk_mq_sched_dispatch_requests+0x3a0/0x4ac
+    [   39.671198]  blk_mq_sched_dispatch_requests+0x28/0x5c
+    [   39.676322]  blk_mq_run_hw_queue+0x11c/0x12c
+    [   39.680668]  blk_mq_flush_plug_list+0x200/0x33c
+    [   39.685278]  blk_add_rq_to_plug+0x68/0xd8
+    [   39.689365]  blk_mq_submit_bio+0x3a4/0x458
+    [   39.693539]  __submit_bio+0x1c/0x80
+    [   39.697096]  submit_bio_noacct_nocheck+0x94/0x174
+    [   39.701875]  submit_bio_noacct+0x1b0/0x22c
+    [   39.706042]  submit_bio+0xac/0xe8
+    [   39.709424]  blk_next_bio+0x4c/0x5c
+    [   39.712973]  blkdev_issue_secure_erase+0x118/0x170
+    [   39.717835]  blkdev_common_ioctl+0x374/0x728
+    [   39.722175]  blkdev_ioctl+0x8c/0x2b0
+    [   39.725816]  vfs_ioctl+0x24/0x40
+    [   39.729117]  __arm64_sys_ioctl+0x5c/0x8c
+    [   39.733114]  invoke_syscall+0x68/0xec
+    [   39.736839]  el0_svc_common.constprop.0+0x70/0xd8
+    [   39.741609]  do_el0_svc+0x18/0x20
+    [   39.744981]  el0_svc+0x68/0x94
+    [   39.748107]  el0t_64_sync_handler+0x88/0x124
+    [   39.752455]  el0t_64_sync+0x168/0x16c
+
+To fix the problem let's override the host_ops->card_busy() callback by
+setting it to NULL, which forces the mmc core to poll with a CMD13 and
+checking the R1_STATUS in the mmc_busy_cb() function.
+
+Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
+Fixes: 0d84c3e6a5b2 ("mmc: core: Convert to mmc_poll_for_busy() for erase/trim/discard")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240603220834.21989-2-kamal.dasu@broadcom.com
+[Ulf: Clarified the commit message]
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci-brcmstb.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/mmc/host/sdhci-brcmstb.c
++++ b/drivers/mmc/host/sdhci-brcmstb.c
+@@ -23,6 +23,7 @@
+ #define BRCMSTB_MATCH_FLAGS_NO_64BIT          BIT(0)
+ #define BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT    BIT(1)
+ #define BRCMSTB_MATCH_FLAGS_HAS_CLOCK_GATE    BIT(2)
++#define BRCMSTB_MATCH_FLAGS_USE_CARD_BUSY     BIT(4)
+ #define BRCMSTB_PRIV_FLAGS_HAS_CQE            BIT(0)
+ #define BRCMSTB_PRIV_FLAGS_GATE_CLOCK         BIT(1)
+@@ -335,6 +336,9 @@ static int sdhci_brcmstb_probe(struct pl
+       if (match_priv->flags & BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT)
+               host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
++      if (!(match_priv->flags & BRCMSTB_MATCH_FLAGS_USE_CARD_BUSY))
++              host->mmc_host_ops.card_busy = NULL;
++
+       /* Change the base clock frequency if the DT property exists */
+       if (device_property_read_u32(&pdev->dev, "clock-frequency",
+                                    &priv->base_freq_hz) != 0)
diff --git a/queue-6.1/mmc-sdhci-do-not-invert-write-protect-twice.patch b/queue-6.1/mmc-sdhci-do-not-invert-write-protect-twice.patch
new file mode 100644 (file)
index 0000000..ab8673a
--- /dev/null
@@ -0,0 +1,90 @@
+From fbd64f902b93fe9658b855b9892ae59ef6ea22b9 Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Fri, 14 Jun 2024 11:00:49 +0300
+Subject: mmc: sdhci: Do not invert write-protect twice
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+commit fbd64f902b93fe9658b855b9892ae59ef6ea22b9 upstream.
+
+mmc_of_parse() reads device property "wp-inverted" and sets
+MMC_CAP2_RO_ACTIVE_HIGH if it is true. MMC_CAP2_RO_ACTIVE_HIGH is used
+to invert a write-protect (AKA read-only) GPIO value.
+
+sdhci_get_property() also reads "wp-inverted" and sets
+SDHCI_QUIRK_INVERTED_WRITE_PROTECT which is used to invert the
+write-protect value as well but also acts upon a value read out from the
+SDHCI_PRESENT_STATE register.
+
+Many drivers call both mmc_of_parse() and sdhci_get_property(),
+so that both MMC_CAP2_RO_ACTIVE_HIGH and
+SDHCI_QUIRK_INVERTED_WRITE_PROTECT will be set if the controller has
+device property "wp-inverted".
+
+Amend the logic in sdhci_check_ro() to allow for that possibility,
+so that the write-protect value is not inverted twice.
+
+Also do not invert the value if it is a negative error value. Note that
+callers treat an error the same as not-write-protected, so the result is
+functionally the same in that case.
+
+Also do not invert the value if sdhci host operation ->get_ro() is used.
+None of the users of that callback set SDHCI_QUIRK_INVERTED_WRITE_PROTECT
+directly or indirectly, but two do call mmc_gpio_get_ro(), so leave it to
+them to deal with that if they ever set SDHCI_QUIRK_INVERTED_WRITE_PROTECT
+in the future.
+
+Fixes: 6d5cd068ee59 ("mmc: sdhci: use WP GPIO in sdhci_check_ro()")
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240614080051.4005-2-adrian.hunter@intel.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci.c |   22 +++++++++++++++-------
+ 1 file changed, 15 insertions(+), 7 deletions(-)
+
+--- a/drivers/mmc/host/sdhci.c
++++ b/drivers/mmc/host/sdhci.c
+@@ -2539,26 +2539,34 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio);
+ static int sdhci_check_ro(struct sdhci_host *host)
+ {
++      bool allow_invert = false;
+       unsigned long flags;
+       int is_readonly;
+       spin_lock_irqsave(&host->lock, flags);
+-      if (host->flags & SDHCI_DEVICE_DEAD)
++      if (host->flags & SDHCI_DEVICE_DEAD) {
+               is_readonly = 0;
+-      else if (host->ops->get_ro)
++      } else if (host->ops->get_ro) {
+               is_readonly = host->ops->get_ro(host);
+-      else if (mmc_can_gpio_ro(host->mmc))
++      } else if (mmc_can_gpio_ro(host->mmc)) {
+               is_readonly = mmc_gpio_get_ro(host->mmc);
+-      else
++              /* Do not invert twice */
++              allow_invert = !(host->mmc->caps2 & MMC_CAP2_RO_ACTIVE_HIGH);
++      } else {
+               is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
+                               & SDHCI_WRITE_PROTECT);
++              allow_invert = true;
++      }
+       spin_unlock_irqrestore(&host->lock, flags);
+-      /* This quirk needs to be replaced by a callback-function later */
+-      return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ?
+-              !is_readonly : is_readonly;
++      if (is_readonly >= 0 &&
++          allow_invert &&
++          (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT))
++              is_readonly = !is_readonly;
++
++      return is_readonly;
+ }
+ #define SAMPLE_COUNT  5
diff --git a/queue-6.1/mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch b/queue-6.1/mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch
new file mode 100644 (file)
index 0000000..3ee886a
--- /dev/null
@@ -0,0 +1,53 @@
+From ab069ce125965a5e282f7b53b86aee76ab32975c Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Fri, 14 Jun 2024 11:00:50 +0300
+Subject: mmc: sdhci: Do not lock spinlock around mmc_gpio_get_ro()
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+commit ab069ce125965a5e282f7b53b86aee76ab32975c upstream.
+
+sdhci_check_ro() can call mmc_gpio_get_ro() while holding the sdhci
+host->lock spinlock. That would be a problem if the GPIO access done by
+mmc_gpio_get_ro() needed to sleep.
+
+However, host->lock is not needed anyway. The mmc core ensures that host
+operations do not race with each other, and asynchronous callbacks like the
+interrupt handler, software timeouts, completion work etc, cannot affect
+sdhci_check_ro().
+
+So remove the locking.
+
+Fixes: 6d5cd068ee59 ("mmc: sdhci: use WP GPIO in sdhci_check_ro()")
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240614080051.4005-3-adrian.hunter@intel.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci.c |    5 -----
+ 1 file changed, 5 deletions(-)
+
+--- a/drivers/mmc/host/sdhci.c
++++ b/drivers/mmc/host/sdhci.c
+@@ -2540,11 +2540,8 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio);
+ static int sdhci_check_ro(struct sdhci_host *host)
+ {
+       bool allow_invert = false;
+-      unsigned long flags;
+       int is_readonly;
+-      spin_lock_irqsave(&host->lock, flags);
+-
+       if (host->flags & SDHCI_DEVICE_DEAD) {
+               is_readonly = 0;
+       } else if (host->ops->get_ro) {
+@@ -2559,8 +2556,6 @@ static int sdhci_check_ro(struct sdhci_h
+               allow_invert = true;
+       }
+-      spin_unlock_irqrestore(&host->lock, flags);
+-
+       if (is_readonly >= 0 &&
+           allow_invert &&
+           (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT))
diff --git a/queue-6.1/mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch b/queue-6.1/mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch
new file mode 100644 (file)
index 0000000..fc198c6
--- /dev/null
@@ -0,0 +1,74 @@
+From ebc4fc34eae8ddfbef49f2bdaced1bf4167ef80d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Mon, 27 May 2024 16:24:41 +0300
+Subject: mmc: sdhci-pci: Convert PCIBIOS_* return codes to errnos
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit ebc4fc34eae8ddfbef49f2bdaced1bf4167ef80d upstream.
+
+jmicron_pmos() and sdhci_pci_probe() use pci_{read,write}_config_byte()
+that return PCIBIOS_* codes. The return code is then returned as is by
+jmicron_probe() and sdhci_pci_probe(). Similarly, the return code is
+also returned as is from jmicron_resume(). Both probe and resume
+functions should return normal errnos.
+
+Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
+errno before returning them the fix these issues.
+
+Fixes: 7582041ff3d4 ("mmc: sdhci-pci: fix simple_return.cocci warnings")
+Fixes: 45211e215984 ("sdhci: toggle JMicron PMOS setting")
+Cc: stable@vger.kernel.org
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20240527132443.14038-1-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci-pci-core.c |   11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/mmc/host/sdhci-pci-core.c
++++ b/drivers/mmc/host/sdhci-pci-core.c
+@@ -1330,7 +1330,7 @@ static int jmicron_pmos(struct sdhci_pci
+       ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch);
+       if (ret)
+-              return ret;
++              goto fail;
+       /*
+        * Turn PMOS on [bit 0], set over current detection to 2.4 V
+@@ -1341,7 +1341,10 @@ static int jmicron_pmos(struct sdhci_pci
+       else
+               scratch &= ~0x47;
+-      return pci_write_config_byte(chip->pdev, 0xAE, scratch);
++      ret = pci_write_config_byte(chip->pdev, 0xAE, scratch);
++
++fail:
++      return pcibios_err_to_errno(ret);
+ }
+ static int jmicron_probe(struct sdhci_pci_chip *chip)
+@@ -2201,7 +2204,7 @@ static int sdhci_pci_probe(struct pci_de
+       ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots);
+       if (ret)
+-              return ret;
++              return pcibios_err_to_errno(ret);
+       slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
+       dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
+@@ -2210,7 +2213,7 @@ static int sdhci_pci_probe(struct pci_de
+       ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar);
+       if (ret)
+-              return ret;
++              return pcibios_err_to_errno(ret);
+       first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
diff --git a/queue-6.1/nfs-drop-the-incorrect-assertion-in-nfs_swap_rw.patch b/queue-6.1/nfs-drop-the-incorrect-assertion-in-nfs_swap_rw.patch
new file mode 100644 (file)
index 0000000..93526aa
--- /dev/null
@@ -0,0 +1,52 @@
+From 54e7d59841dab977f6cb1183d658b1b82c9f4e94 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Tue, 18 Jun 2024 18:56:47 +1200
+Subject: nfs: drop the incorrect assertion in nfs_swap_rw()
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit 54e7d59841dab977f6cb1183d658b1b82c9f4e94 upstream.
+
+Since commit 2282679fb20b ("mm: submit multipage write for SWP_FS_OPS
+swap-space"), we can plug multiple pages then unplug them all together.
+That means iov_iter_count(iter) could be way bigger than PAGE_SIZE, it
+actually equals the size of iov_iter_npages(iter, INT_MAX).
+
+Note this issue has nothing to do with large folios as we don't support
+THP_SWPOUT to non-block devices.
+
+[v-songbaohua@oppo.com: figure out the cause and correct the commit message]
+Link: https://lkml.kernel.org/r/20240618065647.21791-1-21cnbao@gmail.com
+Fixes: 2282679fb20b ("mm: submit multipage write for SWP_FS_OPS swap-space")
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Barry Song <v-songbaohua@oppo.com>
+Closes: https://lore.kernel.org/linux-mm/20240617053201.GA16852@lst.de/
+Reviewed-by: Martin Wege <martin.l.wege@gmail.com>
+Cc: NeilBrown <neilb@suse.de>
+Cc: Anna Schumaker <anna@kernel.org>
+Cc: Steve French <sfrench@samba.org>
+Cc: Trond Myklebust <trondmy@kernel.org>
+Cc: Chuanhua Han <hanchuanhua@oppo.com>
+Cc: Ryan Roberts <ryan.roberts@arm.com>
+Cc: Chris Li <chrisl@kernel.org>
+Cc: "Huang, Ying" <ying.huang@intel.com>
+Cc: Jeff Layton <jlayton@kernel.org>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/direct.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/fs/nfs/direct.c
++++ b/fs/nfs/direct.c
+@@ -131,8 +131,6 @@ int nfs_swap_rw(struct kiocb *iocb, stru
+ {
+       ssize_t ret;
+-      VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE);
+-
+       if (iov_iter_rw(iter) == READ)
+               ret = nfs_file_direct_read(iocb, iter, true);
+       else
diff --git a/queue-6.1/ocfs2-fix-dio-failure-due-to-insufficient-transaction-credits.patch b/queue-6.1/ocfs2-fix-dio-failure-due-to-insufficient-transaction-credits.patch
new file mode 100644 (file)
index 0000000..322b7cd
--- /dev/null
@@ -0,0 +1,141 @@
+From be346c1a6eeb49d8fda827d2a9522124c2f72f36 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 14 Jun 2024 16:52:43 +0200
+Subject: ocfs2: fix DIO failure due to insufficient transaction credits
+
+From: Jan Kara <jack@suse.cz>
+
+commit be346c1a6eeb49d8fda827d2a9522124c2f72f36 upstream.
+
+The code in ocfs2_dio_end_io_write() estimates number of necessary
+transaction credits using ocfs2_calc_extend_credits().  This however does
+not take into account that the IO could be arbitrarily large and can
+contain arbitrary number of extents.
+
+Extent tree manipulations do often extend the current transaction but not
+in all of the cases.  For example if we have only single block extents in
+the tree, ocfs2_mark_extent_written() will end up calling
+ocfs2_replace_extent_rec() all the time and we will never extend the
+current transaction and eventually exhaust all the transaction credits if
+the IO contains many single block extents.  Once that happens a
+WARN_ON(jbd2_handle_buffer_credits(handle) <= 0) is triggered in
+jbd2_journal_dirty_metadata() and subsequently OCFS2 aborts in response to
+this error.  This was actually triggered by one of our customers on a
+heavily fragmented OCFS2 filesystem.
+
+To fix the issue make sure the transaction always has enough credits for
+one extent insert before each call of ocfs2_mark_extent_written().
+
+Heming Zhao said:
+
+------
+PANIC: "Kernel panic - not syncing: OCFS2: (device dm-1): panic forced after error"
+
+PID: xxx  TASK: xxxx  CPU: 5  COMMAND: "SubmitThread-CA"
+  #0 machine_kexec at ffffffff8c069932
+  #1 __crash_kexec at ffffffff8c1338fa
+  #2 panic at ffffffff8c1d69b9
+  #3 ocfs2_handle_error at ffffffffc0c86c0c [ocfs2]
+  #4 __ocfs2_abort at ffffffffc0c88387 [ocfs2]
+  #5 ocfs2_journal_dirty at ffffffffc0c51e98 [ocfs2]
+  #6 ocfs2_split_extent at ffffffffc0c27ea3 [ocfs2]
+  #7 ocfs2_change_extent_flag at ffffffffc0c28053 [ocfs2]
+  #8 ocfs2_mark_extent_written at ffffffffc0c28347 [ocfs2]
+  #9 ocfs2_dio_end_io_write at ffffffffc0c2bef9 [ocfs2]
+#10 ocfs2_dio_end_io at ffffffffc0c2c0f5 [ocfs2]
+#11 dio_complete at ffffffff8c2b9fa7
+#12 do_blockdev_direct_IO at ffffffff8c2bc09f
+#13 ocfs2_direct_IO at ffffffffc0c2b653 [ocfs2]
+#14 generic_file_direct_write at ffffffff8c1dcf14
+#15 __generic_file_write_iter at ffffffff8c1dd07b
+#16 ocfs2_file_write_iter at ffffffffc0c49f1f [ocfs2]
+#17 aio_write at ffffffff8c2cc72e
+#18 kmem_cache_alloc at ffffffff8c248dde
+#19 do_io_submit at ffffffff8c2ccada
+#20 do_syscall_64 at ffffffff8c004984
+#21 entry_SYSCALL_64_after_hwframe at ffffffff8c8000ba
+
+Link: https://lkml.kernel.org/r/20240617095543.6971-1-jack@suse.cz
+Link: https://lkml.kernel.org/r/20240614145243.8837-1-jack@suse.cz
+Fixes: c15471f79506 ("ocfs2: fix sparse file & data ordering issue in direct io")
+Signed-off-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
+Reviewed-by: Heming Zhao <heming.zhao@suse.com>
+Cc: Mark Fasheh <mark@fasheh.com>
+Cc: Joel Becker <jlbec@evilplan.org>
+Cc: Junxiao Bi <junxiao.bi@oracle.com>
+Cc: Changwei Ge <gechangwei@live.cn>
+Cc: Gang He <ghe@suse.com>
+Cc: Jun Piao <piaojun@huawei.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ocfs2/aops.c        |    5 +++++
+ fs/ocfs2/journal.c     |   17 +++++++++++++++++
+ fs/ocfs2/journal.h     |    2 ++
+ fs/ocfs2/ocfs2_trace.h |    2 ++
+ 4 files changed, 26 insertions(+)
+
+--- a/fs/ocfs2/aops.c
++++ b/fs/ocfs2/aops.c
+@@ -2370,6 +2370,11 @@ static int ocfs2_dio_end_io_write(struct
+       }
+       list_for_each_entry(ue, &dwc->dw_zero_list, ue_node) {
++              ret = ocfs2_assure_trans_credits(handle, credits);
++              if (ret < 0) {
++                      mlog_errno(ret);
++                      break;
++              }
+               ret = ocfs2_mark_extent_written(inode, &et, handle,
+                                               ue->ue_cpos, 1,
+                                               ue->ue_phys,
+--- a/fs/ocfs2/journal.c
++++ b/fs/ocfs2/journal.c
+@@ -448,6 +448,23 @@ bail:
+ }
+ /*
++ * Make sure handle has at least 'nblocks' credits available. If it does not
++ * have that many credits available, we will try to extend the handle to have
++ * enough credits. If that fails, we will restart transaction to have enough
++ * credits. Similar notes regarding data consistency and locking implications
++ * as for ocfs2_extend_trans() apply here.
++ */
++int ocfs2_assure_trans_credits(handle_t *handle, int nblocks)
++{
++      int old_nblks = jbd2_handle_buffer_credits(handle);
++
++      trace_ocfs2_assure_trans_credits(old_nblks);
++      if (old_nblks >= nblocks)
++              return 0;
++      return ocfs2_extend_trans(handle, nblocks - old_nblks);
++}
++
++/*
+  * If we have fewer than thresh credits, extend by OCFS2_MAX_TRANS_DATA.
+  * If that fails, restart the transaction & regain write access for the
+  * buffer head which is used for metadata modifications.
+--- a/fs/ocfs2/journal.h
++++ b/fs/ocfs2/journal.h
+@@ -243,6 +243,8 @@ handle_t               *ocfs2_start_trans(struct
+ int                        ocfs2_commit_trans(struct ocfs2_super *osb,
+                                               handle_t *handle);
+ int                        ocfs2_extend_trans(handle_t *handle, int nblocks);
++int                        ocfs2_assure_trans_credits(handle_t *handle,
++                                              int nblocks);
+ int                        ocfs2_allocate_extend_trans(handle_t *handle,
+                                               int thresh);
+--- a/fs/ocfs2/ocfs2_trace.h
++++ b/fs/ocfs2/ocfs2_trace.h
+@@ -2578,6 +2578,8 @@ DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_commit
+ DEFINE_OCFS2_INT_INT_EVENT(ocfs2_extend_trans);
++DEFINE_OCFS2_INT_EVENT(ocfs2_assure_trans_credits);
++
+ DEFINE_OCFS2_INT_EVENT(ocfs2_extend_trans_restart);
+ DEFINE_OCFS2_INT_INT_EVENT(ocfs2_allocate_extend_trans);
diff --git a/queue-6.1/pinctrl-qcom-spmi-gpio-drop-broken-pm8008-support.patch b/queue-6.1/pinctrl-qcom-spmi-gpio-drop-broken-pm8008-support.patch
new file mode 100644 (file)
index 0000000..8bdcc4d
--- /dev/null
@@ -0,0 +1,46 @@
+From 8da86499d4cd125a9561f9cd1de7fba99b0aecbf Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan+linaro@kernel.org>
+Date: Wed, 29 May 2024 18:29:52 +0200
+Subject: pinctrl: qcom: spmi-gpio: drop broken pm8008 support
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+commit 8da86499d4cd125a9561f9cd1de7fba99b0aecbf upstream.
+
+The SPMI GPIO driver assumes that the parent device is an SPMI device
+and accesses random data when backcasting the parent struct device
+pointer for non-SPMI devices.
+
+Fortunately this does not seem to cause any issues currently when the
+parent device is an I2C client like the PM8008, but this could change if
+the structures are reorganised (e.g. using structure randomisation).
+
+Notably the interrupt implementation is also broken for non-SPMI devices.
+
+Also note that the two GPIO pins on PM8008 are used for interrupts and
+reset so their practical use should be limited.
+
+Drop the broken GPIO support for PM8008 for now.
+
+Fixes: ea119e5a482a ("pinctrl: qcom-pmic-gpio: Add support for pm8008")
+Cc: stable@vger.kernel.org     # 5.13
+Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Reviewed-by: Stephen Boyd <swboyd@chromium.org>
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Link: https://lore.kernel.org/r/20240529162958.18081-9-johan+linaro@kernel.org
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pinctrl/qcom/pinctrl-spmi-gpio.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
++++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+@@ -1204,7 +1204,6 @@ static const struct of_device_id pmic_gp
+       { .compatible = "qcom,pm7250b-gpio", .data = (void *) 12 },
+       { .compatible = "qcom,pm7325-gpio", .data = (void *) 10 },
+       { .compatible = "qcom,pm8005-gpio", .data = (void *) 4 },
+-      { .compatible = "qcom,pm8008-gpio", .data = (void *) 2 },
+       { .compatible = "qcom,pm8019-gpio", .data = (void *) 6 },
+       /* pm8150 has 10 GPIOs with holes on 2, 5, 7 and 8 */
+       { .compatible = "qcom,pm8150-gpio", .data = (void *) 10 },
diff --git a/queue-6.1/revert-mips-pci-lantiq-restore-reset-gpio-polarity.patch b/queue-6.1/revert-mips-pci-lantiq-restore-reset-gpio-polarity.patch
new file mode 100644 (file)
index 0000000..d32a704
--- /dev/null
@@ -0,0 +1,52 @@
+From 6e5aee08bd2517397c9572243a816664f2ead547 Mon Sep 17 00:00:00 2001
+From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Date: Thu, 13 Jun 2024 10:17:09 +0200
+Subject: Revert "MIPS: pci: lantiq: restore reset gpio polarity"
+
+From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+
+commit 6e5aee08bd2517397c9572243a816664f2ead547 upstream.
+
+This reverts commit 277a0363120276645ae598d8d5fea7265e076ae9.
+
+While fixing old boards with broken DTs, this change will break
+newer ones with correct gpio polarity annotation.
+
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/mips/pci/pci-lantiq.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/arch/mips/pci/pci-lantiq.c
++++ b/arch/mips/pci/pci-lantiq.c
+@@ -124,14 +124,14 @@ static int ltq_pci_startup(struct platfo
+               clk_disable(clk_external);
+       /* setup reset gpio used by pci */
+-      reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_ASIS);
++      reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
++                                           GPIOD_OUT_LOW);
+       error = PTR_ERR_OR_ZERO(reset_gpio);
+       if (error) {
+               dev_err(&pdev->dev, "failed to request gpio: %d\n", error);
+               return error;
+       }
+       gpiod_set_consumer_name(reset_gpio, "pci_reset");
+-      gpiod_direction_output(reset_gpio, 1);
+       /* enable auto-switching between PCI and EBU */
+       ltq_pci_w32(0xa, PCI_CR_CLK_CTRL);
+@@ -194,10 +194,10 @@ static int ltq_pci_startup(struct platfo
+       /* toggle reset pin */
+       if (reset_gpio) {
+-              gpiod_set_value_cansleep(reset_gpio, 0);
++              gpiod_set_value_cansleep(reset_gpio, 1);
+               wmb();
+               mdelay(1);
+-              gpiod_set_value_cansleep(reset_gpio, 1);
++              gpiod_set_value_cansleep(reset_gpio, 0);
+       }
+       return 0;
+ }
index dae3f8dc693722772116c40972fc387ec95744d4..1eed573af8d288425f1a3dffe95bb97ed5e252b9 100644 (file)
@@ -64,3 +64,11 @@ ima-use-vfs_getattr_nosec-to-get-the-i_version.patch
 ima-fix-use-after-free-on-a-dentry-s-dname.name.patch
 x86-stop-playing-stack-games-in-profile_pc.patch
 parisc-use-generic-sys_fanotify_mark-implementation.patch
+revert-mips-pci-lantiq-restore-reset-gpio-polarity.patch
+pinctrl-qcom-spmi-gpio-drop-broken-pm8008-support.patch
+ocfs2-fix-dio-failure-due-to-insufficient-transaction-credits.patch
+nfs-drop-the-incorrect-assertion-in-nfs_swap_rw.patch
+mmc-sdhci-brcmstb-check-r1_status-for-erase-trim-discard.patch
+mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch
+mmc-sdhci-do-not-invert-write-protect-twice.patch
+mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch