xtensa: mpu: introduce CONFIG_XTENSA_MPU_ONLY_SOC_RANGES

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>
This commit is contained in:
Daniel Leung 2024-02-16 12:30:18 -08:00 committed by Anas Nashif
parent 57d591700b
commit f7165395b4
2 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -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
@ -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.
@ -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.
*/
@ -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.