kvm_booke_hv_asm.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. * Expected inputs (normal exceptions):
  18. * SCRATCH0 = saved r10
  19. * r10 = thread struct
  20. * r11 = appropriate SRR1 variant (currently used as scratch)
  21. * r13 = saved CR
  22. * *(r10 + THREAD_NORMSAVE(0)) = saved r11
  23. * *(r10 + THREAD_NORMSAVE(2)) = saved r13
  24. *
  25. * Expected inputs (crit/mcheck/debug exceptions):
  26. * appropriate SCRATCH = saved r8
  27. * r8 = exception level stack frame
  28. * r9 = *(r8 + _CCR) = saved CR
  29. * r11 = appropriate SRR1 variant (currently used as scratch)
  30. * *(r8 + GPR9) = saved r9
  31. * *(r8 + GPR10) = saved r10 (r10 not yet clobbered)
  32. * *(r8 + GPR11) = saved r11
  33. */
  34. .macro DO_KVM intno srr1
  35. #ifdef CONFIG_KVM_BOOKE_HV
  36. BEGIN_FTR_SECTION
  37. mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */
  38. bf 3, kvmppc_resume_\intno\()_\srr1
  39. b kvmppc_handler_\intno\()_\srr1
  40. kvmppc_resume_\intno\()_\srr1:
  41. END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
  42. #endif
  43. .endm
  44. #endif /*__ASSEMBLY__ */
  45. #endif /* ASM_KVM_BOOKE_HV_ASM_H */