diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2021-06-09 16:22:34 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-14 21:37:50 +0000 |
commit | 9efe07cf273a1bbe9bde1854a2884809d3c11be7 (patch) | |
tree | 35a536d87f4e6a26fd75b00536e970a3fe3b965e /zephyr/Kconfig | |
parent | 592ef1dafdd59629df85b9852fbb629c0323acd6 (diff) | |
download | chrome-ec-9efe07cf273a1bbe9bde1854a2884809d3c11be7.tar.gz |
zephyr: shim: add mpu enable and disable support
Add support for allowing the EC code to control the MPU setup.
ECOS code used to handle configuration as well as MPU enable/disable.
Zephyr has its own way of handling MPU configuration, so that part of
the EC code is compiled out, instead make sure that the fixed MPU
regions (that cover code & data) are disabled before the EC code starts,
and then enable them when mpu_enable() is called
Zephyr APIs do not expose any memory protection funciontality outside of
the arch specific code, so this sets the MPU regiers directly. That's
not very elegant, but it's done in a sample application as well [1], so
it should be an acceptable approach.
Disabling the MPU unit entirely could also be an option, but only doing
the fixed regions has the advantage of leaving the stack protection and
null pointer detection regions enabled.
[1] https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/application_development/code_relocation/src/main.c
BRANCH=none
BUG=b:180039888
TEST=actually tried to write in the static region, verified it fauls
after sysjump disable
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: I020c347e5f1b929500d4cf1c4c400dcd67e78dfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2950168
Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/Kconfig')
-rw-r--r-- | zephyr/Kconfig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 60f44fa8d1..6a350ca5ac 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -420,7 +420,8 @@ config PLATFORM_EC_MKBP_EVENT config PLATFORM_EC_MPU bool "Support Memory-Protection Unit (MPU)" - depends on CPU_CORTEX_M && CPU_HAS_MPU + depends on CPU_CORTEX_M + select ARM_MPU default y help This enables support a Memory-Protection Unit which can limit access |