在2023年10月11日十月 下午3:46,Gregory CLEMENT写道: > Hello Jiaxun, > [...] > > There is a kind of mirror but its physical address start at 0x8000000 > so beyond the first 512MBytes that are used for KSEG0. Really, KSEG0 range is 0x00000000 to 0x20000000, and 0x08000000 to 0x10000000 is definitely within that range. But I'd agree that 0x08000000 to 0x10000000 (32MB) seems too small for kernel text and data. So yeah, it makes sense to load kernel into XKPHYS. My sugesstion is, kernel does not have to be aware of the mirror deisgn. Say that you have DDR fully mapped at 0x100000000, you can split memory space into two trunks: 0x08000000 to 0x10000000 and 0x102000000 to end of the dram. Since memblock always allocate from first continuous range in system, we can guarantee that ebase is allocated with in the first trunk. Thanks > > In short the 32bits mapping is the following: > > - the controllers registers of the SoC are located until 0x8000000, > - then from 0x8000000 to 0x10000000 there is the alias to low addresses > of the DDR > - then the SPIflash is mapped to from 0x10000000 to 0x20000000 > - after the PCIe Memory 32-bit addr space is from 0x20000000 to > 0x40000000 > > Gregory > >> [1]: https://elinux.org/images/1/1f/New-tricks-mips-linux.pdf > > -- > Gregory Clement, Bootlin > Embedded Linux and Kernel engineering > http://bootlin.com -- - Jiaxun