Browse Source

llext: support ARC MPU

Make it so LLEXT allocates a memory region equal or greater
to the minimum size supported by the MPU, to ensure no region
overlap.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
pull/89380/head
Lauren Murphy 3 months ago committed by Benjamin Cabé
parent
commit
e0a54835c2
  1. 6
      subsys/llext/llext_mem.c
  2. 4
      tests/subsys/llext/testcase.yaml

6
subsys/llext/llext_mem.c

@ -20,8 +20,10 @@ LOG_MODULE_DECLARE(llext, CONFIG_LLEXT_LOG_LEVEL); @@ -20,8 +20,10 @@ LOG_MODULE_DECLARE(llext, CONFIG_LLEXT_LOG_LEVEL);
#ifdef CONFIG_MMU_PAGE_SIZE
#define LLEXT_PAGE_SIZE CONFIG_MMU_PAGE_SIZE
#elif CONFIG_ARC_MPU_VER == 2
#define LLEXT_PAGE_SIZE 2048
#else
/* Arm's MPU wants a 32 byte minimum mpu region */
/* Arm and non-v2 ARC MPUs want a 32 byte minimum MPU region */
#define LLEXT_PAGE_SIZE 32
#endif
@ -77,7 +79,7 @@ static int llext_copy_region(struct llext_loader *ldr, struct llext *ext, @@ -77,7 +79,7 @@ static int llext_copy_region(struct llext_loader *ldr, struct llext *ext,
* program-accessible data (not to string tables, for example).
*/
if (region->sh_flags & SHF_ALLOC) {
if (IS_ENABLED(CONFIG_ARM_MPU)) {
if (IS_ENABLED(CONFIG_ARM_MPU) || IS_ENABLED(CONFIG_ARC_MPU)) {
/* On ARM with an MPU, regions must be sized and
* aligned to the same power of two (larger than 32).
*/

4
tests/subsys/llext/testcase.yaml

@ -44,7 +44,9 @@ tests: @@ -44,7 +44,9 @@ tests:
extra_configs:
- CONFIG_LLEXT_STORAGE_WRITABLE=n
llext.readonly_mpu:
arch_allow: arm # Xtensa needs writable storage, currently not supported on RISC-V
arch_allow:
- arm # Xtensa needs writable storage, currently not supported on RISC-V
- arc
filter: CONFIG_ARCH_HAS_USERSPACE
extra_configs:
- CONFIG_USERSPACE=y

Loading…
Cancel
Save