From: Marek Vasut Date: Fri, 11 Jan 2019 17:25:55 +0100 Subject: [U-Boot] memcpy/memset on arm64 platforms In-Reply-To: <20190111161302.GK5463@bill-the-cat> References: <20190111161302.GK5463@bill-the-cat> Message-ID: <42099a09-251e-973b-238a-d193be4f5f02@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 1/11/19 5:13 PM, Tom Rini wrote: > On Mon, Jan 07, 2019 at 02:43:05PM +0530, Lokesh Vutla wrote: > >> Hi All, >> I am trying to enable CONFIG_USE_ARCH_MEMSET/MEMCPY on arm64 platforms and >> realized that there is no arm64 specific memcpy available in u-boot. So I >> tried porting arm64 specific memcpy from kernel[1]. Memcpy stopped working >> after that and observed that if destination address is unaligned then system >> hangs. Why do you want a custom memcpy() implementation in the first place ? >> After doing a bit more research, understood that unaligned access to device >> or strongly ordered memories will fail. And the memory system (even normal >> RAM) behaves like strongly ordered memory when the MMU is disabled[2]. In >> u-boot MMU is enabled very late after relocation and SPL doesn't enable MMU >> at all. The ARM64 MMU table setup seems to be a mess, it could indeed use some improvement. >> Before I proceed any further wanted to hear from others if anyone have >> already tried and have any working solution. If not should we update the >> kernel memcpy to use unaligned destination address and use it in u-boot? >> >> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/lib/memcpy.S >> [2] https://community.arm.com/processors/f/discussions/7557/when-and-where-will-the-ldp-instruction-trigger-an-exception > > I suspect we should, yes. Adding in some custodians of other arm64 > platforms for comment. Does the unaligned access exception happen only before the MMU is enabled or even after ? -- Best regards, Marek Vasut