On 09/10/2020 18:37, Biju Das wrote:
Hi Biju,
Subject: Re: commit 75fab6496e5fce9a11 ("libc: memset: improve performance by avoiding single byte writes") causing BL31 boot failure on Renesas RZ/G2 platforms.
On 08/10/2020 20:05, Biju Das wrote:
Then on target, found that BL31 is failed to boot[3], which is fixed by reverting the commit 75fab6496e5fce9a11 ("libc: memset: improve performance by avoiding single byte writes"), see
the logs [3].
Mmmh, interesting. Can you build with "DEBUG=1" to get more output from BL31?
Sure Will do and provide feedback.
I see some calls to memset() from code in drivers/renesas/rcar. Can you add some debug prints at the top of memset() to dump the parameters on each call? To see what breaks it?
OK.
I believe commenting [1] fixed the issue which corresponds to memset parameters[2]. Looks like calling rcar_log_init-->memset from [3] is causing the issue.
Many thanks for debugging this, that's helpful!
But without your patch it is working fine. Only thing is, you have added extra code to
improve the speed. I am not sure how it is impacting here. Currently I don't have access to Lauterbach to debug further. Any thoughts ???
So this RCAR_BL31_LOG_BASE address is mapped as device memory, what kind of device is this? SRAM? Or something non-volatile, even? Even if it's SRAM, sometimes the controller managing this does not support all AMBA accesses (hence it's a device, not memory).
In general letting the compiler access device memory directly is asking for trouble, every access should go through MMIO accessors. Linux has memset_io() for those kind of problems.
Can you try the attached patch? That should downgrade the stores to 32-bit ones. Not a solution, but would help to isolate the problem.
If that fixes it, we could either have a memset_io32() implementation, or you can revert to those memset() routines I see in drivers/renesas/rcar already, for instance by exporting emmc_memset().
Cheers, Andre
[1] https://elixir.bootlin.com/arm-trusted-firmware/latest/source/drivers/renesa... [2 ]NOTICE: BLDEBUG: dst=0x44040010, val=0, count=81840 [3] https://elixir.bootlin.com/arm-trusted-firmware/latest/source/drivers/renesa...
Regards, Biju
Are you using memset on some I/O memory, by any chance? And that doesn't support all access types, like 64-bit stores?
Will check and let you know.
Cheers, Biju
Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647
Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647