1. 16 5月, 2017 2 次提交
    • C
      mtd: m25p80: add support of SPI 1-2-2 and 1-4-4 protocols · 138f5dc6
      Cyrille Pitchen 提交于
      Before this patch, m25p80_read() supported few SPI protocols:
      - regular SPI 1-1-1
      - SPI Dual Output 1-1-2
      - SPI Quad Output 1-1-4
      On the other hand, m25p80_write() only supported SPI 1-1-1.
      
      This patch updates both m25p80_read() and m25p80_write() functions to let
      them support SPI 1-2-2 and SPI 1-4-4 protocols for Fast Read and Page
      Program SPI commands.
      
      It adopts a conservative approach to avoid regressions. Hence the new
      implementations try to be as close as possible to the old implementations,
      so the main differences are:
      - the tx_nbits values now being set properly for the spi_transfer
        structures carrying the (op code + address/dummy) bytes
      - and the spi_transfer structure being split into 2 spi_transfer
        structures when the numbers of I/O lines are different for op code and
        for address/dummy byte transfers on the SPI bus.
      
      Besides, the current spi-nor framework supports neither the SPI 2-2-2 nor
      the SPI 4-4-4 protocols. So, for now, we don't need to update the
      m25p80_{read|write}_reg() functions as SPI 1-1-1 is the only one possible
      protocol.
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@atmel.com>
      Reviewed-by: NMarek Vasut <marek.vasut@gmail.com>
      138f5dc6
    • C
      mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocols · cfc5604c
      Cyrille Pitchen 提交于
      This patch changes the prototype of spi_nor_scan(): its 3rd parameter
      is replaced by a 'struct spi_nor_hwcaps' pointer, which tells the spi-nor
      framework about the actual hardware capabilities supported by the SPI
      controller and its driver.
      
      Besides, this patch also introduces a new 'struct spi_nor_flash_parameter'
      telling the spi-nor framework about the hardware capabilities supported by
      the SPI flash memory and the associated settings required to use those
      hardware caps.
      
      Then, to improve the readability of spi_nor_scan(), the discovery of the
      memory settings and the memory initialization are now split into two
      dedicated functions.
      
      1 - spi_nor_init_params()
      
      The spi_nor_init_params() function is responsible for initializing the
      'struct spi_nor_flash_parameter'. Currently this structure is filled with
      legacy values but further patches will allow to override some parameter
      values dynamically, for instance by reading the JESD216 Serial Flash
      Discoverable Parameter (SFDP) tables from the SPI memory.
      The spi_nor_init_params() function only deals with the hardware
      capabilities of the SPI flash memory: especially it doesn't care about
      the hardware capabilities supported by the SPI controller.
      
      2 - spi_nor_setup()
      
      The second function is called once the 'struct spi_nor_flash_parameter'
      has been initialized by spi_nor_init_params().
      With both 'struct spi_nor_flash_parameter' and 'struct spi_nor_hwcaps',
      the new argument of spi_nor_scan(), spi_nor_setup() computes the best
      match between hardware caps supported by both the (Q)SPI memory and
      controller hence selecting the relevant settings for (Fast) Read and Page
      Program operations.
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@atmel.com>
      Reviewed-by: NMarek Vasut <marek.vasut@gmail.com>
      cfc5604c
  2. 09 5月, 2017 5 次提交
    • V
      mtd: nand: nandsim: convert to memalloc_noreclaim_*() · dcbe8214
      Vlastimil Babka 提交于
      Nandsim has own functions set_memalloc() and clear_memalloc() for robust
      setting and clearing of PF_MEMALLOC.  Replace them by the new generic
      helpers.  No functional change.
      
      Link: http://lkml.kernel.org/r/20170405074700.29871-5-vbabka@suse.czSigned-off-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Chris Leech <cleech@redhat.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Josef Bacik <jbacik@fb.com>
      Cc: Lee Duncan <lduncan@suse.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dcbe8214
    • B
      ubi: Add debugfs file for tracking PEB state · 7bccd12d
      Ben Shelton 提交于
      Add a file under debugfs to allow easy access to the erase count for
      each physical erase block on an UBI device.  This is useful when
      debugging data integrity issues with UBIFS on NAND flash devices.
      Signed-off-by: NBen Shelton <ben.shelton@ni.com>
      Signed-off-by: NZach Brown <zach.brown@ni.com>
      
      v2:
      * If ubi_io_is_bad eraseblk_count_seq_show just returns the err.
      * if ubi->lookuptbl returns null, its no longer treated as an error
        instead info for that block is not printeded
      * Removed check for UBI_MAX_ERASECOUNTER since it is impossible to hit
      * Removed block state from print, if a block is printed then it is good and
        if it is not printed, then it is bad.
      
      v3:
      * Remove errant ! symbol from if statement checking if erase count is valid.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      7bccd12d
    • R
      ubi: fastmap: Fix slab corruption · 8a143588
      Rabin Vincent 提交于
      Booting with UBI fastmap and SLUB debugging enabled results in the
      following splats.  The problem is that ubi_scan_fastmap() moves the
      fastmap blocks from the scan_ai (allocated in scan_fast()) to the ai
      allocated in ubi_attach().  This results in two problems:
      
       - When the scan_ai is freed, aebs which were allocated from its slab
         cache are still in use.
      
       - When the other ai is being destroyed in destroy_ai(), the
         arguments to kmem_cache_free() call are incorrect since aebs on its
         ->fastmap list were allocated with a slab cache from a differnt ai.
      
      Fix this by making a copy of the aebs in ubi_scan_fastmap() instead of
      moving them.
      
       =============================================================================
       BUG ubi_aeb_slab_cache (Not tainted): Objects remaining in ubi_aeb_slab_cache on __kmem_cache_shutdown()
       -----------------------------------------------------------------------------
      
       INFO: Slab 0xbfd2da3c objects=17 used=1 fp=0xb33d7748 flags=0x40000080
       CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
       [<80111910>] (unwind_backtrace) from [<8010d498>] (show_stack+0x18/0x1c)
       [<8010d498>] (show_stack) from [<804a3274>] (dump_stack+0xb4/0xe0)
       [<804a3274>] (dump_stack) from [<8026c47c>] (slab_err+0x78/0x88)
       [<8026c47c>] (slab_err) from [<802735bc>] (__kmem_cache_shutdown+0x180/0x3e0)
       [<802735bc>] (__kmem_cache_shutdown) from [<8024e13c>] (shutdown_cache+0x1c/0x60)
       [<8024e13c>] (shutdown_cache) from [<8024ed64>] (kmem_cache_destroy+0x19c/0x20c)
       [<8024ed64>] (kmem_cache_destroy) from [<8057cc14>] (destroy_ai+0x1dc/0x1e8)
       [<8057cc14>] (destroy_ai) from [<8057f04c>] (ubi_attach+0x3f4/0x450)
       [<8057f04c>] (ubi_attach) from [<8056fe70>] (ubi_attach_mtd_dev+0x60c/0xff8)
       [<8056fe70>] (ubi_attach_mtd_dev) from [<80571d78>] (ctrl_cdev_ioctl+0x110/0x2b8)
       [<80571d78>] (ctrl_cdev_ioctl) from [<8029c77c>] (do_vfs_ioctl+0xac/0xa00)
       [<8029c77c>] (do_vfs_ioctl) from [<8029d10c>] (SyS_ioctl+0x3c/0x64)
       [<8029d10c>] (SyS_ioctl) from [<80108860>] (ret_fast_syscall+0x0/0x1c)
       INFO: Object 0xb33d7e88 @offset=3720
       INFO: Allocated in scan_peb+0x608/0x81c age=72 cpu=1 pid=118
       	kmem_cache_alloc+0x3b0/0x43c
       	scan_peb+0x608/0x81c
       	ubi_attach+0x124/0x450
       	ubi_attach_mtd_dev+0x60c/0xff8
       	ctrl_cdev_ioctl+0x110/0x2b8
       	do_vfs_ioctl+0xac/0xa00
       	SyS_ioctl+0x3c/0x64
       	ret_fast_syscall+0x0/0x1c
       kmem_cache_destroy ubi_aeb_slab_cache: Slab cache still has objects
       CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
       [<80111910>] (unwind_backtrace) from [<8010d498>] (show_stack+0x18/0x1c)
       [<8010d498>] (show_stack) from [<804a3274>] (dump_stack+0xb4/0xe0)
       [<804a3274>] (dump_stack) from [<8024ed80>] (kmem_cache_destroy+0x1b8/0x20c)
       [<8024ed80>] (kmem_cache_destroy) from [<8057cc14>] (destroy_ai+0x1dc/0x1e8)
       [<8057cc14>] (destroy_ai) from [<8057f04c>] (ubi_attach+0x3f4/0x450)
       [<8057f04c>] (ubi_attach) from [<8056fe70>] (ubi_attach_mtd_dev+0x60c/0xff8)
       [<8056fe70>] (ubi_attach_mtd_dev) from [<80571d78>] (ctrl_cdev_ioctl+0x110/0x2b8)
       [<80571d78>] (ctrl_cdev_ioctl) from [<8029c77c>] (do_vfs_ioctl+0xac/0xa00)
       [<8029c77c>] (do_vfs_ioctl) from [<8029d10c>] (SyS_ioctl+0x3c/0x64)
       [<8029d10c>] (SyS_ioctl) from [<80108860>] (ret_fast_syscall+0x0/0x1c)
       cache_from_obj: Wrong slab cache. ubi_aeb_slab_cache but object is from ubi_aeb_slab_cache
       ------------[ cut here ]------------
       WARNING: CPU: 1 PID: 118 at mm/slab.h:354 kmem_cache_free+0x39c/0x450
       Modules linked in:
       CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
       [<80111910>] (unwind_backtrace) from [<8010d498>] (show_stack+0x18/0x1c)
       [<8010d498>] (show_stack) from [<804a3274>] (dump_stack+0xb4/0xe0)
       [<804a3274>] (dump_stack) from [<80120e40>] (__warn+0xf4/0x10c)
       [<80120e40>] (__warn) from [<80120f20>] (warn_slowpath_null+0x28/0x30)
       [<80120f20>] (warn_slowpath_null) from [<80271fe0>] (kmem_cache_free+0x39c/0x450)
       [<80271fe0>] (kmem_cache_free) from [<8057cb88>] (destroy_ai+0x150/0x1e8)
       [<8057cb88>] (destroy_ai) from [<8057ef1c>] (ubi_attach+0x2c4/0x450)
       [<8057ef1c>] (ubi_attach) from [<8056fe70>] (ubi_attach_mtd_dev+0x60c/0xff8)
       [<8056fe70>] (ubi_attach_mtd_dev) from [<80571d78>] (ctrl_cdev_ioctl+0x110/0x2b8)
       [<80571d78>] (ctrl_cdev_ioctl) from [<8029c77c>] (do_vfs_ioctl+0xac/0xa00)
       [<8029c77c>] (do_vfs_ioctl) from [<8029d10c>] (SyS_ioctl+0x3c/0x64)
       [<8029d10c>] (SyS_ioctl) from [<80108860>] (ret_fast_syscall+0x0/0x1c)
       ---[ end trace 2bd8396277fd0a0b ]---
       =============================================================================
       BUG ubi_aeb_slab_cache (Tainted: G    B   W      ): page slab pointer corrupt.
       -----------------------------------------------------------------------------
      
       INFO: Allocated in scan_peb+0x608/0x81c age=104 cpu=1 pid=118
       	kmem_cache_alloc+0x3b0/0x43c
       	scan_peb+0x608/0x81c
       	ubi_attach+0x124/0x450
       	ubi_attach_mtd_dev+0x60c/0xff8
       	ctrl_cdev_ioctl+0x110/0x2b8
       	do_vfs_ioctl+0xac/0xa00
       	SyS_ioctl+0x3c/0x64
       	ret_fast_syscall+0x0/0x1c
       INFO: Slab 0xbfd2da3c objects=17 used=1 fp=0xb33d7748 flags=0x40000081
       INFO: Object 0xb33d7e88 @offset=3720 fp=0xb33d7da0
      
       Redzone b33d7e80: cc cc cc cc cc cc cc cc                          ........
       Object b33d7e88: 02 00 00 00 01 00 00 00 00 f0 ff 7f ff ff ff ff  ................
       Object b33d7e98: 00 00 00 00 00 00 00 00 bd 16 00 00 00 00 00 00  ................
       Object b33d7ea8: 00 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00  ................
       Redzone b33d7eb8: cc cc cc cc                                      ....
       Padding b33d7f60: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
       CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B   W       4.9.15 #3
       [<80111910>] (unwind_backtrace) from [<8010d498>] (show_stack+0x18/0x1c)
       [<8010d498>] (show_stack) from [<804a3274>] (dump_stack+0xb4/0xe0)
       [<804a3274>] (dump_stack) from [<80271770>] (free_debug_processing+0x320/0x3c4)
       [<80271770>] (free_debug_processing) from [<80271ad0>] (__slab_free+0x2bc/0x430)
       [<80271ad0>] (__slab_free) from [<80272024>] (kmem_cache_free+0x3e0/0x450)
       [<80272024>] (kmem_cache_free) from [<8057cb88>] (destroy_ai+0x150/0x1e8)
       [<8057cb88>] (destroy_ai) from [<8057ef1c>] (ubi_attach+0x2c4/0x450)
       [<8057ef1c>] (ubi_attach) from [<8056fe70>] (ubi_attach_mtd_dev+0x60c/0xff8)
       [<8056fe70>] (ubi_attach_mtd_dev) from [<80571d78>] (ctrl_cdev_ioctl+0x110/0x2b8)
       [<80571d78>] (ctrl_cdev_ioctl) from [<8029c77c>] (do_vfs_ioctl+0xac/0xa00)
       [<8029c77c>] (do_vfs_ioctl) from [<8029d10c>] (SyS_ioctl+0x3c/0x64)
       [<8029d10c>] (SyS_ioctl) from [<80108860>] (ret_fast_syscall+0x0/0x1c)
       FIX ubi_aeb_slab_cache: Object at 0xb33d7e88 not freed
      Signed-off-by: NRabin Vincent <rabinv@axis.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      8a143588
    • A
      ubi: Make mtd parameter readable · 997d30cb
      Andy Shevchenko 提交于
      Fix permissions to allow read mtd parameter back (only for owner).
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      997d30cb
    • A
      ubi: Fix section mismatch · 435009d4
      Andy Shevchenko 提交于
      WARNING: vmlinux.o(.text+0x1f2a80): Section mismatch in reference from the variable __param_ops_mtd to the function .init.text:ubi_mtd_param_parse()
      The function __param_ops_mtd() references
      the function __init ubi_mtd_param_parse().
      This is often because __param_ops_mtd lacks a __init
      annotation or the annotation of ubi_mtd_param_parse is wrong.
      
      Cc: Richard Weinberger <richard@nod.at>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      435009d4
  3. 03 5月, 2017 2 次提交
  4. 02 5月, 2017 1 次提交
  5. 01 5月, 2017 2 次提交
  6. 25 4月, 2017 20 次提交
  7. 21 4月, 2017 3 次提交
  8. 20 4月, 2017 4 次提交
  9. 17 4月, 2017 1 次提交