Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtensa: add MPU support #67938

Merged
merged 9 commits into from
Mar 20, 2024
Merged

xtensa: add MPU support #67938

merged 9 commits into from
Mar 20, 2024

Commits on Mar 17, 2024

  1. xtensa: userspace: simplify syscall trampoline a bit

    There is no need to do a call4 and jx. Simply do a callx4
    is enough.
    
    Also amended the now incorrect comment about how syscall
    trampoline is set up. It is now a straight call4 instead of
    the old 2x call4.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    c44ab16 View commit details
    Browse the repository at this point in the history
  2. xtensa: userspace: fix incorrectly passed syscall frame pointer

    Calling z_mrsh_* functions require 7 arguments where the 7th is
    the stack frame. Only the first 6 arguments are passed by
    registers where the 7th must be done via stack. However, this
    is not being done and an incorrect argument was being passed to
    the z_mrsh_* functions as stack frame pointer. An obvious issue
    would be dumping of stack during kernel oops, as incorrect data
    was being printed or crashes due to inaccessible memory. So fix
    it by properly populating the stack with correct stack frame
    pointer as outgoing argument for the caller of z_mrsh_*
    functions.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    182efb6 View commit details
    Browse the repository at this point in the history
  3. xtensa: userspace: use syscall to check if user context

    For CPU without THREADPTR, we need an alternative way to figure
    out if we are in user context. This extends the user context
    check to do that via a brief syscall.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    1756026 View commit details
    Browse the repository at this point in the history
  4. xtensa: move two kconfigs out of CPU_HAS_MMU block

    Both CONFIG_XTENSA_SYSCALL_USE_HELPER and
    CONFIG_XTENSA_INSECURE_USERSPACE are also applicable to MPU.
    So move them out of the CPU_HAS_MMU block.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    3cad25e View commit details
    Browse the repository at this point in the history
  5. xtensa: add MPU support for kernel mode

    This enables support for MPU on Xtensa. Currently this is
    for kernel mode only.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    3ef4fc1 View commit details
    Browse the repository at this point in the history
  6. tests: kernel/mem_protect/userspace: support for Xtensa MPU

    Add support to test for Xtensa MPU.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    3850c81 View commit details
    Browse the repository at this point in the history
  7. tests: kernel/userspace: skip other thread tests if needed

    With memory domain enabled, all threads within the same domain
    have access to each other threads' stacks, especially with
    CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API enabled (as it is
    expected behavior). So update the conditions to skip both
    tests to read and write to other threads' stacks.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    b9f7be2 View commit details
    Browse the repository at this point in the history
  8. xtensa: mpu: enable userspace support

    This extends the Xtensa MPU to support userspace.
    
    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    473af66 View commit details
    Browse the repository at this point in the history
  9. 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>
    dcpleung committed Mar 17, 2024
    Configuration menu
    Copy the full SHA
    89e3951 View commit details
    Browse the repository at this point in the history