imx9: bootaux: Support authenticate signed Mcore container image
Subsystems (3)
PATCH 1/4 imx9: bootaux: Support authenticate signed Mcore container image
From: Ye Li <[email protected]>
Add new command bootaux_cntr to replace bootaux in secure boot (CONFIG_AHAB_BOOT=y) to authenticate signed M33 core image. The M33 image must be packed in container format and signed. bootaux_cntr supports Mcore image loaded to TCM or run as FlexSPI NOR XIP.
--- arch/arm/include/asm/arch-imx9/imx-regs.h | 12 ++ arch/arm/mach-imx/imx9/imx_bootaux.c | 216 ++++++++++++++++++++++ 2 files changed, 228 insertions(+)
arch/arm/include/asm/arch-imx9/imx-regs.h +12 -0
@@ -47,6 +47,18 @@#define SRC_MEDIA_RBASE (SRC_IPS_BASE_ADDR + 0x2400)#define SRC_M33P_RBASE (SRC_IPS_BASE_ADDR + 0x2800) +#define TCML_BASE_ADDR (0x201E0000UL) +#define TCML_BASE_MCORE_SEC_ADDR (0x1FFE0000UL) +#define TCML_BASE_MCORE_NSEC_ADDR (0x0FFE0000UL) +#define TCML_SIZE (0x20000U) +#define TCMU_BASE_ADDR (0x20200000UL) +#define TCMU_BASE_MCORE_SEC_ADDR (0x30000000UL) +#define TCMU_BASE_MCORE_NSEC_ADDR (0x20000000UL) +#define TCMU_SIZE (0x20000U) + +#define FLEXSPI_AHB_ADDR (0x28000000UL) +#define FLEXSPI_AHB_SIZE (0x8000000UL) +#define SRC_MIX_SLICE_FUNC_STAT_PSW_STAT BIT(0)#define SRC_MIX_SLICE_FUNC_STAT_RST_STAT BIT(2)#define SRC_MIX_SLICE_FUNC_STAT_ISO_STAT BIT(4)
arch/arm/mach-imx/imx9/imx_bootaux.c +216 -0
249 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/4 imx9: bootaux: Support booting CM70, CM71 and CM33 sync cores
From: Alice Guo <[email protected]>
Support booting CM70, CM71 and CM33 sync core image by bootaux command on iMX95, iMX94 and iMX952. (iMX95 and iMX952 only supports CM70).
Each core uses different core id which is defined by SM and passed in SIP call.
- CM33: 0 - CM70: 1 - CM71: 7
- CM33S: 8
Prior to run bootaux to start core, prepaux is needed before loading image. Below is example for booting CM70 TCM image on iMX95.
=>fatload mmc 1:1 0x90000000 rpmsg.bin
=>prepaux 1
=>cp.b 0x90000000 0x203c0000 ${filesize}
=>bootaux 0 1--- arch/arm/include/asm/arch-imx9/imx-regs.h | 18 +++ arch/arm/mach-imx/imx9/imx_bootaux.c | 188 ++++++++++++++++++---- arch/arm/mach-imx/imx9/scmi/soc.c | 33 +++- include/imx_sip.h | 2 + 4 files changed, 206 insertions(+), 35 deletions(-)
arch/arm/include/asm/arch-imx9/imx-regs.h +18 -0
@@ -47,6 +47,16 @@#define SRC_MEDIA_RBASE (SRC_IPS_BASE_ADDR + 0x2400)#define SRC_M33P_RBASE (SRC_IPS_BASE_ADDR + 0x2800) +#ifdef CONFIG_IMX94 +#define TCML_BASE_ADDR (0x209C0000UL) +#define TCML_BASE_MCORE_SEC_ADDR (0x1FFC0000UL) +#define TCML_BASE_MCORE_NSEC_ADDR (0x0FFC0000UL) +#define TCML_SIZE (0x40000U) +#define TCMU_BASE_ADDR (0x20A00000UL) +#define TCMU_BASE_MCORE_SEC_ADDR (0x30000000UL) +#define TCMU_BASE_MCORE_NSEC_ADDR (0x20000000UL) +#define TCMU_SIZE (0x40000U) +#else #define TCML_BASE_ADDR (0x201E0000UL)#define TCML_BASE_MCORE_SEC_ADDR (0x1FFE0000UL)#define TCML_BASE_MCORE_NSEC_ADDR (0x0FFE0000UL)
@@ -55,6 +65,14 @@#define TCMU_BASE_MCORE_SEC_ADDR (0x30000000UL)#define TCMU_BASE_MCORE_NSEC_ADDR (0x20000000UL)#define TCMU_SIZE (0x20000U) +#endif + +#define M7_TCML_BASE_ADDR (0x20380000UL) +#define M7_TCML_BASE_MCORE_ADDR (0x0UL) +#define M7_TCML_MAX_SIZE (0x80000U)/* Could configure to 512KB TCML */ +#define M71_TCML_BASE_ADDR (0x20280000UL) +#define M71_TCML_BASE_MCORE_ADDR (0x0UL) +#define M71_TCML_MAX_SIZE (0x80000U)/* Could configure to 512KB TCML */ #define FLEXSPI_AHB_ADDR (0x28000000UL)#define FLEXSPI_AHB_SIZE (0x8000000UL)
arch/arm/mach-imx/imx9/imx_bootaux.c +154 -34
311 lines not on this page · raw message
arch/arm/mach-imx/imx9/scmi/soc.c +32 -1
@@ -247,7 +247,38 @@ static struct mm_region imx9_mem_map[] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { + }, +#if IS_ENABLED(CONFIG_IMX94) + { + /* M71 TCM */ + .virt = 0x202c0000UL, + .phys = 0x202c0000UL, + .size = 0x80000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, + { + /* M33S TCM */ + .virt = 0x209c0000UL, + .phys = 0x209c0000UL, + .size = 0x80000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, + /* 644K netc ocram for rpmsg buffer */ + { + /* M33S NETC OCRAM */ + .virt = 0x20800000UL, + .phys = 0x20800000UL, + .size = 0xa1000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, +#endif + { /* OCRAM */ .virt = 0x20480000UL, .phys = 0x20480000UL,
include/imx_sip.h +2 -0
@@ -16,5 +16,7 @@#define IMX_SIP_SRC_MCU_START 0x00#define IMX_SIP_SRC_MCU_STARTED 0x01#define IMX_SIP_SRC_MCU_STOP 0x02 +#define IMX_SIP_SRC_MCU_PREP 0x04 +#define IMX_SIP_SRC_MCU_PREPED 0x05#endif
Signature · 1 line
2.34.1
PATCH 3/4 nxp: imx9{4, 5, 52}_evk: power on mcore according to SM config
In reply to [email protected]From: Ye Li <[email protected]>
When working with SM config mx9{4,5,52}evkrpmsg, mcores are not booted by ROM. Hence, power on the mcore and initialize TCM ECC in u-boot for subsequent mcore booting.
--- arch/arm/include/asm/arch-imx9/sys_proto.h | 2 + arch/arm/mach-imx/imx9/scmi/soc.c | 98 ++++++++++++++++++++++ board/nxp/imx94_evk/imx94_evk.c | 5 +- board/nxp/imx952_evk/imx952_evk.c | 3 + board/nxp/imx95_evk/imx95_evk.c | 10 ++- configs/imx95_evk.config | 2 +- include/scmi_nxp_protocols.h | 11 +++ 7 files changed, 128 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-imx9/sys_proto.h +2 -0
@@ -27,6 +27,8 @@ int scmi_get_boot_device_offset(unsigned long *img_off);int scmi_get_boot_stage (u8 *stage);u8 scmi_get_imgset_sel (void ); +int power_on_mcore (const char *sm_cfgname); +#define is_voltage_mode (mode) (soc_target_voltage_mode() == (mode))#endif
arch/arm/mach-imx/imx9/scmi/soc.c +98 -0
110 lines not on this page · raw message
board/nxp/imx94_evk/imx94_evk.c +4 -1
@@ -7,10 +7,13 @@#include <fdt_support.h> #include <asm/gpio.h> #include <asm/arch/clock.h> -#include <asm/mach-imx/sys_proto.h> +#include <asm/arch/sys_proto.h> int board_init (void ) { +/* Power on mcores when using rpmsg cfg */ +power_on_mcore ("mx94evkrpmsg" ); +return 0 ; }
board/nxp/imx952_evk/imx952_evk.c +3 -0
@@ -9,6 +9,9 @@int board_init (void ) { +/* Power on mcores when using rpmsg cfg */ +power_on_mcore ("mx952evkrpmsg" ); +return 0 ; }
board/nxp/imx95_evk/imx95_evk.c +9 -1
@@ -5,7 +5,15 @@#include <asm/gpio.h> #include <asm/arch/clock.h> -#include <asm/mach-imx/sys_proto.h> +#include <asm/arch/sys_proto.h> + +int board_init (void ) +{ +/* Power on mcores when using rpmsg cfg */ +power_on_mcore ("mx95evkrpmsg" ); + +return 0 ; +}int board_late_init (void ) {
configs/imx95_evk.config +1 -1
@@ -37,7 +37,7 @@ CONFIG_BOOTCOMMAND="bootflow scan -l; run bsp_bootcmd" CONFIG_DEFAULT_FDT_FILE="imx95-19x19-evk.dtb" CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2074 -# CONFIG_BOARD_INIT is not set +CONFIG_BOARD_INIT=y CONFIG_BOARD_LATE_INIT=y CONFIG_PCI_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000
include/scmi_nxp_protocols.h +11 -0
@@ -18,6 +18,7 @@#define SCMI_ARRAY (X ,Y ) ((SCMI_PAYLOAD_LEN - (X)) / sizeof(Y))#define SCMI_IMX_MISC_RESET_REASON 0xA +#define SCMI_IMX_MISC_CFG_INFO 0xCstruct scmi_imx_misc_reset_reason_in {#define MISC_REASON_FLAG_SYSTEM BIT(0)
@@ -119,4 +120,14 @@ static inline int scmi_imx_cpu_start(struct udevice *dev, u32 cpuid, bool start)return -EOPNOTSUPP ; }#endif + +struct scmi_imx_misc_cfg_info_out { +s32 status; +/* Mode selector value */ +u32 msel; +#define MISC_MAX_CFGNAME 16 +/* Config (cfg) file basename */ +char cfgname[MISC_MAX_CFGNAME ]; +}; +#endif
Signature · 1 line
2.34.1
PATCH 4/4 imx9: scmi: reset GPIO2 according its node status
In reply to [email protected]From: Peng Fan <[email protected]>
Check the GPIO2 dts node status to determine reset it or not. On iMX952 single SPL/U-Boot image is shared for both mx952evk and mx952evkrpmsg SM configs. GPIO2 is assigned to M7 domain in mx952evkrpmsg, and there is no active user of GPIO2 for mx952evk and mx952evkrpmsg in SPL/U-Boot, so it is disabled in DTS. Otherwise, reset GPIO2 will meet hang when working with mx952evkrpmsg SM.
--- arch/arm/mach-imx/imx9/scmi/soc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx9/scmi/soc.c +20 -1
@@ -14,6 +14,7 @@#include <asm/setup.h> #include <dm/uclass.h> #include <dm/device.h> +#include <dm/ofnode.h> #include <env_internal.h> #include <fuse.h> #include <imx_thermal.h>
@@ -949,6 +950,22 @@ static void gpio_reset(ulong gpio_base)writel (0 , gpio_base +0x1c ); } +static int gpio_available (const char *nodes_path) +{ +ofnode gpio_node =ofnode_path (nodes_path); +const char *status; + +if (!ofnode_valid (gpio_node)) +return false; + + status =ofnode_read_string (gpio_node,"status" ); + +if (status && !strcmp (status,"disabled" )) +return false; + +return true; +} +int arch_cpu_init (void ) {if (IS_ENABLED (CONFIG_SPL_BUILD )) {
@@ -964,7 +981,9 @@ int arch_cpu_init(void)disable_wdog ((void __iomem *)base); } -gpio_reset (GPIO2_BASE_ADDR ); +if (gpio_available ("/soc/gpio@43810000" )) +gpio_reset (GPIO2_BASE_ADDR ); +gpio_reset (GPIO3_BASE_ADDR );gpio_reset (GPIO4_BASE_ADDR );gpio_reset (GPIO5_BASE_ADDR );
Signature · 1 line
2.34.1