kvm_booke_hv_asm.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2010-2011 Freescale Semiconductor, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License, version 2, as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef ASM_KVM_BOOKE_HV_ASM_H
  9. #define ASM_KVM_BOOKE_HV_ASM_H
  10. #ifdef __ASSEMBLY__
  11. /*
  12. * All exceptions from guest state must go through KVM
  13. * (except for those which are delivered directly to the guest) --
  14. * there are no exceptions for which we fall through directly to
  15. * the normal host handler.
  16. *
  17. * 32-bit host
  18. * Expected inputs (normal exceptions):
  19. * SCRATCH0 = saved r10
  20. * r10 = thread struct
  21. * r11 = appropriate SRR1 variant (currently used as scratch)
  22. * r13 = saved CR
  23. * *(r10 + THREAD_NORMSAVE(0)) = saved r11
  24. * *(r10 + THREAD_NORMSAVE(2)) = saved r13
  25. *
  26. * Expected inputs (crit/mcheck/debug exceptions):
  27. * appropriate SCRATCH = saved r8
  28. * r8 = exception level stack frame
  29. * r9 = *(r8 + _CCR) = saved CR
  30. * r11 = appropriate SRR1 variant (currently used as scratch)
  31. * *(r8 + GPR9) = saved r9
  32. * *(r8 + GPR10) = saved r10 (r10 not yet clobbered)
  33. * *(r8 + GPR11) = saved r11
  34. *
  35. * 64-bit host
  36. * Expected inputs (GEN/GDBELL/DBG/CRIT/MC exception types):
  37. * r10 = saved CR
  38. * r13 = PACA_POINTER
  39. * *(r13 + PACA_EX##type + EX_R10) = saved r10
  40. * *(r13 + PACA_EX##type + EX_R11) = saved r11
  41. * SPRN_SPRG_##type##_SCRATCH = saved r13
  42. *
  43. * Expected inputs (TLB exception type):
  44. * r10 = saved CR
  45. * r12 = extlb pointer
  46. * r13 = PACA_POINTER
  47. * *(r12 + EX_TLB_R10) = saved r10
  48. * *(r12 + EX_TLB_R11) = saved r11
  49. * *(r12 + EX_TLB_R13) = saved r13
  50. * SPRN_SPRG_GEN_SCRATCH = saved r12
  51. *
  52. * Only the bolted version of TLB miss exception handlers is supported now.
  53. */
  54. .macro DO_KVM intno srr1
  55. #ifdef CONFIG_KVM_BOOKE_HV
  56. BEGIN_FTR_SECTION
  57. mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */
  58. bf 3, 1975f
  59. b kvmppc_handler_\intno\()_\srr1
  60. 1975:
  61. END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
  62. #endif
  63. .endm
  64. #endif /*__ASSEMBLY__ */
  65. #endif /* ASM_KVM_BOOKE_HV_ASM_H */