epapr_hcalls.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  4. */
  5. #include <linux/export.h>
  6. #include <linux/threads.h>
  7. #include <asm/epapr_hcalls.h>
  8. #include <asm/reg.h>
  9. #include <asm/page.h>
  10. #include <asm/cputable.h>
  11. #include <asm/thread_info.h>
  12. #include <asm/ppc_asm.h>
  13. #include <asm/asm-compat.h>
  14. #include <asm/asm-offsets.h>
  15. #ifndef CONFIG_PPC64
  16. /* epapr_ev_idle() was derived from e500_idle() */
  17. _GLOBAL(epapr_ev_idle)
  18. PPC_LL r4, TI_LOCAL_FLAGS(r2) /* set napping bit */
  19. ori r4, r4,_TLF_NAPPING /* so when we take an exception */
  20. PPC_STL r4, TI_LOCAL_FLAGS(r2) /* it will return to our caller */
  21. #ifdef CONFIG_BOOKE
  22. wrteei 1
  23. #else
  24. mfmsr r4
  25. ori r4, r4, MSR_EE
  26. mtmsr r4
  27. #endif
  28. idle_loop:
  29. LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
  30. .global epapr_ev_idle_start
  31. epapr_ev_idle_start:
  32. li r3, -1
  33. nop
  34. nop
  35. nop
  36. /*
  37. * Guard against spurious wakeups from a hypervisor --
  38. * only interrupt will cause us to return to LR due to
  39. * _TLF_NAPPING.
  40. */
  41. b idle_loop
  42. #endif
  43. /* Hypercall entry point. Will be patched with device tree instructions. */
  44. .global epapr_hypercall_start
  45. epapr_hypercall_start:
  46. li r3, -1
  47. nop
  48. nop
  49. nop
  50. blr
  51. EXPORT_SYMBOL(epapr_hypercall_start)