Skip to content
Closed
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
17 changes: 15 additions & 2 deletions drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include <zephyr/toolchain.h>

#include <hal/nrf_vpr.h>
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
#if (DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) || \
DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_dma_secure)) && \
!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)

Check notice on line 20 in drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c:20 -#if (DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) || \ - DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_dma_secure)) && \ +#if (DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) || \ + DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_dma_secure)) && \
#include <hal/nrf_spu.h>
#endif

Expand All @@ -25,6 +27,7 @@
NRF_VPR_Type *vpr;
uintptr_t exec_addr;
bool enable_secure;
bool enable_dma_secure;
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory)
uintptr_t src_addr;
size_t size;
Expand Down Expand Up @@ -53,12 +56,21 @@
}
#endif

#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure)
if (config->enable_secure) {
nrf_spu_periph_perm_secattr_set(NRF_SPU00,
nrf_address_slave_get((uint32_t)config->vpr),
true);
}
#endif
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_dma_secure)
if (config->enable_dma_secure) {
nrf_spu_periph_perm_dmasec_set(NRF_SPU00,
nrf_address_slave_get((uint32_t)config->vpr),
true);
}

Check notice on line 72 in drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c:72 - nrf_address_slave_get((uint32_t)config->vpr), - true); + nrf_address_slave_get((uint32_t)config->vpr), true);
#endif
#endif
LOG_DBG("Launching VPR (%p) from %p", config->vpr, (void *)config->exec_addr);
nrf_vpr_initpc_set(config->vpr, config->exec_addr);
Expand Down Expand Up @@ -86,11 +98,12 @@
IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, execution_memory), \
(.exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)),)) \
.enable_secure = DT_INST_PROP(inst, enable_secure), \
.enable_dma_secure = DT_INST_PROP(inst, enable_dma_secure), \
IF_ENABLED(NEEDS_COPYING(inst), \
(.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \
.size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \
\
DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \
POST_KERNEL, CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY, NULL);

Check notice on line 107 in drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c:107 -#define NORDIC_VPR_LAUNCHER_DEFINE(inst) \ +#define NORDIC_VPR_LAUNCHER_DEFINE(inst) \ IF_ENABLED(NEEDS_COPYING(inst), \ (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) <= \ DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ - "Execution memory exceeds source memory size");)) \ - \ - static const struct nordic_vpr_launcher_config config##inst = { \ - .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ + "Execution memory exceeds source memory size");)) \ + \ + static const struct nordic_vpr_launcher_config config##inst = { \ + .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, execution_memory), \ - (.exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)),)) \ - .enable_secure = DT_INST_PROP(inst, enable_secure), \ - .enable_dma_secure = DT_INST_PROP(inst, enable_dma_secure), \ - IF_ENABLED(NEEDS_COPYING(inst), \ + (.exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)),)) .enable_secure = \ + DT_INST_PROP(inst, enable_secure), \ + .enable_dma_secure = DT_INST_PROP(inst, enable_dma_secure), \ + IF_ENABLED(NEEDS_COPYING(inst), \ (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ .size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \ - \ - DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ + \ + DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \

DT_INST_FOREACH_STATUS_OKAY(NORDIC_VPR_LAUNCHER_DEFINE)
5 changes: 5 additions & 0 deletions dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ properties:
type: boolean
description: |
Enables setting VPR core's secure attribute to secure.

enable-dma-secure:
type: boolean
description: |
Enables setting VPR core's DMA secure attribute to secure.
Loading