Add CAAM driver model support
Subsystems (5)
v8 cover Add CAAM driver model support
This patchset adds the support for following:
1) CAAM Driver model for all i.MX, layerscape, PPC platforms.
2) Added crypto node in device tree files.
3) fix build issue for mx6sabre: Remove SPL DTB related configs and SPL_OF_CONTROL.
4) improve hwrng performance in kernel.
i.MX platforms:
i.MX6, i.MX7, i.MX7ULP, i.MX8MM/MN/MP/MQ, i.MX8QM/QXP
Layerscape platforms:
LS1021, LS1012, LS1028, LS1043, LS1046, LS1088, LS2088, LX2160, LX2162
Powerpc platforms:
P3041, P4080, P5040, P2041, T1024, T1042, T2080, T4240
changes since v7:
- rebase to latest master
- corrected the order of include files as per coding style in jr.c.
https://www.denx.de/wiki/U-Boot/CodingStyle
- added brackets around #defines for -ve number in jr.h
- added comments for struct caam_regs added in jr.h
changes since v6:
- rebase to latest master
- added caam_jr_ioctl() operation which calls run_descriptor_jr().
- removed CONFIG_ARCH_IMX8 config from JR driver.
- removed FSL_BLOB config
changes since v5:
- rebase to latest master
- updated BIT() macro for JRDID in drivers/crypto/fsl/jr.h
- removed auto select FSL_BLOB from CMD_BLOB config.
- removed patch for blob key encryption key(bkek), random number generation.
- updated patch description for improving hwrng performance in kernel.
- removed sec_init() from kontron/sl28.
- for LS1028A architecture, enable CAAM only for LS1028AQDS and LS1028ARDB.
changes since v4:
- rebase to latest master
- updated caam_jr_probe() with livetree APIs.
- imx8m: moved jr0 disable code to *-uboot.dtsi files.
changes since v3:
- rebase to latest master
- fixed build error when new file arch/powerpc/include/asm/u-boot-ppc.h is included from assembly files.
- removed arch/arm/dts/fsl-ls1028a.dtsi as it is conflicting with the series
https://lore.kernel.org/u-boot/[email protected]/
Gaurav Jain (13):
crypto/fsl: Add support for CAAM Job ring driver model i.MX8M: crypto: updated device tree for supporting DM in SPL crypto/fsl: i.MX8M: Enable Job ring driver model. i.MX6: Enable Job ring driver model.
i.MX7: Enable Job ring driver model.
i.MX7ULP: Enable Job ring driver model.
i.MX8: Add crypto node in device tree
crypto/fsl: i.MX8: Enable Job ring driver model.
Layerscape: Add crypto node in device tree
Layerscape: Enable Job ring driver model.
PPC: Add crypto node in device tree
PPC: Enable Job ring driver model.
update CAAM MAINTAINER
Ye Li (2):
mx6sabre: Remove unnecessary SPL configs
crypto/fsl: Improve hwrng performance in kernel
MAINTAINERS | 6 + arch/arm/Kconfig | 13 +- arch/arm/cpu/armv7/ls102xa/Kconfig | 3 + arch/arm/cpu/armv7/ls102xa/cpu.c | 16 + arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 17 + arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 10 +- arch/arm/dts/fsl-imx8dx.dtsi | 61 ++- arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi | 34 +- arch/arm/dts/fsl-imx8qm.dtsi | 61 ++- arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi | 34 +- arch/arm/dts/fsl-ls1012a.dtsi | 46 +- arch/arm/dts/fsl-ls1043a.dtsi | 45 +- arch/arm/dts/fsl-ls1046a.dtsi | 44 ++ arch/arm/dts/fsl-ls1088a.dtsi | 39 ++ arch/arm/dts/fsl-ls2080a.dtsi | 39 ++ arch/arm/dts/fsl-lx2160a.dtsi | 41 +- arch/arm/dts/imx7ulp.dtsi | 24 + arch/arm/dts/imx8mm-evk-u-boot.dtsi | 19 +- arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 19 +- arch/arm/dts/imx8mp-evk-u-boot.dtsi | 19 +- arch/arm/dts/imx8mq-evk-u-boot.dtsi | 4 + arch/arm/dts/ls1021a.dtsi | 40 ++ arch/arm/include/asm/arch-imx8/imx-regs.h | 5 +- arch/arm/include/asm/arch-imx8m/imx-regs.h | 1 + arch/arm/mach-imx/cmd_dek.c | 1 + arch/arm/mach-imx/imx8/Kconfig | 7 + arch/arm/mach-imx/imx8/cpu.c | 16 +- arch/arm/mach-imx/imx8m/Kconfig | 18 + arch/arm/mach-imx/imx8m/soc.c | 10 +- arch/arm/mach-imx/mx6/Kconfig | 15 + arch/arm/mach-imx/mx6/soc.c | 12 +- arch/arm/mach-imx/mx7/Kconfig | 2 + arch/arm/mach-imx/mx7/soc.c | 11 +- arch/arm/mach-imx/mx7ulp/Kconfig | 3 + arch/arm/mach-imx/mx7ulp/soc.c | 16 + arch/powerpc/cpu/mpc85xx/Kconfig | 33 ++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 17 +- arch/powerpc/dts/p2041si-post.dtsi | 1 + arch/powerpc/dts/p3041si-post.dtsi | 1 + arch/powerpc/dts/p4080si-post.dtsi | 1 + arch/powerpc/dts/p5040si-post.dtsi | 1 + arch/powerpc/dts/qoriq-sec4.0-0.dtsi | 74 +++ arch/powerpc/dts/qoriq-sec4.2-0.dtsi | 83 +++ arch/powerpc/dts/qoriq-sec5.2-0.dtsi | 92 ++++ arch/powerpc/dts/t1023si-post.dtsi | 1 + arch/powerpc/dts/t1042si-post.dtsi | 1 + arch/powerpc/dts/t2080si-post.dtsi | 1 + arch/powerpc/dts/t4240si-post.dtsi | 1 + arch/powerpc/include/asm/u-boot-ppc.h | 17 + arch/powerpc/include/asm/u-boot.h | 1 + board/freescale/imx8mm_evk/spl.c | 9 +- board/freescale/imx8mn_evk/spl.c | 8 +- board/freescale/imx8mp_evk/spl.c | 13 +- board/freescale/imx8mq_evk/spl.c | 9 +- board/freescale/imx8qm_mek/spl.c | 6 +- board/freescale/imx8qxp_mek/spl.c | 6 +- board/freescale/ls1012afrdm/ls1012afrdm.c | 7 +- board/freescale/ls1012aqds/ls1012aqds.c | 6 +- board/freescale/ls1012ardb/ls1012ardb.c | 6 +- board/freescale/ls1021aiot/ls1021aiot.c | 6 +- board/freescale/ls1021aqds/ls1021aqds.c | 6 +- board/freescale/ls1021atsn/ls1021atsn.c | 7 +- board/freescale/ls1021atwr/ls1021atwr.c | 8 +- board/freescale/ls1028a/ls1028a.c | 6 +- board/freescale/ls1043ardb/ls1043ardb.c | 6 +- board/freescale/ls1046afrwy/ls1046afrwy.c | 7 +- board/freescale/ls1046aqds/ls1046aqds.c | 7 +- board/freescale/ls1046ardb/ls1046ardb.c | 6 +- board/freescale/ls1088a/ls1088a.c | 6 +- board/freescale/ls2080aqds/ls2080aqds.c | 6 +- board/freescale/ls2080ardb/ls2080ardb.c | 9 +- board/freescale/lx2160a/lx2160a.c | 5 - board/kontron/sl28/sl28.c | 3 - configs/P2041RDB_defconfig | 1 - configs/P3041DS_defconfig | 1 - configs/P4080DS_defconfig | 1 - configs/P5040DS_defconfig | 1 - configs/T1024RDB_defconfig | 1 - configs/T1042D4RDB_defconfig | 1 - configs/T2080QDS_defconfig | 1 - configs/T2080RDB_defconfig | 1 - configs/T2080RDB_revD_defconfig | 1 - configs/T4240RDB_defconfig | 1 - configs/ls1021aiot_qspi_defconfig | 1 - configs/ls1021aqds_nor_defconfig | 1 - configs/ls1021aqds_qspi_defconfig | 1 - configs/ls1021atsn_qspi_defconfig | 1 - configs/ls1021atwr_nor_defconfig | 1 - ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig | 1 + configs/ls1028ardb_tfa_defconfig | 1 - configs/ls1043ardb_tfa_defconfig | 1 - configs/ls1046afrwy_tfa_defconfig | 1 - configs/ls1046aqds_tfa_defconfig | 1 - configs/ls1046ardb_tfa_defconfig | 1 - configs/ls2088aqds_tfa_defconfig | 1 - configs/ls2088ardb_tfa_defconfig | 1 - configs/lx2160aqds_tfa_defconfig | 1 - configs/lx2160ardb_tfa_defconfig | 1 - configs/lx2162aqds_tfa_defconfig | 1 - configs/mx6sabreauto_defconfig | 2 - configs/mx6sabresd_defconfig | 4 - drivers/crypto/fsl/Kconfig | 2 +- drivers/crypto/fsl/jr.c | 476 +++++++++++++----- drivers/crypto/fsl/jr.h | 31 +- include/fsl_sec.h | 13 +- scripts/config_whitelist.txt | 1 + 106 files changed, 1493 insertions(+), 296 deletions(-) create mode 100644 arch/powerpc/dts/qoriq-sec4.0-0.dtsi create mode 100644 arch/powerpc/dts/qoriq-sec4.2-0.dtsi create mode 100644 arch/powerpc/dts/qoriq-sec5.2-0.dtsi create mode 100644 arch/powerpc/include/asm/u-boot-ppc.h
Signature · 1 line
2.17.1
PATCH v8 1/15 crypto/fsl: Add support for CAAM Job ring driver model
added device tree support for job ring driver. sec is initialized based on job ring information processed from device tree.
--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)
drivers/crypto/fsl/jr.c +212 -111
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */
@@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h"
@@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size - 1))
@@ -35,20 +37,29 @@ uint32_t sec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {#endif }; +#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) +{ +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or
@@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx)*/ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq (uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg |JR_INTMASK ;
@@ -80,10 +84,10 @@ static inline void jr_disable_irq(uint8_t sec_idx)sec_out32 (®s->jrcfg1, jrcfg); } -static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring);caam_dma_addr_t op_base =virt_to_phys ((void *)jr->output_ring);
@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET
@@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup (uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset (uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }
@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word;int length =desc_len (desc_addr);
@@ -263,10 +222,10 @@ static int jr_enqueue(uint32_t *desc_addr,return 0 ; } -static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;
@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void *arg) {struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus (status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;
@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" ); ret =JQ_ENQ_ERR ;
@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" ); ret =JQ_DEQ_ERR ;
@@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc)return run_descriptor_jr_idx (desc,0 ); } +static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) +{ +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) +{ +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }
@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;
@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;
@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx, int state_handle_mask)return ret; } -static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;
@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;if (caam_get_era () <10 ) {
@@ -574,9 +586,8 @@ static u8 get_rng_vid(uint8_t sec_idx)* By default, the TRNG runs for 200 clocks per sample; * 1200 clocks per sample generates better entropy. */ -static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 val;
@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t sec_idx)sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;
@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/*
@@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) {printf ("SEC%u: Failed to instantiate RNG\n" , sec_idx);
@@ -646,13 +656,28 @@ static int rng_init(uint8_t sec_idx)return ret; } -#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev); +#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;
@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms =JRDID_MS_TZ_OWN |JRDID_MS_PRIM_TZ |JRDID_MS_PRIM_DID ; +sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms); +#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD
@@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;
@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }
@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }
@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long request,void *buf) +{ +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); +} + +static int caam_jr_probe (struct udevice *dev) +{ +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) +{ +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif
drivers/crypto/fsl/jr.h +28 -3
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */
@@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4/* Timeout currently defined as 10 sec */
@@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0#define JRSLIODN_MASK 0x00000fff -#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;
@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +}; +void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);
Signature · 1 line
2.17.1
Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board imx6dl_mamoj because SPL exceeds the maximum size for a DL SOC.
See https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/387370
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
Best regards,
Stefano
Quoted 658 lines · Gaurav Jain
added device tree support for job ring driver. sec is initialized based on job ring information processed from device tree.
Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c +212
-111@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size - 1))@@ -35,20 +37,29 @@ uint32_t sec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {#endif }; +#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) +{ +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx)*/ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq (uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg |JR_INTMASK ;@@ -80,10 +84,10 @@ static inline void jr_disable_irq(uint8_t sec_idx)sec_out32 (®s->jrcfg1, jrcfg); } -static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring);caam_dma_addr_t op_base =virt_to_phys ((void *)jr->output_ring);@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup (uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset (uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word;int length =desc_len (desc_addr);@@ -263,10 +222,10 @@ static int jr_enqueue(uint32_t *desc_addr,return 0 ; } -static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void *arg) {struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus (status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" ); ret =JQ_ENQ_ERR ;@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" ); ret =JQ_DEQ_ERR ;@@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc)return run_descriptor_jr_idx (desc,0 ); } +static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) +{ +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) +{ +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx, int state_handle_mask)return ret; } -static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;if (caam_get_era () <10 ) {@@ -574,9 +586,8 @@ static u8 get_rng_vid(uint8_t sec_idx)* By default, the TRNG runs for 200 clocks per sample; * 1200 clocks per sample generates better entropy. */ -static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 val;@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t sec_idx)sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) {printf ("SEC%u: Failed to instantiate RNG\n" , sec_idx);@@ -646,13 +656,28 @@ static int rng_init(uint8_t sec_idx)return ret; } -#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev); +#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms =JRDID_MS_TZ_OWN |JRDID_MS_PRIM_TZ |JRDID_MS_PRIM_DID ; +sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms); +#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long request,void *buf) +{ +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); +} + +static int caam_jr_probe (struct udevice *dev) +{ +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) +{ +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h +28
-3@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4/* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0#define JRSLIODN_MASK 0x00000fff -#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +}; +void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Marek
Quoted 39 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C3a273 1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C 0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserve d=0
Quoted 2 lines
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
CONFIG_IMX_HAB is enabled for imx6dl_mamoj. So CAAM is built for SPL, results in increased size. However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?
Regards
Gaurav Jain
Quoted 668 lines
Best regards,
Stefanodrivers/crypto/fsl/jr.c uint32_t
Quoted 44 lines · Gaurav Jain
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c index renamed from drivers/crypto/fsl/jr.c +0
-022b649219e..8103987425 100644
drivers/crypto/fsl/jr.c +4
-2@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size - 1))@@ -35,20 +37,29 @@ uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
drivers/crypto/fsl/jr.c static inline int run_descriptor_jr_idx(uint32_t *desc,
Quoted 206 lines
drivers/crypto/fsl/jr.c +12
-3#endif }; +#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) || (scfgr & SEC_SCFGR_VIRT_EN))drivers/crypto/fsl/jr.c +15
-64-sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg |JR_INTMASK ;@@ -80,10 +84,10 @@ static inline void jr_disable_irq(uint8_t sec_idx)sec_out32 (®s->jrcfg1, jrcfg); } -static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring);caam_dma_addr_t op_base =virt_to_phys ((void *)jr->output_ring);@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@ staticint jr_enqueue(uint32_t
*desc_addr,return 0;}
drivers/crypto/fsl/jr.c +10
-6-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void *arg) {struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus (status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)drivers/crypto/fsl/jr.c static int deinstantiate_rng(u8 sec_idx, int
Quoted 103 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" ); ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int
run_descriptor_jr(uint32_t *desc)return run_descriptor_jr_idx(desc, 0);}
drivers/crypto/fsl/jr.c +58
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev); +#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx, int
state_handle_mask)Quoted 100 lines
drivers/crypto/fsl/jr.c +26
-14return ret; } -static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;if (caam_get_era () <10 ) {@@ -574,9 +586,8 @@ static u8 get_rng_vid(uint8_t sec_idx)* By default, the TRNG runs for 200 clocks per sample; * 1200 clocks per sample generates better entropy. */ -static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 val;@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t sec_idx)sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) {printf ("SEC%u: Failed to instantiate RNG\n" , sec_idx);@@ -646,13 +656,28 @@ static int rng_init(uint8_t sec_idx)return ret; } -#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev); +#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 182 lines
drivers/crypto/fsl/jr.c +80
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long request, +void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); +} + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h index renamed from drivers/crypto/fsl/jr.h +0
-0
1047aa772c..3eb7be79da100644drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +18
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs {drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 10 lines
drivers/crypto/fsl/jr.h +7
-0+ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +}; +void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Marek
A gentle reminder!!
Please help to check if some feature can be dropped in SPL from imx6dl_mamoj board so that CAAM driver model patches can be accepted.
Regards
Gaurav Jain
Quoted 747 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, February 7, 2022 12:43 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
Quoted 7 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye LiQuoted 8 lines
<[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 13 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.Quoted 5 lines
See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsour
ce.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C3a273
Quoted 1 line
1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
Quoted 1 line
0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
Quoted 1 line
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
Quoted 1 line
p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserve
Quoted 4 lines
d=0
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
CONFIG_IMX_HABis enabled forimx6dl_mamoj. So CAAM is built for SPL, results in increased size.
However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?Regards
Gaurav JainQuoted 651 lines
Best regards,
StefanoQuoted 43 lines · Gaurav Jain
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c index renamed from drivers/crypto/fsl/jr.c +0
-022b649219e..8103987425 100644
drivers/crypto/fsl/jr.c +4
-2@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size -Quoted 1 line
1)) @@ -35,20 +37,29 @@
uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
Quoted 206 lines
#endif };drivers/crypto/fsl/jr.c +27
-67+#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg |JR_INTMASK ;@@ -80,10 +84,10 @@ static inline void jr_disable_irq(uint8_t sec_idx)sec_out32 (®s->jrcfg1, jrcfg); } -static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring);caam_dma_addr_t op_base =virt_to_phys ((void *)jr->output_ring);@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@ staticint jr_enqueue(uint32_t
*desc_addr,return 0;}
drivers/crypto/fsl/jr.c +9
-6-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void *arg) {struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus (status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c static inline int run_descriptor_jr_idx(uint32_t · line 338
Quoted 1 line
drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)drivers/crypto/fsl/jr.c static int deinstantiate_rng(u8 sec_idx, int
Quoted 102 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" );ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc) return run_descriptor_jr_idx(desc, 0);}
drivers/crypto/fsl/jr.c +56
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;drivers/crypto/fsl/jr.c +0
-0@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx, int
state_handle_mask)Quoted 99 lines
drivers/crypto/fsl/jr.c +7
-10return ret; } -static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;if (caam_get_era () <10 ) {@@ -574,9 +586,8 @@ static u8 get_rng_vid(uint8_t sec_idx)* By default, the TRNG runs for 200 clocks per sample; * 1200 clocks per sample generates better entropy. */ -static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 val;@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t sec_idx)sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) { printf("SEC%u: Failed to instantiate RNG\n",
sec_idx); @@ -646,13 +656,28 @@ static intrng_init(uint8_t sec_idx)return ret;}
drivers/crypto/fsl/jr.c +18
-4-#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev);#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 185 lines
drivers/crypto/fsl/jr.c +79
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long +request,void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); } + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h index renamed from drivers/crypto/fsl/jr.h +0
-0
1047aa772c..3eb7be79da100644drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +22
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ Quoted 9 lines
drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 6 lines
drivers/crypto/fsl/jr.h +3
-0+struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +}; +void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);--
=================================================================
Quoted 5 lines
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]=================================================================
Quoted 1 line
====
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Stefano
Quoted 99 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 11, 2022 3:09 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
A gentle reminder!!
Please help to check if some feature can be dropped in SPL fromimx6dl_mamojboard so that CAAM driver model patches can be accepted.Regards
Gaurav JainQuoted 7 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, February 7, 2022 12:43 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>;Quoted 8 lines
Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 22 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
Quoted 7 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye LiQuoted 8 lines
<[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Quoted 23 lines
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 20 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fso
ur
ce.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C3a2
Quoted 3 lines
73
Quoted 1 line
1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
Quoted 2 lines
Quoted 1 line
Quoted 11 lines
0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
Quoted 2 lines
Quoted 1 line
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
Quoted 2 lines
Quoted 1 line
p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserve
Quoted 4 lines
Quoted 4 lines
d=0
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
As we have not received any response from imx6dl_mamoj board maintainer. I propose the below solution
arch/arm/mach-imx/Kconfig +4 -3
@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Help --- a/configs/imx6dl_mamoj_defconfig +++ b/configs/imx6dl_mamoj_defconfig
@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=n
Need your help to review this or suggest any other solution.
Regards
Gaurav Jain
Quoted 684 lines
Quoted 395 lines
CONFIG_IMX_HABis enabled forimx6dl_mamoj. So CAAM is built for SPL, results in increased size.
However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?Regards
Gaurav JainQuoted 387 lines
Best regards,
StefanoQuoted 44 lines · Gaurav Jain
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c +0
-0index
22b649219e..8103987425 100644drivers/crypto/fsl/jr.c +4
-2@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size -Quoted 1 line
1)) @@ -35,20 +37,29 @@
uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
Quoted 206 lines
#endif };drivers/crypto/fsl/jr.c +27
-67+#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg |JR_INTMASK ;@@ -80,10 +84,10 @@ static inline void jr_disable_irq(uint8_t sec_idx)sec_out32 (®s->jrcfg1, jrcfg); } -static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring);caam_dma_addr_t op_base =virt_to_phys ((void *)jr->output_ring);@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@static int jr_enqueue(uint32_t
*desc_addr,return 0;}
drivers/crypto/fsl/jr.c +9
-6-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void *arg) {struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus (status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c static inline int · line 338
Quoted 1 line
drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)drivers/crypto/fsl/jr.c static int deinstantiate_rng(u8 sec_idx, int
Quoted 103 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" );ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc) return run_descriptor_jr_idx(desc, 0);}
drivers/crypto/fsl/jr.c +57
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct +op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;drivers/crypto/fsl/jr.c +0
-0@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx, int
state_handle_mask)Quoted 24 lines
drivers/crypto/fsl/jr.c +3
-4return ret; } -static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/crypto/fsl/jr.c +0
-0if (caam_get_era () <10 ) {@@ -574,9 +586,8 @@ static u8 get_rng_vid(uint8_t sec_idx)* By default, the TRNG runs for 200 clocks per sample; * 1200 clocks per sample generates better entropy. */ Quoted 8 lines
drivers/crypto/fsl/jr.c static void kick_trng(int ent_delay, uint8_t
Quoted 8 lines
drivers/crypto/fsl/jr.c +1
-2-static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 val;@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t
sec_idx)Quoted 255 lines
Quoted 255 lines
Quoted 63 lines
drivers/crypto/fsl/jr.c +3
-4sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; -ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR (sec_idx);struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) { printf("SEC%u: Failed to instantiate RNG\n",
sec_idx); @@ -646,13 +656,28 @@ static intrng_init(uint8_t sec_idx)return ret;}
drivers/crypto/fsl/jr.c +18
-4-#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev);#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 186 lines
drivers/crypto/fsl/jr.c +79
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long +request,void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); } + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +23
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ];Quoted 9 lines
Quoted 8 lines
drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 5 lines
drivers/crypto/fsl/jr.h +2
-0+}; +void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);--
=================================================================
Quoted 8 lines
Quoted 7 lines
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]=================================================================
Quoted 1 line
Quoted 1 line
====
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Stefano
A gentle reminder!!
Need your help to check the proposed solution to fix imx6dl_mamoj SPL size issue shared in last mail.
Regards
Gaurav Jain
Quoted 860 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 25, 2022 12:33 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Stefano
Quoted 7 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 11, 2022 3:09 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>;Quoted 8 lines
Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 30 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
A gentle reminder!!
Please help to check if some feature can be dropped in SPL fromimx6dl_mamojboard so that CAAM driver model patches can be accepted.Regards
Gaurav JainQuoted 8 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, February 7, 2022 12:43 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia GeantaQuoted 8 lines
<[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Quoted 50 lines
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 47 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
Quoted 8 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji LuoQuoted 8 lines
<[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 21 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
so
ur
ce.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C3a
Quoted 5 lines
2
Quoted 3 lines
73
Quoted 1 line
1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserve
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
d=0
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Helpconfigs/imx6dl_mamoj_defconfig +1
-0@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=nNeed your help to review this or suggest any other solution.
Regards
Gaurav JainQuoted 226 lines
Quoted 226 lines
CONFIG_IMX_HABis enabled forimx6dl_mamoj. So CAAM is built for SPL, results in increased size.
However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?Regards
Gaurav JainQuoted 218 lines
Best regards,
StefanoQuoted 45 lines · Gaurav Jain
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c +0
-0index
22b649219e..8103987425 100644drivers/crypto/fsl/jr.c +4
-3@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size -Quoted 1 line
1)) @@ -35,20 +37,29 @@
uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
Quoted 166 lines
#endif };drivers/crypto/fsl/jr.c +15
-12+#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg | JR_INTMASK; @@ -80,10 +84,10 @@ staticinline void
jr_disable_irq(uint8_t sec_idx)sec_out32(®s->jrcfg1, jrcfg);}
drivers/crypto/fsl/jr.c +4
-3-static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs +*caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring); caam_dma_addr_t op_base = virt_to_phys((void*)jr->output_ring);
drivers/crypto/fsl/jr.c +9
-52@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@static int jr_enqueue(uint32_t
*desc_addr,return 0;}
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/crypto/fsl/jr.c static void desc_done(uint32_t status, void
Quoted 11 lines
drivers/crypto/fsl/jr.c +3
-3-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void*arg)
Quoted 139 lines
Quoted 139 lines
Quoted 139 lines
Quoted 29 lines
drivers/crypto/fsl/jr.c +6
-2{struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus(status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c static inline int · line 338
Quoted 1 line
drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)Quoted 103 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" );ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc) return run_descriptor_jr_idx(desc, 0);}
drivers/crypto/fsl/jr.c +57
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct +op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;drivers/crypto/fsl/jr.c +0
-0@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx,Quoted 1 line
int
state_handle_mask)Quoted 3 lines
return ret;}
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/crypto/fsl/jr.c
Quoted 9 lines
drivers/crypto/fsl/jr.c +3
-2-static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec, +int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
struct rng4tst
__iomem*rng =
(struct rng4tst__iomem*)&sec->rng;drivers/crypto/fsl/jr.c +1
-2@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/crypto/fsl/jr.c
Quoted 9 lines
drivers/crypto/fsl/jr.c +0
-0if (caam_get_era() < 10) { @@ -574,9 +586,8 @@ static u8
get_rng_vid(uint8_t sec_idx)
* By default, the TRNG runs for 200 clocks per sample;
* 1200 clocks per sample generates better entropy. */drivers/crypto/fsl/jr.c +1
-2-static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; u32 val;drivers/crypto/fsl/jr.c +0
-0@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay,
uint8_t
sec_idx)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/crypto/fsl/jr.c
Quoted 8 lines
sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM);}
drivers/crypto/fsl/jr.c +1
-2-static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 248 lines
Quoted 248 lines
Quoted 248 lines
Quoted 55 lines
struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; u32 inst_handles;drivers/crypto/fsl/jr.c +2
-2@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) { printf("SEC%u: Failed to instantiate RNG\n",
sec_idx); @@ -646,13 +656,28 @@ static intrng_init(uint8_t sec_idx)return ret;}
drivers/crypto/fsl/jr.c +18
-4-#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev);#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 187 lines
drivers/crypto/fsl/jr.c +79
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long +request,void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); } + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +24
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +};Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 4 lines
drivers/crypto/fsl/jr.h +1
-0+void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);--
=================================================================
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]=================================================================
Quoted 1 line
Quoted 1 line
Quoted 1 line
====
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 4 lines · Gaurav Jain
Hello Stefano
A gentle reminder!!
Need your help to check the proposed solution to fiximx6dl_mamojSPL size issue shared in last mail.
Ouch...is there a solution ? I confess I have not seen, is there an answer by Marek ?
Regards,
Stefano
Quoted 864 lines
Regards
Gaurav JainQuoted 860 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 25, 2022 12:33 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Stefano
Quoted 7 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 11, 2022 3:09 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>;Quoted 8 lines
Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 30 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
A gentle reminder!!
Please help to check if some feature can be dropped in SPL fromimx6dl_mamojboard so that CAAM driver model patches can be accepted.Regards
Gaurav JainQuoted 8 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, February 7, 2022 12:43 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia GeantaQuoted 8 lines
<[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Quoted 50 lines
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 47 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
Quoted 8 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji LuoQuoted 8 lines
<[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 21 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
so
ur
ce.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C3a
Quoted 5 lines
2
Quoted 3 lines
73
Quoted 1 line
1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserve
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
d=0
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Helpconfigs/imx6dl_mamoj_defconfig +1
-0@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=nNeed your help to review this or suggest any other solution.
Regards
Gaurav JainQuoted 226 lines
Quoted 226 lines
CONFIG_IMX_HABis enabled forimx6dl_mamoj. So CAAM is built for SPL, results in increased size.
However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?Regards
Gaurav JainQuoted 218 lines
Best regards,
StefanoQuoted 45 lines · Gaurav Jain
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++-------------- drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c +0
-0index
22b649219e..8103987425 100644drivers/crypto/fsl/jr.c +4
-3@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size -Quoted 1 line
1)) @@ -35,20 +37,29 @@
uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
Quoted 166 lines
#endif };drivers/crypto/fsl/jr.c +15
-12+#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg | JR_INTMASK; @@ -80,10 +84,10 @@ staticinline void
jr_disable_irq(uint8_t sec_idx)sec_out32(®s->jrcfg1, jrcfg);}
drivers/crypto/fsl/jr.c +4
-3-static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs +*caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring); caam_dma_addr_t op_base = virt_to_phys((void*)jr->output_ring);
drivers/crypto/fsl/jr.c +9
-52@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@static int jr_enqueue(uint32_t
*desc_addr,return 0;}
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/crypto/fsl/jr.c static void desc_done(uint32_t status, void
Quoted 11 lines
drivers/crypto/fsl/jr.c +3
-3-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void*arg)
Quoted 139 lines
Quoted 139 lines
Quoted 139 lines
Quoted 29 lines
drivers/crypto/fsl/jr.c +6
-2{struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus(status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c static inline int · line 338
Quoted 1 line
drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)Quoted 103 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" );ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc) return run_descriptor_jr_idx(desc, 0);}
drivers/crypto/fsl/jr.c +57
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct +op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;drivers/crypto/fsl/jr.c +0
-0@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx,Quoted 1 line
int
state_handle_mask)Quoted 3 lines
return ret;}
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/crypto/fsl/jr.c
Quoted 9 lines
drivers/crypto/fsl/jr.c +3
-2-static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec, +int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
struct rng4tst
__iomem*rng =
(struct rng4tst__iomem*)&sec->rng;drivers/crypto/fsl/jr.c +1
-2@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/crypto/fsl/jr.c
Quoted 9 lines
drivers/crypto/fsl/jr.c +0
-0if (caam_get_era() < 10) { @@ -574,9 +586,8 @@ static u8
get_rng_vid(uint8_t sec_idx)
* By default, the TRNG runs for 200 clocks per sample;
* 1200 clocks per sample generates better entropy. */drivers/crypto/fsl/jr.c +1
-2-static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; u32 val;drivers/crypto/fsl/jr.c +0
-0@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay,
uint8_t
sec_idx)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/crypto/fsl/jr.c
Quoted 8 lines
sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM);}
drivers/crypto/fsl/jr.c +1
-2-static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 248 lines
Quoted 248 lines
Quoted 248 lines
Quoted 55 lines
struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; u32 inst_handles;drivers/crypto/fsl/jr.c +2
-2@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) { printf("SEC%u: Failed to instantiate RNG\n",
sec_idx); @@ -646,13 +656,28 @@ static intrng_init(uint8_t sec_idx)return ret;}
drivers/crypto/fsl/jr.c +18
-4-#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev);#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 187 lines
drivers/crypto/fsl/jr.c +79
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long +request,void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); } + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +24
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +};Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 4 lines
drivers/crypto/fsl/jr.h +1
-0+void caam_jr_strstatus (u32 status);int run_descriptor_jr (uint32_t *desc);--
=================================================================
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]=================================================================
Quoted 1 line
Quoted 1 line
Quoted 1 line
====
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Stefano
As we have not received any response from imx6dl_mamoj board maintainer. I propose the below solution
arch/arm/mach-imx/Kconfig +4 -3
@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Help --- a/configs/imx6dl_mamoj_defconfig +++ b/configs/imx6dl_mamoj_defconfig
@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=n
Need your help to review this or suggest any other solution.
Regards
Gaurav Jain
Quoted 921 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Thursday, March 3, 2022 6:32 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; u- [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Quoted 4 lines · Gaurav Jain
Hello Stefano
A gentle reminder!!
Need your help to check the proposed solution to fiximx6dl_mamojSPL sizeissue shared in last mail.
Ouch...is there a solution ? I confess I have not seen, is there an answer by Marek ?
Regards,
StefanoQuoted 20 lines
Regards
Gaurav JainQuoted 16 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 25, 2022 12:33 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;Alison
Quoted 1 line
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 99 lines
Quoted 99 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Stefano
Quoted 8 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 11, 2022 3:09 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia GeantaQuoted 8 lines
<[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 73 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
A gentle reminder!!
Please help to check if some feature can be dropped in SPL fromimx6dl_mamojboard so that CAAM driver model patches can be accepted.Regards
Gaurav JainQuoted 8 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, February 7, 2022 12:43 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia GeantaQuoted 8 lines
<[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 40 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
Quoted 8 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji LuoQuoted 8 lines
<[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 14 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
so
ur
ce.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C
Quoted 7 lines
Quoted 7 lines
3a
Quoted 5 lines
2
Quoted 3 lines
73
Quoted 1 line
1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserv
Quoted 41 lines
Quoted 41 lines
e
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
d=0
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Helpconfigs/imx6dl_mamoj_defconfig +1
-0@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=nNeed your help to review this or suggest any other solution.
Regards
Gaurav JainQuoted 13 lines
Quoted 13 lines
CONFIG_IMX_HABis enabled forimx6dl_mamoj. So CAAM is built for SPL, results in increased size.
However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?Regards
Gaurav JainQuoted 5 lines
Best regards,
StefanoOn 10.01.22 13:27, Gaurav Jain wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++--------------
Quoted 652 lines
Quoted 652 lines
Quoted 205 lines
Quoted 205 lines
Quoted 205 lines
Quoted 37 lines
drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c +0
-0index
22b649219e..8103987425 100644drivers/crypto/fsl/jr.c +4
-3@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size -Quoted 1 line
1)) @@ -35,20 +37,29 @@
uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
Quoted 166 lines
#endif };drivers/crypto/fsl/jr.c +15
-12+#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg | JR_INTMASK; @@ -80,10 +84,10 @@ staticinline void
jr_disable_irq(uint8_t sec_idx)sec_out32(®s->jrcfg1, jrcfg);}
drivers/crypto/fsl/jr.c +4
-3-static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs +*caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring); caam_dma_addr_t op_base = virt_to_phys((void*)jr->output_ring);
drivers/crypto/fsl/jr.c +9
-52@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@static int jr_enqueue(uint32_t
*desc_addr,return 0;}
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/crypto/fsl/jr.c static void desc_done(uint32_t status, void
Quoted 11 lines
drivers/crypto/fsl/jr.c +3
-3-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void*arg)
Quoted 139 lines
Quoted 139 lines
Quoted 139 lines
Quoted 29 lines
drivers/crypto/fsl/jr.c +6
-2{struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus(status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c static inline int · line 338
Quoted 1 line
drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)Quoted 103 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" );ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc) return run_descriptor_jr_idx(desc, 0);}
drivers/crypto/fsl/jr.c +57
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct +op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;drivers/crypto/fsl/jr.c +0
-0@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx,Quoted 1 line
int
state_handle_mask)Quoted 3 lines
return ret;}
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/crypto/fsl/jr.c
Quoted 8 lines
drivers/crypto/fsl/jr.c +2
-2-static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
struct rng4tst
__iomem*rng =
(struct rng4tst__iomem*)&sec->rng;drivers/crypto/fsl/jr.c +1
-2@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/crypto/fsl/jr.c
Quoted 9 lines
drivers/crypto/fsl/jr.c +0
-0if (caam_get_era() < 10) { @@ -574,9 +586,8 @@ static u8
get_rng_vid(uint8_t sec_idx)
* By default, the TRNG runs for 200 clocks per sample;
* 1200 clocks per sample generates better entropy. */drivers/crypto/fsl/jr.c +1
-2-static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
drivers/crypto/fsl/jr.c static void kick_trng(int ent_delay, uint8_t
Quoted 4 lines
struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; u32 val;drivers/crypto/fsl/jr.c +0
-0@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t
sec_idx)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/crypto/fsl/jr.c static void kick_trng(int ent_delay, uint8_t · line 609
Quoted 8 lines
drivers/crypto/fsl/jr.c +1
-2sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 250 lines
Quoted 250 lines
Quoted 250 lines
Quoted 55 lines
drivers/crypto/fsl/jr.c +2
-2struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) { printf("SEC%u: Failed to instantiate RNG\n",
sec_idx); @@ -646,13 +656,28 @@ static intrng_init(uint8_t sec_idx)return ret;}
drivers/crypto/fsl/jr.c +18
-4-#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev);#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 189 lines
drivers/crypto/fsl/jr.c +79
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long +request,void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); } + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +25
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +}; +void caam_jr_strstatus (u32 status);Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 2 lines
drivers/crypto/fsl/jr.h +0
-0int run_descriptor_jr (uint32_t *desc);--
=================================================================
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]=================================================================
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
====
--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi,
Quoted 8 lines · Gaurav Jain
Hi Stefano
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solution
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 6 lines
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Help
IMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to change).
Regards,
Stefano
Quoted 931 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=nNeed your help to review this or suggest any other solution.
Regards
Gaurav JainQuoted 921 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Thursday, March 3, 2022 6:32 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; u- [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Quoted 4 lines · Gaurav Jain
Hello Stefano
A gentle reminder!!
Need your help to check the proposed solution to fiximx6dl_mamojSPL sizeissue shared in last mail.
Ouch...is there a solution ? I confess I have not seen, is there an answer by Marek ?
Regards,
StefanoQuoted 20 lines
Regards
Gaurav JainQuoted 16 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 25, 2022 12:33 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;Alison
Quoted 1 line
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 99 lines
Quoted 99 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Stefano
Quoted 8 lines
-----Original Message-----
From: Gaurav Jain
Sent: Friday, February 11, 2022 3:09 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia GeantaQuoted 8 lines
<[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 73 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
A gentle reminder!!
Please help to check if some feature can be dropped in SPL fromimx6dl_mamojboard so that CAAM driver model patches can be accepted.Regards
Gaurav JainQuoted 8 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, February 7, 2022 12:43 PM
To: Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia GeantaQuoted 8 lines
<[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 40 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHello Marek
Quoted 8 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Saturday, February 5, 2022 7:46 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji LuoQuoted 8 lines
<[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 14 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; Marek Vasut <[email protected]>
Subject: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi Gaurav,
rather I still have issues to run CI with this applied. The reason is that this adds an overhead to SPL and it breaks the board
imx6dl_mamojbecause SPL exceeds the maximum size for a DL SOC.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
so
ur
ce.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F387370&data=04%7C01%7Cgaurav.jain%40nxp.com%7C
Quoted 7 lines
Quoted 7 lines
3a
Quoted 5 lines
2
Quoted 3 lines
73
Quoted 1 line
1dd27fc4bebcad308d9e8b21464%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
0%7C0%7C637796673834942697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
p;sdata=pI%2F%2FlNtrdrGCa8sSvcr6uNu4jze7pzDqZtI52FIDj50%3D&reserv
Quoted 41 lines
Quoted 41 lines
e
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
d=0
I do not know if it is possible to drop some features from SPL for this board (Added Marek as board maintainer).
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM Helpconfigs/imx6dl_mamoj_defconfig +1
-0@@ -59,3 +59,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_FSL_CAAM=nNeed your help to review this or suggest any other solution.
Regards
Gaurav JainQuoted 13 lines
Quoted 13 lines
CONFIG_IMX_HABis enabled forimx6dl_mamoj. So CAAM is built for SPL, results in increased size.
However CAAM is not initialized in SPL. As Stefano suggested, Can you drop some features from SPL?Regards
Gaurav JainQuoted 5 lines
Best regards,
StefanoOn 10.01.22 13:27, Gaurav Jain wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
added device tree support for job ring driver.
sec is initialized based on job ring information processed from device tree.Signed-off-by Gaurav Jain <[email protected]>Reviewed-by Ye Li <[email protected]>--- drivers/crypto/fsl/jr.c | 323 ++++++++++++++++++++++++++--------------
Quoted 652 lines
Quoted 652 lines
Quoted 205 lines
Quoted 205 lines
Quoted 205 lines
Quoted 37 lines
drivers/crypto/fsl/jr.h | 31 +++- 2 files changed, 240 insertions(+), 114 deletions(-)drivers/crypto/fsl/jr.c +0
-0index
22b649219e..8103987425 100644drivers/crypto/fsl/jr.c +4
-3@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * * Based on CAAM driver in drivers/crypto/caam in Linux */ @@ -11,7 +11,6 @@#include <linux/kernel.h> #include <log.h> #include <malloc.h> -#include "fsl_sec.h" #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" @@ -21,7 +20,10 @@#include <asm/cache.h> #include <asm/fsl_pamu.h> #endif +#include <dm.h> #include <dm/lists.h> +#include <dm/root.h> +#include <dm/device-internal.h> #include <linux/delay.h> #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size -Quoted 1 line
1)) @@ -35,20 +37,29 @@
uint32_tsec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
Quoted 166 lines
#endif };drivers/crypto/fsl/jr.c +15
-12+#if CONFIG_IS_ENABLED (DM ) +struct udevice *caam_dev; +#else #define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))#define SEC_JR0_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +struct caam_regs caam_st; +#endif -struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +static inline u32 jr_start_reg (u8 jrid) { +return (1 << jrid); +} -static inline void start_jr0 (uint8_t sec_idx) +static inline void start_jr (struct caam_regs *caam) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +ccsr_sec_t *sec = caam->sec;u32 ctpr_ms =sec_in32 (&sec->ctpr_ms);u32 scfgr =sec_in32 (&sec->scfgr); +u32 jrstart =jr_start_reg (caam->jrid);if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_INCL ) {/* VIRT_EN_INCL = 1 & VIRT_EN_POR = 1 or @@ -56,23 +67,16 @@ static inline void start_jr0(uint8_t sec_idx) */ if ((ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) || (scfgr &SEC_SCFGR_VIRT_EN )) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); }else {/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */ if (ctpr_ms &SEC_CTPR_MS_VIRT_EN_POR ) -sec_out32 (&sec->jrstartr,CONFIG_JRSTARTR_JR0 ); +sec_out32 (&sec->jrstartr, jrstart); } } -static inline void jr_reset_liodn (uint8_t sec_idx) +static inline void jr_disable_irq (struct jr_regs *regs) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -sec_out32 (&sec->jrliodnr[0 ].ls,0 ); -} - -static inline void jr_disable_irq(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx);uint32_t jrcfg =sec_in32 (®s->jrcfg1); jrcfg = jrcfg | JR_INTMASK; @@ -80,10 +84,10 @@ staticinline void
jr_disable_irq(uint8_t sec_idx)sec_out32(®s->jrcfg1, jrcfg); }drivers/crypto/fsl/jr.c +4
-3-static void jr_initregs (uint8_t sec_idx) +static void jr_initregs (uint8_t sec_idx,struct caam_regs +*caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];caam_dma_addr_t ip_base =virt_to_phys ((void *)jr->input_ring); caam_dma_addr_t op_base = virt_to_phys((void*)jr->output_ring);
drivers/crypto/fsl/jr.c +9
-52@@ -103,16 +107,16 @@ static void jr_initregs(uint8_t sec_idx)sec_out32 (®s->irs,JR_SIZE );if (!jr->irq) -jr_disable_irq (sec_idx); +jr_disable_irq (regs); } -static int jr_init (uint8_t sec_idx) +static int jr_init (uint8_t sec_idx,struct caam_regs *caam) { -struct jobring *jr = &jr0[sec_idx]; +struct jobring *jr = &caam->jr[sec_idx];memset (jr,0 ,sizeof (struct jobring )); - jr->jq_id =DEFAULT_JR_ID ; + jr->jq_id = caam->jrid; jr->irq =DEFAULT_IRQ ;#ifdef CONFIG_FSL_CORENET @@ -134,53 +138,8 @@ static int jr_init(uint8_t sec_idx)memset (jr->input_ring,0 ,JR_SIZE *sizeof (caam_dma_addr_t));memset (jr->output_ring,0 , jr->op_size); -start_jr0 (sec_idx); - -jr_initregs (sec_idx); - -return 0 ; -} - -static int jr_sw_cleanup(uint8_t sec_idx) -{ -struct jobring *jr = &jr0[sec_idx]; - - jr->head =0 ; - jr->tail =0 ; - jr->read_idx =0 ; - jr->write_idx =0 ; -memset (jr->info,0 ,sizeof (jr->info)); -memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); -memset (jr->output_ring,0 , jr->size *sizeof (struct op_ring )); - -return 0 ; -} - -static int jr_hw_reset(uint8_t sec_idx) -{ -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -uint32_t timeout =100000 ; -uint32_t jrint, jrcr; - -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrint =sec_in32 (®s->jrint); - }while (((jrint &JRINT_ERR_HALT_MASK ) == -JRINT_ERR_HALT_INPROGRESS ) && --timeout); - - jrint =sec_in32 (®s->jrint); -if (((jrint &JRINT_ERR_HALT_MASK ) != -JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) -return -1 ; - - timeout =100000 ; -sec_out32 (®s->jrcr,JRCR_RESET ); -do { - jrcr =sec_in32 (®s->jrcr); - }while ((jrcr &JRCR_RESET ) && --timeout); - -if (timeout ==0 ) -return -1 ; +start_jr (caam); +jr_initregs (sec_idx, caam);return 0 ; }@@ -188,10 +147,10 @@ static int jr_hw_reset(uint8_t sec_idx)/* -1 --- error, can't enqueue -- no space available */ static int jr_enqueue (uint32_t *desc_addr,void (*callback)(uint32_t status,void *arg), -void *arg,uint8_t sec_idx) +void *arg,uint8_t sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;uint32_t desc_word; int length = desc_len(desc_addr); @@ -263,10 +222,10 @@static int jr_enqueue(uint32_t
*desc_addr,return 0; }Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/crypto/fsl/jr.c static void desc_done(uint32_t status, void
Quoted 11 lines
drivers/crypto/fsl/jr.c +3
-3-static int jr_dequeue (int sec_idx) +static int jr_dequeue (int sec_idx,struct caam_regs *caam) { -struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); -struct jobring *jr = &jr0[sec_idx]; +struct jr_regs *regs = caam->regs; +struct jobring *jr = &caam->jr[sec_idx];int head = jr->head;int tail = jr->tail;int idx, i, found;@@ -349,14 +308,18 @@ static void desc_done(uint32_t status, void*arg)
Quoted 139 lines
Quoted 139 lines
Quoted 139 lines
Quoted 29 lines
drivers/crypto/fsl/jr.c +6
-2{struct result *x = arg; x->status = status; -#ifndef CONFIG_SPL_BUILD caam_jr_strstatus(status); -#endif x->done =1 ; }static inline int run_descriptor_jr_idx (uint32_t *desc,uint8_t sec_idx) { +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif unsigned long long timeval =0 ;unsigned long long timeout =CONFIG_USEC_DEQ_TIMEOUT ;struct result op;@@ -364,7 +327,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)memset (&op,0 ,sizeof (op)); - ret =jr_enqueue (desc, desc_done, &op, sec_idx); + ret =jr_enqueue (desc, desc_done, &op, sec_idx, caam);if (ret) {debug ("Error in SEC enq\n" );ret = JQ_ENQ_ERR;drivers/crypto/fsl/jr.c static inline int · line 338
Quoted 1 line
drivers/crypto/fsl/jr.c +0
-0@@ -375,7 +338,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc,
uint8_tsec_idx)Quoted 103 lines
drivers/crypto/fsl/jr.c +1
-1udelay (1 ); timeval +=1 ; - ret =jr_dequeue (sec_idx); + ret =jr_dequeue (sec_idx, caam);if (ret) {debug ("Error in SEC deq\n" );ret = JQ_DEQ_ERR; @@ -402,13 +365,62 @@ int run_descriptor_jr(uint32_t *desc) return run_descriptor_jr_idx(desc, 0); }drivers/crypto/fsl/jr.c +57
-9+static int jr_sw_cleanup (uint8_t sec_idx,struct caam_regs *caam) { +struct jobring *jr = &caam->jr[sec_idx]; + + jr->head =0 ; + jr->tail =0 ; + jr->read_idx =0 ; + jr->write_idx =0 ; +memset (jr->info,0 ,sizeof (jr->info)); +memset (jr->input_ring,0 , jr->size *sizeof (caam_dma_addr_t)); +memset (jr->output_ring,0 , jr->size *sizeof (struct +op_ring )); + +return 0 ; +} + +static int jr_hw_reset (struct jr_regs *regs) { +uint32_t timeout =100000 ; +uint32_t jrint, jrcr; + +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrint =sec_in32 (®s->jrint); + }while (((jrint &JRINT_ERR_HALT_MASK ) == +JRINT_ERR_HALT_INPROGRESS ) && --timeout); + + jrint =sec_in32 (®s->jrint); +if (((jrint &JRINT_ERR_HALT_MASK ) != +JRINT_ERR_HALT_INPROGRESS ) && timeout ==0 ) +return -1 ; + + timeout =100000 ; +sec_out32 (®s->jrcr,JRCR_RESET ); +do { + jrcr =sec_in32 (®s->jrcr); + }while ((jrcr &JRCR_RESET ) && --timeout); + +if (timeout ==0 ) +return -1 ; + +return 0 ; +} +static inline int jr_reset_sec (uint8_t sec_idx) { -if (jr_hw_reset (sec_idx) <0 ) +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +if (jr_hw_reset (caam->regs) <0 )return -1 ;/* Clean up the jobring structure maintained by software */ -jr_sw_cleanup (sec_idx); +jr_sw_cleanup (sec_idx, caam);return 0 ; }@@ -418,9 +430,15 @@ int jr_reset(void)return jr_reset_sec (0 ); } -static inline int sec_reset_idx (uint8_t sec_idx) +int sec_reset (void ) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) + caam =dev_get_priv (caam_dev);#else + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec;uint32_t mcfgr =sec_in32 (&sec->mcfgr);uint32_t timeout =100000 ;@@ -446,11 +464,7 @@ static inline int sec_reset_idx(uint8_t sec_idx)return 0 ; } -int sec_reset (void ) -{ -return sec_reset_idx (0 ); -} -#ifndef CONFIG_SPL_BUILD +static int deinstantiate_rng (u8 sec_idx,int state_handle_mask) {u32 *desc;drivers/crypto/fsl/jr.c +0
-0@@ -496,12 +510,11 @@ static int deinstantiate_rng(u8 sec_idx,Quoted 1 line
int
state_handle_mask)Quoted 3 lines
return ret; }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/crypto/fsl/jr.c
Quoted 8 lines
drivers/crypto/fsl/jr.c +2
-2-static int instantiate_rng (u8 sec_idx,int gen_sk) +static int instantiate_rng (uint8_t sec_idx,ccsr_sec_t *sec,int +gen_sk) {u32 *desc;u32 rdsta_val;int ret =0 , sh_idx, size; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
struct rng4tst
__iomem*rng =
(struct rng4tst__iomem*)&sec->rng;drivers/crypto/fsl/jr.c +1
-2@@ -554,9 +567,8 @@ static int instantiate_rng(u8 sec_idx, int gen_sk)return ret; } -static u8 get_rng_vid (uint8_t sec_idx) +static u8 get_rng_vid (ccsr_sec_t *sec) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx);u8 vid;Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/crypto/fsl/jr.c
Quoted 9 lines
drivers/crypto/fsl/jr.c +0
-0if (caam_get_era() < 10) { @@ -574,9 +586,8 @@ static u8
get_rng_vid(uint8_t sec_idx)
* By default, the TRNG runs for 200 clocks per sample;
* 1200 clocks per sample generates better entropy. */drivers/crypto/fsl/jr.c +1
-2-static void kick_trng (int ent_delay,uint8_t sec_idx) +static void kick_trng (int ent_delay,ccsr_sec_t *sec) { - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
drivers/crypto/fsl/jr.c static void kick_trng(int ent_delay, uint8_t
Quoted 4 lines
struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; u32 val;drivers/crypto/fsl/jr.c +0
-0@@ -603,10 +614,9 @@ static void kick_trng(int ent_delay, uint8_t
sec_idx)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/crypto/fsl/jr.c static void kick_trng(int ent_delay, uint8_t · line 609
Quoted 8 lines
drivers/crypto/fsl/jr.c +1
-2sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); } -static int rng_init (uint8_t sec_idx) +static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec) {int ret, gen_sk, ent_delay =RTSDCTL_ENT_DLY_MIN ; - ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem*)SEC_ADDR(sec_idx);
Quoted 250 lines
Quoted 250 lines
Quoted 250 lines
Quoted 55 lines
drivers/crypto/fsl/jr.c +2
-2struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng;u32 inst_handles;@@ -624,7 +634,7 @@ static int rng_init(uint8_t sec_idx)* the TRNG parameters. */ if (!inst_handles) { -kick_trng (ent_delay, sec_idx); +kick_trng (ent_delay, sec); ent_delay +=400 ; }/* @@ -634,7 +644,7 @@ static int rng_init(uint8_t sec_idx)* interval, leading to a sucessful initialization of * the RNG. */ - ret =instantiate_rng (sec_idx, gen_sk); + ret =instantiate_rng (sec_idx, sec, gen_sk); }while ((ret ==-1 ) && (ent_delay <RTSDCTL_ENT_DLY_MAX ));if (ret) { printf("SEC%u: Failed to instantiate RNG\n",
sec_idx); @@ -646,13 +656,28 @@ static intrng_init(uint8_t sec_idx)return ret; }drivers/crypto/fsl/jr.c +18
-4-#endif +int sec_init_idx (uint8_t sec_idx) { -ccsr_sec_t *sec = (void *)SEC_ADDR (sec_idx); -uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; - +struct caam_regs *caam; +#if CONFIG_IS_ENABLED (DM ) +if (!caam_dev) { +printf ("caam_jr: caam not found\n" ); +return -1 ; + } + caam =dev_get_priv (caam_dev);#else + caam_st.sec = (void *)SEC_ADDR (sec_idx); + caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); + caam_st.jrid =0 ; + caam = &caam_st; +#endif +ccsr_sec_t *sec = caam->sec; +uint32_t mcr =sec_in32 (&sec->mcfgr);#if +defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) +uint32_t jrdid_ms =0 ; +#endif #ifdef CONFIG_FSL_CORENET uint32_t liodnr;uint32_t liodn_ns;drivers/crypto/fsl/jr.c int sec_init_idx(uint8_t sec_idx) · line 711
Quoted 5 lines
drivers/crypto/fsl/jr.c +2
-0@@ -682,6 +707,11 @@ int sec_init_idx(uint8_t sec_idx) mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_IMX8M ) + jrdid_ms = JRDID_MS_TZ_OWN | JRDID_MS_PRIM_TZ |
JRDID_MS_PRIM_DID;Quoted 189 lines
drivers/crypto/fsl/jr.c +79
-9+sec_out32 (&sec->jrliodnr[caam->jrid].ms, jrdid_ms);#endif +jr_reset ();#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_SPL_BUILD @@ -693,20 +723,19 @@ int sec_init_idx(uint8_t sec_idx) liodn_ns =CONFIG_SPL_JR0_LIODN_NS &JRNSLIODN_MASK ; liodn_s =CONFIG_SPL_JR0_LIODN_S &JRSLIODN_MASK ; - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls) & + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls) & ~(JRNSLIODN_MASK |JRSLIODN_MASK ); liodnr = liodnr | (liodn_ns <<JRNSLIODN_SHIFT ) | (liodn_s <<JRSLIODN_SHIFT ); -sec_out32 (&sec->jrliodnr[0 ].ls, liodnr); +sec_out32 (&sec->jrliodnr[caam->jrid].ls, liodnr);#else - liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodnr =sec_in32 (&sec->jrliodnr[caam->jrid].ls); liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ;#endif #endif - - ret =jr_init (sec_idx); + ret =jr_init (sec_idx, caam);if (ret <0 ) {printf ("SEC%u: initialization failed\n" , sec_idx);return -1 ;@@ -719,9 +748,9 @@ int sec_init_idx(uint8_t sec_idx)pamu_enable ();#endif -#ifndef CONFIG_SPL_BUILD -if (get_rng_vid (sec_idx) >=4 ) { -if (rng_init (sec_idx) <0 ) { + +if (get_rng_vid (caam->sec) >=4 ) { +if (rng_init (sec_idx, caam->sec) <0 ) {printf ("SEC%u: RNG instantiation failed\n" , sec_idx);return -1 ; }@@ -735,7 +764,6 @@ int sec_init_idx(uint8_t sec_idx)printf ("SEC%u: RNG instantiated\n" , sec_idx); } -#endif return ret; }@@ -743,3 +771,76 @@ int sec_init(void) {return sec_init_idx (0 ); } + +#if CONFIG_IS_ENABLED (DM ) +static int caam_jr_ioctl (struct udevice *dev,unsigned long +request,void *buf) { +if (request !=CAAM_JR_RUN_DESC ) +return -ENOSYS ; + +return run_descriptor_jr (buf); } + +static int caam_jr_probe (struct udevice *dev) { +struct caam_regs *caam =dev_get_priv (dev); +fdt_addr_t addr; +ofnode node; +unsigned int jr_node =0 ; + + caam_dev = dev; + + addr =dev_read_addr (dev); +if (addr ==FDT_ADDR_T_NONE ) { +printf ("caam_jr: crypto not found\n" ); +return -EINVAL ; + } + caam->sec = (ccsr_sec_t *)(uintptr_t )addr; + caam->regs = (struct jr_regs *)caam->sec; + +/* Check for enabled job ring node */ +ofnode_for_each_subnode (node,dev_ofnode (dev)) { +if (!ofnode_is_available (node)) +continue ; + + jr_node =ofnode_read_u32_default (node,"reg" ,-1 ); +if (jr_node >0 ) { + caam->regs = (struct jr_regs *)((ulong )caam->sec + jr_node); +while (!(jr_node &0x0F )) + jr_node = jr_node >>4 ; + + caam->jrid = jr_node -1 ; +break ; + } + } + +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +return 0 ; +} + +static int caam_jr_bind (struct udevice *dev) { +return 0 ; +} + +static const struct misc_ops caam_jr_ops = { + .ioctl = caam_jr_ioctl, +}; + +static const struct udevice_id caam_jr_match[] = { + { .compatible ="fsl,sec-v4.0" }, + { } +}; + +U_BOOT_DRIVER (caam_jr) = { + .name ="caam_jr" , + .id =UCLASS_MISC , + .of_match = caam_jr_match, + .ops = &caam_jr_ops, + .bind = caam_jr_bind, + .probe = caam_jr_probe, + .priv_auto =sizeof (struct caam_regs ), +}; +#endif drivers/crypto/fsl/jr.h +3
-0@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2008-2014 Freescale Semiconductor, Inc. +* Copyright 2021 NXP * */ @@ -8,7 +9,9 @@#define __JR_H#include <linux/compiler.h> +#include "fsl_sec.h" #include "type.h" +#include <misc.h> #define JR_SIZE 4 /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@#define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x00000fffdrivers/crypto/fsl/jr.h +25
-3-#define JQ_DEQ_ERR -1 -#define JQ_DEQ_TO_ERR -2 -#define JQ_ENQ_ERR -3 +#define JRDID_MS_PRIM_DID BIT(0) +#define JRDID_MS_PRIM_TZ BIT(4) +#define JRDID_MS_TZ_OWN BIT(15) + +#define JQ_DEQ_ERR (-1) +#define JQ_DEQ_TO_ERR (-2) +#define JQ_ENQ_ERR (-3)#define RNG4_MAX_HANDLES 2 +enum { +/* Run caam jobring descriptor(in buf) */ +CAAM_JR_RUN_DESC , +}; +struct op_ring {caam_dma_addr_t desc;uint32_t status;@@ -102,6 +114,19 @@ struct result {uint32_t status; }; +/* +* struct caam_regs - CAAM initialization register interface +* +* Interface to caam memory map, jobring register, jobring storage. +*/ +struct caam_regs { +ccsr_sec_t *sec;/*caam initialization registers*/ +struct jr_regs *regs;/*jobring configuration registers*/ +u8 jrid;/*id to identify a jobring*/ +/*Private sub-storage for a single JobR*/ +struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC ]; +}; +void caam_jr_strstatus (u32 status);Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
drivers/crypto/fsl/jr.h struct result { · line 132
Quoted 2 lines
drivers/crypto/fsl/jr.h +0
-0int run_descriptor_jr (uint32_t *desc);--
=================================================================
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]=================================================================
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
====
--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Stefano,
Quoted 27 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefano Babic
Sent: Thursday, March 3, 2022 4:30 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; u- [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHi,
Quoted 5 lines · Gaurav Jain
Hi Stefano
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solution
Quoted 15 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 9 lines
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to change).
I had a couple of concerns which I raised in V10 without any follow-up.
Main thing is the JR reservation, which (if applied) would lead to misconfiguration when upstream TF-A is used, see [1].
Quoted 4 lines
Regards,
Stefano
-- andrey
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Andrey
Quoted 82 lines
-----Original Message-----
From: ZHIZHIKIN Andrey <[email protected]>
Sent: Monday, March 7, 2022 1:08 AM
To: Stefano Babic <[email protected]>; Gaurav Jain <[email protected]>; u- [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl- uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hello Stefano,
Quoted 7 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefano Babic
Sent: Thursday, March 3, 2022 4:30 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; u- [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>;Quoted 8 lines
Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>;
Alison
Quoted 1 line
Wang <[email protected]>; Pramod Kumar
Quoted 13 lines
Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHi,
Quoted 5 lines · Gaurav Jain
Hi Stefano
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionQuoted 15 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 9 lines
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
change).
I had a couple of concerns which I raised in V10 without any follow-up.
Main thing is the JR reservation, which (if applied) would lead to misconfiguration when upstream TF-A is used, see [1].
Quoted 4 lines
Regards,
Stefano
Quoted 10 lines
Link: [1]:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kern
el.org%2Fu- boot%2FAM6PR06MB4691178347827CB77F44F537A6309%40AM6PR06MB4691 .eurprd06.prod.outlook.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.c om%7C87775d9291044d6aad3808d9ffa8db17%7C686ea1d3bc2b4c6fa92cd99c5 c301635%7C0%7C0%7C637821922977072803%7CUnknown%7CTWFpbGZsb3d8 eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D% 7C3000&sdata=3Gng6vVpNKyV8xNLSEuwG%2F7DEVDjSnYh5iYi47wvyvc%3 D&reserved=0
Ok, I will follow the approach suggested by you. First a patch will be submitted to ATF and then the one for uboot will follow. Will send a V11 after removing the JR0 reservation code. Any other concern?
Gaurav
Quoted 2 lines
-- andrey
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Gaurav,
Quoted 19 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Gaurav Jain
Sent: Monday, March 7, 2022 3:10 PM
To: ZHIZHIKIN Andrey <[email protected]>; Stefano Babic <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver model
Quoted 5 lines
Hello Andrey
Ok, I will follow the approach suggested by you. First a patch will be submitted to ATF and then the one for uboot will follow.
Perfect, thanks a lot for following it up here!
Quoted 1 line
Will send a V11 after removing the JR0 reservation code. Any other concern?
Besides the one above, I have no further concerns on the series.
Quoted 4 lines
Gaurav
Quoted 1 line
-- andrey
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
In reply to Stefano BabicQuoted 19 lines · Gaurav Jain
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 12 lines
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to change).
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
-michael
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 42 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Quoted 19 lines · Gaurav Jain
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 12 lines
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
Quoted 5 lines
change).
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
imx6dl_mamoj caam driver is not enabled by any of my changes.
This board is enabling IMX_HAB which select FSL_CAAM.
Proposed changes making it imply so that FSL_CAAM can be disabled in board defconfig.
Gaurav
Quoted 12 lines
-michael
[1]
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kern
el.org%2Fu- boot%2F4068dc3f802dad82972c64123743fd08%40walle.cc%2F&data=04% 7C01%7Cgaurav.jain%40nxp.com%7C998fc3ba1b384d75e58708da0021058b%7 C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637822439101994232%7 CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI 6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=u7fCKThNnSHG0ttLAzOxTo0 SHC6kGAwDpJgUmdSDokw%3D&reserved=0
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Am 2022-03-07 11:56, schrieb Gaurav Jain:
Quoted 44 lines
Quoted 44 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Quoted 19 lines · Gaurav Jain
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 12 lines
As we have not received any response from
imx6dl_mamojboard maintainer. I propose the below solutionarch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
change).
Quoted 8 lines
Quoted 3 lines
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
imx6dl_mamojcaam driver is not enabled by any of my changes. This board is enablingIMX_HABwhich selectFSL_CAAM. Proposed changes making it imply so thatFSL_CAAMcan be disabled in board defconfig.
Ahh it was already selected before. But mhh, does IMX_HAB even makes sense without FSL_CAAM? Why was is a hard dependency before?
-michael
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 77 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 4:39 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 11:56, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyTang
Quoted 16 lines
Quoted 16 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 4 lines
Quoted 4 lines
Caution: EXT Email
Quoted 2 lines · Gaurav Jain
Quoted 1 line
As we have not received any response from
imx6dl_mamojboardmaintainer.
Quoted 24 lines
Quoted 23 lines
Quoted 18 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 11 lines
I propose the below solution
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
change).
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
Quoted 7 lines
Quoted 4 lines
imx6dl_mamojcaam driver is not enabled by any of my changes. This board is enablingIMX_HABwhich selectFSL_CAAM. Proposed changes making it imply so thatFSL_CAAMcan be disabled in board defconfig.Ahh it was already selected before. But mhh, does
IMX_HABeven makes sense withoutFSL_CAAM? Why was is a hard dependency before?
With imply, this will still enable FSL_CAAM unless it is explicitly disabled in defconfig. With select I do not have choice of disabling FSL_CAAM in defconfig. Now I have disabled FSL_CAAM only for imx6dl_mamoj_defconfig, as it is reporting spl size issues with caam driver model approach.
Gaurav
Quoted 2 lines
-michael
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Am 2022-03-07 12:33, schrieb Gaurav Jain:
Quoted 80 lines
Quoted 80 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 4:39 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 11:56, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyTang
Quoted 16 lines
Quoted 16 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 4 lines
Quoted 4 lines
Caution: EXT Email
Quoted 2 lines · Gaurav Jain
Quoted 1 line
As we have not received any response from
imx6dl_mamojboardmaintainer.
Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 11 lines
I propose the below solution
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
Quoted 5 lines
change).
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
imx6dl_mamojcaam driver is not enabled by any of my changes. This board is enablingIMX_HABwhich selectFSL_CAAM. Proposed changes making it imply so thatFSL_CAAMcan be disabled in board defconfig.
Quoted 8 lines
Quoted 2 lines
Ahh it was already selected before. But mhh, does
IMX_HABeven makes sense withoutFSL_CAAM? Why was is a hard dependency before?With imply, this will still enable
FSL_CAAMunless it is explicitly disabled in defconfig. With select I do not have choice of disablingFSL_CAAMin defconfig. Now I have disabledFSL_CAAMonly forimx6dl_mamoj_defconfig, as it is reporting spl size issues with caam driver model approach.
I can see *what* you are doing, but that doesn't answer *why* it was a hard dependency before and why now of a sudden can be a soft dependency.
-michael
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 112 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 5:12 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 12:33, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 4:39 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyTang
Quoted 6 lines
Quoted 6 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>;
Priyanka
Quoted 18 lines
Quoted 18 lines
Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 11:56, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyQuoted 7 lines
Quoted 7 lines
Tang
Quoted 6 lines
Quoted 6 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod
Kumar
Quoted 47 lines
Quoted 46 lines
Quoted 10 lines
Quoted 10 lines
<[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 4 lines
Quoted 4 lines
Caution: EXT Email
Quoted 2 lines · Gaurav Jain
Quoted 1 line
As we have not received any response from
imx6dl_mamojboardmaintainer.
Quoted 20 lines
Quoted 20 lines
Quoted 18 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 11 lines
I propose the below solution
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
change).
Quoted 8 lines
Quoted 3 lines
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
imx6dl_mamojcaam driver is not enabled by any of my changes. This board is enablingIMX_HABwhich selectFSL_CAAM. Proposed changes making it imply so thatFSL_CAAMcan be disabled in board defconfig.Ahh it was already selected before. But mhh, does
IMX_HABeven makes sense withoutFSL_CAAM? Why was is a hard dependency before?
Quoted 8 lines
Quoted 5 lines
With imply, this will still enable
FSL_CAAMunless it is explicitly disabled in defconfig. With select I do not have choice of disablingFSL_CAAMin defconfig. Now I have disabledFSL_CAAMonly forimx6dl_mamoj_defconfig, as it is reporting spl size issues with caam driver model approach.I can see *what* you are doing, but that doesn't answer *why* it was a hard dependency before and why now of a sudden can be a soft dependency.
I am not sure of any other dependency, but from the code ./arch/arm/mach-imx/cmd_dek.c needs caam for blob_encap_dek operation for mx6, mx7, mx7ulp. Making it soft dependency allows me to disable caam for imx6dl_mamoj.
Gaurav
Quoted 2 lines
-michael
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 118 lines · Gaurav Jain
Quoted 118 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 5:12 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 12:33, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 4:39 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyTang
Quoted 6 lines
Quoted 6 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>;
Priyanka
Quoted 18 lines
Quoted 18 lines
Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 11:56, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyQuoted 7 lines
Quoted 7 lines
Tang
Quoted 6 lines
Quoted 6 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod
Kumar
Quoted 52 lines
Quoted 39 lines
Quoted 10 lines
Quoted 10 lines
<[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 4 lines
Quoted 4 lines
Caution: EXT Email
Quoted 2 lines · Gaurav Jain
Quoted 1 line
As we have not received any response from
imx6dl_mamojboardmaintainer.
Quoted 24 lines
Quoted 23 lines
Quoted 18 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config IMX_HAB · line 52
Quoted 11 lines
I propose the below solution
arch/arm/mach-imx/Kconfig +2
-2@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config IMX_HAB - select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpIMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
change).
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
Quoted 7 lines
Quoted 4 lines
imx6dl_mamojcaam driver is not enabled by any of my changes. This board is enablingIMX_HABwhich selectFSL_CAAM. Proposed changes making it imply so thatFSL_CAAMcan be disabled in board defconfig.Ahh it was already selected before. But mhh, does
IMX_HABeven makes sense withoutFSL_CAAM? Why was is a hard dependency before?With imply, this will still enable
FSL_CAAMunless it is explicitly disabled in defconfig. With select I do not have choice of disablingFSL_CAAMin defconfig. Now I have disabledFSL_CAAMonly forimx6dl_mamoj_defconfig, as it is reporting spl size issues with caam driver model approach.
Quoted 5 lines
Quoted 2 lines
I can see *what* you are doing, but that doesn't answer *why* it was a hard dependency before and why now of a sudden can be a soft dependency.
I am not sure of any other dependency, but from the code
./arch/arm/mach-imx/cmd_dek.cneeds caam forblob_encap_dekoperation for mx6, mx7, mx7ulp. Making it soft dependency allows me to disable caam forimx6dl_mamoj.
Yes, but can you reasonably, functionally, do that? Or are you just making things link but now the platform is non functional? Nothing that's an actual shell cmd should be linked in / included in the SPL binary (it should get discarded if built), but my recollection from migrating the HAB/CAAM symbols to Kconfig is that functionally you can't do what you're trying to do.
Signature · 1 line
Tom
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Tom
Quoted 157 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Monday, March 7, 2022 8:46 PM
To: Gaurav Jain <[email protected]>
Cc: Michael Walle <[email protected]>; [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 14 lines · Gaurav Jain
Quoted 14 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 5:12 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>;Priyanka
Quoted 45 lines
Quoted 45 lines
Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 12:33, schrieb Gaurav Jain:
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 4:39 PM
To: Gaurav Jain <[email protected]>
Cc: [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyTang
Quoted 6 lines
Quoted 6 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>;
Priyanka
Quoted 19 lines
Quoted 19 lines
Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Am 2022-03-07 11:56, schrieb Gaurav Jain:
Quoted 7 lines
Quoted 7 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, March 7, 2022 3:28 PM
To: [email protected]
Cc: Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; AndyQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Tang
Quoted 5 lines
Quoted 5 lines
<[email protected]>; [email protected]; Franck Lenormand <[email protected]>; Gaurav Jain <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu
Quoted 18 lines
Quoted 18 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod
Kumar
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
<[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Michael Walle <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Quoted 1 line · Gaurav Jain
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
As we have not received any response from
imx6dl_mamojboardmaintainer.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config
Quoted 5 lines
I propose the below solution
arch/arm/mach-imx/Kconfig +0
-0@@ -49,8 +49,8 @@ config USE_IMXIMG_PLUGIN config
IMX_HABQuoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 27 lines
Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
arch/arm/mach-imx/Kconfig config USE_IMXIMG_PLUGIN config · line 52
Quoted 6 lines
arch/arm/mach-imx/Kconfig +2
-2- select FSL_CAAM if HAS_CAAM - imply CMD_DEKBLOB if HAS_CAAM + imply FSL_CAAM if HAS_CAAM + imply CMD_DEKBLOB if FSL_CAAM HelpQuoted 7 lines
IMO this is ok, I was also wrong, Marek is not the maintainer of this board. This was the only board with broken build - let's say, I will still wait a couple of days, and if there is no comments, I will apply your series (but then V10). I can apply this fix myself, no need to post the series again (I have not seen any other comment or request to
change).
Quoted 8 lines
Quoted 3 lines
I don't understand why the solution isn't the same one as for the layerscape part in this series[1]: enable the config per board (that is your boards) and leave all others the same as before?
imx6dl_mamojcaam driver is not enabled by any of my changes. This board is enablingIMX_HABwhich selectFSL_CAAM. Proposed changes making it imply so thatFSL_CAAMcan be disabled in board defconfig.Ahh it was already selected before. But mhh, does
IMX_HABeven makes sense withoutFSL_CAAM? Why was is a hard dependency before?Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
With imply, this will still enable
FSL_CAAMunless it is explicitly disabled in defconfig. With select I do not have choice of disablingFSL_CAAMin defconfig. Now I have disabledFSL_CAAMonly forimx6dl_mamoj_defconfig, as it is reporting spl size issues with caam driver model approach.I can see *what* you are doing, but that doesn't answer *why* it was a hard dependency before and why now of a sudden can be a soft
dependency.
Quoted 2 lines
I am not sure of any other dependency, but from the code
./arch/arm/mach-
imx/cmd_dek.cneeds caam forblob_encap_dekoperation for mx6, mx7, mx7ulp.
Quoted 8 lines
Quoted 1 line
Making it soft dependency allows me to disable caam for
imx6dl_mamoj.Yes, but can you reasonably, functionally, do that? Or are you just making things link but now the platform is non functional? Nothing that's an actual shell cmd should be linked in / included in the SPL binary (it should get discarded if built), but my recollection from migrating the HAB/CAAM symbols to
Kconfigis that functionally you can't do what you're trying to do.
I further checked on your concern and propose the below change to stop building caam driver in SPL for imx6dl_mamoj.
configs/imx6dl_mamoj_defconfig +1 -0
@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=n
Gaurav
Quoted 2 lines
--
Tom
Fabio Estevam
reviewerRe: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 9 lines · Gaurav Jain
I further checked on your concern and propose the below change to stop building caam driver in SPL for
imx6dl_mamoj.configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=n
No, this is not how defconfig works.
You should set:
# CONFIG_SPL_CRYPTO is not set
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 40 lines
-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Tuesday, March 8, 2022 4:42 PM
To: Gaurav Jain <[email protected]>
Cc: Tom Rini <[email protected]>; Michael Walle <[email protected]>; [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Quoted 1 line · Gaurav Jain
I further checked on your concern and propose the below change to stop
building caam driver in SPL for
imx6dl_mamoj.configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not set
Ok. Noted.
Gaurav
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
In reply to Fabio EstevamQuoted 14 lines · Fabio Estevam
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 9 lines · Gaurav Jain
I further checked on your concern and propose the below change to stop building caam driver in SPL for
imx6dl_mamoj.configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not set
But more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like. Why are you not fixing the board so it still links? What makes this board a problem that other (I assume) imx6dl boards are not?
Signature · 1 line
Tom
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 39 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Tuesday, March 8, 2022 6:19 PM
To: Fabio Estevam <[email protected]>
Cc: Gaurav Jain <[email protected]>; Michael Walle <[email protected]>; [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 3 lines · Fabio Estevam
Quoted 1 line · Gaurav Jain
I further checked on your concern and propose the below change to stop
building caam driver in SPL for
imx6dl_mamoj.Quoted 11 lines
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 9 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like. Why are you not fixing the board so it still links? What makes this board a problem that other (I assume) imx6dl boards are not?
SPL exceeds the maximum size for only imx6dl_mamoj. spl/u-boot-spl.bin exceeds file size limit:
limit: 0xefa0 bytes
actual: 0x1004d bytes
excess: 0x10ad bytes
on further checking I see that caam is not initialized in SPL but only built. So disabling the build for caam driver in SPL should not be a problem.
(Added Jagan, Raffaele, Simone as board maintainer.)
Gaurav
Quoted 2 lines
--
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 54 lines · Gaurav Jain
Quoted 39 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Tuesday, March 8, 2022 6:19 PM
To: Fabio Estevam <[email protected]>
Cc: Gaurav Jain <[email protected]>; Michael Walle <[email protected]>; [email protected]; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelQuoted 3 lines · Fabio Estevam
Quoted 1 line · Gaurav Jain
I further checked on your concern and propose the below change to stop
building caam driver in SPL for
imx6dl_mamoj.Quoted 11 lines
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 9 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like. Why are you not fixing the board so it still links? What makes this board a problem that other (I assume) imx6dl boards are not?
SPL exceeds the maximum size for only
imx6dl_mamoj. spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0x1004dbytes
excess:0x10adbytes
Quoted 4 lines
on further checking I see that caam is not initialized in SPL but only built. So disabling the build for caam driver in SPL should not be a problem.
(Added Jagan, Raffaele, Simone as board maintainer.)
That's a lot of growth, what's going on? And is the CAAM being built but not initialized a generic issue with imx6 platforms? That seems like something to further understand, and hopefully the board maintainers can chime in here soon.
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
In reply to Tom RiniHi Tom,
Quoted 15 lines · Tom Rini
Quoted 14 lines · Fabio Estevam
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 9 lines · Gaurav Jain
I further checked on your concern and propose the below change to stop building caam driver in SPL for
imx6dl_mamoj.configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 7 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like.
This was my blocking point, too, for this series. There is no answer about the board.
I can just imagine (as for other MX6DL) that the required functionality is secure boot, then CONFIG_IMX_HAB is enough. But well, just the board maintainers can say. Added Raffaele and Jagan as reported maintainers for this board.
Quoted 2 lines
Why are you not fixing the board so it still links? What
makes this board a problem that other (I assume) imx6dl boards are not?
Well, this board has, compared to other MX6DL, a lot of SPL_ option that are bloating the SPL size. And then does not match anymore with the internal RAm, while other MX6DL boards are not so affected by the increased size because they have no SPL at all or SPL with less options and then smaller. We do not need to fix the link, but reduce the size, and nobody else than the maintainers can tell us if removing some feature is ok.
Regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi
Quoted 38 lines · Stefano Babic
Hi Tom,
Quoted 15 lines · Tom Rini
Quoted 14 lines · Fabio Estevam
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 9 lines · Gaurav Jain
I further checked on your concern and propose the below change to stop building caam driver in SPL for
imx6dl_mamoj.configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 7 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like.
This was my blocking point, too, for this series. There is no answer about the board.
I can just imagine (as for other MX6DL) that the required functionality is secure boot, then
CONFIG_IMX_HABis enough. But well, just the board maintainers can say. Added Raffaele and Jagan as reported maintainers for this board.Quoted 2 lines
Why are you not fixing the board so it still links? What
makes this board a problem that other (I assume) imx6dl boards are not?
Quoted 8 lines
Well, this board has, compared to other MX6DL, a lot of
SPL_option that are bloating the SPL size. And then does not match anymore with the internal RAm, while other MX6DL boards are not so affected by the increased size because they have no SPL at all or SPL with less options and then smaller. We do not need to fix the link, but reduce the size, and nobody else than the maintainers can tell us if removing some feature is ok.
I will test this week, and try to find a board here to test
* Jagan * Do you have a momoj?
Michael
Quoted 9 lines
Regards,
Stefano--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Michael
Quoted 77 lines
-----Original Message-----
From: Michael Nazzareno Trimarchi <[email protected]>
Sent: Tuesday, March 8, 2022 7:05 PM
To: Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio Estevam <[email protected]>; Gaurav Jain <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi
Quoted 6 lines · Stefano Babic
Hi Tom,
Quoted 2 lines · Tom Rini
Quoted 1 line · Fabio Estevam
On Tue, Mar 8, 2022 at 8:10 AM Gaurav Jain <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I further checked on your concern and propose the below change to
stop building caam driver in SPL for
imx6dl_mamoj.Quoted 30 lines
Quoted 11 lines
Quoted 11 lines
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 7 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like.
This was my blocking point, too, for this series. There is no answer about the board.
I can just imagine (as for other MX6DL) that the required functionality is secure boot, then
CONFIG_IMX_HABis enough. But well, just the board maintainers can say. Added Raffaele and Jagan as reported maintainers for this board.Quoted 2 lines
Why are you not fixing the board so it still links? What makes
this board a problem that other (I assume) imx6dl boards are not?Quoted 8 lines
Well, this board has, compared to other MX6DL, a lot of
SPL_option that are bloating the SPL size. And then does not match anymore with the internal RAm, while other MX6DL boards are not so affected by the increased size because they have no SPL at all or SPL with less options and then smaller. We do not need to fix the link, but reduce the size, and nobody else than the maintainers can tell us if removing some feature is ok.
Quoted 3 lines
I will test this week, and try to find a board here to test
* Jagan * Do you have a momoj?
Have you tested mamoj board?
Regards
Gaurav
Quoted 36 lines
Michael
Quoted 5 lines
Regards,
Stefano--
================================================================
=====Quoted 4 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]================================================================
=====--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected]
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.a
marulasolutions.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.com% 7C843e57f75346449f13ae08da010867b6%7C686ea1d3bc2b4c6fa92cd99c5c3 01635%7C0%7C0%7C637823432854617357%7CUnknown%7CTWFpbGZsb3d8 eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 D%7C3000&sdata=f025HmlIM8FuTEYspDjwOevTT1k7JRZeIiS%2FpTH2hc Y%3D&reserved=0
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hello Michael
A gentle reminder!!
As you said earlier, can you test the mamoj board with proposed solution to fix SPL size issue.
Regards
Gaurav Jain
Quoted 159 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, March 14, 2022 11:18 AM
To: Michael Nazzareno Trimarchi <[email protected]>; Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio Estevam <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHi Michael
Quoted 5 lines
-----Original Message-----
From: Michael Nazzareno Trimarchi <[email protected]>
Sent: Tuesday, March 8, 2022 7:05 PM
To: Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio EstevamQuoted 74 lines
Gaurav Jain <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi
Quoted 6 lines · Stefano Babic
Hi Tom,
Quoted 2 lines · Tom Rini
Quoted 1 line · Fabio Estevam
On Tue, Mar 8, 2022 at 8:10 AM Gaurav Jain <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I further checked on your concern and propose the below change to
stop building caam driver in SPL for
imx6dl_mamoj.Quoted 30 lines
Quoted 11 lines
Quoted 11 lines
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 7 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like.
This was my blocking point, too, for this series. There is no answer about the board.
I can just imagine (as for other MX6DL) that the required functionality is secure boot, then
CONFIG_IMX_HABis enough. But well, just the board maintainers can say. Added Raffaele and Jagan as reported maintainers for this board.Quoted 2 lines
Why are you not fixing the board so it still links? What makes
this board a problem that other (I assume) imx6dl boards are not?Quoted 8 lines
Well, this board has, compared to other MX6DL, a lot of
SPL_option that are bloating the SPL size. And then does not match anymore with the internal RAm, while other MX6DL boards are not so affected by the increased size because they have no SPL at all or SPL with less options and then smaller. We do not need to fix the link, but reduce the size, and nobody else than the maintainers can tell us if removing some feature is ok.Quoted 3 lines
I will test this week, and try to find a board here to test
* Jagan * Do you have a momoj?
Have you tested mamoj board?
Regards
GauravQuoted 9 lines
Michael
Quoted 5 lines
Regards,
Stefano--
================================================================
Quoted 8 lines
=====
Quoted 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]================================================================
Quoted 11 lines
=====
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Quoted 4 lines
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected]https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.a
Quoted 2 lines
marulasolutions.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.com%
7C843e57f75346449f13ae08da010867b6%7C686ea1d3bc2b4c6fa92cd99c5c3
Quoted 1 line
01635%7C0%7C0%7C637823432854617357%7CUnknown%7CTWFpbGZsb3d8
Quoted 1 line
eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3
Quoted 1 line
D%7C3000&sdata=f025HmlIM8FuTEYspDjwOevTT1k7JRZeIiS%2FpTH2hc
Quoted 1 line
Y%3D&reserved=0
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
HI
Please send me a link to apply your series
Michael
Quoted 168 lines · Gaurav Jain
Hello Michael
A gentle reminder!!
As you said earlier, can you test the mamoj board with proposed solution to fix SPL size issue.Regards
Gaurav JainQuoted 159 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, March 14, 2022 11:18 AM
To: Michael Nazzareno Trimarchi <[email protected]>; Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio Estevam <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHi Michael
Quoted 5 lines
-----Original Message-----
From: Michael Nazzareno Trimarchi <[email protected]>
Sent: Tuesday, March 8, 2022 7:05 PM
To: Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio EstevamQuoted 74 lines
Gaurav Jain <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi
Quoted 6 lines · Stefano Babic
Hi Tom,
Quoted 2 lines · Tom Rini
Quoted 1 line · Fabio Estevam
On Tue, Mar 8, 2022 at 8:10 AM Gaurav Jain <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I further checked on your concern and propose the below change to
stop building caam driver in SPL for
imx6dl_mamoj.Quoted 30 lines
Quoted 11 lines
Quoted 11 lines
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 7 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like.
This was my blocking point, too, for this series. There is no answer about the board.
I can just imagine (as for other MX6DL) that the required functionality is secure boot, then
CONFIG_IMX_HABis enough. But well, just the board maintainers can say. Added Raffaele and Jagan as reported maintainers for this board.Quoted 2 lines
Why are you not fixing the board so it still links? What makes
this board a problem that other (I assume) imx6dl boards are not?Quoted 8 lines
Well, this board has, compared to other MX6DL, a lot of
SPL_option that are bloating the SPL size. And then does not match anymore with the internal RAm, while other MX6DL boards are not so affected by the increased size because they have no SPL at all or SPL with less options and then smaller. We do not need to fix the link, but reduce the size, and nobody else than the maintainers can tell us if removing some feature is ok.Quoted 3 lines
I will test this week, and try to find a board here to test
* Jagan * Do you have a momoj?
Have you tested mamoj board?
Regards
GauravQuoted 9 lines
Michael
Quoted 5 lines
Regards,
Stefano--
================================================================
Quoted 8 lines
=====
Quoted 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]================================================================
Quoted 11 lines
=====
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Quoted 4 lines
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected]https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.a
Quoted 2 lines
marulasolutions.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.com%
7C843e57f75346449f13ae08da010867b6%7C686ea1d3bc2b4c6fa92cd99c5c3
Quoted 1 line
01635%7C0%7C0%7C637823432854617357%7CUnknown%7CTWFpbGZsb3d8
Quoted 1 line
eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3
Quoted 1 line
D%7C3000&sdata=f025HmlIM8FuTEYspDjwOevTT1k7JRZeIiS%2FpTH2hc
Quoted 1 line
Y%3D&reserved=0
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Gaurav
Quoted 129 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
Michael
Quoted 121 lines · Gaurav Jain
Hello Michael
A gentle reminder!!
As you said earlier, can you test the mamoj board with proposed solution to fix SPL size issue.Regards
Gaurav JainQuoted 112 lines
-----Original Message-----
From: Gaurav Jain
Sent: Monday, March 14, 2022 11:18 AM
To: Michael Nazzareno Trimarchi <[email protected]>; Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio Estevam <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelHi Michael
Quoted 5 lines
-----Original Message-----
From: Michael Nazzareno Trimarchi <[email protected]>
Sent: Tuesday, March 8, 2022 7:05 PM
To: Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>; Fabio EstevamQuoted 74 lines
Gaurav Jain <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; u- [email protected]; dl-uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
Hi
Quoted 6 lines · Stefano Babic
Hi Tom,
Quoted 2 lines · Tom Rini
Quoted 1 line · Fabio Estevam
On Tue, Mar 8, 2022 at 8:10 AM Gaurav Jain <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I further checked on your concern and propose the below change to
stop building caam driver in SPL for
imx6dl_mamoj.Quoted 30 lines
Quoted 11 lines
Quoted 11 lines
configs/imx6dl_mamoj_defconfig CONFIG_USB_GADGET_MANUFACTURER="FSL" · line 64
Quoted 8 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -61,3 +61,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_SPL_CRYPTO=nNo, this is not how defconfig works.
Quoted 7 lines
Quoted 3 lines
You should set:
#
CONFIG_SPL_CRYPTOis not setBut more, WHY is this the right answer? You're disabling functionality and the board maintainers aren't even on the CC list for this thread it looks like.
This was my blocking point, too, for this series. There is no answer about the board.
I can just imagine (as for other MX6DL) that the required functionality is secure boot, then
CONFIG_IMX_HABis enough. But well, just the board maintainers can say. Added Raffaele and Jagan as reported maintainers for this board.Quoted 2 lines
Why are you not fixing the board so it still links? What makes
this board a problem that other (I assume) imx6dl boards are not?Quoted 8 lines
Well, this board has, compared to other MX6DL, a lot of
SPL_option that are bloating the SPL size. And then does not match anymore with the internal RAm, while other MX6DL boards are not so affected by the increased size because they have no SPL at all or SPL with less options and then smaller. We do not need to fix the link, but reduce the size, and nobody else than the maintainers can tell us if removing some feature is ok.Quoted 3 lines
I will test this week, and try to find a board here to test
* Jagan * Do you have a momoj?
Have you tested mamoj board?
git diff
arch/arm/mach-imx/mx6/Kconfig +0 -1
@@ -309,7 +309,6 @@ config TARGET_MX6DL_MAMOJ select PINCTRL select SPL select SPL_DM if SPL - select SPL_GPIO if SPL select SPL_LIBCOMMON_SUPPORT if SPL select SPL_LIBDISK_SUPPORT if SPL select SPL_LIBGENERIC_SUPPORT if SPL
I strongly suggest to drop this and check again for now. I don't have access to board and I have asked Jagan
Michael
Quoted 62 lines
Quoted 39 lines
Quoted 39 lines
Regards
GauravQuoted 9 lines
Michael
Quoted 5 lines
Regards,
Stefano--
================================================================
Quoted 8 lines
=====
Quoted 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
[email protected]================================================================
Quoted 11 lines
=====
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Quoted 4 lines
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected]https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.a
Quoted 2 lines
marulasolutions.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.com%
Quoted 8 lines
Quoted 8 lines
7C843e57f75346449f13ae08da010867b6%7C686ea1d3bc2b4c6fa92cd99c5c3
Quoted 1 line
01635%7C0%7C0%7C637823432854617357%7CUnknown%7CTWFpbGZsb3d8
Quoted 1 line
eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3
Quoted 1 line
D%7C3000&sdata=f025HmlIM8FuTEYspDjwOevTT1k7JRZeIiS%2FpTH2hc
Quoted 1 line
Y%3D&reserved=0
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Fabio Estevam
reviewerRe: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
In reply to Michael Nazzareno TrimarchiHi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi
Quoted 6 lines · Fabio Estevam
Hi Michael,
Quoted 1 line · Michael Nazzareno Trimarchi
Quoted 6 lines
Quoted 3 lines
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Done, well, I have tried remove DM_GPIO in SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?
Michael
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 11 lines · Michael Nazzareno Trimarchi
Hi
Quoted 8 lines · Fabio Estevam
Hi Michael,
Quoted 3 lines · Michael Nazzareno Trimarchi
HI
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?
That is very strange. Can you post your patches somewhere?
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
Tom
Start from here 9776c4e9d00ac49d6388ffe9e084ff03b37ae479 export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make imx6dl_mamoj_defconfig
build it
Try then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit: 0xefa0 bytes
actual: 0xf071 bytes
excess: 0xd1 bytes
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
Michael
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 39 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
Quoted 7 lines
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesSo LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytes
Quoted 7 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help here
Michael
Quoted 2 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help here
Yes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi
Quoted 65 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help here
Quoted 3 lines
Yes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
Michael
Quoted 3 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 68 lines · Michael Nazzareno Trimarchi
Hi
Quoted 65 lines · Tom Rini
Quoted 62 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help here
Quoted 6 lines
Quoted 3 lines
Yes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Tom
Quoted 74 lines · Tom Rini
Quoted 72 lines · Michael Nazzareno Trimarchi
Hi
Quoted 68 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help hereYes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles
-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned
-ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__
-D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access
-fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe
-march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a
-Ispl/include -Iinclude -I./arch/arm/include -include./include/linux/kconfig.h -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/9/include -Wl,-T -Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000 arch/arm/cpu/armv7/start.o -Wl,--whole-archive arch/arm/cpu/armv7/built-in.o arch/arm/cpu/built-in.o arch/arm/lib/built-in.o arch/arm/mach-imx/built-in.o board/bticino/mamoj/built-in.o common/spl/built-in.o common/init/built-in.o boot/built-in.o common/built-in.o cmd/built-in.o env/built-in.o lib/built-in.o disk/built-in.o drivers/built-in.o drivers/usb/dwc3/built-in.o drivers/usb/cdns3/built-in.o dts/built-in.o fs/built-in.o keep-syms-lto.o arch/arm/lib/eabi_compat.o arch/arm/lib/lib.a -Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit: 0xefa0 bytes
actual: 0xf079 bytes
excess: 0xd9 bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'
and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o
spl/u-boot-spl.cfgout arch/arm/mach-imx/spl_sd.cfg
./tools/mkimage -n spl/u-boot-spl.cfgout -T imximage -e 0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.log
Image Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004
make -f ./scripts/Makefile.build obj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage -n spl/u-boot-spl.cfgout -T imximage -e 0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.log
Image Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imx
What I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff
configs/imx6dl_mamoj_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y
Michael
Quoted 3 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 175 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 74 lines · Tom Rini
Quoted 72 lines · Michael Nazzareno Trimarchi
Hi
Quoted 68 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help hereYes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-13-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-2-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000
arch/arm/cpu/armv7/start.o-Wl,--whole-archivearch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o
spl/u-boot-spl.cfgoutarch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff
configs/imx6dl_mamoj_defconfig +0
-0
configs/imx6dl_mamoj_defconfig CONFIG_SPL_TEXT_BASE=0x00908000 · line 20
Quoted 7 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y
Here's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- -sj12 ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl* -rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40 spl/u-boot-spl.ltrans0.ltrans.su -rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40 spl/u-boot-spl.ltrans1.ltrans.su -rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40 spl/u-boot-spl-nodtb.bin -rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.sym
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
HI Tom
Quoted 217 lines · Tom Rini
Quoted 175 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 74 lines · Tom Rini
Quoted 72 lines · Michael Nazzareno Trimarchi
Hi
Quoted 68 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help hereYes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-13-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-2-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000
arch/arm/cpu/armv7/start.o-Wl,--whole-archivearch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o
spl/u-boot-spl.cfgoutarch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff
configs/imx6dl_mamoj_defconfig +0
-0configs/imx6dl_mamoj_defconfig CONFIG_SPL_TEXT_BASE=0x00908000 · line 20
Quoted 7 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=yHere's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- -sj12 ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl*(quoted diff) +0
-1-rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl
Review
Quoted 10 lines
(quoted diff) +0
-10-rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40 spl/u-boot-spl.ltrans0.ltrans.su -rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40 spl/u-boot-spl.ltrans1.ltrans.su -rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40 spl/u-boot-spl-nodtb.bin -rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.sym
The only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Michael
Quoted 2 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Quoted 225 lines · Michael Nazzareno Trimarchi
HI Tom
Quoted 222 lines · Tom Rini
Quoted 175 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 74 lines · Tom Rini
Quoted 72 lines · Michael Nazzareno Trimarchi
Hi
Quoted 68 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
Quoted 4 lines · Michael Nazzareno Trimarchi
HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help hereYes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-13-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-2-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000
arch/arm/cpu/armv7/start.o-Wl,--whole-archivearch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o
spl/u-boot-spl.cfgoutarch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff
configs/imx6dl_mamoj_defconfig +0
-0configs/imx6dl_mamoj_defconfig CONFIG_SPL_TEXT_BASE=0x00908000 · line 20
Quoted 7 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=yHere's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- -sj12 ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl*(quoted diff) +0
-7-rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40 spl/u-boot-spl.ltrans0.ltrans.su
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +0
-4-rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40 spl/u-boot-spl.ltrans1.ltrans.su -rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40 spl/u-boot-spl-nodtb.bin -rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.symThe only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Yeah, that's too old of a toolchain for LTO to be usable. A patch to catch and error out in that case would be good :)
Signature · 1 line
Tom
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
HI Tom
Quoted 236 lines · Tom Rini
Quoted 225 lines · Michael Nazzareno Trimarchi
HI Tom
Quoted 222 lines · Tom Rini
Quoted 175 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 74 lines · Tom Rini
Quoted 72 lines · Michael Nazzareno Trimarchi
Hi
Quoted 68 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 46 lines · Tom Rini
Quoted 44 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 18 lines · Tom Rini
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
Quoted 12 lines · Fabio Estevam
Hi Michael,
On Sat, Mar 19, 2022 at 6:47 AM Michael Nazzareno Trimarchi
<[email protected]> wrote:HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove
DM_GPIOin SPL. Seems that I need to remove a lot of features. I have tested LTO build but size of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help hereYes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-13-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-2-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000
arch/arm/cpu/armv7/start.o-Wl,--whole-archivearch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o
spl/u-boot-spl.cfgoutarch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff
configs/imx6dl_mamoj_defconfig +0
-0configs/imx6dl_mamoj_defconfig CONFIG_SPL_TEXT_BASE=0x00908000 · line 20
Quoted 7 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=yHere's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- -sj12 ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl*(quoted diff) +0
-7-rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40 spl/u-boot-spl.ltrans0.ltrans.suQuoted 8 lines
Review
Quoted 5 lines
(quoted diff) +0
-4-rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40 spl/u-boot-spl.ltrans1.ltrans.su -rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40 spl/u-boot-spl-nodtb.bin -rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.symThe only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Quoted 2 lines
Yeah, that's too old of a toolchain for LTO to be usable. A patch to catch and error out in that case would be good :)
Let's do it this way. I will test with the newer gcc version and decrease the size and send a patch.
This can be done on Monday, because I don't have access to it.
Michael
Quoted 3 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
R: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi Michael,
Quoted 240 lines
HI Tom
Quoted 200 lines · Tom Rini
Quoted 198 lines · Michael Nazzareno Trimarchi
HI Tom
Quoted 195 lines · Tom Rini
Quoted 175 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 74 lines · Tom Rini
Quoted 72 lines · Michael Nazzareno Trimarchi
Hi
Quoted 68 lines · Tom Rini
Quoted 56 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 48 lines · Tom Rini
Quoted 46 lines
Quoted 23 lines · Michael Nazzareno Trimarchi
Quoted 1 line
Hi Tom
On Sat, Mar 19, 2022 at 5:05 PM Tom Rini <[email protected]> wrote:
Quoted 16 lines · Michael Nazzareno Trimarchi
Hi
On Sat, Mar 19, 2022 at 2:25 PM Fabio Estevam <[email protected]> wrote:
Hi Michael,
On Sat, Mar 19, 2022 at 6:47 AM Michael Nazzareno Trimarchi
<[email protected]> wrote:HI
Please send me a link to apply your series
You can get the series from patchwork (just click in the 'series' button)
https://eur01.safelinks.protection.outlook.com/?>url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220112133127.16880-2->gaurav.jain%40nxp.com%2F&data=04%7C01%7Craffaele.recalcati%40bticino.it%7Cd7b85983151448602>62808da09d260da%7C199686b5bef4496087867a6b1888fee3%7C1%7C0%7C637833096424290979%7CUnkn>own%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C30>00&sdata=cLvLVUDGQzJ7VTyzBrTqOeobl0lgBOxJtmhV2RMjvB0%3D&reserved=0<https://eur01.safelinks.protection.outlook.com/?>url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220112133127.16880-2-gaurav.jain%40nxp.com%2F&data=04%7C01%7Craffaele.recalcati%40bticino.it%7Cd7b8598315144860262808da09d260da%7C199686b5bef4496087867a6b1888fee3%7C1%7C0%7C637833096424290979%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=cLvLVUDGQzJ7VTyzBrTqOeobl0lgBOxJtmhV2RMjvB0%3D&reserved=0>Quoted 8 lines
Quoted 3 lines
Done, well, I have tried remove DM_GPIO in SPL. Seems that I need to
remove a lot of features. I have tested LTO build but size
of SPL increase. Is that strange?That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfig
build itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 6 lines
Quoted 2 lines
So LTO does not help even on beginning on this board. You don't need to apply any patch for this test
I think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 6 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but
I was hoping that LTO give me some help hereYes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-13-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-2-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000
arch/arm/cpu/armv7/start.o-Wl,--whole-archivearch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o
spl/u-boot-spl.cfgoutarch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000
-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff
configs/imx6dl_mamoj_defconfig +0
-0configs/imx6dl_mamoj_defconfig CONFIG_SPL_TEXT_BASE=0x00908000 · line 20
Quoted 7 lines
configs/imx6dl_mamoj_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=yHere's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/confQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
#
# configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-l>linux-gnueabi- -sj12
Quoted 28 lines
Quoted 27 lines
Quoted 14 lines
===================== WARNING ======================
This board does not useCONFIG_DM_SERIAL(Driver Model
for Serial drivers). Please update the board to useCONFIG_DM_SERIALbefore the v2023.04 release. Failure to
update by the deadline may result in board removal.
Seedoc/driver-model/migration.rstfor more info.
====================================================arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a >phandle referencearch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3])arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle referencearch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '>#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3])$ ls -lh spl/u-boot-spl*(quoted diff) +0
-1-rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-splReview
Quoted 10 lines
(quoted diff) +0
-10-rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40 spl/u-boot-spl.ltrans0.ltrans.su -rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40 spl/u-boot-spl.ltrans1.ltrans.su -rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40 spl/u-boot-spl-nodtb.bin -rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.symThe only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Quoted 8 lines
Quoted 2 lines
Yeah, that's too old of a toolchain for LTO to be usable. A patch to catch and error out in that case would be good :)
Let's do it this way. I will test with the newer gcc version and decrease the size and send a patch.
This can be done on Monday, because I don't have access to it.Michael
I can test on the board if needed.
Let me know.
Quoted 3 lines
--
Tom
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=04%7C01%7Craffaele.recalcati%40bticino.it%7Cd7b8598315144860262808da09d260da%7C199686b5bef4496087867a6b1888fee3%7C1%7C0%7C637833096424290979%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6zWfMb%2Bt6h3CDq2Ktm4l3WRr24KqfP%2BaAMlNb%2F4xsxM%3D&reserved=0
________________________________
Ce message, ainsi que tous les fichiers joints à ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas être divulguées. Si vous n'êtes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier immédiatement à son expéditeur, et de détruire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autorisée, directe ou indirecte, de tout ou partie de ce message, est strictement interdite.
This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
RE: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
In reply to Michael Nazzareno TrimarchiHi Michael
Quoted 302 lines
-----Original Message-----
From: Michael Nazzareno Trimarchi <[email protected]>
Sent: Saturday, March 19, 2022 11:30 PM
To: Tom Rini <[email protected]>
Cc: Fabio Estevam <[email protected]>; Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
HI Tom
Quoted 2 lines · Tom Rini
On Sat, Mar 19, 2022 at 06:49:25PM +0100, Michael Nazzareno Trimarchi
Quoted 5 lines · wrote:
Quoted 5 lines
HI Tom
Quoted 2 lines · Tom Rini
On Sat, Mar 19, 2022 at 06:37:18PM +0100, Michael Nazzareno Trimarchi
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Hi Tom
Quoted 2 lines · Tom Rini
On Sat, Mar 19, 2022 at 06:27:38PM +0100, Michael Nazzareno
Quoted 3 lines · Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi
On Sat, Mar 19, 2022 at 6:25 PM Tom Rini <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Sat, Mar 19, 2022 at 06:08:18PM +0100, Michael Nazzareno
Quoted 3 lines · Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi Tom
On Sat, Mar 19, 2022 at 6:03 PM Tom Rini <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Sat, Mar 19, 2022 at 05:48:59PM +0100, Michael Nazzareno
Quoted 3 lines · Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi Tom
On Sat, Mar 19, 2022 at 5:05 PM Tom Rini
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Sat, Mar 19, 2022 at 02:51:01PM +0100, Michael
Quoted 3 lines · Nazzareno Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi
On Sat, Mar 19, 2022 at 2:25 PM Fabio Estevam
Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Hi Michael,
On Sat, Mar 19, 2022 at 6:47 AM Michael
Nazzareno Trimarchi <[email protected]>Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
HI
Please send me a link to apply your series
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
You can get the series from patchwork (just
click in the 'series' button)
https://eur01.safelinks.protection.outlook.com
/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpro
ject%2Fuboot%2Fpatch%2F20220112133127.16880-2-
gaurav.jain%40nxp.com%2F&data=04%7C01%7Cga
urav.jain%40nxp.com%7Cf2e5639efe9e491287e008da
09d260f9%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637833096989631395%7CUnknown%7CTWFpbGZ
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBT
iI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Sv5W81K1CO1KdNO%2FW8v4cCrqK4gLC0IoChfHYmHSEZM%3D&
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
amp;reserved=0
Done, well, I have tried remove DM_GPIO in SPL.
Seems that I need to remove a lot of features. I
have tested LTO build but size of SPL increase. Is thatstrange?
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 41 lines
Quoted 41 lines
Quoted 40 lines
Quoted 28 lines
Quoted 20 lines
Quoted 20 lines
Quoted 5 lines
That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfigbuild itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 7 lines
Quoted 3 lines
So LTO does not help even on beginning on this
board. You don't need to apply any patch for this
testI think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 8 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but I was hoping that LTO give me some help here
Yes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-3-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8Quoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
(quoted diff) +0
-8-fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
(quoted diff) +0
-3-fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-3-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000 arch/arm/cpu/armv7/start.o -Wl,--whole-archive
arch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -
o
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
spl/u-boot-spl.cfgout
arch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
git diff
(quoted diff) +0
-0b/configs/imx6dl_mamoj_defconfig index
ae27857e6f..4a535012b2100644configs/imx6dl_mamoj_defconfig +0
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000
CONFIG_SPL_DRIVERS_MISC=yCONFIG_IMX_HAB=y#
CONFIG_CMD_BMODEQuoted 59 lines
Quoted 58 lines
Quoted 52 lines
Quoted 5 lines
is not set
+CONFIG_LTO=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BOOTDELAY=3
CONFIG_SPL_OS_BOOT=yHere's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-g nueabi/bin/arm-linux-gnueabi- -sj12 ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl* -rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl(quoted diff) +0
-6-rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40spl/u-boot-spl.ltrans0.ltrans.su
-rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40
spl/u-boot-spl.ltrans1.ltrans.su(quoted diff) +0
-2-rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40Quoted 3 lines
spl/u-boot-spl-nodtb.bin
-rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.symThe only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Quoted 6 lines
Quoted 2 lines
Yeah, that's too old of a toolchain for LTO to be usable. A patch to catch and error out in that case would be good :)
Let's do it this way. I will test with the newer gcc version and decrease the size and send a patch.
This can be done on Monday, because I don't have access to it.
Waiting for your patch to decrease the spl size as my patch series is dependent on your fix.
Gaurav
Quoted 25 lines
Michael
Quoted 3 lines
--
Tom--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected]
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ama
rulasolutions.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.com%7Cf2e 5639efe9e491287e008da09d260f9%7C686ea1d3bc2b4c6fa92cd99c5c301635% 7C0%7C0%7C637833096989631395%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a mp;sdata=pBaV4f5%2BrMJh7CsyEwpU0xOCQVQjWMkIyZ5%2BoPeey4k%3D&a mp;reserved=0
Re: [EXT] Re: [PATCH v8 01/15] crypto/fsl: Add support for CAAM Job ring driver model
Hi
Quoted 305 lines · Gaurav Jain
Hi Michael
Quoted 302 lines
-----Original Message-----
From: Michael Nazzareno Trimarchi <[email protected]>
Sent: Saturday, March 19, 2022 11:30 PM
To: Tom Rini <[email protected]>
Cc: Fabio Estevam <[email protected]>; Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Michael Walle <[email protected]>; Varun Sethi <[email protected]>; Adrian Alonso <[email protected]>; Alison Wang <[email protected]>; Andy Tang <[email protected]>; Franck Lenormand <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; [email protected]; Meenakshi Aggarwal <[email protected]>; Mingkai Hu <[email protected]>; [email protected]; Pankaj Gupta <[email protected]>; Peng Fan <[email protected]>; Pramod Kumar <[email protected]>; Priyanka Jain <[email protected]>; Rajesh Bhagat <[email protected]>; Sahil Malhotra <[email protected]>; Shengzhou Liu <[email protected]>; Silvano Di Ninno <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>; Wasim Khan <[email protected]>; Ye Li <[email protected]>; Raffaele RECALCATI <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 01/15]crypto/fsl: Add support for CAAM Job ring driver modelCaution: EXT Email
HI Tom
Quoted 2 lines · Tom Rini
On Sat, Mar 19, 2022 at 06:49:25PM +0100, Michael Nazzareno Trimarchi
Quoted 5 lines · wrote:
Quoted 5 lines
HI Tom
Quoted 2 lines · Tom Rini
On Sat, Mar 19, 2022 at 06:37:18PM +0100, Michael Nazzareno Trimarchi
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Hi Tom
Quoted 2 lines · Tom Rini
On Sat, Mar 19, 2022 at 06:27:38PM +0100, Michael Nazzareno
Quoted 3 lines · Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi
On Sat, Mar 19, 2022 at 6:25 PM Tom Rini <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Sat, Mar 19, 2022 at 06:08:18PM +0100, Michael Nazzareno
Quoted 3 lines · Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi Tom
On Sat, Mar 19, 2022 at 6:03 PM Tom Rini <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Sat, Mar 19, 2022 at 05:48:59PM +0100, Michael Nazzareno
Quoted 3 lines · Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi Tom
On Sat, Mar 19, 2022 at 5:05 PM Tom Rini
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Sat, Mar 19, 2022 at 02:51:01PM +0100, Michael
Quoted 3 lines · Nazzareno Trimarchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hi
On Sat, Mar 19, 2022 at 2:25 PM Fabio Estevam
Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Hi Michael,
On Sat, Mar 19, 2022 at 6:47 AM Michael
Nazzareno Trimarchi <[email protected]>Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
HI
Please send me a link to apply your series
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
You can get the series from patchwork (just
click in the 'series' button)
https://eur01.safelinks.protection.outlook.com
/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpro
ject%2Fuboot%2Fpatch%2F20220112133127.16880-2-
gaurav.jain%40nxp.com%2F&data=04%7C01%7Cga
urav.jain%40nxp.com%7Cf2e5639efe9e491287e008da
09d260f9%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637833096989631395%7CUnknown%7CTWFpbGZ
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBT
iI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Sv5W81K1CO1KdNO%2FW8v4cCrqK4gLC0IoChfHYmHSEZM%3D&
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
amp;reserved=0
Done, well, I have tried remove DM_GPIO in SPL.
Seems that I need to remove a lot of features. I
have tested LTO build but size of SPL increase. Is thatstrange?
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 41 lines
Quoted 41 lines
Quoted 40 lines
Quoted 28 lines
Quoted 20 lines
Quoted 20 lines
Quoted 5 lines
That is very strange. Can you post your patches somewhere?
--
TomStart from here
9776c4e9d00ac49d6388ffe9e084ff03b37ae479
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-make
imx6dl_mamoj_defconfigbuild itTry then to enable LTO and build it again
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf071bytes
excess:0xd1bytesQuoted 7 lines
Quoted 3 lines
So LTO does not help even on beginning on this
board. You don't need to apply any patch for this
testI think that's some artifact of mixing LTO/non-LTO and the world not getting rebuilt? Just enabling LTO after the defconfig works fine and is smaller than before.
Quoted 8 lines
In order to save space I did not change what we have. Every build starts from a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm using upstream defconfig and upstream defconfig + LTO enabled and the result is that spl increase in size for LTO building. I'm working to keep out part that are not really needed but I was hoping that LTO give me some help here
Yes, LTO saves about 5KiB on the SPL binary. You just need to enable it in the config before you start building, not after you've built everything once.
Quoted 6 lines
Quoted 2 lines
Offcourse ;) but this not the case. I don't drink enough to think that change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
spl/keep-syms-lto.c
( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles(quoted diff) +0
-3-fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8Quoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
(quoted diff) +0
-8-fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
(quoted diff) +0
-3-fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include
./include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc-cross/arm-linux-gnueabihf/9/include-Wl,-T(quoted diff) +0
-3-Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000 arch/arm/cpu/armv7/start.o -Wl,--whole-archive
arch/arm/cpu/armv7/built-in.oarch/arm/cpu/built-in.oarch/arm/lib/built-in.oarch/arm/mach-imx/built-in.oboard/bticino/mamoj/built-in.ocommon/spl/built-in.ocommon/init/built-in.oboot/built-in.ocommon/built-in.ocmd/built-in.oenv/built-in.olib/built-in.odisk/built-in.odrivers/built-in.odrivers/usb/dwc3/built-in.odrivers/usb/cdns3/built-in.odts/built-in.ofs/built-in.okeep-syms-lto.oarch/arm/lib/eabi_compat.oarch/arm/lib/lib.a-Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl )
arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin
arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin
spl/u-boot-spl.bin exceeds file size limit:
limit:0xefa0bytes
actual:0xf079bytes
excess:0xd9bytes
make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1
make: *** Deleting file 'spl/u-boot-spl.bin'Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -
o
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
spl/u-boot-spl.cfgout
arch/arm/mach-imx/spl_sd.cfg
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004make -f
./scripts/Makefile.buildobj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/
./tools/mkimage-n spl/u-boot-spl.cfgout -T imximage -e0x00908000-d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.logImage Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j
.secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imxWhat I'm trying to say is that I have followed the correct steps and this is the LTO change
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
git diff
(quoted diff) +0
-0b/configs/imx6dl_mamoj_defconfig index
ae27857e6f..4a535012b2100644configs/imx6dl_mamoj_defconfig +0
-0@@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000
CONFIG_SPL_DRIVERS_MISC=yCONFIG_IMX_HAB=y#
CONFIG_CMD_BMODEQuoted 59 lines
Quoted 58 lines
Quoted 52 lines
Quoted 5 lines
is not set
+CONFIG_LTO=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BOOTDELAY=3
CONFIG_SPL_OS_BOOT=yHere's what I see:
$ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-g nueabi/bin/arm-linux-gnueabi- -sj12 ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl* -rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl(quoted diff) +0
-6-rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40spl/u-boot-spl.ltrans0.ltrans.su
-rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40
spl/u-boot-spl.ltrans1.ltrans.su(quoted diff) +0
-2-rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40Quoted 3 lines
spl/u-boot-spl-nodtb.bin
-rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.symThe only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Yeah, that's too old of a toolchain for LTO to be usable. A patch to catch and error out in that case would be good :)
Let's do it this way. I will test with the newer gcc version and decrease the size and send a patch.
This can be done on Monday, because I don't have access to it.Waiting for your patch to decrease the spl size as my patch series is dependent on your fix.
I will not let wait more. We had already gain using LTO enable and remove DM_GPIO (around 8k)
Michael
Quoted 26 lines
Gaurav
Quoted 25 lines
Michael
Quoted 3 lines
--
Tom--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected]
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ama
rulasolutions.com%2F&data=04%7C01%7Cgaurav.jain%40nxp.com%7Cf2e 5639efe9e491287e008da09d260f9%7C686ea1d3bc2b4c6fa92cd99c5c301635% 7C0%7C0%7C637833096989631395%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a mp;sdata=pBaV4f5%2BrMJh7CsyEwpU0xOCQVQjWMkIyZ5%2BoPeey4k%3D&a mp;reserved=0
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
PATCH v8 2/15 i.MX8M: crypto: updated device tree for supporting DM in SPL
In reply to Gaurav Jaindisabled use of JR0 in SPL and uboot, as JR0 is reserved for secure boot.
--- arch/arm/dts/imx8mm-evk-u-boot.dtsi | 19 ++++++++++++++++++- arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 19 ++++++++++++++++++- arch/arm/dts/imx8mp-evk-u-boot.dtsi | 19 ++++++++++++++++++- arch/arm/dts/imx8mq-evk-u-boot.dtsi | 4 ++++ 4 files changed, 58 insertions(+), 3 deletions(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +18 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2019 NXP + * Copyright 2019, 2021 NXP */ #include "imx8mm-u-boot.dtsi"
@@ -68,6 +68,23 @@ u-boot,dm-spl; }; +&crypto { + u-boot,dm-spl; +}; + +&sec_jr0 { + u-boot,dm-spl; + status = "disabled"; +}; + +&sec_jr1 { + u-boot,dm-spl; +}; + +&sec_jr2 { + u-boot,dm-spl; +}; + &usdhc1 { u-boot,dm-spl; };
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +18 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2019 NXP + * Copyright 2019, 2021 NXP */ / {
@@ -104,6 +104,23 @@ u-boot,dm-spl; }; +&crypto { + u-boot,dm-spl; +}; + +&sec_jr0 { + u-boot,dm-spl; + status = "disabled"; +}; + +&sec_jr1 { + u-boot,dm-spl; +}; + +&sec_jr2 { + u-boot,dm-spl; +}; + &usdhc1 { u-boot,dm-spl; };
arch/arm/dts/imx8mp-evk-u-boot.dtsi +18 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2019 NXP + * Copyright 2019, 2021 NXP */ #include "imx8mp-u-boot.dtsi"
@@ -67,6 +67,23 @@ u-boot,dm-spl; }; +&crypto { + u-boot,dm-spl; +}; + +&sec_jr0 { + u-boot,dm-spl; + status = "disabled"; +}; + +&sec_jr1 { + u-boot,dm-spl; +}; + +&sec_jr2 { + u-boot,dm-spl; +}; + &i2c1 { u-boot,dm-spl; };
arch/arm/dts/imx8mq-evk-u-boot.dtsi +4 -0
@@ -10,3 +10,7 @@ sd-uhs-sdr104; sd-uhs-ddr50; }; + +&sec_jr0 { + status = "disabled"; +};
Signature · 1 line
2.17.1
PATCH v8 3/15 crypto/fsl: i.MX8M: Enable Job ring driver model.
In reply to Gaurav Jaini.MX8MM/MN/MP/MQ - added support for JR driver model. sec is initialized based on job ring information processed from device tree.
--- arch/arm/Kconfig | 2 +- arch/arm/include/asm/arch-imx8m/imx-regs.h | 1 + arch/arm/mach-imx/imx8m/Kconfig | 18 ++++++++++++++++++ arch/arm/mach-imx/imx8m/soc.c | 10 +++++++++- board/freescale/imx8mm_evk/spl.c | 9 ++++++++- board/freescale/imx8mn_evk/spl.c | 8 ++++++-- board/freescale/imx8mp_evk/spl.c | 13 +++++++++++-- board/freescale/imx8mq_evk/spl.c | 9 +++++++-- drivers/crypto/fsl/jr.c | 14 +++++++++++--- scripts/config_whitelist.txt | 1 + 10 files changed, 73 insertions(+), 12 deletions(-)
arch/arm/Kconfig +1 -1
@@ -815,7 +815,7 @@ config ARCH_IMX8M select ARM64 select GPIO_EXTRA_HEADER select MACH_IMX - select SYS_FSL_HAS_SEC if IMX_HAB + select SYS_FSL_HAS_SEC select SYS_FSL_SEC_COMPAT_4 select SYS_FSL_SEC_LE select SYS_I2C_MXC
arch/arm/include/asm/arch-imx8m/imx-regs.h +1 -0
@@ -72,6 +72,7 @@#define CONFIG_SYS_FSL_SEC_ADDR (CAAM_IPS_BASE_ADDR + \ CONFIG_SYS_FSL_SEC_OFFSET)#define CONFIG_SYS_FSL_JR0_OFFSET (0x1000) +#define CONFIG_SYS_FSL_JR1_OFFSET (0x2000)#define CONFIG_SYS_FSL_JR0_ADDR (CONFIG_SYS_FSL_SEC_ADDR + \ CONFIG_SYS_FSL_JR0_OFFSET)#define CONFIG_SYS_FSL_MAX_NUM_OF_SEC 1
arch/arm/mach-imx/imx8m/Kconfig +18 -0
@@ -39,6 +39,10 @@ config TARGET_IMX8MQ_EVK select BINMAN select IMX8MQ select IMX8M_LPDDR4 + select FSL_CAAM + select MISC + select ARCH_MISC_INIT + select SPL_CRYPTO if SPL config TARGET_IMX8MQ_PHANBELL bool "imx8mq_phanbell"
@@ -52,6 +56,10 @@ config TARGET_IMX8MM_EVK select IMX8MM select SUPPORT_SPL select IMX8M_LPDDR4 + select FSL_CAAM + select MISC + select ARCH_MISC_INIT + select SPL_CRYPTO if SPL config TARGET_IMX8MM_ICORE_MX8MM bool "Engicam i.Core MX8M Mini SOM"
@@ -91,6 +99,9 @@ config TARGET_IMX8MN_EVK select IMX8MN select SUPPORT_SPL select IMX8M_LPDDR4 + select FSL_CAAM + select MISC + select SPL_CRYPTO if SPL config TARGET_IMX8MN_DDR4_EVK bool "imx8mn DDR4 EVK board"
@@ -98,6 +109,9 @@ config TARGET_IMX8MN_DDR4_EVK select IMX8MN select SUPPORT_SPL select IMX8M_DDR4 + select FSL_CAAM + select MISC + select SPL_CRYPTO if SPL config TARGET_IMX8MP_EVK bool "imx8mp LPDDR4 EVK board"
@@ -105,6 +119,10 @@ config TARGET_IMX8MP_EVK select IMX8MP select SUPPORT_SPL select IMX8M_LPDDR4 + select FSL_CAAM + select MISC + select ARCH_MISC_INIT + select SPL_CRYPTO if SPL config TARGET_PICO_IMX8MQ bool "Support Technexion Pico iMX8MQ"
arch/arm/mach-imx/imx8m/soc.c +9 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2017-2019 NXP +* Copyright 2017-2019, 2021 NXP * * Peng Fan <[email protected]> */
@@ -20,6 +20,7 @@#include <asm/ptrace.h> #include <asm/armv8/mmu.h> #include <dm/uclass.h> +#include <dm/device.h> #include <efi_loader.h> #include <env.h> #include <env_internal.h>
@@ -1197,6 +1198,13 @@ static void acquire_buildinfo(void)int arch_misc_init (void ) { +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); +acquire_buildinfo ();return 0 ;
board/freescale/imx8mm_evk/spl.c +8 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2019 NXP +* Copyright 2019, 2021 NXP */ #include <common.h>
@@ -51,6 +51,13 @@ static void spl_dram_init(void)void spl_board_init (void ) { +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); +puts ("Normal Boot\n" ); }
board/freescale/imx8mn_evk/spl.c +6 -2
@@ -1,7 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* -* Copyright 2018-2019 NXP +* Copyright 2018-2019, 2021 NXP * -* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h>
@@ -49,6 +49,10 @@ void spl_board_init(void)struct udevice *dev;int ret; + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); +puts ("Normal Boot\n" ); ret = uclass_get_device_by_name(UCLASS_CLK,
board/freescale/imx8mp_evk/spl.c +11 -2
@@ -1,7 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* -* Copyright 2018-2019 NXP +* Copyright 2018-2019, 2021 NXP * -* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h>
@@ -20,6 +20,8 @@#include <asm/arch/ddr.h> #include <power/pmic.h> #include <power/pca9450.h> +#include <dm/uclass.h> +#include <dm/device.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -35,6 +37,13 @@ void spl_dram_init(void)void spl_board_init (void ) { +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); +/* * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does * not allow to change it. Should set the clock after PMIC
board/freescale/imx8mq_evk/spl.c +7 -2
@@ -1,8 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * -* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h>
@@ -22,6 +21,7 @@#include <asm/mach-imx/gpio.h> #include <asm/mach-imx/mxc_i2c.h> #include <fsl_esdhc_imx.h> +#include <fsl_sec.h> #include <mmc.h> #include <linux/delay.h> #include <power/pmic.h>
@@ -199,6 +199,11 @@ int power_init_board(void)void spl_board_init (void ) { +#ifdef CONFIG_FSL_CAAM +if (sec_init ()) +printf ("\nsec_init failed!\n" ); + +#endif puts ("Normal Boot\n" ); }
drivers/crypto/fsl/jr.c +11 -3
@@ -43,9 +43,17 @@ struct udevice *caam_dev;#define SEC_ADDR (idx) \ (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx])) -#define SEC_JR0_ADDR (idx) \ +#ifndef CONFIG_IMX8M +#define SEC_JR_ADDR (idx) \ (ulong)(SEC_ADDR(idx) + \ (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +#define JR_ID 0 +#else +#define SEC_JR_ADDR (idx) \ + (ulong)(SEC_ADDR(idx) + \ + (CONFIG_SYS_FSL_JR1_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET)) +#define JR_ID 1 +#endif struct caam_regs caam_st;#endif
@@ -669,8 +677,8 @@ int sec_init_idx(uint8_t sec_idx) caam =dev_get_priv (caam_dev);#else caam_st.sec = (void *)SEC_ADDR (sec_idx); - caam_st.regs = (struct jr_regs *)SEC_JR0_ADDR (sec_idx); - caam_st.jrid =0 ; + caam_st.regs = (struct jr_regs *)SEC_JR_ADDR (sec_idx); + caam_st.jrid =JR_ID ; caam = &caam_st;#endif ccsr_sec_t *sec = caam->sec;
scripts/config_whitelist.txt +1 -0
@@ -1848,6 +1848,7 @@ CONFIG_SYS_FSL_IFC_SIZE2 CONFIG_SYS_FSL_ISBC_VER CONFIG_SYS_FSL_JR0_ADDR CONFIG_SYS_FSL_JR0_OFFSET +CONFIG_SYS_FSL_JR1_OFFSET CONFIG_SYS_FSL_LS1_CLK_ADDR CONFIG_SYS_FSL_LSCH3_SERDES_ADDR CONFIG_SYS_FSL_MAX_NUM_OF_SEC
Signature · 1 line
2.17.1
PATCH v8 4/15 mx6sabre: Remove unnecessary SPL configs
In reply to Gaurav JainFrom: Ye Li <[email protected]>
Because we don't use SPL_DM on mx6sabresd and mx6sabreauto, so it is unnecessary to have SPL DTB related configs and SPL_OF_CONTROL enabled.
--- configs/mx6sabreauto_defconfig | 2 -- configs/mx6sabresd_defconfig | 4 ---- 2 files changed, 6 deletions(-)
configs/mx6sabreauto_defconfig +0 -2
@@ -60,10 +60,8 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_CONTROL=y -CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIST="imx6dl-sabreauto imx6q-sabreauto imx6qp-sabreauto" CONFIG_MULTI_DTB_FIT=y -CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
configs/mx6sabresd_defconfig +0 -4
@@ -63,12 +63,8 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIST="imx6q-sabresd imx6qp-sabresd imx6dl-sabresd" CONFIG_MULTI_DTB_FIT=y -CONFIG_SPL_MULTI_DTB_FIT=y -CONFIG_SPL_OF_LIST="imx6dl-sabresd imx6q-sabresd imx6qp-sabresd" -CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
Signature · 1 line
2.17.1
PATCH v8 5/15 i.MX6: Enable Job ring driver model.
In reply to Gaurav Jaini.MX6,i.MX6SX,i.MX6UL - added support for JR driver model.
removed sec_init() call, sec is initialized based on job ring information processed from device tree.
--- arch/arm/mach-imx/mx6/Kconfig | 15 +++++++++++++++ arch/arm/mach-imx/mx6/soc.c | 12 ++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-)
arch/arm/mach-imx/mx6/Kconfig +15 -0
@@ -354,6 +354,9 @@ config TARGET_MX6SABREAUTO select DM_THERMAL select SUPPORT_SPL imply CMD_DM + select FSL_CAAM + select MISC + select ARCH_MISC_INIT config TARGET_MX6SABRESD bool "mx6sabresd"
@@ -364,6 +367,9 @@ config TARGET_MX6SABRESD select DM_THERMAL select SUPPORT_SPL imply CMD_DM + select FSL_CAAM + select MISC + select ARCH_MISC_INIT config TARGET_MX6SLEVK bool "mx6slevk"
@@ -386,6 +392,9 @@ config TARGET_MX6SXSABRESD select DM select DM_THERMAL select SUPPORT_SPL + select FSL_CAAM + select MISC + select ARCH_MISC_INIT config TARGET_MX6SXSABREAUTO bool "mx6sxsabreauto"
@@ -404,6 +413,9 @@ config TARGET_MX6UL_9X9_EVK select DM_THERMAL select SUPPORT_SPL imply CMD_DM + select FSL_CAAM + select MISC + select ARCH_MISC_INIT config TARGET_MX6UL_14X14_EVK bool "mx6ul_14x14_evk"
@@ -413,6 +425,9 @@ config TARGET_MX6UL_14X14_EVK select DM_THERMAL select SUPPORT_SPL imply CMD_DM + select FSL_CAAM + select MISC + select ARCH_MISC_INIT config TARGET_MX6UL_ENGICAM bool "Support Engicam GEAM6UL/Is.IoT"
arch/arm/mach-imx/mx6/soc.c +8 -4
@@ -4,6 +4,7 @@* Sascha Hauer, Pengutronix * * (C) Copyright 2009 Freescale Semiconductor, Inc. +* Copyright 2021 NXP */ #include <common.h>
@@ -23,7 +24,6 @@#include <asm/arch/mxc_hdmi.h> #include <asm/arch/crm_regs.h> #include <dm.h> -#include <fsl_sec.h> #include <imx_thermal.h> #include <mmc.h>
@@ -734,9 +734,13 @@ static void setup_serial_number(void)int arch_misc_init (void ) { -#ifdef CONFIG_FSL_CAAM -sec_init (); -#endif +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); +setup_serial_number ();return 0 ; }
Signature · 1 line
2.17.1
PATCH v8 6/15 i.MX7: Enable Job ring driver model.
In reply to Gaurav Jaini.MX7D - added support for JR driver model.
removed sec_init() call, sec is initialized based on job ring information processed from device tree.
--- arch/arm/Kconfig | 2 +- arch/arm/mach-imx/mx7/Kconfig | 2 ++ arch/arm/mach-imx/mx7/soc.c | 11 +++++++---- 3 files changed, 10 insertions(+), 5 deletions(-)
arch/arm/Kconfig +1 -1
@@ -883,7 +883,7 @@ config ARCH_MX7 select CPU_V7A select GPIO_EXTRA_HEADER select MACH_IMX - select SYS_FSL_HAS_SEC if IMX_HAB + select SYS_FSL_HAS_SEC select SYS_FSL_SEC_COMPAT_4 select SYS_FSL_SEC_LE imply BOARD_EARLY_INIT_F
arch/arm/mach-imx/mx7/Kconfig +2 -0
@@ -68,6 +68,8 @@ config TARGET_MX7DSABRESD select DM_THERMAL select MX7D imply CMD_DM + select FSL_CAAM + select MISC config TARGET_PICO_IMX7D bool "pico-imx7d"
arch/arm/mach-imx/mx7/soc.c +7 -4
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2015 Freescale Semiconductor, Inc. +* Copyright 2021 NXP */ #include <common.h>
@@ -19,7 +20,6 @@#include <dm.h> #include <env.h> #include <imx_thermal.h> -#include <fsl_sec.h> #include <asm/setup.h> #include <linux/delay.h>
@@ -337,6 +337,9 @@ int arch_cpu_init(void)#ifdef CONFIG_ARCH_MISC_INIT int arch_misc_init (void ) { +struct udevice *dev; +int ret; +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG struct tag_serialnr serialnr;char serial_string[0x20 ];
@@ -353,9 +356,9 @@ int arch_misc_init(void)env_set ("serial#" , serial_string);#endif -#ifdef CONFIG_FSL_CAAM -sec_init (); -#endif + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret);return 0 ; }
Signature · 1 line
2.17.1
PATCH v8 7/15 i.MX7ULP: Enable Job ring driver model.
In reply to Gaurav Jainadded crypto node in device tree.
sec is initialized based on job ring information processed from device tree.
--- arch/arm/Kconfig | 2 +- arch/arm/dts/imx7ulp.dtsi | 24 ++++++++++++++++++++++++ arch/arm/mach-imx/mx7ulp/Kconfig | 3 +++ arch/arm/mach-imx/mx7ulp/soc.c | 16 ++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
@@ -870,7 +870,7 @@ config ARCH_MX7ULP select CPU_V7A select GPIO_EXTRA_HEADER select MACH_IMX - select SYS_FSL_HAS_SEC if IMX_HAB + select SYS_FSL_HAS_SEC select SYS_FSL_SEC_COMPAT_4 select SYS_FSL_SEC_LE select ROM_UNIFIED_SECTIONS
arch/arm/dts/imx7ulp.dtsi +24 -0
@@ -1,5 +1,6 @@ /* * Copyright 2015-2016 Freescale Semiconductor, Inc. + * Copyright 2021 NXP * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -198,6 +199,29 @@ }; }; + crypto: crypto@40240000 { + compatible = "fsl,sec-v4.0"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x40240000 0x10000>; + ranges = <0 0x40240000 0x10000>; + clocks = <&clks IMX7ULP_CLK_CAAM>, + <&clks IMX7ULP_CLK_NIC1_BUS_DIV>; + clock-names = "aclk", "ipg"; + + sec_jr0: jr@1000 { + compatible = "fsl,sec-v4.0-job-ring"; + reg = <0x1000 0x1000>; + interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr1: jr@2000 { + compatible = "fsl,sec-v4.0-job-ring"; + reg = <0x2000 0x1000>; + interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + tpm5: tpm@40260000 { compatible = "fsl,imx7ulp-tpm"; reg = <0x40260000 0x1000>;
arch/arm/mach-imx/mx7ulp/Kconfig +3 -0
@@ -25,6 +25,9 @@ config TARGET_MX7ULP_EVK bool "Support mx7ulp EVK board" select MX7ULP select SYS_ARCH_TIMER + select FSL_CAAM + select MISC + select ARCH_MISC_INIT endchoice
arch/arm/mach-imx/mx7ulp/soc.c +16 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2016 Freescale Semiconductor, Inc. +* Copyright 2021 NXP */ #include <common.h>
@@ -15,6 +16,7 @@#include <asm/mach-imx/hab.h> #include <asm/setup.h> #include <linux/bitops.h> +#include <dm.h> #define PMC0_BASE_ADDR 0x410a1000#define PMC0_CTRL 0x28
@@ -80,6 +82,20 @@ int arch_cpu_init(void)return 0 ; } +#if defined(CONFIG_ARCH_MISC_INIT ) +int arch_misc_init (void ) +{ +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); + +return 0 ; +} +#endif +#ifdef CONFIG_BOARD_POSTCLK_INIT int board_postclk_init (void ) {
Signature · 1 line
2.17.1
PATCH v8 8/15 i.MX8: Add crypto node in device tree
In reply to Gaurav Jaini.MX8(QM/QXP) - updated device tree for supporting DM in SPL.
disabled use of JR1 in SPL and uboot, as JR1 is reserved for SECO FW.
--- arch/arm/dts/fsl-imx8dx.dtsi | 61 +++++++++++++++++++++++- arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi | 34 ++++++++++++- arch/arm/dts/fsl-imx8qm.dtsi | 61 +++++++++++++++++++++++- arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi | 34 ++++++++++++- 4 files changed, 186 insertions(+), 4 deletions(-)
arch/arm/dts/fsl-imx8dx.dtsi +60 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2018 NXP + * Copyright 2018, 2021 NXP */ #include <dt-bindings/interrupt-controller/arm-gic.h>
@@ -261,6 +261,30 @@ power-domains = <&pd_dma>; }; }; + + pd_caam: PD_CAAM { + compatible = "nxp,imx8-pd"; + reg = <SC_R_NONE>; + #power-domain-cells = <0>; + #address-cells = <1>; + #size-cells = <0>; + + pd_caam_jr1: PD_CAAM_JR1 { + reg = <SC_R_CAAM_JR1>; + #power-domain-cells = <0>; + power-domains = <&pd_caam>; + }; + pd_caam_jr2: PD_CAAM_JR2 { + reg = <SC_R_CAAM_JR2>; + #power-domain-cells = <0>; + power-domains = <&pd_caam>; + }; + pd_caam_jr3: PD_CAAM_JR3 { + reg = <SC_R_CAAM_JR3>; + #power-domain-cells = <0>; + power-domains = <&pd_caam>; + }; + }; }; i2c0: i2c@5a800000 {
@@ -609,6 +633,41 @@ }; }; }; + + crypto: caam@0x31400000 { + compatible = "fsl,sec-v4.0"; + reg = <0 0x31400000 0 0x400000>; + interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0x31400000 0x400000>; + fsl,first-jr-index = <2>; + fsl,sec-era = <9>; + + sec_jr1: jr1@0x20000 { + compatible = "fsl,sec-v4.0-job-ring"; + reg = <0x20000 0x1000>; + interrupts = <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd_caam_jr1>; + status = "disabled"; + }; + + sec_jr2: jr2@30000 { + compatible = "fsl,sec-v4.0-job-ring"; + reg = <0x30000 0x1000>; + interrupts = <GIC_SPI 453 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd_caam_jr2>; + status = "okay"; + }; + + sec_jr3: jr3@40000 { + compatible = "fsl,sec-v4.0-job-ring"; + reg = <0x40000 0x1000>; + interrupts = <GIC_SPI 454 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd_caam_jr3>; + status = "okay"; + }; + }; }; &A35_0 {
arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi +33 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2018 NXP + * Copyright 2018, 2021 NXP */ &{/imx8qm-pm} {
@@ -80,6 +80,22 @@ u-boot,dm-spl; }; +&pd_caam { + u-boot,dm-spl; +}; + +&pd_caam_jr1 { + u-boot,dm-spl; +}; + +&pd_caam_jr2 { + u-boot,dm-spl; +}; + +&pd_caam_jr3 { + u-boot,dm-spl; +}; + &gpio0 { u-boot,dm-spl; };
@@ -126,3 +142,19 @@ sd-uhs-sdr104; sd-uhs-ddr50; }; + +&crypto { + u-boot,dm-spl; +}; + +&sec_jr1 { + u-boot,dm-spl; +}; + +&sec_jr2 { + u-boot,dm-spl; +}; + +&sec_jr3 { + u-boot,dm-spl; +};
arch/arm/dts/fsl-imx8qm.dtsi +60 -1
78 lines not on this page · raw message
arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi +33 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2018 NXP + * Copyright 2018, 2021 NXP */ &{/imx8qx-pm} {
@@ -80,6 +80,22 @@ u-boot,dm-spl; }; +&pd_caam { + u-boot,dm-spl; +}; + +&pd_caam_jr1 { + u-boot,dm-spl; +}; + +&pd_caam_jr2 { + u-boot,dm-spl; +}; + +&pd_caam_jr3 { + u-boot,dm-spl; +}; + &gpio0 { u-boot,dm-spl; };
@@ -126,3 +142,19 @@ sd-uhs-sdr104; sd-uhs-ddr50; }; + +&crypto { + u-boot,dm-spl; +}; + +&sec_jr1 { + u-boot,dm-spl; +}; + +&sec_jr2 { + u-boot,dm-spl; +}; + +&sec_jr3 { + u-boot,dm-spl; +};
Signature · 1 line
2.17.1
PATCH v8 9/15 crypto/fsl: i.MX8: Enable Job ring driver model.
In reply to Gaurav Jaini.MX8(QM/QXP) - added support for JR driver model. sec is initialized based on job ring information processed from device tree.
--- arch/arm/Kconfig | 3 ++ arch/arm/include/asm/arch-imx8/imx-regs.h | 5 ++- arch/arm/mach-imx/cmd_dek.c | 1 + arch/arm/mach-imx/imx8/Kconfig | 7 ++++ arch/arm/mach-imx/imx8/cpu.c | 16 +++++++- board/freescale/imx8qm_mek/spl.c | 6 ++- board/freescale/imx8qxp_mek/spl.c | 6 ++- drivers/crypto/fsl/Kconfig | 2 +- drivers/crypto/fsl/jr.c | 47 ++++++++++++++++++++++- include/fsl_sec.h | 12 +++--- 10 files changed, 89 insertions(+), 16 deletions(-)
arch/arm/Kconfig +3 -0
@@ -804,6 +804,9 @@ config ARCH_LPC32XX config ARCH_IMX8 bool "NXP i.MX8 platform" select ARM64 + select SYS_FSL_HAS_SEC + select SYS_FSL_SEC_COMPAT_4 + select SYS_FSL_SEC_LE select DM select GPIO_EXTRA_HEADER select MACH_IMX
arch/arm/include/asm/arch-imx8/imx-regs.h +4 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP */ #ifndef __ASM_ARCH_IMX8_REGS_H__
@@ -47,4 +47,7 @@#define USB_BASE_ADDR 0x5b0d0000#define USB_PHY0_BASE_ADDR 0x5b100000 +#define CONFIG_SYS_FSL_SEC_ADDR (0x31400000) +#define CONFIG_SYS_FSL_MAX_NUM_OF_SEC 1 +#endif /* __ASM_ARCH_IMX8_REGS_H__ */
arch/arm/mach-imx/cmd_dek.c +1 -0
@@ -9,6 +9,7 @@#include <command.h> #include <log.h> #include <malloc.h> +#include <memalign.h> #include <asm/byteorder.h> #include <linux/compiler.h> #include <fsl_sec.h>
arch/arm/mach-imx/imx8/Kconfig +7 -0
@@ -8,6 +8,7 @@ config AHAB_BOOT config IMX8 bool + select HAS_CAAM config MU_BASE_SPL hex "MU base address used in SPL"
@@ -72,6 +73,9 @@ config TARGET_IMX8QM_MEK bool "Support i.MX8QM MEK board" select BOARD_LATE_INIT select IMX8QM + select FSL_CAAM + select ARCH_MISC_INIT + select SPL_CRYPTO if SPL config TARGET_CONGA_QMX8 bool "Support congatec conga-QMX8 board"
@@ -89,6 +93,9 @@ config TARGET_IMX8QXP_MEK bool "Support i.MX8QXP MEK board" select BOARD_LATE_INIT select IMX8QXP + select FSL_CAAM + select ARCH_MISC_INIT + select SPL_CRYPTO if SPL endchoice
arch/arm/mach-imx/imx8/cpu.c +15 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP */ #include <common.h>
@@ -89,6 +89,20 @@ int arch_cpu_init_dm(void)return 0 ; } +#if defined(CONFIG_ARCH_MISC_INIT ) +int arch_misc_init (void ) +{ +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (caam_jr), &dev); +if (ret) +printf ("Failed to initialize %s: %d\n" , dev->name, ret); + +return 0 ; +} +#endif +int print_bootinfo (void ) {enum boot_device bt_dev =get_boot_device ();
board/freescale/imx8qm_mek/spl.c +4 -2
@@ -1,7 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * -* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h>
@@ -24,6 +24,8 @@ void spl_board_init(void) {struct udevice *dev; +uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (imx8_scu), &dev); +uclass_find_first_device (UCLASS_MISC , &dev);for (; dev;uclass_find_next_device (&dev)) {
board/freescale/imx8qxp_mek/spl.c +4 -2
@@ -1,7 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP * -* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h>
@@ -39,6 +39,8 @@ void spl_board_init(void) {struct udevice *dev; +uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (imx8_scu), &dev); +uclass_find_first_device (UCLASS_MISC , &dev);for (; dev;uclass_find_next_device (&dev)) {
drivers/crypto/fsl/Kconfig +1 -1
@@ -11,7 +11,7 @@ config FSL_CAAM config CAAM_64BIT bool - default y if PHYS_64BIT && !ARCH_IMX8M + default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8 help Select Crypto driver for 64 bits CAAM version
drivers/crypto/fsl/jr.c +45 -2
102 lines not on this page · raw message
include/fsl_sec.h +5 -7
@@ -3,7 +3,7 @@* Common internal memory map for some Freescale SoCs * * Copyright 2014 Freescale Semiconductor, Inc. -* Copyright 2018 NXP +* Copyright 2018, 2021 NXP */ #ifndef __FSL_SEC_H
@@ -194,12 +194,10 @@ typedef struct ccsr_sec {#define SEC_CHAVID_LS_RNG_SHIFT 16#define SEC_CHAVID_RNG_LS_MASK 0x000f0000 -#define CONFIG_JRSTARTR_JR0 0x00000001 -struct jr_regs {#if defined(CONFIG_SYS_FSL_SEC_LE ) && \ !(defined(CONFIG_MX6 ) || defined(CONFIG_MX7 ) || \ - defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M )) + defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M ) || defined(CONFIG_IMX8 ))u32 irba_l;u32 irba_h;#else
@@ -214,7 +212,7 @@ struct jr_regs {u32 irja;#if defined(CONFIG_SYS_FSL_SEC_LE ) && \ !(defined(CONFIG_MX6 ) || defined(CONFIG_MX7 ) || \ - defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M )) + defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M ) || defined(CONFIG_IMX8 ))u32 orba_l;u32 orba_h;#else
@@ -248,7 +246,7 @@ struct jr_regs {struct sg_entry {#if defined(CONFIG_SYS_FSL_SEC_LE ) && \ !(defined(CONFIG_MX6 ) || defined(CONFIG_MX7 ) || \ - defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M )) + defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M ) || defined(CONFIG_IMX8 ))uint32_t addr_lo;/* Memory Address - lo */ uint32_t addr_hi;/* Memory Address of start of buffer - hi */ #else
@@ -268,7 +266,7 @@ struct sg_entry { };#if defined(CONFIG_MX6 ) || defined(CONFIG_MX7 ) || \ - defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M ) + defined(CONFIG_MX7ULP ) || defined(CONFIG_IMX8M ) || defined(CONFIG_IMX8 )/* Job Ring Base Address */ #define JR_BASE_ADDR (x) (CONFIG_SYS_FSL_SEC_ADDR + 0x1000 * (x + 1))/* Secure Memory Offset varies accross versions */
Signature · 1 line
2.17.1
PATCH v8 10/15 crypto/fsl: Improve hwrng performance in kernel
In reply to Gaurav JainFrom: Ye Li <[email protected]>
RNG parameters are reconfigured.
- For TRNG to generate 256 bits of entropy, RNG TRNG Seed Control register is configured to have reduced SAMP_SIZE from default 2500 to 512. it is number of entropy samples that will be taken during Entropy generation.
- self-test registers(Monobit Limit, Poker Range, Run Length Limit) are synchronized with new RTSDCTL[SAMP_SIZE] of 512.
TRNG time is caluculated based on sample size. time required to generate entropy is reduced and hwrng performance improved from 0.3 kB/s to 1.3 kB/s.
--- drivers/crypto/fsl/jr.c | 102 +++++++++++++++++++++++++++++++++------- include/fsl_sec.h | 1 + 2 files changed, 87 insertions(+), 16 deletions(-)
drivers/crypto/fsl/jr.c +86 -16
@@ -603,30 +603,100 @@ static u8 get_rng_vid(ccsr_sec_t *sec)*/ static void kick_trng (int ent_delay,ccsr_sec_t *sec) { +u32 samples =512 ;/* number of bits to generate and test */ +u32 mono_min =195 ; +u32 mono_max =317 ; +u32 mono_range = mono_max - mono_min; +u32 poker_min =1031 ; +u32 poker_max =1600 ; +u32 poker_range = poker_max - poker_min +1 ; +u32 retries =2 ; +u32 lrun_max =32 ; +s32 run_1_min =27 ; +s32 run_1_max =107 ; +s32 run_1_range = run_1_max - run_1_min; +s32 run_2_min =7 ; +s32 run_2_max =62 ; +s32 run_2_range = run_2_max - run_2_min; +s32 run_3_min =0 ; +s32 run_3_max =39 ; +s32 run_3_range = run_3_max - run_3_min; +s32 run_4_min =-1 ; +s32 run_4_max =26 ; +s32 run_4_range = run_4_max - run_4_min; +s32 run_5_min =-1 ; +s32 run_5_max =18 ; +s32 run_5_range = run_5_max - run_5_min; +s32 run_6_min =-1 ; +s32 run_6_max =17 ; +s32 run_6_range = run_6_max - run_6_min; +u32 val; +struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; -u32 val; -/* put RNG4 into program mode */ -sec_setbits32 (&rng->rtmctl,RTMCTL_PRGM ); -/* rtsdctl bits 0-15 contain "Entropy Delay, which defines the -* length (in system clocks) of each Entropy sample taken -* */ +/* Put RNG in program mode */ +/* Setting both RTMCTL:PRGM and RTMCTL:TRNG_ACC causes TRNG to +* properly invalidate the entropy in the entropy register and +* force re-generation. +*/ +sec_setbits32 (&rng->rtmctl,RTMCTL_PRGM |RTMCTL_ACC ); + +/* Configure the RNG Entropy Delay +* Performance-wise, it does not make sense to +* set the delay to a value that is lower +* than the last one that worked (i.e. the state handles +* were instantiated properly. Thus, instead of wasting +* time trying to set the values controlling the sample +* frequency, the function simply returns. +*/ val =sec_in32 (&rng->rtsdctl); - val = (val & ~RTSDCTL_ENT_DLY_MASK ) | - (ent_delay <<RTSDCTL_ENT_DLY_SHIFT ); + val &=RTSDCTL_ENT_DLY_MASK ; + val >>=RTSDCTL_ENT_DLY_SHIFT ; +if (ent_delay < val) { +/* Put RNG4 into run mode */ +sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM |RTMCTL_ACC ); +return ; + } + + val = (ent_delay <<RTSDCTL_ENT_DLY_SHIFT ) | samples;sec_out32 (&rng->rtsdctl, val); -/* min. freq. count, equal to 1/4 of the entropy sample length */ -sec_out32 (&rng->rtfreqmin, ent_delay >>2 ); -/* disable maximum frequency count */ -sec_out32 (&rng->rtfreqmax,RTFRQMAX_DISABLE ); + +/* +* Recommended margins (min,max) for freq. count: +* freq_mul = RO_freq / TRNG_clk_freq +* rtfrqmin = (ent_delay x freq_mul) >> 1; +* rtfrqmax = (ent_delay x freq_mul) << 3; +* Given current deployments of CAAM in i.MX SoCs, and to simplify +* the configuration, we consider [1,16] to be a safe interval +* for the freq_mul and the limits of the interval are used to compute +* rtfrqmin, rtfrqmax +*/ +sec_out32 (&rng->rtfreqmin, ent_delay >>1 ); +sec_out32 (&rng->rtfreqmax, ent_delay <<7 ); + +sec_out32 (&rng->rtscmisc, (retries <<16 ) | lrun_max); +sec_out32 (&rng->rtpkrmax, poker_max); +sec_out32 (&rng->rtpkrrng, poker_range); +sec_out32 (&rng->rsvd1[0 ], (mono_range <<16 ) | mono_max); +sec_out32 (&rng->rsvd1[1 ], (run_1_range <<16 ) | run_1_max); +sec_out32 (&rng->rsvd1[2 ], (run_2_range <<16 ) | run_2_max); +sec_out32 (&rng->rsvd1[3 ], (run_3_range <<16 ) | run_3_max); +sec_out32 (&rng->rsvd1[4 ], (run_4_range <<16 ) | run_4_max); +sec_out32 (&rng->rsvd1[5 ], (run_5_range <<16 ) | run_5_max); +sec_out32 (&rng->rsvd1[6 ], (run_6_range <<16 ) | run_6_max); + + val =sec_in32 (&rng->rtmctl);/* -* select raw sampling in both entropy shifter +* Select raw sampling in both entropy shifter * and statistical checker */ -sec_setbits32 (&rng->rtmctl,RTMCTL_SAMP_MODE_RAW_ES_SC ); -/* put RNG4 into run mode */ -sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); + val &= ~RTMCTL_SAMP_MODE_INVALID ; + val |=RTMCTL_SAMP_MODE_RAW_ES_SC ; +/* Put RNG4 into run mode */ + val &= ~(RTMCTL_PRGM |RTMCTL_ACC ); +/*test with sample mode only */ +sec_out32 (&rng->rtmctl, val); }static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec)
include/fsl_sec.h +1 -0
@@ -34,6 +34,7 @@ #if CONFIG_SYS_FSL_SEC_COMPAT >= 4 /* RNG4 TRNG test registers */ struct rng4tst { +#define RTMCTL_ACC 0x20 #define RTMCTL_PRGM 0x00010000 /* 1 -> program mode, 0 -> run mode */ #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0 /* use von Neumann data in both entropy shifter and
Signature · 1 line
2.17.1
RE: [PATCH v8 10/15] crypto/fsl: Improve hwrng performance in kernel
Hello Gaurav,
Quoted 20 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Gaurav Jain
Sent: Monday, January 10, 2022 1:27 PM
To: [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; NXP i . MX U-Boot Team <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Tang Yuantian <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: [PATCH v8 10/15]crypto/fsl: Improve hwrng performance in kernelFrom: Ye Li <[email protected]>
Quoted 8 lines
RNG parameters are reconfigured.
- For TRNG to generate 256 bits of entropy, RNG TRNG Seed Control register is configured to have reducedSAMP_SIZEfrom default 2500 to 512. it is number of entropy samples that will be taken during Entropy generation.
- self-testregisters(Monobit Limit, Poker Range, Run Length Limit)are synchronized with new RTSDCTL[SAMP_SIZE] of 512.TRNG time is caluculated based on sample size.
Typo: caluculated -> calculated
Quoted 2 lines
time required to generate entropy is reduced and hwrng performance improved from 0.3 kB/s to 1.3 kB/s.
Is there any degradation in passed/failed FIPS 140-2 test count? Can you provide some results from at least rngtest run?
Quoted 33 lines
Signed-off-by Ye Li <[email protected]>Acked-by Gaurav Jain <[email protected]>>--- drivers/crypto/fsl/jr.c | 102 +++++++++++++++++++++++++++++++++------- include/fsl_sec.h | 1 + 2 files changed, 87 insertions(+), 16 deletions(-)drivers/crypto/fsl/jr.c +17
-0@@ -603,30 +603,100 @@ static u8 get_rng_vid(ccsr_sec_t *sec)*/ static void kick_trng (int ent_delay,ccsr_sec_t *sec) { +u32 samples =512 ;/* number of bits to generate and test */ +u32 mono_min =195 ; +u32 mono_max =317 ; +u32 mono_range = mono_max - mono_min; +u32 poker_min =1031 ; +u32 poker_max =1600 ; +u32 poker_range = poker_max - poker_min +1 ; +u32 retries =2 ; +u32 lrun_max =32 ; +s32 run_1_min =27 ; +s32 run_1_max =107 ; +s32 run_1_range = run_1_max - run_1_min; +s32 run_2_min =7 ; +s32 run_2_max =62 ; +s32 run_2_range = run_2_max - run_2_min; +s32 run_3_min =0 ; +s32 run_3_max =39 ;
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 632
Quoted 10 lines
drivers/crypto/fsl/jr.c +10
-0+s32 run_3_range = run_3_max - run_3_min; +s32 run_4_min =-1 ; +s32 run_4_max =26 ; +s32 run_4_range = run_4_max - run_4_min; +s32 run_5_min =-1 ; +s32 run_5_max =18 ; +s32 run_5_range = run_5_max - run_5_min; +s32 run_6_min =-1 ; +s32 run_6_max =17 ; +s32 run_6_range = run_6_max - run_6_min;
I have a feeling that this whole block of local variables can be simplified. I'm not sure it is required to list this so detailed.
You can attempt to define those values in header file and use macros to compute bound conditions, rather than allocating this on the stack here.
Quoted 41 lines
drivers/crypto/fsl/jr.c +26
-10+u32 val; +struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; -u32 val; -/* put RNG4 into program mode */ -sec_setbits32 (&rng->rtmctl,RTMCTL_PRGM ); -/* rtsdctl bits 0-15 contain "Entropy Delay, which defines the -* length (in system clocks) of each Entropy sample taken -* */ +/* Put RNG in program mode */ +/* Setting both RTMCTL:PRGM and RTMCTL:TRNG_ACC causes TRNG to +* properly invalidate the entropy in the entropy register and +* force re-generation. +*/ +sec_setbits32 (&rng->rtmctl,RTMCTL_PRGM |RTMCTL_ACC ); + +/* Configure the RNG Entropy Delay +* Performance-wise, it does not make sense to +* set the delay to a value that is lower +* than the last one that worked (i.e. the state handles +* were instantiated properly. Thus, instead of wasting +* time trying to set the values controlling the sample +* frequency, the function simply returns. +*/ val =sec_in32 (&rng->rtsdctl); - val = (val & ~RTSDCTL_ENT_DLY_MASK ) | - (ent_delay <<RTSDCTL_ENT_DLY_SHIFT ); + val &=RTSDCTL_ENT_DLY_MASK ; + val >>=RTSDCTL_ENT_DLY_SHIFT ; +if (ent_delay < val) { +/* Put RNG4 into run mode */ +sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM |RTMCTL_ACC ); +return ; + } + + val = (ent_delay <<RTSDCTL_ENT_DLY_SHIFT ) | samples;sec_out32 (&rng->rtsdctl, val); -/* min. freq. count, equal to 1/4 of the entropy sample length */ -sec_out32 (&rng->rtfreqmin, ent_delay >>2 );
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 671
Quoted 10 lines
drivers/crypto/fsl/jr.c +8
-2-/* disable maximum frequency count */ -sec_out32 (&rng->rtfreqmax,RTFRQMAX_DISABLE ); + +/* +* Recommended margins (min,max) for freq. count: +* freq_mul = RO_freq / TRNG_clk_freq +* rtfrqmin = (ent_delay x freq_mul) >> 1; +* rtfrqmax = (ent_delay x freq_mul) << 3; +* Given current deployments of CAAM in i.MX SoCs, and to simplify +* the configuration, we consider [1,16] to be a safe interval
Statement "... we consider ..." should be perhaps extended with justification on how this conclusion was made. Some test results (either here in the comment or in commit message) would be beneficial to see.
Quoted 6 lines
drivers/crypto/fsl/jr.c +6
-0+* for the freq_mul and the limits of the interval are used to compute +* rtfrqmin, rtfrqmax +*/ +sec_out32 (&rng->rtfreqmin, ent_delay >>1 ); +sec_out32 (&rng->rtfreqmax, ent_delay <<7 ); +
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 687
Quoted 10 lines
drivers/crypto/fsl/jr.c +10
-0+sec_out32 (&rng->rtscmisc, (retries <<16 ) | lrun_max); +sec_out32 (&rng->rtpkrmax, poker_max); +sec_out32 (&rng->rtpkrrng, poker_range); +sec_out32 (&rng->rsvd1[0 ], (mono_range <<16 ) | mono_max); +sec_out32 (&rng->rsvd1[1 ], (run_1_range <<16 ) | run_1_max); +sec_out32 (&rng->rsvd1[2 ], (run_2_range <<16 ) | run_2_max); +sec_out32 (&rng->rsvd1[3 ], (run_3_range <<16 ) | run_3_max); +sec_out32 (&rng->rsvd1[4 ], (run_4_range <<16 ) | run_4_max); +sec_out32 (&rng->rsvd1[5 ], (run_5_range <<16 ) | run_5_max); +sec_out32 (&rng->rsvd1[6 ], (run_6_range <<16 ) | run_6_max);
Writing in reserved area is not a good idea. Those registers are defined in HW, can you please define them also in the header file?
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 691
Quoted 5 lines
drivers/crypto/fsl/jr.c +3
-1+ + val =sec_in32 (&rng->rtmctl);/* -* select raw sampling in both entropy shifter +* Select raw sampling in both entropy shifter
This change is not needed, otherwise please adjust all comments in original file, as for example comment below also starts with small letter...
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 627
Quoted 3 lines
drivers/crypto/fsl/jr.c +0
-1* and statistical checker */ -sec_setbits32 (&rng->rtmctl,RTMCTL_SAMP_MODE_RAW_ES_SC );
The only usage of RTMCTL_SAMP_MODE_RAW_ES_SC is dropped here, please remove it from include/fsl_sec.h as well.
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 697
Quoted 6 lines
drivers/crypto/fsl/jr.c +4
-2-/* put RNG4 into run mode */ -sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); + val &= ~RTMCTL_SAMP_MODE_INVALID ; + val |=RTMCTL_SAMP_MODE_RAW_ES_SC ; +/* Put RNG4 into run mode */ + val &= ~(RTMCTL_PRGM |RTMCTL_ACC );
BIT() macro for both new and existing defines?
Quoted 18 lines
drivers/crypto/fsl/jr.c +2
-0+/*test with sample mode only */ +sec_out32 (&rng->rtmctl, val); }static int rng_init (uint8_t sec_idx,ccsr_sec_t *sec)include/fsl_sec.h +1
-1@@ -34,6 +34,7 @@ #if CONFIG_SYS_FSL_SEC_COMPAT >= 4 /* RNG4 TRNG test registers */ struct rng4tst { +#define RTMCTL_ACC 0x20 #define RTMCTL_PRGM 0x00010000 /* 1 -> program mode, 0 -> run mode */ #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0 /* use von Neumann data in both entropy shifter and --
Quoted 1 line
2.17.1
-- andrey
RE: [EXT] RE: [PATCH v8 10/15] crypto/fsl: Improve hwrng performance in kernel
Hi Andrey
For now I will remove this particular patch from my series and will send a separate patch addressing your comments.
Regards
Gaurav Jain
Quoted 243 lines
-----Original Message-----
From: ZHIZHIKIN Andrey <[email protected]>
Sent: Monday, January 10, 2022 7:31 PM
To: Gaurav Jain <[email protected]>; [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil Malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; dl-uboot-imx <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Meenakshi Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod Kumar <[email protected]>; Andy Tang <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>; [email protected]
Subject: [EXT] RE: [PATCH v8 10/15]crypto/fsl: Improve hwrng performance in kernelCaution: EXT Email
Hello Gaurav,
Cc Michael WalleQuoted 6 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Gaurav Jain
Sent: Monday, January 10, 2022 1:27 PM
To: [email protected]
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon GlassQuoted 8 lines
<[email protected]>; Priyanka Jain <[email protected]>; Ye Li <[email protected]>; Horia Geanta <[email protected]>; Ji Luo <[email protected]>; Franck Lenormand <[email protected]>; Silvano Di Ninno <[email protected]>; Sahil malhotra <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; NXP i . MX U-Boot Team <[email protected]>; Shengzhou Liu <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>;
Meenakshi
Quoted 2 lines
Aggarwal <[email protected]>; Wasim Khan <[email protected]>; Alison Wang <[email protected]>; Pramod
Kumar
Quoted 7 lines
<[email protected]>; Tang Yuantian <[email protected]>; Adrian Alonso <[email protected]>; Vladimir Oltean <[email protected]>
Subject: [PATCH v8 10/15]crypto/fsl: Improve hwrng performance in kernelFrom: Ye Li <[email protected]>
Quoted 8 lines
RNG parameters are reconfigured.
- For TRNG to generate 256 bits of entropy, RNG TRNG Seed Control register is configured to have reducedSAMP_SIZEfrom default 2500 to 512. it is number of entropy samples that will be taken during Entropy generation.
- self-testregisters(Monobit Limit, Poker Range, Run Length Limit)are synchronized with new RTSDCTL[SAMP_SIZE] of 512.TRNG time is caluculated based on sample size.
Typo: caluculated -> calculated
Quoted 2 lines
time required to generate entropy is reduced and hwrng performance improved from 0.3 kB/s to 1.3 kB/s.
Is there any degradation in passed/failed FIPS 140-2 test count? Can you provide some results from at least rngtest run?
Quoted 32 lines
Signed-off-by Ye Li <[email protected]>Acked-by Gaurav Jain <[email protected]>>--- drivers/crypto/fsl/jr.c | 102 +++++++++++++++++++++++++++++++++------- include/fsl_sec.h | 1 + 2 files changed, 87 insertions(+), 16 deletions(-)drivers/crypto/fsl/jr.c index renamed from drivers/crypto/fsl/jr.c +0
-0
a84440ab10..e5346a84a4100644drivers/crypto/fsl/jr.c +17
-0@@ -603,30 +603,100 @@ static u8 get_rng_vid(ccsr_sec_t *sec)*/ static void kick_trng (int ent_delay,ccsr_sec_t *sec) { +u32 samples =512 ;/* number of bits to generate and test */ +u32 mono_min =195 ; +u32 mono_max =317 ; +u32 mono_range = mono_max - mono_min; +u32 poker_min =1031 ; +u32 poker_max =1600 ; +u32 poker_range = poker_max - poker_min +1 ; +u32 retries =2 ; +u32 lrun_max =32 ; +s32 run_1_min =27 ; +s32 run_1_max =107 ; +s32 run_1_range = run_1_max - run_1_min; +s32 run_2_min =7 ; +s32 run_2_max =62 ; +s32 run_2_range = run_2_max - run_2_min; +s32 run_3_min =0 ; +s32 run_3_max =39 ;drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 631
Quoted 10 lines
drivers/crypto/fsl/jr.c +10
-0+s32 run_3_range = run_3_max - run_3_min; +s32 run_4_min =-1 ; +s32 run_4_max =26 ; +s32 run_4_range = run_4_max - run_4_min; +s32 run_5_min =-1 ; +s32 run_5_max =18 ; +s32 run_5_range = run_5_max - run_5_min; +s32 run_6_min =-1 ; +s32 run_6_max =17 ; +s32 run_6_range = run_6_max - run_6_min;I have a feeling that this whole block of local variables can be simplified. I'm not sure it is required to list this so detailed.
You can attempt to define those values in header file and use macros to compute bound conditions, rather than allocating this on the stack here.
Quoted 41 lines
drivers/crypto/fsl/jr.c +26
-10+u32 val; +struct rng4tst __iomem *rng = (struct rng4tst __iomem *)&sec->rng; -u32 val; -/* put RNG4 into program mode */ -sec_setbits32 (&rng->rtmctl,RTMCTL_PRGM ); -/* rtsdctl bits 0-15 contain "Entropy Delay, which defines the -* length (in system clocks) of each Entropy sample taken -* */ +/* Put RNG in program mode */ +/* Setting both RTMCTL:PRGM and RTMCTL:TRNG_ACC causes TRNG to +* properly invalidate the entropy in the entropy register and +* force re-generation. +*/ +sec_setbits32 (&rng->rtmctl,RTMCTL_PRGM |RTMCTL_ACC ); + +/* Configure the RNG Entropy Delay +* Performance-wise, it does not make sense to +* set the delay to a value that is lower +* than the last one that worked (i.e. the state handles +* were instantiated properly. Thus, instead of wasting +* time trying to set the values controlling the sample +* frequency, the function simply returns. +*/ val =sec_in32 (&rng->rtsdctl); - val = (val & ~RTSDCTL_ENT_DLY_MASK ) | - (ent_delay <<RTSDCTL_ENT_DLY_SHIFT ); + val &=RTSDCTL_ENT_DLY_MASK ; + val >>=RTSDCTL_ENT_DLY_SHIFT ; +if (ent_delay < val) { +/* Put RNG4 into run mode */ +sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM |RTMCTL_ACC ); +return ; + } + + val = (ent_delay <<RTSDCTL_ENT_DLY_SHIFT ) | samples;sec_out32 (&rng->rtsdctl, val); -/* min. freq. count, equal to 1/4 of the entropy sample length */ -sec_out32 (&rng->rtfreqmin, ent_delay >>2 );drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 671
Quoted 10 lines
drivers/crypto/fsl/jr.c +8
-2-/* disable maximum frequency count */ -sec_out32 (&rng->rtfreqmax,RTFRQMAX_DISABLE ); + +/* +* Recommended margins (min,max) for freq. count: +* freq_mul = RO_freq / TRNG_clk_freq +* rtfrqmin = (ent_delay x freq_mul) >> 1; +* rtfrqmax = (ent_delay x freq_mul) << 3; +* Given current deployments of CAAM in i.MX SoCs, and to simplify +* the configuration, we consider [1,16] to be a safe interval Statement "... we consider ..." should be perhaps extended with justification on how this conclusion was made. Some test results (either here in the comment or in commit message) would be beneficial to see.
Quoted 6 lines
drivers/crypto/fsl/jr.c +6
-0+* for the freq_mul and the limits of the interval are used to compute +* rtfrqmin, rtfrqmax +*/ +sec_out32 (&rng->rtfreqmin, ent_delay >>1 ); +sec_out32 (&rng->rtfreqmax, ent_delay <<7 ); +drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 687
Quoted 10 lines
drivers/crypto/fsl/jr.c +10
-0+sec_out32 (&rng->rtscmisc, (retries <<16 ) | lrun_max); +sec_out32 (&rng->rtpkrmax, poker_max); +sec_out32 (&rng->rtpkrrng, poker_range); +sec_out32 (&rng->rsvd1[0 ], (mono_range <<16 ) | mono_max); +sec_out32 (&rng->rsvd1[1 ], (run_1_range <<16 ) | run_1_max); +sec_out32 (&rng->rsvd1[2 ], (run_2_range <<16 ) | run_2_max); +sec_out32 (&rng->rsvd1[3 ], (run_3_range <<16 ) | run_3_max); +sec_out32 (&rng->rsvd1[4 ], (run_4_range <<16 ) | run_4_max); +sec_out32 (&rng->rsvd1[5 ], (run_5_range <<16 ) | run_5_max); +sec_out32 (&rng->rsvd1[6 ], (run_6_range <<16 ) | run_6_max);Writing in reserved area is not a good idea. Those registers are defined in HW, can you please define them also in the header file?
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 691
Quoted 5 lines
drivers/crypto/fsl/jr.c +3
-1+ + val =sec_in32 (&rng->rtmctl);/* -* select raw sampling in both entropy shifter +* Select raw sampling in both entropy shifter This change is not needed, otherwise please adjust all comments in original file, as for example comment below also starts with small letter...
drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 627
Quoted 3 lines
drivers/crypto/fsl/jr.c +0
-1* and statistical checker */ -sec_setbits32 (&rng->rtmctl,RTMCTL_SAMP_MODE_RAW_ES_SC );The only usage of
RTMCTL_SAMP_MODE_RAW_ES_SCis dropped here, please remove it frominclude/fsl_sec.has well.drivers/crypto/fsl/jr.c static u8 get_rng_vid(ccsr_sec_t *sec) · line 697
Quoted 6 lines
drivers/crypto/fsl/jr.c +4
-2-/* put RNG4 into run mode */ -sec_clrbits32 (&rng->rtmctl,RTMCTL_PRGM ); + val &= ~RTMCTL_SAMP_MODE_INVALID ; + val |=RTMCTL_SAMP_MODE_RAW_ES_SC ; +/* Put RNG4 into run mode */ + val &= ~(RTMCTL_PRGM |RTMCTL_ACC );
BIT()macro for both new and existing defines?Quoted 10 lines
drivers/crypto/fsl/jr.c +2
-0+/*test with sample mode only */ +sec_out32 (&rng->rtmctl, val); } static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec) diff --git
a/include/fsl_sec.hb/include/fsl_sec.hindex7b6e3e2c20..2b3239414a100644include/fsl_sec.h line 38
Quoted 5 lines
include/fsl_sec.h +1
-0@@ -34,6 +34,7 @@ #if CONFIG_SYS_FSL_SEC_COMPAT >= 4 /* RNG4 TRNG test registers */ struct rng4tst { +#define RTMCTL_ACC 0x20 #define RTMCTL_PRGM 0x00010000 /* 1 -> program mode, 0 -> run mode*/
include/fsl_sec.h line 39
Quoted 1 line
include/fsl_sec.h +0
-0#define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0/* use von Neumann data in
Quoted 4 lines
include/fsl_sec.h +0
-0both entropy shifterand
--
2.17.1-- andrey
PATCH v8 11/15 Layerscape: Add crypto node in device tree
In reply to Gaurav JainLS(1021/1012/1028/1043/1046/1088/2088), LX2160 - updated device tree
--- arch/arm/dts/fsl-ls1012a.dtsi | 46 ++++++++++++++++++++++++++++++++++- arch/arm/dts/fsl-ls1043a.dtsi | 45 +++++++++++++++++++++++++++++++++- arch/arm/dts/fsl-ls1046a.dtsi | 44 +++++++++++++++++++++++++++++++++ arch/arm/dts/fsl-ls1088a.dtsi | 39 +++++++++++++++++++++++++++++ arch/arm/dts/fsl-ls2080a.dtsi | 39 +++++++++++++++++++++++++++++ arch/arm/dts/fsl-lx2160a.dtsi | 41 ++++++++++++++++++++++++++++++- arch/arm/dts/ls1021a.dtsi | 40 ++++++++++++++++++++++++++++++ 7 files changed, 291 insertions(+), 3 deletions(-)
arch/arm/dts/fsl-ls1012a.dtsi +45 -1
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ OR X11 /* - * Copyright 2020 NXP + * Copyright 2020-2021 NXP * Copyright 2016 Freescale Semiconductor */
@@ -71,6 +71,50 @@ bus-width = <4>; }; + crypto: crypto@1700000 { + compatible = "fsl,sec-v5.4", "fsl,sec-v5.0", + "fsl,sec-v4.0"; + fsl,sec-era = <8>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x00 0x1700000 0x100000>; + reg = <0x00 0x1700000 0x0 0x100000>; + interrupts = <0 75 0x4>; + dma-coherent; + + sec_jr0: jr@10000 { + compatible = "fsl,sec-v5.4-job-ring", + "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x10000 0x10000>; + interrupts = <0 71 0x4>; + }; + + sec_jr1: jr@20000 { + compatible = "fsl,sec-v5.4-job-ring", + "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x20000 0x10000>; + interrupts = <0 72 0x4>; + }; + + sec_jr2: jr@30000 { + compatible = "fsl,sec-v5.4-job-ring", + "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x30000 0x10000>; + interrupts = <0 73 0x4>; + }; + + sec_jr3: jr@40000 { + compatible = "fsl,sec-v5.4-job-ring", + "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x40000 0x10000>; + interrupts = <0 74 0x4>; + }; + }; + gpio0: gpio@2300000 { compatible = "fsl,qoriq-gpio"; reg = <0x0 0x2300000 0x0 0x10000>;
arch/arm/dts/fsl-ls1043a.dtsi +44 -1
57 lines not on this page · raw message
arch/arm/dts/fsl-ls1046a.dtsi +44 -0
56 lines not on this page · raw message
arch/arm/dts/fsl-ls1088a.dtsi +39 -0
@@ -174,6 +174,45 @@ dr_mode = "host"; }; + crypto: crypto@8000000 { + compatible = "fsl,sec-v5.0", "fsl,sec-v4.0"; + fsl,sec-era = <8>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x00 0x8000000 0x100000>; + reg = <0x00 0x8000000 0x0 0x100000>; + interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; + dma-coherent; + + sec_jr0: jr@10000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x10000 0x10000>; + interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr1: jr@20000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x20000 0x10000>; + interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr2: jr@30000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x30000 0x10000>; + interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr3: jr@40000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x40000 0x10000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + pcie1: pcie@3400000 { compatible = "fsl,ls-pcie", "snps,dw-pcie"; reg = <0x00 0x03400000 0x0 0x80000 /* dbi registers */
arch/arm/dts/fsl-ls2080a.dtsi +39 -0
@@ -239,6 +239,45 @@ status = "disabled"; }; + crypto: crypto@8000000 { + compatible = "fsl,sec-v5.0", "fsl,sec-v4.0"; + fsl,sec-era = <8>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x00 0x8000000 0x100000>; + reg = <0x00 0x8000000 0x0 0x100000>; + interrupts = <0 139 0x4>; /* Level high type */ + dma-coherent; + + sec_jr0: jr@10000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x10000 0x10000>; + interrupts = <0 140 0x4>; /* Level high type */ + }; + + sec_jr1: jr@20000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x20000 0x10000>; + interrupts = <0 141 0x4>; /* Level high type */ + }; + + sec_jr2: jr@30000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x30000 0x10000>; + interrupts = <0 142 0x4>; /* Level high type */ + }; + + sec_jr3: jr@40000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x40000 0x10000>; + interrupts = <0 143 0x4>; /* Level high type */ + }; + }; + fsl_mc: fsl-mc@80c000000 { compatible = "fsl,qoriq-mc", "simple-mfd"; reg = <0x00000008 0x0c000000 0 0x40>, /* MC portal base */
arch/arm/dts/fsl-lx2160a.dtsi +40 -1
53 lines not on this page · raw message
arch/arm/dts/ls1021a.dtsi +40 -0
@@ -3,6 +3,7 @@ * Freescale ls1021a SOC common device tree source * * Copyright 2013-2015 Freescale Semiconductor, Inc. + * Copyright 2021 NXP */ #include "skeleton.dtsi"
@@ -144,6 +145,45 @@ big-endian; }; + crypto: crypto@1700000 { + compatible = "fsl,sec-v5.0", "fsl,sec-v4.0"; + fsl,sec-era = <7>; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x1700000 0x100000>; + ranges = <0x0 0x1700000 0x100000>; + interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>; + + sec_jr0: jr@10000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x10000 0x10000>; + interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr1: jr@20000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x20000 0x10000>; + interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr2: jr@30000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x30000 0x10000>; + interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>; + }; + + sec_jr3: jr@40000 { + compatible = "fsl,sec-v5.0-job-ring", + "fsl,sec-v4.0-job-ring"; + reg = <0x40000 0x10000>; + interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; + }; + + }; + clockgen: clocking@1ee1000 { #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.17.1