Skip to content

mtd: physmap: actually prevent unaligned accesses

Jonas Gorski linux-mtd 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mtd: simple_map: make NO_XIP actually prevent unaligned accessesinclude/linux/mtd/map.h+23 -30 replies
2/3mtd: physmap: allow setting no_unaligned_access for !OFdrivers/mtd/maps/physmap.c include/linux/mtd/physmap.h+4 -00 replies
3/3MIPS: BCM63XX: disable unaligned accesses for SMParch/mips/bcm63xx/dev-flash.c+1 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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(-)
Signature · 1 line
2.0.0