On Tue, Jan 09, 2024 at 10:37:15AM +0100, Ahmad Fatoum wrote: > On 09.01.24 10:15, Sascha Hauer wrote: > > On LS1028a the TF-A is placed in DDR, so we have to reserve the region > > in order to keep Linux away from it. > > > > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> > > --- > > arch/arm/mach-layerscape/soc.c | 2 ++ > > drivers/mci/imx-esdhc-pbl.c | 3 ++- > > include/mach/layerscape/layerscape.h | 8 ++++++++ > > 3 files changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm/mach-layerscape/soc.c b/arch/arm/mach-layerscape/soc.c > > index 4d4ef05d4b..5f9d0d5171 100644 > > --- a/arch/arm/mach-layerscape/soc.c > > +++ b/arch/arm/mach-layerscape/soc.c > > @@ -91,6 +91,8 @@ static int ls1028a_init(void) > > > > layerscape_register_pbl_image_handler(); > > > > + reserve_sdram_region("tfa", LS1028A_TFA_RESERVED_START, LS1028A_TFA_RESERVED_SIZE); > > Does this mean that the TF-A region is mapped executable (and therefore prefetchable) > from early MMU setup time until this line has finished executing? No, it doesn't. The TFA is placed at the end of lowmem and barebox_arm_entry() is called with the real memory size minus the space occupied by the TFA. Nevertheless this patch needs a fixup. reserve_sdram_region() is called before the full DDR is registered, so there's nothing to reserve from at this point. I'll have to create a mmu_initcall() from it. Sascha > > > + > > return 0; > > } > > > > diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c > > index 2c74d101e4..2d071eaca8 100644 > > --- a/drivers/mci/imx-esdhc-pbl.c > > +++ b/drivers/mci/imx-esdhc-pbl.c > > @@ -21,6 +21,7 @@ > > #endif > > #ifdef CONFIG_ARCH_LAYERSCAPE > > #include <mach/layerscape/xload.h> > > +#include <mach/layerscape/layerscape.h> > > #endif > > #include "sdhci.h" > > #include "imx-esdhc.h" > > @@ -387,7 +388,7 @@ static int ls1028a_esdhc_start_image(void __iomem *base, struct dram_regions_inf > > .socdata = &data, > > }; > > void *sdram = (void *)0x80000000; > > - void (*bl31)(void) = (void *)0xfbe00000; > > + void (*bl31)(void) = (void *)LS1028A_TFA_RESERVED_START; > > size_t bl31_size; > > void *bl31_image; > > struct bl2_to_bl31_params_mem_v2 *params; > > diff --git a/include/mach/layerscape/layerscape.h b/include/mach/layerscape/layerscape.h > > index a048b7ef9e..6f420dd4f4 100644 > > --- a/include/mach/layerscape/layerscape.h > > +++ b/include/mach/layerscape/layerscape.h > > @@ -3,6 +3,8 @@ > > #ifndef __MACH_LAYERSCAPE_H > > #define __MACH_LAYERSCAPE_H > > > > +#include <linux/sizes.h> > > + > > #define LS1046A_DDR_SDRAM_BASE 0x80000000 > > #define LS1046A_DDR_FREQ 2100000000 > > > > @@ -16,6 +18,12 @@ > > #define LS1028A_SP_SHARED_DRAM_SIZE SZ_2M > > #define LS1028A_TZC400_BASE 0x01100000 > > > > +#define LS1028A_TFA_SIZE SZ_64M > > +#define LS1028A_TFA_SHRD SZ_2M > > +#define LS1028A_TFA_RESERVED_SIZE (LS1028A_TFA_SIZE + LS1028A_TFA_SHRD) > > +#define LS1028A_TFA_RESERVED_START (0x100000000 - LS1028A_TFA_RESERVED_SIZE) > > +#define LS1028A_TFA_START (0x100000000 - LS1028A_TFA_SIZE) > > + > > enum bootsource ls1046a_bootsource_get(void); > > enum bootsource ls1021a_bootsource_get(void); > > > > -- > 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 | > > -- 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 |