Skip to content

Reduce SVCall priority on ARMv8-M - #1481

Open
jefftenney wants to merge 4 commits into
FreeRTOS:mainfrom
jefftenney:reduce-SVC-priority-ARMv8M
Open

Reduce SVCall priority on ARMv8-M#1481
jefftenney wants to merge 4 commits into
FreeRTOS:mainfrom
jefftenney:reduce-SVC-priority-ARMv8M

Conversation

@jefftenney

@jefftenney jefftenney commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

Instead of using the maximum priority for SVCall, use a priority just sufficient for preemption wherever SVC may be used. After this change, the developer can now assign some interrupts to higher priorities than SVC.

Also require configMAX_SYSCALL_INTERRUPT_PRIORITY to have a zero in the least-significant implemented preemption-priority bit in TrustZone applications. This change prevents confusion caused by the hardware de-prioritizing non-secure interrupts, which coalesces neighboring preemption priority groups. This change also simplified the determination of the optimal priority setting for SVCall.

Test Steps

Test two existing applications - one TZ and one non-TZ. (Neither uses the MPU though.)

Checklist:

  • I have tested my changes. No regression in existing tests.
  • (N/A) I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

#1470

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

After this commit, configMAX_SYSCALL_INTERRUPT_PRIORITY must have a zero
in the least-significant implemented preemption-priority bit in
Trustzone applications.

This change ensures that interrupts of higher priority are not masked
as a result of non-secure interrupt de-prioritization.  For example,
consider a PE with 4 preemption-priority bits implemented.  If
configMAX_SYSCALL_INTERRUPT_PRIORITY is 0x50, then non-secure interrupts
that use priority 0x40 would also be masked by FreeRTOS critical
sections.  This is unexpected because 0x40 is a higher priority than
0x50.  De-prioritization changes both 0x50 and 0x40 into 0xA0.
@jefftenney jefftenney changed the title Reduce SV priority ar mv8 m Reduce SVCall priority on ARMv8-M Aug 26, 2026
@jefftenney

Copy link
Copy Markdown
Contributor Author

These changes test OK in some basic testing. One TZ application and one non-TZ application on STM32U585 (CM33).

Note that pre-existing TZ applications that have set configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY to an odd number now hit the new assert. That is probably a good thing. It will cause the developer to consider possible undesirable consequences of setting that least-significant bit.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant