arm64 memcpy_{from|to}io and memset_io

Arnd Bergmann arnd at arndb.de
Wed Oct 14 01:17:12 PDT 2015


On Tuesday 13 October 2015 23:12:18 Radha Mohan wrote:
> Hi,
> I see that the memcpy_{from|to}io and memset_io are not in an
> optimized manner. I guess these are just a copy from
> arch/arm/include/asm/io.h where there could be problem with different
> implementations.
> Do we still need these to be byte write ?

No.

> Can we convert them to use a more optimized memcpy ?

Yes.

> We have some drivers, like framebuffer driver using these functions
> and end up writing byte-by-byte. This causes a very poor VGA
> performance.
> 
> Let me know if there are any concerns to convert these to use memcpy.
> I can send a patch.

A few things to watch out for:

- you cannot use a static inline to do the job, because gcc might
  replace a plain memcpy() with unaligned pointer dereferences
  that are not allowed on __iomem

- when providing an external implementation of the functions, make sure
  they honor the alignment as well

- I think you need the same barriers that readl/writel have, but only
  at the start/end of the loop, not in the middle.

	Arnd



More information about the linux-arm-kernel mailing list