Skip to content

Commit 1800b17

Browse files
decsnymmahadevan108
authored andcommitted
caam: Fixes RNG descriptors
Moves CAAM initialization and RNG related job descriptors to a non-cacheable region instead of being on the write-back stack. Currently the CAAM and cores are accessing these descriptors incoherently. Signed-off-by: Declan Snyder <[email protected]>
1 parent 2640fbf commit 1800b17

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

mcux/mcux-sdk-ng/README

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
MCUXpresso SDK NG
2+
##############
3+
4+
Origin:
5+
NXP MCUXpresso SDK Core
6+
https://github.com/nxp-mcuxpresso/mcuxsdk-core
7+
SHA: 84547d55114471cd361e32559db1c4ecb3a32815
8+
9+
NXP MCUXpresso SDK Component
10+
https://github.com/nxp-mcuxpresso/mcux-component
11+
SHA: 0a95c0536c168a97e1caac0bc41898c3cf9f75a8
12+
13+
NXP MCUXpresso SDK Device i.MX
14+
https://github.com/nxp-mcuxpresso/mcux-devices-imx
15+
SHA: bd9dec893950a163c5f9f4c53e5bc7a202b83819
16+
17+
NXP MCUXpresso SDK Device RT
18+
https://github.com/nxp-mcuxpresso/mcux-devices-rt
19+
SHA: 69599d3038bf20fdffb5b89dc3fcb34a2322f43a
20+
21+
NXP MCUXpresso SDK Device Kinetis
22+
https://github.com/nxp-mcuxpresso/mcux-devices-kinetis
23+
SHA: d3b2cbe46095f59a27d7f0d8b251bcfa7a8f5d6f
24+
25+
NXP MCUXpresso SDK Device LPC
26+
https://github.com/nxp-mcuxpresso/mcux-devices-lpc
27+
SHA: 4671b7f19480417fefb23eb8c6e71a2bc9f2d9f1
28+
29+
NXP MCUXpresso SDK Device MCX
30+
https://github.com/nxp-mcuxpresso/mcux-devices-mcx
31+
SHA: 3ff51c8cf729c59918e96f4ce33b37c3e93ffc74
32+
33+
NXP MCUXpresso SDK Device Wireless
34+
https://github.com/nxp-mcuxpresso/mcux-devices-wireless
35+
SHA: 0dbc39ab4a247d7edc1b2b9aecdf3f0ea33369af
36+
37+
NXP MCUXpresso SDK USB
38+
https://github.com/nxp-mcuxpresso/mcuxsdk-middleware-usb
39+
SHA: ff4c277499155029637526e0bf7ad7fa4c875e48
40+
41+
42+
Patch List:
43+
- drivers/caam/fsl_caam.c: Move used job descriptors in the CAAM driver from the stack to noncacheable section. At time of writing, there should
44+
be four being used for entropy in zephyr.

mcux/mcux-sdk-ng/drivers/caam/fsl_caam.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ static uint32_t s_jrIndex2 = 0; /*!< Current index in the input
221221
static caam_job_ring_interface_t *s_jr3 = NULL; /*!< Pointer to job ring interface 3. */
222222
static uint32_t s_jrIndex3 = 0; /*!< Current index in the input job ring 3. */
223223

224+
AT_NONCACHEABLE_SECTION(static caam_rng_config_t rngConfig);
225+
AT_NONCACHEABLE_SECTION(static caam_desc_rng_t rngGenSeckey);
226+
AT_NONCACHEABLE_SECTION(static caam_desc_rng_t rngInstantiate);
227+
AT_NONCACHEABLE_SECTION(static caam_desc_rng_t descBuf);
224228
/*******************************************************************************
225229
* Code
226230
******************************************************************************/
@@ -1842,7 +1846,6 @@ status_t CAAM_Init(CAAM_Type *base, const caam_config_t *config)
18421846
* for FIFO STORE command to be able to store Key register as Black key
18431847
* for example during AES XCBC-MAC context switch (need to store derived key K1 to memory)
18441848
*/
1845-
caam_rng_config_t rngConfig;
18461849
(void)CAAM_RNG_GetDefaultConfig(&rngConfig);
18471850

18481851
/* reset RNG */
@@ -4444,7 +4447,6 @@ status_t CAAM_RNG_Init(CAAM_Type *base,
44444447
status_t status;
44454448

44464449
/* create job descriptor */
4447-
caam_desc_rng_t rngInstantiate = {0};
44484450
rngInstantiate[0] = 0xB0800006u;
44494451
rngInstantiate[1] = 0x12200020u; /* LOAD 32 bytes of to Class 1 Context Register. Offset 0 bytes. */
44504452
rngInstantiate[2] = (uint32_t)ADD_OFFSET((uint32_t)config->personalString);
@@ -4540,7 +4542,6 @@ status_t CAAM_RNG_GenerateSecureKey(CAAM_Type *base, caam_handle_t *handle, caam
45404542
status_t status;
45414543

45424544
/* create job descriptor */
4543-
caam_desc_rng_t rngGenSeckey = {0};
45444545
rngGenSeckey[0] = 0xB0800004u; /* HEADER */
45454546
rngGenSeckey[1] = 0x12200020u; /* LOAD 32 bytes of to Class 1 Context Register. Offset 0 bytes. */
45464547
rngGenSeckey[2] = ADD_OFFSET((uint32_t)additionalEntropy);
@@ -4647,7 +4648,6 @@ status_t CAAM_RNG_GetRandomData(CAAM_Type *base,
46474648
caam_rng_generic256_t additionalEntropy)
46484649
{
46494650
status_t status;
4650-
caam_desc_rng_t descBuf;
46514651

46524652
do
46534653
{

0 commit comments

Comments
 (0)