1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_CPUIDLE_H
3 #define __ASM_CPUIDLE_H
5 #include <asm/proc-fns.h>
8 extern int arm_cpuidle_init(unsigned int cpu);
9 extern int arm_cpuidle_suspend(int index);
11 static inline int arm_cpuidle_init(unsigned int cpu)
16 static inline int arm_cpuidle_suspend(int index)
22 #ifdef CONFIG_ARM64_PSEUDO_NMI
23 #include <asm/arch_gicv3.h>
25 struct arm_cpuidle_irq_context {
27 unsigned long daif_bits;
30 #define arm_cpuidle_save_irq_context(__c) \
32 struct arm_cpuidle_irq_context *c = __c; \
33 if (system_uses_irq_prio_masking()) { \
34 c->daif_bits = read_sysreg(daif); \
35 write_sysreg(c->daif_bits | PSR_I_BIT | PSR_F_BIT, \
37 c->pmr = gic_read_pmr(); \
38 gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET); \
42 #define arm_cpuidle_restore_irq_context(__c) \
44 struct arm_cpuidle_irq_context *c = __c; \
45 if (system_uses_irq_prio_masking()) { \
46 gic_write_pmr(c->pmr); \
47 write_sysreg(c->daif_bits, daif); \
51 struct arm_cpuidle_irq_context { };
53 #define arm_cpuidle_save_irq_context(c) (void)c
54 #define arm_cpuidle_restore_irq_context(c) (void)c