runlatch.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  3. */
  4. #ifndef _ASM_POWERPC_RUNLATCH_H
  5. #define _ASM_POWERPC_RUNLATCH_H
  6. #ifdef CONFIG_PPC64
  7. extern void __ppc64_runlatch_on(void);
  8. extern void __ppc64_runlatch_off(void);
  9. /*
  10. * We manually hard enable-disable, this is called
  11. * in the idle loop and we don't want to mess up
  12. * with soft-disable/enable & interrupt replay.
  13. */
  14. #define ppc64_runlatch_off() \
  15. do { \
  16. if (cpu_has_feature(CPU_FTR_CTRL) && \
  17. test_thread_local_flags(_TLF_RUNLATCH)) { \
  18. unsigned long msr = mfmsr(); \
  19. __hard_irq_disable(); \
  20. __ppc64_runlatch_off(); \
  21. if (msr & MSR_EE) \
  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. unsigned long msr = mfmsr(); \
  30. __hard_irq_disable(); \
  31. __ppc64_runlatch_on(); \
  32. if (msr & MSR_EE) \
  33. __hard_irq_enable(); \
  34. } \
  35. } while (0)
  36. #else
  37. #define ppc64_runlatch_on()
  38. #define ppc64_runlatch_off()
  39. #endif /* CONFIG_PPC64 */
  40. #endif /* _ASM_POWERPC_RUNLATCH_H */