runlatch.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 1999 Cort Dougan <[email protected]>
  4. */
  5. #ifndef _ASM_POWERPC_RUNLATCH_H
  6. #define _ASM_POWERPC_RUNLATCH_H
  7. #ifdef CONFIG_PPC64
  8. extern void __ppc64_runlatch_on(void);
  9. extern void __ppc64_runlatch_off(void);
  10. /*
  11. * We manually hard enable-disable, this is called
  12. * in the idle loop and we don't want to mess up
  13. * with soft-disable/enable & interrupt replay.
  14. */
  15. #define ppc64_runlatch_off() \
  16. do { \
  17. if (cpu_has_feature(CPU_FTR_CTRL) && \
  18. test_thread_local_flags(_TLF_RUNLATCH)) { \
  19. __hard_irq_disable(); \
  20. __ppc64_runlatch_off(); \
  21. if (!(local_paca->irq_happened & PACA_IRQ_HARD_DIS)) \
  22. __hard_irq_enable(); \
  23. } \
  24. } while (0)
  25. #define ppc64_runlatch_on() \
  26. do { \
  27. if (cpu_has_feature(CPU_FTR_CTRL) && \
  28. !test_thread_local_flags(_TLF_RUNLATCH)) { \
  29. __hard_irq_disable(); \
  30. __ppc64_runlatch_on(); \
  31. if (!(local_paca->irq_happened & PACA_IRQ_HARD_DIS)) \
  32. __hard_irq_enable(); \
  33. } \
  34. } while (0)
  35. #else
  36. #define ppc64_runlatch_on()
  37. #define ppc64_runlatch_off()
  38. #endif /* CONFIG_PPC64 */
  39. #endif /* _ASM_POWERPC_RUNLATCH_H */