epapr_hcalls.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  4. */
  5. #include <linux/threads.h>
  6. #include <asm/epapr_hcalls.h>
  7. #include <asm/reg.h>
  8. #include <asm/page.h>
  9. #include <asm/cputable.h>
  10. #include <asm/thread_info.h>
  11. #include <asm/ppc_asm.h>
  12. #include <asm/asm-compat.h>
  13. #include <asm/asm-offsets.h>
  14. #include <asm/export.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. wrteei 1
  22. idle_loop:
  23. LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
  24. .global epapr_ev_idle_start
  25. epapr_ev_idle_start:
  26. li r3, -1
  27. nop
  28. nop
  29. nop
  30. /*
  31. * Guard against spurious wakeups from a hypervisor --
  32. * only interrupt will cause us to return to LR due to
  33. * _TLF_NAPPING.
  34. */
  35. b idle_loop
  36. #endif
  37. /* Hypercall entry point. Will be patched with device tree instructions. */
  38. .global epapr_hypercall_start
  39. epapr_hypercall_start:
  40. li r3, -1
  41. nop
  42. nop
  43. nop
  44. blr
  45. EXPORT_SYMBOL(epapr_hypercall_start)