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

Question: Cortex-M7 revision r0p1 errata #23930

Closed
pftbest opened this issue Mar 30, 2020 · 7 comments
Closed

Question: Cortex-M7 revision r0p1 errata #23930

pftbest opened this issue Mar 30, 2020 · 7 comments
Labels
area: Architectures area: ARM ARM (32-bit) Architecture

Comments

@pftbest
Copy link

pftbest commented Mar 30, 2020

Some Cortex-M7 chips has errata 837070 "Increasing priority using a write to BASEPRI does not take effect immediately".

Is there any mitigation for this in zephyr kernel? I can see a lot of writes to BASEPRI in the source code but it's not clear to me if they are affected or not.

Other projects implement a workaround for this, for example FreeRTOS has a separate port for r0p1.

@pftbest pftbest added the Enhancement Changes/Updates/Additions to existing features label Mar 30, 2020
@stephanosio stephanosio added area: Architectures area: ARM ARM (32-bit) Architecture question and removed Enhancement Changes/Updates/Additions to existing features labels Mar 30, 2020
@stephanosio
Copy link
Member

cc @ioannisg

@ioannisg
Copy link
Member

Thanks for posting this, @pftbest .

As far as I can see from this errata:

This effect is only limited to the next instruction. Subsequent instructions are guaranteed to see the new boosted priority.

So, it seems to me that even though we do not directly account for this errata in the code, MSR to BASEPRI is followed by an ISB instruction; (this was done for extra protection so even fetching instructions or reading registers / ALU operations are not done before MSR BASEPRI is completed) the latter takes care of this errata as well.

@stephanosio ^^

@stephanosio
Copy link
Member

It seems we do indeed have isb after all boosts to BASEPRI, as far as the arch implementation goes (e.g. in arch_irq_lock), and given that this errata effectively delays interrupt locking until the next instruction is executed, where that next instruction is always isb, this should not be a problem.

"msr BASEPRI, %1;"
"isb;"

@stephanosio
Copy link
Member

@ioannisg What is rather curious is that FreeRTOS Cortex-M7 r0p1 port (the one with errata workaround) implements the cpsid i and cpsie e workaround despite having dsb and isb after msr basepri, ....

https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/88e32327e975ddde97c390bc5b6c1f8e7d9d239e/portable/IAR/ARM_CM7/r0p1/portmacro.h#L131-L136

@ioannisg
Copy link
Member

@ioannisg What is rather curious is that FreeRTOS Cortex-M7 r0p1 port (the one with errata workaround) implements the cpsid i and cpsie e workaround despite having dsb and isb after msr basepri, ....

https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/88e32327e975ddde97c390bc5b6c1f8e7d9d239e/portable/IAR/ARM_CM7/r0p1/portmacro.h#L131-L136

Might just be done for extra protection. Hard to assess with un-commented code.

@ioannisg
Copy link
Member

@pftbest I guess you can close this question if you feel the response was adequate

@pftbest
Copy link
Author

pftbest commented Apr 21, 2020

Ok, thank you.

@pftbest pftbest closed this as completed Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Architectures area: ARM ARM (32-bit) Architecture
Projects
None yet
Development

No branches or pull requests

3 participants