arch: arm: cortex_m: Update APIs to save and restore FPU context #93057
+23
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update API to save and restore FPU context to address suspend to ram use case.
The API is updated as follow:
z_arm_save_fp_context
andz_arm_restore_fp_context
have been changed to always save/restore FPU context regardless ofFPU_SHARING
settingz_arm_save_shared_fp_context
andz_arm_restore_shared_fp_context
) to addressFPU_SHARING
use cases (See https://docs.zephyrproject.org/latest/kconfig.html#!%5ECONFIG_FPU_SHARING$)The existing API
z_arm_save_fp_context
andz_arm_restore_fp_context
were used only in TFM code, but I believe that in this use case we need to save/restore FPU context regardless of FPU_SHARING setting. Please feedback on this point.I also noticed by reading code and ARM documentation that the FPU context is preserved across threads by hardware on Cortex-M devices (via the FPCCR.ASPEN register field), so it seems to me that this new API (which mimic existing API) is not needed (except for the doubtful TFM case above). If this is the case, this PR can be simplified.
See also #90001, #92847 (comment)