Skip to content

Commit

Permalink
xtensa: mpu: introduce CONFIG_XTENSA_MPU_ONLY_SOC_RANGES
Browse files Browse the repository at this point in the history
This allows the SoC to have total control on what MPU ranges
to be programmed at boot. This overrides the generic ranges
in the architecture core code.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
  • Loading branch information
dcpleung authored and nashif committed Mar 20, 2024
1 parent 57d5917 commit f716539
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ config XTENSA_MPU_DEFAULT_MEM_TYPE
If userspace is enabled, it will be used to restore the memory type of
the region being removed from a memory domain.

config XTENSA_MPU_ONLY_SOC_RANGES
bool
help
Enable this by the SoC to indicate to the architecture code to use
the MPU ranges specified by SoC only, and skip the common ranges
defined in the core architecture code. This gives total control to
the SoC on the MPU ranges.

endif # XTENSA_MPU

endif # CPU_HAS_MPU
Expand Down
4 changes: 4 additions & 0 deletions arch/xtensa/core/mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static struct xtensa_mpu_map xtensa_mpu_map_fg_kernel;
* definied in the processor configuration.
*/

#ifndef CONFIG_XTENSA_MPU_ONLY_SOC_RANGES
/**
* Static definition of all code and data memory regions of the
* current Zephyr image. This information must be available and
Expand Down Expand Up @@ -129,6 +130,7 @@ static const struct xtensa_mpu_range mpu_zephyr_ranges[] = {
.memory_type = CONFIG_XTENSA_MPU_DEFAULT_MEM_TYPE,
},
};
#endif /* !CONFIG_XTENSA_MPU_ONLY_SOC_RANGES */

/**
* Return the pointer to the entry encompassing @a addr out of an array of MPU entries.
Expand Down Expand Up @@ -679,6 +681,7 @@ void xtensa_mpu_init(void)
xtensa_mpu_map_fg_kernel.entries[entry] = ent;
}

#ifndef CONFIG_XTENSA_MPU_ONLY_SOC_RANGES
/*
* Add necessary MPU entries for the memory regions of base Zephyr image.
*/
Expand All @@ -696,6 +699,7 @@ void xtensa_mpu_init(void)
(unsigned int)range->end,
ret);
}
#endif /* !CONFIG_XTENSA_MPU_ONLY_SOC_RANGES */

/*
* Now for the entries for memory regions needed by SoC.
Expand Down

0 comments on commit f716539

Please sign in to comment.