08 Oct, 2020

1 commit

  • * tag 'v5.4.70': (3051 commits)
    Linux 5.4.70
    netfilter: ctnetlink: add a range check for l3/l4 protonum
    ep_create_wakeup_source(): dentry name can change under you...
    ...

    Conflicts:
    arch/arm/mach-imx/pm-imx6.c
    arch/arm64/boot/dts/freescale/imx8mm-evk.dts
    arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
    drivers/crypto/caam/caamalg.c
    drivers/gpu/drm/imx/dw_hdmi-imx.c
    drivers/gpu/drm/imx/imx-ldb.c
    drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
    drivers/mmc/host/sdhci-esdhc-imx.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
    drivers/net/ethernet/freescale/enetc/enetc.c
    drivers/net/ethernet/freescale/enetc/enetc_pf.c
    drivers/thermal/imx_thermal.c
    drivers/usb/cdns3/ep0.c
    drivers/xen/swiotlb-xen.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c

    Signed-off-by: Jason Liu

    Jason Liu
     

01 Oct, 2020

6 commits

  • [ Upstream commit c16f39d14a7e0ec59881fbdb22ae494907534384 ]

    When CONFIG_MTD_UBI_FASTMAP is enabled, fm_anchor will be assigned
    a free PEB during ubi_wl_init() or ubi_update_fastmap(). However
    if fastmap is not used or disabled on the MTD device, ubi_wl_entry
    related with the PEB will not be freed during detach.

    So Fix it by freeing the unused fastmap anchor during detach.

    Fixes: f9c34bb52997 ("ubi: Fix producing anchor PEBs")
    Reported-by: syzbot+f317896aae32eb281a58@syzkaller.appspotmail.com
    Reviewed-by: Sascha Hauer
    Signed-off-by: Hou Tao
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Hou Tao
     
  • [ Upstream commit eb13fa0227417e84aecc3bd9c029d376e33474d3 ]

    Looks like some drivers define MTD names with a colon in it, thus
    making mtdpart= parsing impossible. Let's fix the parser to gracefully
    handle that case: the last ':' in a partition definition sequence is
    considered instead of the first one.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Ron Minnich
    Tested-by: Ron Minnich
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Boris Brezillon
     
  • [ Upstream commit 37f7212148cf1d796135cdf8d0c7fee13067674b ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200522104008.28340-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit 550e68ea36a6671a96576c0531685ce6e6c0d19d ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200522095139.19653-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin

    Dinghao Liu
     
  • [ Upstream commit f9c34bb529975fe9f85b870a80c53a83a3c5a182 ]

    When a new fastmap is about to be written UBI must make sure it has a
    free block for a fastmap anchor available. For this ubi_update_fastmap()
    calls ubi_ensure_anchor_pebs(). This stopped working with 2e8f08deabbc
    ("ubi: Fix races around ubi_refill_pools()"), with this commit the wear
    leveling code is blocked and can no longer produce free PEBs. UBI then
    more often than not falls back to write the new fastmap anchor to the
    same block it was already on which means the same erase block gets
    erased during each fastmap write and wears out quite fast.

    As the locking prevents us from producing the anchor PEB when we
    actually need it, this patch changes the strategy for creating the
    anchor PEB. We no longer create it on demand right before we want to
    write a fastmap, but instead we create an anchor PEB right after we have
    written a fastmap. This gives us enough time to produce a new anchor PEB
    before it is needed. To make sure we have an anchor PEB for the very
    first fastmap write we call ubi_ensure_anchor_pebs() during
    initialisation as well.

    Fixes: 2e8f08deabbc ("ubi: Fix races around ubi_refill_pools()")
    Signed-off-by: Sascha Hauer
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Sascha Hauer
     
  • [ Upstream commit 03976af89e3bd9489d542582a325892e6a8cacc0 ]

    Else there may be a double-free problem, because cfi->cfiq will
    be freed by mtd_do_chip_probe() if both the two invocations of
    check_cmd_set() return failure.

    Signed-off-by: Hou Tao
    Reviewed-by: Richard Weinberger
    Signed-off-by: Vignesh Raghavendra
    Signed-off-by: Sasha Levin

    Hou Tao
     

21 Aug, 2020

1 commit

  • [ Upstream commit ccc49eff77bee2885447a032948959a134029fe3 ]

    The mtd var in fun_wait_rnb() is now unused, let's get rid of it and
    fix the warning resulting from this unused var.

    Fixes: 50a487e7719c ("mtd: rawnand: Pass a nand_chip object to chip->dev_ready()")
    Signed-off-by: Boris Brezillon
    Reviewed-by: Miquel Raynal
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200603134922.1352340-2-boris.brezillon@collabora.com
    Signed-off-by: Sasha Levin

    Boris Brezillon
     

19 Aug, 2020

1 commit

  • commit 443440cc4a901af462239d286cd10721aa1c7dfc upstream.

    SFLASHC_BURST_CFG is only available on older ipq NAND platforms, this
    register has been removed when the NAND controller got implemented in
    the qpic controller.

    Avoid writing this register on devices which are based on qpic NAND
    controller.

    Fixes: dce84760b09f ("mtd: nand: qcom: Support for IPQ8074 QPIC NAND controller")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sivaprakash Murugesan
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/1591948696-16015-2-git-send-email-sivaprak@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman

    Sivaprakash Murugesan
     

11 Aug, 2020

1 commit

  • commit f7e6b19bc76471ba03725fe58e0c218a3d6266c3 upstream.

    When doing a "write" ioctl call, properly check that we have permissions
    to do so before copying anything from userspace or anything else so we
    can "fail fast". This includes also covering the MEMWRITE ioctl which
    previously missed checking for this.

    Cc: Miquel Raynal
    Cc: Richard Weinberger
    Cc: Vignesh Raghavendra
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman
    [rw: Fixed locking issue]
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

22 Jul, 2020

9 commits

  • commit 0a5f45e57e35d0840bedb816974ce2e63406cd8b upstream.

    oxnans_nand_remove() should release all MTD devices and clean all NAND
    devices, not only the first one registered.

    Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-39-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit b60391eb17b2956ff2fc4c348e5a464da21ff9cb upstream.

    On error, the oxnas probe path just frees the device which failed and
    aborts the probe, leaving unreleased resources.

    Fix this situation by calling mtd_device_unregister()/nand_cleanup()
    on these.

    Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-38-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 383fc3f613e7eac9f2e3c13b6f9fb8c1f39cb9d5 upstream.

    All initialized and registered devices should be listed somewhere so
    that we can unregister/free them in the _remove() path.

    This patch is not a fix per-se but is needed to apply three other
    fixes coming right after, explaining the Fixes/Cc: stable tags.

    Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-36-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 3d3fb3c5be9ce07fa85d8f67fb3922e4613b955b upstream.

    Only v3.3-v5.0 have a different CS0 layout.
    Controllers before v3.3 use the same layout for every CS.

    Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
    Signed-off-by: Álvaro Fernández Rojas
    Acked-by: Florian Fainelli
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-3-noltari@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Álvaro Fernández Rojas
     
  • commit dcb351c03f2fa6a599de1061b174167e03ee312b upstream.

    The current code checks that the whole OOB area is erased.
    This is a problem when JFFS2 cleanmarkers are added to the OOB, since it will
    fail due to the usable OOB bytes not being 0xff.
    Correct this by only checking that data and ECC bytes aren't 0xff.

    Fixes: 02b88eea9f9c ("mtd: brcmnand: Add check for erased page bitflips")
    Signed-off-by: Álvaro Fernández Rojas
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200512082451.771212-1-noltari@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Álvaro Fernández Rojas
     
  • commit 4d8ec041d9c454029f6cd90622f6d81eb61e781c upstream.

    tR and tCCS are currently wrongly expressed in femtoseconds, while we
    expect these values to be expressed in picoseconds. Set right
    hardcoded values.

    Fixes: 6a943386ee36 mtd: rawnand: add default values for dynamic timings
    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon
    Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-3-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit c525b7af96714f72e316c70781570a4a3e1c2856 upstream.

    Ensure all chips are deregistered and cleaned in case of error during
    the probe.

    Fixes: 02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon
    Link: https://lore.kernel.org/linux-mtd/20200424164501.26719-5-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 7a0c18fb5c71c6ac7d4662a145e4227dcd4a36a3 upstream.

    Do not call nand_release() while the MTD device has not been
    registered, use nand_cleanup() instead.

    Fixes: 02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon
    Link: https://lore.kernel.org/linux-mtd/20200424164501.26719-4-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit c27075772d1f1c8aaf276db9943b35adda8a8b65 upstream.

    In a previous fix, I changed the condition on which the timeout of an
    IRQ is reached from:

    if (!ret)

    into:

    if (ret && !pending)

    While having a non-zero return code is usual in the Linux kernel, here
    ret comes from a wait_for_completion_timeout() which returns 0 when
    the waiting period is too long.

    Hence, the revised condition should be:

    if (!ret && !pending)

    The faulty patch did not produce any error because of the !pending
    condition so this change is finally purely cosmetic and does not
    change the actual driver behavior.

    Fixes: cafb56dd741e ("mtd: rawnand: marvell: prevent timeouts on a loaded machine")
    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon
    Link: https://lore.kernel.org/linux-mtd/20200424164501.26719-2-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     

22 Jun, 2020

15 commits

  • commit 75e9a330a9bd48f97a55a08000236084fe3dae56 upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense even if this commit is not
    introducing any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-57-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 8a82bbcadec877f5f938c54026278dfc1f05a332 upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense even if this commit is not
    introducing any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-28-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit f51466901c07e6930435d30b02a21f0841174f61 upstream.

    nand_cleanup() is supposed to be called on error after a successful
    call to nand_scan() to free all NAND resources.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible, hence pointing it as the commit to
    fix for backporting purposes, even if this commit is not introducing
    any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-41-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 5284024b4dac5e94f7f374ca905c7580dbc455e9 upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible, hence pointing it as the commit to
    fix for backporting purposes, even if this commit is not introducing
    any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-43-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 3d84515ffd8fb657e10fa5b1215e9f095fa7efca upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-54-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 154298e2a3f6c9ce1d76cdb48d89fd5b107ea1a3 upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    While at it, be consistent and move the function call in the error
    path thanks to a goto statement.

    Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-37-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 9c6c2e5cc77119ce0dacb4f9feedb73ce0354421 upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense even if this commit is not
    introducing any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-51-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit be238fbf78e4c7c586dac235ab967d3e565a4d1a upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense even if this commit is not
    introducing any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-34-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 34531be5e804a8e1abf314a6c3a19fe342e4a154 upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense even if this commit is not
    introducing any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-61-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit de17cade0e034e9b721a6db9b488014effac1e5a upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no real Fixes tag applying here as the use of nand_release()
    in this driver predates the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. Hence, pointing it as the commit to
    fix for backporting purposes, even if this commit is not introducing
    any bug makes sense.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Cc: Paul Cercueil
    Cc: Harvey Hunt
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-22-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 0f44b3275b3798ccb97a2f51ac85871c30d6fbbc upstream.

    nand_release() is supposed be called after MTD device registration.
    Here, only nand_scan() happened, so use nand_cleanup() instead.

    There is no Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-49-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit c5be12e45940f1aa1b5dfa04db5d15ad24f7c896 upstream.

    Not sure nand_cleanup() is the right function to call here but in any
    case it is not nand_release(). Indeed, even a comment says that
    calling nand_release() is a bit of a hack as there is no MTD device to
    unregister. So switch to nand_cleanup() for now and drop this
    comment.

    There is no Fixes tag applying here as the use of nand_release()
    in this driver predates by far the introduction of nand_cleanup() in
    commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    which makes this change possible. However, pointing this commit as the
    culprit for backporting purposes makes sense even if it did not intruce
    any bug.

    Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
    Signed-off-by: Miquel Raynal
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-13-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit 130bbde4809b011faf64f99dddc14b4b01f440c3 upstream.

    First 2 bytes are used in large-page nand.

    Fixes: ef5eeea6e911 ("mtd: nand: brcm: switch to mtd_ooblayout_ops")
    Cc: stable@vger.kernel.org
    Signed-off-by: Álvaro Fernández Rojas
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200512075733.745374-2-noltari@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Álvaro Fernández Rojas
     
  • commit 1d5d08ee9b28cff907326b4ad5a2463fd2808be1 upstream.

    During ONFI detection, the CRC derived from the parameter page and the
    CRC supposed to be at the end of the parameter page are compared. If
    they do not match, the second then the third copies of the page are
    tried.

    The current implementation compares the newly derived CRC with the CRC
    contained in the first page only. So if this particular CRC area has
    been corrupted, then the detection will fail for a wrong reason.

    Fix this issue by checking the derived CRC against the right one.

    Fixes: 39138c1f4a31 ("mtd: rawnand: use bit-wise majority to recover the ONFI param page")
    Cc: stable@vger.kernel.org
    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon
    Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-4-miquel.raynal@bootlin.com
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     
  • commit e45a4b652dbd2f8b5a3b8e97e89f602a58cb28aa upstream.

    Mimic what's done in nand_soft_waitrdy() and add one to the jiffies
    timeout so we don't end up waiting less than actually required.

    Reported-by: Tudor Ambarus
    Fixes: b0e137ad24b6c ("mtd: rawnand: Provide helper for polling GPIO R/B pin")
    Cc:
    Signed-off-by: Boris Brezillon
    Reviewed-by: Tudor Ambarus
    Signed-off-by: Miquel Raynal
    Link: https://lore.kernel.org/linux-mtd/20200518155237.297549-1-boris.brezillon@collabora.com
    Signed-off-by: Greg Kroah-Hartman

    Boris Brezillon
     

19 Jun, 2020

1 commit

  • * tag 'v5.4.47': (2193 commits)
    Linux 5.4.47
    KVM: arm64: Save the host's PtrAuth keys in non-preemptible context
    KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception
    ...

    Conflicts:
    arch/arm/boot/dts/imx6qdl.dtsi
    arch/arm/mach-imx/Kconfig
    arch/arm/mach-imx/common.h
    arch/arm/mach-imx/suspend-imx6.S
    arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
    arch/powerpc/include/asm/cacheflush.h
    drivers/cpufreq/imx6q-cpufreq.c
    drivers/dma/imx-sdma.c
    drivers/edac/synopsys_edac.c
    drivers/firmware/imx/imx-scu.c
    drivers/net/ethernet/freescale/fec.h
    drivers/net/ethernet/freescale/fec_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/phy_device.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/usb/cdns3/gadget.c
    drivers/usb/dwc3/gadget.c
    include/uapi/linux/dma-buf.h

    Signed-off-by: Jason Liu

    Jason Liu
     

27 May, 2020

3 commits

  • [ Upstream commit 7b01b7239d0dc9832e0d0d23605c1ff047422a2c ]

    When the nvmem framework is enabled, a nvmem device is created per mtd
    device/partition.

    It is not uncommon that a device can have multiple mtd devices with
    partitions that have the same name. Eg, when there DT overlay is allowed
    and the same device with mtd is attached twice.

    Under that circumstances, the mtd fails to register due to a name
    duplication on the nvmem framework.

    With this patch we use the mtdX name instead of the partition name,
    which is unique.

    [ 8.948991] sysfs: cannot create duplicate filename '/bus/nvmem/devices/Production Data'
    [ 8.948992] CPU: 7 PID: 246 Comm: systemd-udevd Not tainted 5.5.0-qtec-standard #13
    [ 8.948993] Hardware name: AMD Dibbler/Dibbler, BIOS 05.22.04.0019 10/26/2019
    [ 8.948994] Call Trace:
    [ 8.948996] dump_stack+0x50/0x70
    [ 8.948998] sysfs_warn_dup.cold+0x17/0x2d
    [ 8.949000] sysfs_do_create_link_sd.isra.0+0xc2/0xd0
    [ 8.949002] bus_add_device+0x74/0x140
    [ 8.949004] device_add+0x34b/0x850
    [ 8.949006] nvmem_register.part.0+0x1bf/0x640
    ...
    [ 8.948926] mtd mtd8: Failed to register NVMEM device

    Fixes: c4dfa25ab307 ("mtd: add support for reading MTD devices via the nvmem API")
    Signed-off-by: Ricardo Ribalda Delgado
    Acked-by: Miquel Raynal
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Ricardo Ribalda Delgado
     
  • [ Upstream commit 0e7572cffe442290c347e779bf8bd4306bb0aa7c ]

    3bfa7e141b0b ("fs/seq_file.c: seq_read(): add info message about buggy .next functions")
    showed that we don't use seq_file correctly.
    So make sure that our ->next function always updates the position.

    Fixes: 7bccd12d27b7 ("ubi: Add debugfs file for tracking PEB state")
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Richard Weinberger
     
  • [ Upstream commit 3507273d5a4d3c2e46f9d3f9ed9449805f5dff07 ]

    This is done by default in the raw NAND core (nand_base.c) but was
    missing in the SPI-NAND core. Without these two lines the ecc_strength
    and ecc_step_size values are not exported to the user through sysfs.

    Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Miquel Raynal
     

15 May, 2020

2 commits

  • remove the redundant pm_runtime_get_sync introduced in last code rebase

    Signed-off-by: Han Xu

    Han Xu
     
  • To get better performance, current gpmi driver collected and chained all
    small DMA transfers in gpmi_nfc_exec_op, the whole chain triggered and
    wait for complete at the end.

    But some random DMA timeout found in this new driver, with the help of
    ftrace, we found the root cause is as follows:

    Take gpmi_ecc_read_page() as an example, gpmi_nfc_exec_op collected 6
    DMA transfers and the DMA chain triggered at the end. It waits for bch
    completion and check jiffies if it's timeout. The typical function graph
    shown below,

    63.216351 | 1) | gpmi_ecc_read_page() {
    63.216352 | 1) 0.750 us | gpmi_bch_layout_std();
    63.216354 | 1) | gpmi_nfc_exec_op() {
    63.216355 | 1) | gpmi_chain_command() {
    63.216356 | 1) | mxs_dma_prep_slave_sg() {
    63.216357 | 1) | /* mxs chan ccw idx: 0 */
    63.216358 | 1) 1.750 us | }
    63.216359 | 1) | mxs_dma_prep_slave_sg() {
    63.216360 | 1) | /* mxs chan ccw idx: 1 */
    63.216361 | 1) 2.000 us | }
    63.216361 | 1) 6.500 us | }
    63.216362 | 1) | gpmi_chain_command() {
    63.216363 | 1) | mxs_dma_prep_slave_sg() {
    63.216364 | 1) | /* mxs chan ccw idx: 2 */
    63.216365 | 1) 1.750 us | }
    63.216366 | 1) | mxs_dma_prep_slave_sg() {
    63.216367 | 1) | /* mxs chan ccw idx: 3 */
    63.216367 | 1) 1.750 us | }
    63.216368 | 1) 5.875 us | }
    63.216369 | 1) | /* gpmi_chain_wait_ready */
    63.216370 | 1) | mxs_dma_prep_slave_sg() {
    63.216372 | 1) | /* mxs chan ccw idx: 4 */
    63.216373 | 1) 3.000 us | }
    63.216374 | 1) | /* gpmi_chain_data_read */
    63.216376 | 1) | mxs_dma_prep_slave_sg() {
    63.216377 | 1) | /* mxs chan ccw idx: 5 */
    63.216378 | 1) 2.000 us | }
    63.216379 | 1) 1.125 us | mxs_dma_tx_submit();
    63.216381 | 1) 1.000 us | mxs_dma_enable_chan();
    63.216712 | 0) 2.625 us | mxs_dma_int_handler();
    63.216717 | 0) 4.250 us | bch_irq();
    63.216723 | 0) 1.250 us | mxs_dma_tasklet();
    63.216723 | 1) | /* jiffies left 250 */
    63.216725 | 1) ! 372.000 us | }
    63.216726 | 1) 2.625 us | gpmi_count_bitflips();
    63.216730 | 1) ! 379.125 us | }

    but it's not gurantee that bch irq handled always after dma irq handled,
    sometimes bch_irq comes first and gpmi_nfc_exec_op won't wait anymore,
    another gpmi_nfc_exec_op may get invoked before last DMA chain IRQ
    handled, this messed up the next DMA chain and causes DMA timeout. Check
    the trace log when issue happened.

    63.218923 | 1) | gpmi_ecc_read_page() {
    63.218924 | 1) 0.625 us | gpmi_bch_layout_std();
    63.218926 | 1) | gpmi_nfc_exec_op() {
    63.218927 | 1) | gpmi_chain_command() {
    63.218928 | 1) | mxs_dma_prep_slave_sg() {
    63.218929 | 1) | /* mxs chan ccw idx: 0 */
    63.218929 | 1) 1.625 us | }
    63.218931 | 1) | mxs_dma_prep_slave_sg() {
    63.218931 | 1) | /* mxs chan ccw idx: 1 */
    63.218932 | 1) 1.750 us | }
    63.218933 | 1) 5.875 us | }
    63.218934 | 1) | gpmi_chain_command() {
    63.218934 | 1) | mxs_dma_prep_slave_sg() {
    63.218935 | 1) | /* mxs chan ccw idx: 2 */
    63.218936 | 1) 1.875 us | }
    63.218937 | 1) | mxs_dma_prep_slave_sg() {
    63.218938 | 1) | /* mxs chan ccw idx: 3 */
    63.218939 | 1) 1.625 us | }
    63.218939 | 1) 5.875 us | }
    63.218940 | 1) | /* gpmi_chain_wait_ready */
    63.218941 | 1) | mxs_dma_prep_slave_sg() {
    63.218942 | 1) | /* mxs chan ccw idx: 4 */
    63.218942 | 1) 1.625 us | }
    63.218943 | 1) | /* gpmi_chain_data_read */
    63.218944 | 1) | mxs_dma_prep_slave_sg() {
    63.218945 | 1) | /* mxs chan ccw idx: 5 */
    63.218947 | 1) 2.375 us | }
    63.218948 | 1) 0.625 us | mxs_dma_tx_submit();
    63.218949 | 1) 1.000 us | mxs_dma_enable_chan();
    63.219276 | 0) 5.125 us | bch_irq();

    Han Xu