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

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Jul 21 14:33:44 PDT 2014


"linux-mtd" <linux-mtd-bounces at lists.infradead.org> wrote on 2014/07/21 
22:47:25:
> 
> 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.

They don't just call memcpy, it is memcpy_fromio and I think your(MIPS)
memcpy_fromio should be fixed to copy with unaligned accesses instead of
here.

> 
> 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.





More information about the linux-mtd mailing list