Skip to content

Commit f4dd686

Browse files
committed
[nrf fromtree] drivers: misc: nordic_vpr_launcher: add DMA secure attribute support
Extend vpr_launcher and device tree bindings to support configuring the DMA secure attribute. Signed-off-by: Dhanoo Surasarang <[email protected]> (cherry picked from commit 8053d23)
1 parent 9f038bf commit f4dd686

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include <zephyr/toolchain.h>
1616

1717
#include <hal/nrf_vpr.h>
18-
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
18+
#if (DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) || \
19+
DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_dma_secure)) && \
20+
!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
1921
#include <hal/nrf_spu.h>
2022
#endif
2123

@@ -25,6 +27,7 @@ struct nordic_vpr_launcher_config {
2527
NRF_VPR_Type *vpr;
2628
uintptr_t exec_addr;
2729
bool enable_secure;
30+
bool enable_dma_secure;
2831
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory)
2932
uintptr_t src_addr;
3033
size_t size;
@@ -53,12 +56,21 @@ static int nordic_vpr_launcher_init(const struct device *dev)
5356
}
5457
#endif
5558

56-
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
59+
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
60+
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure)
5761
if (config->enable_secure) {
5862
nrf_spu_periph_perm_secattr_set(NRF_SPU00,
5963
nrf_address_slave_get((uint32_t)config->vpr),
6064
true);
6165
}
66+
#endif
67+
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_dma_secure)
68+
if (config->enable_dma_secure) {
69+
nrf_spu_periph_perm_dmasec_set(NRF_SPU00,
70+
nrf_address_slave_get((uint32_t)config->vpr),
71+
true);
72+
}
73+
#endif
6274
#endif
6375
LOG_DBG("Launching VPR (%p) from %p", config->vpr, (void *)config->exec_addr);
6476
nrf_vpr_initpc_set(config->vpr, config->exec_addr);
@@ -86,6 +98,7 @@ static int nordic_vpr_launcher_init(const struct device *dev)
8698
IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, execution_memory), \
8799
(.exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)),)) \
88100
.enable_secure = DT_INST_PROP(inst, enable_secure), \
101+
.enable_dma_secure = DT_INST_PROP(inst, enable_dma_secure), \
89102
IF_ENABLED(NEEDS_COPYING(inst), \
90103
(.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \
91104
.size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \

dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ properties:
3030
type: boolean
3131
description: |
3232
Enables setting VPR core's secure attribute to secure.
33+
34+
enable-dma-secure:
35+
type: boolean
36+
description: |
37+
Enables setting VPR core's DMA secure attribute to secure.

0 commit comments

Comments
 (0)