kvm_asm.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License, version 2, as
  4. * published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. *
  15. * Copyright IBM Corp. 2008
  16. *
  17. * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  18. */
  19. #ifndef __POWERPC_KVM_ASM_H__
  20. #define __POWERPC_KVM_ASM_H__
  21. #ifdef __ASSEMBLY__
  22. #ifdef CONFIG_64BIT
  23. #define PPC_STD(sreg, offset, areg) std sreg, (offset)(areg)
  24. #define PPC_LD(treg, offset, areg) ld treg, (offset)(areg)
  25. #else
  26. #define PPC_STD(sreg, offset, areg) stw sreg, (offset+4)(areg)
  27. #define PPC_LD(treg, offset, areg) lwz treg, (offset+4)(areg)
  28. #endif
  29. #endif
  30. /* IVPR must be 64KiB-aligned. */
  31. #define VCPU_SIZE_ORDER 4
  32. #define VCPU_SIZE_LOG (VCPU_SIZE_ORDER + 12)
  33. #define VCPU_TLB_PGSZ PPC44x_TLB_64K
  34. #define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG)
  35. #define BOOKE_INTERRUPT_CRITICAL 0
  36. #define BOOKE_INTERRUPT_MACHINE_CHECK 1
  37. #define BOOKE_INTERRUPT_DATA_STORAGE 2
  38. #define BOOKE_INTERRUPT_INST_STORAGE 3
  39. #define BOOKE_INTERRUPT_EXTERNAL 4
  40. #define BOOKE_INTERRUPT_ALIGNMENT 5
  41. #define BOOKE_INTERRUPT_PROGRAM 6
  42. #define BOOKE_INTERRUPT_FP_UNAVAIL 7
  43. #define BOOKE_INTERRUPT_SYSCALL 8
  44. #define BOOKE_INTERRUPT_AP_UNAVAIL 9
  45. #define BOOKE_INTERRUPT_DECREMENTER 10
  46. #define BOOKE_INTERRUPT_FIT 11
  47. #define BOOKE_INTERRUPT_WATCHDOG 12
  48. #define BOOKE_INTERRUPT_DTLB_MISS 13
  49. #define BOOKE_INTERRUPT_ITLB_MISS 14
  50. #define BOOKE_INTERRUPT_DEBUG 15
  51. /* E500 */
  52. #define BOOKE_INTERRUPT_SPE_UNAVAIL 32
  53. #define BOOKE_INTERRUPT_SPE_FP_DATA 33
  54. #define BOOKE_INTERRUPT_SPE_FP_ROUND 34
  55. #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
  56. #define BOOKE_INTERRUPT_DOORBELL 36
  57. #define BOOKE_INTERRUPT_DOORBELL_CRITICAL 37
  58. /* booke_hv */
  59. #define BOOKE_INTERRUPT_GUEST_DBELL 38
  60. #define BOOKE_INTERRUPT_GUEST_DBELL_CRIT 39
  61. #define BOOKE_INTERRUPT_HV_SYSCALL 40
  62. #define BOOKE_INTERRUPT_HV_PRIV 41
  63. /* altivec */
  64. #define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 42
  65. #define BOOKE_INTERRUPT_ALTIVEC_ASSIST 43
  66. /* book3s */
  67. #define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
  68. #define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200
  69. #define BOOK3S_INTERRUPT_DATA_STORAGE 0x300
  70. #define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380
  71. #define BOOK3S_INTERRUPT_INST_STORAGE 0x400
  72. #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480
  73. #define BOOK3S_INTERRUPT_EXTERNAL 0x500
  74. #define BOOK3S_INTERRUPT_EXTERNAL_LEVEL 0x501
  75. #define BOOK3S_INTERRUPT_EXTERNAL_HV 0x502
  76. #define BOOK3S_INTERRUPT_ALIGNMENT 0x600
  77. #define BOOK3S_INTERRUPT_PROGRAM 0x700
  78. #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800
  79. #define BOOK3S_INTERRUPT_DECREMENTER 0x900
  80. #define BOOK3S_INTERRUPT_HV_DECREMENTER 0x980
  81. #define BOOK3S_INTERRUPT_SYSCALL 0xc00
  82. #define BOOK3S_INTERRUPT_TRACE 0xd00
  83. #define BOOK3S_INTERRUPT_H_DATA_STORAGE 0xe00
  84. #define BOOK3S_INTERRUPT_H_INST_STORAGE 0xe20
  85. #define BOOK3S_INTERRUPT_H_EMUL_ASSIST 0xe40
  86. #define BOOK3S_INTERRUPT_PERFMON 0xf00
  87. #define BOOK3S_INTERRUPT_ALTIVEC 0xf20
  88. #define BOOK3S_INTERRUPT_VSX 0xf40
  89. #define BOOK3S_IRQPRIO_SYSTEM_RESET 0
  90. #define BOOK3S_IRQPRIO_DATA_SEGMENT 1
  91. #define BOOK3S_IRQPRIO_INST_SEGMENT 2
  92. #define BOOK3S_IRQPRIO_DATA_STORAGE 3
  93. #define BOOK3S_IRQPRIO_INST_STORAGE 4
  94. #define BOOK3S_IRQPRIO_ALIGNMENT 5
  95. #define BOOK3S_IRQPRIO_PROGRAM 6
  96. #define BOOK3S_IRQPRIO_FP_UNAVAIL 7
  97. #define BOOK3S_IRQPRIO_ALTIVEC 8
  98. #define BOOK3S_IRQPRIO_VSX 9
  99. #define BOOK3S_IRQPRIO_SYSCALL 10
  100. #define BOOK3S_IRQPRIO_MACHINE_CHECK 11
  101. #define BOOK3S_IRQPRIO_DEBUG 12
  102. #define BOOK3S_IRQPRIO_EXTERNAL 13
  103. #define BOOK3S_IRQPRIO_DECREMENTER 14
  104. #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15
  105. #define BOOK3S_IRQPRIO_EXTERNAL_LEVEL 16
  106. #define BOOK3S_IRQPRIO_MAX 17
  107. #define BOOK3S_HFLAG_DCBZ32 0x1
  108. #define BOOK3S_HFLAG_SLB 0x2
  109. #define BOOK3S_HFLAG_PAIRED_SINGLE 0x4
  110. #define BOOK3S_HFLAG_NATIVE_PS 0x8
  111. #define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
  112. #define RESUME_FLAG_HOST (1<<1) /* Resume host? */
  113. #define RESUME_FLAG_ARCH1 (1<<2)
  114. #define RESUME_GUEST 0
  115. #define RESUME_GUEST_NV RESUME_FLAG_NV
  116. #define RESUME_HOST RESUME_FLAG_HOST
  117. #define RESUME_HOST_NV (RESUME_FLAG_HOST|RESUME_FLAG_NV)
  118. #define KVM_GUEST_MODE_NONE 0
  119. #define KVM_GUEST_MODE_GUEST 1
  120. #define KVM_GUEST_MODE_SKIP 2
  121. #define KVM_INST_FETCH_FAILED -1
  122. #endif /* __POWERPC_KVM_ASM_H__ */