Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entropy: Enable the PSA RNG for nRF54H20 #2008

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions boards/nordic/nrf54h20dk/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ if BOARD_NRF54H20DK_NRF54H20_CPUAPP
config BT_HCI_IPC
default y if BT

config MAX_THREAD_BYTES
default 3 if USERSPACE

endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP

if BOARD_NRF54H20DK_NRF54H20_CPURAD

config BT_CTLR
default y if BT

config MAX_THREAD_BYTES
default 3 if USERSPACE

endif # BOARD_NRF54H20DK_NRF54H20_CPURAD

if BOARD_NRF54H20DK_NRF54H20_CPUPPR
Expand Down
32 changes: 16 additions & 16 deletions boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@

/ {
reserved-memory {
cpuapp_ram0x_region: memory@2f010000 {
cpurad_ram0x_region: memory@2f010000 {
compatible = "nordic,owned-memory";
reg = <0x2f010000 DT_SIZE_K(260)>;
reg = <0x2f010000 DT_SIZE_K(4)>;
status = "disabled";
nordic,access = <NRF_OWNER_ID_APPLICATION NRF_PERM_RWS>;
nordic,access = <NRF_OWNER_ID_RADIOCORE NRF_PERM_RWS>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x2f010000 0x41000>;
ranges = <0x0 0x2f010000 0x1000>;

cpusec_cpuapp_ipc_shm: memory@0 {
cpusec_cpurad_ipc_shm: memory@0 {
reg = <0x0 DT_SIZE_K(2)>;
};

cpuapp_cpusec_ipc_shm: memory@800 {
cpurad_cpusec_ipc_shm: memory@800 {
reg = <0x800 DT_SIZE_K(2)>;
};

cpuapp_data: memory@1000 {
reg = <0x1000 DT_SIZE_K(256)>;
};
};

cpurad_ram0x_region: memory@2f051000 {
cpuapp_ram0x_region: memory@2f011000 {
compatible = "nordic,owned-memory";
reg = <0x2f051000 DT_SIZE_K(4)>;
reg = <0x2f011000 DT_SIZE_K(260)>;
status = "disabled";
nordic,access = <NRF_OWNER_ID_RADIOCORE NRF_PERM_RWS>;
nordic,access = <NRF_OWNER_ID_APPLICATION NRF_PERM_RWS>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x2f051000 0x1000>;
ranges = <0x0 0x2f011000 0x41000>;

cpusec_cpurad_ipc_shm: memory@0 {
cpusec_cpuapp_ipc_shm: memory@0 {
reg = <0x0 DT_SIZE_K(2)>;
};

cpurad_cpusec_ipc_shm: memory@800 {
cpuapp_cpusec_ipc_shm: memory@800 {
reg = <0x800 DT_SIZE_K(2)>;
};

cpuapp_data: memory@1000 {
reg = <0x1000 DT_SIZE_K(256)>;
};
};

etr_buf_ram0x_region: memory@2f0be000 {
Expand Down
11 changes: 8 additions & 3 deletions boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
zephyr,bt-hci = &bt_hci_ipc0;
nordic,802154-spinel-ipc = &ipc0;
zephyr,canbus = &can120;
zephyr,entropy = &prng;
zephyr,entropy = &psa_rng;
};

aliases {
Expand Down Expand Up @@ -109,8 +109,8 @@
};
};

prng: prng {
compatible = "nordic,entropy-prng";
psa_rng: psa-rng {
compatible = "zephyr,psa-crypto-rng";
status = "okay";
};
};
Expand Down Expand Up @@ -150,11 +150,16 @@
};

&cpusec_cpuapp_ipc {
status = "okay";
mbox-names = "tx", "rx";
tx-region = <&cpuapp_cpusec_ipc_shm>;
rx-region = <&cpusec_cpuapp_ipc_shm>;
};

&cpusec_bellboard {
status = "okay";
};

ipc0: &cpuapp_cpurad_ipc {
status = "okay";
mbox-names = "rx", "tx";
Expand Down
20 changes: 15 additions & 5 deletions boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,27 @@
zephyr,ieee802154 = &cpurad_ieee802154;
zephyr,bt-hci-ipc = &ipc0;
nordic,802154-spinel-ipc = &ipc0;
zephyr,entropy = &prng;
};
prng: prng {
compatible = "nordic,entropy-prng";
status = "okay";
zephyr,entropy = &psa_rng;
};
aliases {
ipc-to-cpusys = &cpurad_cpusys_ipc;
resetinfo = &cpurad_resetinfo;
};

psa_rng: psa-rng {
compatible = "zephyr,psa-crypto-rng";
status = "okay";
};
};

&cpuapp_cpurad_ram0x_region {
status = "okay";
};

&cpurad_ram0x_region {
status = "okay";
};

&cpurad_bellboard {
status = "okay";
interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>;
Expand All @@ -60,11 +65,16 @@
};

&cpusec_cpurad_ipc {
status = "okay";
mbox-names = "tx", "rx";
tx-region = <&cpurad_cpusec_ipc_shm>;
rx-region = <&cpusec_cpurad_ipc_shm>;
};

&cpusec_bellboard {
status = "okay";
};

ipc0: &cpuapp_cpurad_ipc {
status = "okay";
mbox-names = "tx", "rx";
Expand Down
1 change: 1 addition & 0 deletions drivers/entropy/Kconfig.psa_crypto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config ENTROPY_PSA_CRYPTO_RNG
depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED
select ENTROPY_HAS_DRIVER
select PSA_WANT_GENERATE_RANDOM
select SSF_PSA_CRYPTO_SERVICE_ENABLED if (SOC_SERIES_NRF54HX && !RISCV_CORE_NORDIC_VPR)
default y
help
Enable the PSA Crypto source Entropy driver.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_MAIN_STACK_SIZE=1024
4 changes: 2 additions & 2 deletions soc/nordic/nrf54h/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config SOC_NRF54H20_CPUAPP_COMMON
select CPU_CORTEX_M33
select CPU_HAS_ARM_MPU
select CPU_HAS_ARM_SAU
select CPU_HAS_DCACHE
select CPU_HAS_DCACHE if !SSF_PSA_CRYPTO_SERVICE_ENABLED
select CPU_HAS_ICACHE
select CPU_HAS_FPU
select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS
Expand All @@ -41,7 +41,7 @@ config SOC_NRF54H20_CPURAD_COMMON
select CPU_CORTEX_M33
select CPU_HAS_ARM_MPU
select CPU_HAS_ARM_SAU
select CPU_HAS_DCACHE
select CPU_HAS_DCACHE if !SSF_PSA_CRYPTO_SERVICE_ENABLED
select CPU_HAS_ICACHE
select CPU_HAS_FPU
select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* SPDX-License-Identifier: Apache-2.0 */

&cpusec_cpuapp_ipc {
status = "disabled";
};

&cpusec_bellboard {
status = "disabled";
};
5 changes: 4 additions & 1 deletion tests/crypto/mbedtls/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ common:
timeout: 400
tests:
crypto.mbedtls:
platform_exclude: m2gl025_miv
platform_exclude:
- m2gl025_miv
- nrf54h20dk/nrf54h20/cpuapp
- nrf54h20dk/nrf54h20/cpurad
extra_configs:
- CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=0
- arch:riscv64:CONFIG_ZTEST_STACK_SIZE=8192
Expand Down
3 changes: 2 additions & 1 deletion tests/crypto/mbedtls_psa/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# latter case will allow to test
# CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG.
common:
filter: not CONFIG_BUILD_WITH_TFM
filter: not CONFIG_BUILD_WITH_TFM and
not CONFIG_PSA_SSF_CRYPTO_CLIENT
tags:
- mbedtls
- psa
Expand Down
4 changes: 3 additions & 1 deletion tests/crypto/secp256r1/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ common:
CONFIG_CSPRNG_ENABLED and
CONFIG_HARDWARE_DEVICE_CS_GENERATOR and
not CONFIG_BUILD_WITH_TFM and
not (CONFIG_MBEDTLS and CONFIG_TINYCRYPT)
not (CONFIG_MBEDTLS and CONFIG_TINYCRYPT) and
not CONFIG_PSA_SSF_CRYPTO_CLIENT

tags:
- mbedtls
- tinycrypt
Expand Down
1 change: 0 additions & 1 deletion tests/subsys/portability/cmsis_rtos_v2/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CONFIG_SCHED_SCALABLE=y
CONFIG_CMSIS_V2_MEM_SLAB_MAX_DYNAMIC_SIZE=128
CONFIG_CMSIS_V2_THREAD_MAX_COUNT=23
CONFIG_CMSIS_V2_THREAD_DYNAMIC_MAX_COUNT=10
CONFIG_TIMEOUT_64BIT=n
CONFIG_CMSIS_V2_THREAD_MAX_STACK_SIZE=1024
CONFIG_CMSIS_V2_THREAD_DYNAMIC_STACK_SIZE=1024
CONFIG_MP_MAX_NUM_CPUS=1