AW: Aarch64 Qemu virt - crash

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Mar 12 12:34:54 GMT 2021


Hello Joerg,

On 12.03.21 13:23, Gittinger Joerg (XC-ECO/ESH2) wrote:
> Hi Ahmad,
> 
>>> Apparently the NOR cfi driver tries to figure out the flash width by writing to it. In QEMU aarch64 virt machine, the flash starts at 0x0, so the address is correct. 
>>> In barebox config the "QEMU arm64 virt machine" is selected. I tried with specifying a "-pflash ..." parameter at QEMU command line but still got the same exception. 
>>> MMU (SCTLR.M) is turned on - therefore I wonder why I get this exception. It seems that the MMU region for the flash is not or not correctly set up when the memory 
>>> access occurs..? Or do I do something wrong? Please let me know how I get it running.
> 
>> There was recent rework on this platform, please pull again. This particular issue is worked around with
>> 767edcc58757 ("mtd: cfi-flash: fail gracefully instead of crashing on NULL page")
> 
> Yes, cherry-picking this change solved the crash. Thanks.
> 
>> The root cause is that when MMU is enabled, barebox traps NULL pointer dereference and accessing the first page of a cfi-flash mapped at zero looks just like one.
>>
>> The proper fix would be to remap the cfi-flash for this board, but no one has come around to do this yet. An alternative if you need to pass data to barebox is to use 
>> VirtIO Block devices. They need no further configuration than qemu command line parameters. That's in next as well.
> 
> BTW, I tried disabling MMU in config as well as Rouven suggested (thanks). But this gives me a linker error:

Don't cherry pick, check out next. This is also fixed there.

> 
> ---------------------------------------------
> ...
>   LD      barebox
> aarch64-linux-gnu-ld: common/uimage.o: in function `zero_page_memcpy':
> /home/gjt2abt/src/barebox/include/zero_page.h:47: undefined reference to `zero_page_access'
> /home/gjt2abt/src/barebox/include/zero_page.h:47:(.text.uimage_sdram_flush+0xc4): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `zero_page_access'
> aarch64-linux-gnu-ld: /home/gjt2abt/src/barebox/include/zero_page.h:49: undefined reference to `zero_page_faulting'
> /home/gjt2abt/src/barebox/include/zero_page.h:49:(.text.uimage_sdram_flush+0xd8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `zero_page_faulting'
> aarch64-linux-gnu-ld: /home/gjt2abt/src/barebox/include/zero_page.h:47: undefined reference to `zero_page_access'
> /home/gjt2abt/src/barebox/include/zero_page.h:47:(.text.file_to_sdram+0xd8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `zero_page_access'
> aarch64-linux-gnu-ld: /home/gjt2abt/src/barebox/include/zero_page.h:49: undefined reference to `zero_page_faulting'
> /home/gjt2abt/src/barebox/include/zero_page.h:49:(.text.file_to_sdram+0xf0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `zero_page_faulting'
> make: *** [Makefile:915: barebox] Error 1
> ---------------------------------------------
> 
> Regards,
> Joerg
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list