[PATCH 0/3] mtd: physmap: actually prevent unaligned accesses

Jonas Gorski jogo at openwrt.org
Mon Jul 21 13:47:25 PDT 2014


Commit d0788ce4924758249c9552c91cc33024d3434419 ("mtd: physmap_of: Add
"no-unaligned-direct-access" DT property") intended to prevent
unaligned accesses to the mapped flash by setting map.virt to NO_XIP.

But simple mapping's read_from/write_to still just call memcpy, which
will do unaligned reads/writes at least on mips.

This causes problems on e.g. bcm63xx with smp, as both cores share a
unaligned load/store unit, and unaligned reads sometimes read garbage.

This patchset aims at preventing unaligned accesses for good by making
read_from/write_to check for NO_XIP and do a bytewise copy if one of
to or from is unaligned.

Since this is mostly mtd stuff, it should go through the mtd tree.

Jonas Gorski (3):
  mtd: simple_map: make NO_XIP actually prevent unaligned accesses
  mtd: physmap: allow setting no_unaligned_access for !OF
  MIPS: BCM63XX: disable unaligned accesses for SMP

 arch/mips/bcm63xx/dev-flash.c |  1 +
 drivers/mtd/maps/physmap.c    |  3 +++
 include/linux/mtd/map.h       | 26 +++++++++++++++++++++++---
 include/linux/mtd/physmap.h   |  1 +
 4 files changed, 28 insertions(+), 3 deletions(-)

-- 
2.0.0



More information about the linux-mtd mailing list