kvm_booke_hv_asm.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #include <asm/feature-fixups.h>
  11. #ifdef __ASSEMBLY__
  12. /*
  13. * All exceptions from guest state must go through KVM
  14. * (except for those which are delivered directly to the guest) --
  15. * there are no exceptions for which we fall through directly to
  16. * the normal host handler.
  17. *
  18. * 32-bit host
  19. * Expected inputs (normal exceptions):
  20. * SCRATCH0 = saved r10
  21. * r10 = thread struct
  22. * r11 = appropriate SRR1 variant (currently used as scratch)
  23. * r13 = saved CR
  24. * *(r10 + THREAD_NORMSAVE(0)) = saved r11
  25. * *(r10 + THREAD_NORMSAVE(2)) = saved r13
  26. *
  27. * Expected inputs (crit/mcheck/debug exceptions):
  28. * appropriate SCRATCH = saved r8
  29. * r8 = exception level stack frame
  30. * r9 = *(r8 + _CCR) = saved CR
  31. * r11 = appropriate SRR1 variant (currently used as scratch)
  32. * *(r8 + GPR9) = saved r9
  33. * *(r8 + GPR10) = saved r10 (r10 not yet clobbered)
  34. * *(r8 + GPR11) = saved r11
  35. *
  36. * 64-bit host
  37. * Expected inputs (GEN/GDBELL/DBG/CRIT/MC exception types):
  38. * r10 = saved CR
  39. * r13 = PACA_POINTER
  40. * *(r13 + PACA_EX##type + EX_R10) = saved r10
  41. * *(r13 + PACA_EX##type + EX_R11) = saved r11
  42. * SPRN_SPRG_##type##_SCRATCH = saved r13
  43. *
  44. * Expected inputs (TLB exception type):
  45. * r10 = saved CR
  46. * r12 = extlb pointer
  47. * r13 = PACA_POINTER
  48. * *(r12 + EX_TLB_R10) = saved r10
  49. * *(r12 + EX_TLB_R11) = saved r11
  50. * *(r12 + EX_TLB_R13) = saved r13
  51. * SPRN_SPRG_GEN_SCRATCH = saved r12
  52. *
  53. * Only the bolted version of TLB miss exception handlers is supported now.
  54. */
  55. .macro DO_KVM intno srr1
  56. #ifdef CONFIG_KVM_BOOKE_HV
  57. BEGIN_FTR_SECTION
  58. mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */
  59. bf 3, 1975f
  60. b kvmppc_handler_\intno\()_\srr1
  61. 1975:
  62. END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
  63. #endif
  64. .endm
  65. #endif /*__ASSEMBLY__ */
  66. #endif /* ASM_KVM_BOOKE_HV_ASM_H */