Hi Everyone,
I am attempting to bring our custom PC with an LS1046a up under U-boot. I am using the most current version of U-boot available from github, as we need some features from it.
The issue I have: The instant I try and enable the MMU after setting up the page tables, (in final_mmu_setup() in fsl-layerscape/cpu.c) I immediately generate a synchronous exception upon issuing the set_sctlr() with the CR_M bit. With the exception of the device tree which I necessarily had to modify, I have basically copied the settings directly from ls1046ardb, so I'm not sure what could be going wrong.
Does anyone know what could be causing u-boot to generate a synchronous exception the instant the final MMU is activated?
I printed out the final_map table I am using just before the error. I also added a mapping from 0xffffffff00000000 (idx #7) because I thought that might be the issue (the elr is set to a funny value in the Synchronous Abort Exception), but it didn't help.
U-Boot 2024.04-00900-gc086852891-dirty (Apr 24 2024 - 09:43:08 +0700)
SoC: LS1046AE Rev1.0 (0x87070010)
Clock Configuration:
CPU0(A72):1800 MHz CPU1(A72):1800 MHz CPU2(A72):1800 MHz
CPU3(A72):1800 MHz
Bus: 600 MHz DDR: 2100 MT/s FMAN: 700 MHz
Reset Configuration Word (RCW):
00000000: 0c150012 0e000000 00000000 00000000
00000010: 00008888 00c0001e 40000000 c1000000
00000020: 00000000 00000000 00000000 00018ffc
00000030: 20244500 25603100 00000096 00000001
Model: LS1046A Copier Board
Board: Nexcopy LS1046A, boot from QSPI
DRAM: Initializing DDR....using SPD
Detected UDIMM JM2666HLH-4G
DRAM setup success
4 GiB (effective 2 GiB) (DDR4, 64-bit, CL=15, ECC off)
ec1
final_mmu_setup running at EL3, SP=0x00000000ffe12bc0
VM map: 0| 0x 0 0x 0 0x 1000000,
VM map: 1| 0x 1000000 0x 1000000 0x f000000,
VM map: 2| 0x 10000000 0x 10000000 0x 200000,
VM map: 3| 0x 20000000 0x 20000000 0x 4000000,
VM map: 4| 0x 40000000 0x 40000000 0x 20000000,
VM map: 5| 0x 60000000 0x 60000000 0x 20000000,
VM map: 6| 0x 80000000 0x 80000000 0x 80000000,
VM map: 7| 0xffffffff80000000 0x 80000000 0x 80000000,
VM map: 8| 0x 500000000 0x 500000000 0x 10000000,
VM map: 9| 0x 880000000 0x 880000000 0x 0,
VM map: 10| 0x4000000000 0x4000000000 0x 800000000,
VM map: 11| 0x4800000000 0x4800000000 0x 800000000,
VM map: 12| 0x5000000000 0x5000000000 0x 800000000,
Synchronous Abort Exception, esr 0x8600000e , far[3] 0x4014a350
elr: ffffffff80331350 lr : 0000000040149b40 (reloc)
elr: 000000004014a350 lr : 00000000fff62b40
x0 : 000000001000e508 x1 : 0000000000000042
x2 : 000000004014a350 x3 : 0000000000000001
x4 : 0000000000000028 x5 : 0000000080820000
x6 : 0000000000000003 x7 : 0000000000000000
x8 : 00000000fffc3a50 x9 : 000000000000000c
x10: 000000000a200023 x11: 0000000000000002
x12: 0000000000000002 x13: 00000008c0000000
x14: 000000000000000a x15: 00000000fff1aee0
x16: 0000000000000000 x17: 0000000000000064
x18: 00000000ffe14da0 x19: 000000001000e508
x20: 0000000000000042 x21: 0000000040189320
x22: 00000000fffb67b3 x23: 00000000ffff0000
x24: 0000000880000000 x25: 0000008800000000
x26: 0000000080000000 x27: 0000000000000000
x28: 00000000401039e8 x29: 00000000ffe12b70
SP: 00000000ffe12100 IDR: 0000000080000000
Code: 000000004014a340
c1 ff ff 97 1f 00 1b 72 e0 17 9f 1a fa ff ff 17 (fd 7b be a9)
The code displayed disassembles to:
0x000000004014a340: C1 FF FF 97 bl #0x4014a244
0x000000004014a344: 1F 00 1B 72 tst w0, #0x20
0x000000004014a348: E0 17 9F 1A cset w0, eq
0x000000004014a34c: FA FF FF 17 b #0x4014a334
0x000000004014a350: FD 7B BE A9 stp x29, x30, [sp, #-0x20]!
The address displayed, 0x4014a350, is the entry point to the function ns16550_serial_putc() [drivers/serial/ns16550.c]
Every crash always occurs on this same instruction, even if I move code around. But there is nothing wrong that I can see with SP as reported in the exception.
We are running at EL3 right now. No trusted architecture or secure memory is configured.
Has anyone ever ported u-boot before, and have any idea what might be happening here?