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

arch: arm: Add code for swapping threads between secure and non-secure #26414

Merged
merged 7 commits into from May 5, 2021

Commits on May 4, 2021

  1. arch: arm: Add config for non-blocking secure calls

    Introduce a Kconfig option to allow Secure function calls to be
    pre-empted.
    
    Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
    Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
    ioannisg authored and oyvindronningstad committed May 4, 2021
    Configuration menu
    Copy the full SHA
    bf223ff View commit details
    Browse the repository at this point in the history
  2. arch: arm: Add code for swapping threads between secure and non-secure

    This adds code to swap_helper.S which does special handling of LR when
    the interrupt came from secure. The LR value is stored to memory, and
    put back into LR when swapping back to the relevant thread.
    
    Also, add special handling of FP state when switching from secure to
    non-secure, since we don't know whether the original non-secure thread
    (which called a secure service) was using FP registers, so we always
    store them, just in case.
    
    Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
    oyvindronningstad committed May 4, 2021
    Configuration menu
    Copy the full SHA
    9242e22 View commit details
    Browse the repository at this point in the history
  3. trusted-firmware-m: Store FP context before entering secure calls

    When ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS is enabled, if FPU is
    being used (CONTROL.FPCA == 1), store all FP registers before
    entering the secure function, and restore them afterwards.
    
    This is needed if any NS thread or ISR that interrupts the secure
    function uses FP registers. If they do, a secure UsageFault occurs
    unless this change is applied.
    
    This allows k_sched_lock() and k_sched_unlock() to be dropped when
    ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS is enabled.
    
    Enable ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS by default when
    building TF-M.
    
    Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
    oyvindronningstad committed May 4, 2021
    Configuration menu
    Copy the full SHA
    d51cba0 View commit details
    Browse the repository at this point in the history
  4. tests: arm: Add arm_thread_swap_tz test

    For testing secure->non-secure thread swapping.
    This also tests that the FP context is correctly preserved
    when calling a secure function.
    
    Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
    oyvindronningstad committed May 4, 2021
    Configuration menu
    Copy the full SHA
    0c29fc5 View commit details
    Browse the repository at this point in the history
  5. doc: release notes: release notes entry for non-blocking secure calls

    Add an entry in the release notes regarding the
    support for non-blocking secure calls in Zephyr.
    
    Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
    ioannisg authored and oyvindronningstad committed May 4, 2021
    Configuration menu
    Copy the full SHA
    e8a3996 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2021

  1. tests: arm_thread_swap_tz: decrease work delay to ensure test passing

    Decrease the submitted work delay, to ensure that the PSA
    crypto operation will be preempted when the work fires. The
    modification is required for devices with fast crypto
    operations. Also minor corrections to the test ase name,
    so it is not the same with the other arm_thread_swap test.
    
    Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
    ioannisg committed May 5, 2021
    Configuration menu
    Copy the full SHA
    dcfc666 View commit details
    Browse the repository at this point in the history
  2. tests: arm_thread_swap_tz: correct dt overlays for stm32 boards

    Correct thee dt overlays for the STM32 boards, so the Zephyr
    image starting address is in accordance with what TF-m expects
    it to be.
    
    Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
    ioannisg committed May 5, 2021
    Configuration menu
    Copy the full SHA
    bda970a View commit details
    Browse the repository at this point in the history