From ff2d4edaefb31089ca1bd8f99a0b85536eeab381 Mon Sep 17 00:00:00 2001 From: cepetr Date: Thu, 12 Jun 2025 16:47:22 +0200 Subject: [PATCH] fix(core): remove unnecessary non-secure variant of irq_lock/unlock [no changelog] --- core/embed/sys/irq/inc/sys/irq.h | 32 ------------------- .../embed/sys/power_save/stm32u5/power_save.c | 8 ----- 2 files changed, 40 deletions(-) diff --git a/core/embed/sys/irq/inc/sys/irq.h b/core/embed/sys/irq/inc/sys/irq.h index 74c9cf69a1..e2a946545b 100644 --- a/core/embed/sys/irq/inc/sys/irq.h +++ b/core/embed/sys/irq/inc/sys/irq.h @@ -89,38 +89,6 @@ static inline void irq_unlock(irq_key_t key) { ); } -#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) - -// Disables non-secure interrupts and returns the previous interrupt state. -// -// see irq_lock() for more details. -static inline irq_key_t irq_lock_ns(void) { - uint32_t key; - const uint32_t tmp = 1; - __asm volatile( - "MRS %0, PRIMASK_NS\n" - "MSR PRIMASK_NS, %1\n" - : "=r"(key) - : "r"(tmp) - : "memory" // Clobber memory to ensure correct memory operations - ); - return key; -} - -// Restores the non-secure interrupt state to what it was before `irq_lock`. -// -// see irq_unlock() for more details. -static inline void irq_unlock_ns(irq_key_t key) { - __asm volatile( - "MSR PRIMASK_NS, %0\n" - : - : "r"(key) - : "memory" // Clobber memory to ensure correct memory operations - ); -} - -#endif // defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) - // IRQ priority levels used throughout the system // Highest priority in the system (only RESET, NMI, and diff --git a/core/embed/sys/power_save/stm32u5/power_save.c b/core/embed/sys/power_save/stm32u5/power_save.c index 07ad2d81e5..629e1bebe0 100644 --- a/core/embed/sys/power_save/stm32u5/power_save.c +++ b/core/embed/sys/power_save/stm32u5/power_save.c @@ -71,10 +71,6 @@ void power_save_suspend_cpu(void) { // PRIMASK is cleared again. This is necessary to restore the system clock // immediately after exiting STOP2 mode. -#ifdef SECMON - irq_key_t irq_key_ns = irq_lock_ns(); -#endif - irq_key_t irq_key = irq_lock(); // The PWR clock is disabled after system initialization. @@ -91,10 +87,6 @@ void power_save_suspend_cpu(void) { SystemInit(); irq_unlock(irq_key); - -#ifdef SECMON - irq_unlock_ns(irq_key_ns); -#endif } void power_save_suspend_secure_io() {