I reported the same problem earlier and was told that this was by design.

Earlier thread:
https://lists.trustedfirmware.org/archives/list/tf-m@lists.trustedfirmware.org/thread/CEHFBMY6AG67GAVZJ2LY4OUHNBEDAMII/#CEHFBMY6AG67GAVZJ2LY4OUHNBEDAMII

 

-Joakim

 

From: Bohdan.Hunko--- via TF-M <tf-m@lists.trustedfirmware.org>
Sent: mandag 13. mars 2023 15:17
To: tf-m@lists.trustedfirmware.org
Cc: Roman.Mazurak@infineon.com
Subject: [TF-M] Scheduler problem

 

Caution: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

 

Hi everyone,

 

Why investigation some interrupts related stuff I have noticed a problem/bug in the scheduler.

PendSV_Handler has following code:

"   movs    r0, #"M2S(EXC_RETURN_SECURE_STACK)" \n"

        "   mov     r1, lr                              \n"

        "   tst     r0, r1                              \n" /* NS interrupted */

        "   beq     v8b_pendsv_exit                     \n" /* No schedule */

Which means that if NSPE was interrupted then no scheduling will be done. This created a problem in following scenario:

  1. NSPE is executing
  2. Secure interrupts arrives.
  3. NSPE is interrupted, secure interrupt is handled.
  4. Secure interrupts triggers scheduling of some partition.
  5. Secure interrupt returns
  6. Scheduling is triggered
  7. PendSV returns (because /* NS interrupted */ /* No schedule */ ) and does not perform scheduling even thought pending partition is present. This means that pending partition will only be scheduled when next PSA call will be done be NSPE. Even if there would be subsequent Secure interrupts that preempt NSPE, partition will not be scheduled because PendSV will always return without scheduling because NSPE was interrupted.

 

I was not able to find any information about this in TFM docs so I assume this is a bug.

 

Please let me know if I am wrong. And if this is real problem then is there a plan to fix this?

 

 

Regards,

Bohdan Hunko

 

Cypress Semiconductor Ukraine

Engineer

CSUKR CSS ICW SW FW

Mobile: +38099 50 19 714
Bohdan.Hunko@infineon.com