]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Jul 2018 18:22:53 +0000 (20:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Jul 2018 18:22:53 +0000 (20:22 +0200)
added patches:
arm-dts-imx6q-use-correct-sdma-script-for-spi5-core.patch
ubi-fastmap-correctly-handle-interrupted-erasures-in-eba.patch

queue-4.4/arm-dts-imx6q-use-correct-sdma-script-for-spi5-core.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/ubi-fastmap-correctly-handle-interrupted-erasures-in-eba.patch [new file with mode: 0644]

diff --git a/queue-4.4/arm-dts-imx6q-use-correct-sdma-script-for-spi5-core.patch b/queue-4.4/arm-dts-imx6q-use-correct-sdma-script-for-spi5-core.patch
new file mode 100644 (file)
index 0000000..75f8948
--- /dev/null
@@ -0,0 +1,41 @@
+From df07101e1c4a29e820df02f9989a066988b160e6 Mon Sep 17 00:00:00 2001
+From: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
+Date: Tue, 22 May 2018 19:45:09 +0200
+Subject: ARM: dts: imx6q: Use correct SDMA script for SPI5 core
+
+From: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
+
+commit df07101e1c4a29e820df02f9989a066988b160e6 upstream.
+
+According to the reference manual the shp_2_mcu / mcu_2_shp
+scripts must be used for devices connected through the SPBA.
+
+This fixes an issue we saw with DMA transfers.
+Sometimes the SPI controller RX FIFO was not empty after a DMA
+transfer and the driver got stuck in the next PIO transfer when
+it read one word more than expected.
+
+commit dd4b487b32a35 ("ARM: dts: imx6: Use correct SDMA script
+for SPI cores") is fixing the same issue but only for SPI1 - 4.
+
+Fixes: 677940258dd8e ("ARM: dts: imx6q: enable dma for ecspi5")
+Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
+Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/imx6q.dtsi |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/imx6q.dtsi
++++ b/arch/arm/boot/dts/imx6q.dtsi
+@@ -95,7 +95,7 @@
+                                       clocks = <&clks IMX6Q_CLK_ECSPI5>,
+                                                <&clks IMX6Q_CLK_ECSPI5>;
+                                       clock-names = "ipg", "per";
+-                                      dmas = <&sdma 11 7 1>, <&sdma 12 7 2>;
++                                      dmas = <&sdma 11 8 1>, <&sdma 12 8 2>;
+                                       dma-names = "rx", "tx";
+                                       status = "disabled";
+                               };
index b9a70be742892c50314601c46ae1c457fd436386..9f0b5757d606cf51d883aed4d4f005ec394090f6 100644 (file)
@@ -11,3 +11,5 @@ ipv4-fix-error-return-value-in-fib_convert_metrics.patch
 kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch
 nvme-pci-initialize-queue-memory-before-interrupts.patch
 netfilter-nf_tables-use-warn_on_once-instead-of-bug_on-in-nft_do_chain.patch
+arm-dts-imx6q-use-correct-sdma-script-for-spi5-core.patch
+ubi-fastmap-correctly-handle-interrupted-erasures-in-eba.patch
diff --git a/queue-4.4/ubi-fastmap-correctly-handle-interrupted-erasures-in-eba.patch b/queue-4.4/ubi-fastmap-correctly-handle-interrupted-erasures-in-eba.patch
new file mode 100644 (file)
index 0000000..b69e41c
--- /dev/null
@@ -0,0 +1,143 @@
+From 781932375ffc6411713ee0926ccae8596ed0261c Mon Sep 17 00:00:00 2001
+From: Richard Weinberger <richard@nod.at>
+Date: Mon, 28 May 2018 22:04:32 +0200
+Subject: ubi: fastmap: Correctly handle interrupted erasures in EBA
+
+From: Richard Weinberger <richard@nod.at>
+
+commit 781932375ffc6411713ee0926ccae8596ed0261c upstream.
+
+Fastmap cannot track the LEB unmap operation, therefore it can
+happen that after an interrupted erasure the mapping still looks
+good from Fastmap's point of view, while reading from the PEB will
+cause an ECC error and confuses the upper layer.
+
+Instead of teaching users of UBI how to deal with that, we read back
+the VID header and check for errors. If the PEB is empty or shows ECC
+errors we fixup the mapping and schedule the PEB for erasure.
+
+Fixes: dbb7d2a88d2a ("UBI: Add fastmap core")
+Cc: <stable@vger.kernel.org>
+Reported-by: martin bayern <Martinbayern@outlook.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/eba.c |   92 +++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 91 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/ubi/eba.c
++++ b/drivers/mtd/ubi/eba.c
+@@ -350,6 +350,82 @@ out_unlock:
+       return err;
+ }
++#ifdef CONFIG_MTD_UBI_FASTMAP
++/**
++ * check_mapping - check and fixup a mapping
++ * @ubi: UBI device description object
++ * @vol: volume description object
++ * @lnum: logical eraseblock number
++ * @pnum: physical eraseblock number
++ *
++ * Checks whether a given mapping is valid. Fastmap cannot track LEB unmap
++ * operations, if such an operation is interrupted the mapping still looks
++ * good, but upon first read an ECC is reported to the upper layer.
++ * Normaly during the full-scan at attach time this is fixed, for Fastmap
++ * we have to deal with it while reading.
++ * If the PEB behind a LEB shows this symthom we change the mapping to
++ * %UBI_LEB_UNMAPPED and schedule the PEB for erasure.
++ *
++ * Returns 0 on success, negative error code in case of failure.
++ */
++static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
++                       int *pnum)
++{
++      int err;
++      struct ubi_vid_hdr *vid_hdr;
++
++      if (!ubi->fast_attach)
++              return 0;
++
++      vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
++      if (!vid_hdr)
++              return -ENOMEM;
++
++      err = ubi_io_read_vid_hdr(ubi, *pnum, vid_hdr, 0);
++      if (err > 0 && err != UBI_IO_BITFLIPS) {
++              int torture = 0;
++
++              switch (err) {
++                      case UBI_IO_FF:
++                      case UBI_IO_FF_BITFLIPS:
++                      case UBI_IO_BAD_HDR:
++                      case UBI_IO_BAD_HDR_EBADMSG:
++                              break;
++                      default:
++                              ubi_assert(0);
++              }
++
++              if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_FF_BITFLIPS)
++                      torture = 1;
++
++              down_read(&ubi->fm_eba_sem);
++              vol->eba_tbl[lnum] = UBI_LEB_UNMAPPED;
++              up_read(&ubi->fm_eba_sem);
++              ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture);
++
++              *pnum = UBI_LEB_UNMAPPED;
++      } else if (err < 0) {
++              ubi_err(ubi, "unable to read VID header back from PEB %i: %i",
++                      *pnum, err);
++
++              goto out_free;
++      }
++
++      err = 0;
++
++out_free:
++      ubi_free_vid_hdr(ubi, vid_hdr);
++
++      return err;
++}
++#else
++static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
++                int *pnum)
++{
++      return 0;
++}
++#endif
++
+ /**
+  * ubi_eba_read_leb - read data.
+  * @ubi: UBI device description object
+@@ -381,7 +457,13 @@ int ubi_eba_read_leb(struct ubi_device *
+               return err;
+       pnum = vol->eba_tbl[lnum];
+-      if (pnum < 0) {
++      if (pnum >= 0) {
++              err = check_mapping(ubi, vol, lnum, &pnum);
++              if (err < 0)
++                      goto out_unlock;
++      }
++
++      if (pnum == UBI_LEB_UNMAPPED) {
+               /*
+                * The logical eraseblock is not mapped, fill the whole buffer
+                * with 0xFF bytes. The exception is static volumes for which
+@@ -697,6 +779,14 @@ int ubi_eba_write_leb(struct ubi_device
+       pnum = vol->eba_tbl[lnum];
+       if (pnum >= 0) {
++              err = check_mapping(ubi, vol, lnum, &pnum);
++              if (err < 0) {
++                      leb_write_unlock(ubi, vol_id, lnum);
++                      return err;
++              }
++      }
++
++      if (pnum >= 0) {
+               dbg_eba("write %d bytes at offset %d of LEB %d:%d, PEB %d",
+                       len, offset, vol_id, lnum, pnum);