I am working on mbed-os/tf-m port on M2351. From M2351 NS, it needs to call platform-specific secure function in interrupt-disabled context. Currently, tfm_ns_lock_dispatch doesn't dispatch in interrupt-disabled context. I would like to support it partially by exporting tfm_ns_lock_get_lock_state. NS world can regard it has acquired NS lock and call secure function straight when interrupt is disabled and NS lock is not acquired (tfm_ns_lock_get_lock_state returns false) by any other thread.
I know this solution is not sound. It cannot handle the context that interrupt is disabled and NS lock is also acquired by another thread. Expect a solution can address the dilemma.
A related change is submitted in 1124.