kvm.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. #ifndef __ASM_IA64_KVM_H
  2. #define __ASM_IA64_KVM_H
  3. /*
  4. * kvm structure definitions for ia64
  5. *
  6. * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms and conditions of the GNU General Public License,
  10. * version 2, as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  19. * Place - Suite 330, Boston, MA 02111-1307 USA.
  20. *
  21. */
  22. #include <linux/types.h>
  23. #include <linux/ioctl.h>
  24. /* Select x86 specific features in <linux/kvm.h> */
  25. #define __KVM_HAVE_IOAPIC
  26. #define __KVM_HAVE_IRQ_LINE
  27. #define __KVM_HAVE_DEVICE_ASSIGNMENT
  28. /* Architectural interrupt line count. */
  29. #define KVM_NR_INTERRUPTS 256
  30. #define KVM_IOAPIC_NUM_PINS 48
  31. struct kvm_ioapic_state {
  32. __u64 base_address;
  33. __u32 ioregsel;
  34. __u32 id;
  35. __u32 irr;
  36. __u32 pad;
  37. union {
  38. __u64 bits;
  39. struct {
  40. __u8 vector;
  41. __u8 delivery_mode:3;
  42. __u8 dest_mode:1;
  43. __u8 delivery_status:1;
  44. __u8 polarity:1;
  45. __u8 remote_irr:1;
  46. __u8 trig_mode:1;
  47. __u8 mask:1;
  48. __u8 reserve:7;
  49. __u8 reserved[4];
  50. __u8 dest_id;
  51. } fields;
  52. } redirtbl[KVM_IOAPIC_NUM_PINS];
  53. };
  54. #define KVM_IRQCHIP_PIC_MASTER 0
  55. #define KVM_IRQCHIP_PIC_SLAVE 1
  56. #define KVM_IRQCHIP_IOAPIC 2
  57. #define KVM_NR_IRQCHIPS 3
  58. #define KVM_CONTEXT_SIZE 8*1024
  59. struct kvm_fpreg {
  60. union {
  61. unsigned long bits[2];
  62. long double __dummy; /* force 16-byte alignment */
  63. } u;
  64. };
  65. union context {
  66. /* 8K size */
  67. char dummy[KVM_CONTEXT_SIZE];
  68. struct {
  69. unsigned long psr;
  70. unsigned long pr;
  71. unsigned long caller_unat;
  72. unsigned long pad;
  73. unsigned long gr[32];
  74. unsigned long ar[128];
  75. unsigned long br[8];
  76. unsigned long cr[128];
  77. unsigned long rr[8];
  78. unsigned long ibr[8];
  79. unsigned long dbr[8];
  80. unsigned long pkr[8];
  81. struct kvm_fpreg fr[128];
  82. };
  83. };
  84. struct thash_data {
  85. union {
  86. struct {
  87. unsigned long p : 1; /* 0 */
  88. unsigned long rv1 : 1; /* 1 */
  89. unsigned long ma : 3; /* 2-4 */
  90. unsigned long a : 1; /* 5 */
  91. unsigned long d : 1; /* 6 */
  92. unsigned long pl : 2; /* 7-8 */
  93. unsigned long ar : 3; /* 9-11 */
  94. unsigned long ppn : 38; /* 12-49 */
  95. unsigned long rv2 : 2; /* 50-51 */
  96. unsigned long ed : 1; /* 52 */
  97. unsigned long ig1 : 11; /* 53-63 */
  98. };
  99. struct {
  100. unsigned long __rv1 : 53; /* 0-52 */
  101. unsigned long contiguous : 1; /*53 */
  102. unsigned long tc : 1; /* 54 TR or TC */
  103. unsigned long cl : 1;
  104. /* 55 I side or D side cache line */
  105. unsigned long len : 4; /* 56-59 */
  106. unsigned long io : 1; /* 60 entry is for io or not */
  107. unsigned long nomap : 1;
  108. /* 61 entry cann't be inserted into machine TLB.*/
  109. unsigned long checked : 1;
  110. /* 62 for VTLB/VHPT sanity check */
  111. unsigned long invalid : 1;
  112. /* 63 invalid entry */
  113. };
  114. unsigned long page_flags;
  115. }; /* same for VHPT and TLB */
  116. union {
  117. struct {
  118. unsigned long rv3 : 2;
  119. unsigned long ps : 6;
  120. unsigned long key : 24;
  121. unsigned long rv4 : 32;
  122. };
  123. unsigned long itir;
  124. };
  125. union {
  126. struct {
  127. unsigned long ig2 : 12;
  128. unsigned long vpn : 49;
  129. unsigned long vrn : 3;
  130. };
  131. unsigned long ifa;
  132. unsigned long vadr;
  133. struct {
  134. unsigned long tag : 63;
  135. unsigned long ti : 1;
  136. };
  137. unsigned long etag;
  138. };
  139. union {
  140. struct thash_data *next;
  141. unsigned long rid;
  142. unsigned long gpaddr;
  143. };
  144. };
  145. #define NITRS 8
  146. #define NDTRS 8
  147. struct saved_vpd {
  148. unsigned long vhpi;
  149. unsigned long vgr[16];
  150. unsigned long vbgr[16];
  151. unsigned long vnat;
  152. unsigned long vbnat;
  153. unsigned long vcpuid[5];
  154. unsigned long vpsr;
  155. unsigned long vpr;
  156. union {
  157. unsigned long vcr[128];
  158. struct {
  159. unsigned long dcr;
  160. unsigned long itm;
  161. unsigned long iva;
  162. unsigned long rsv1[5];
  163. unsigned long pta;
  164. unsigned long rsv2[7];
  165. unsigned long ipsr;
  166. unsigned long isr;
  167. unsigned long rsv3;
  168. unsigned long iip;
  169. unsigned long ifa;
  170. unsigned long itir;
  171. unsigned long iipa;
  172. unsigned long ifs;
  173. unsigned long iim;
  174. unsigned long iha;
  175. unsigned long rsv4[38];
  176. unsigned long lid;
  177. unsigned long ivr;
  178. unsigned long tpr;
  179. unsigned long eoi;
  180. unsigned long irr[4];
  181. unsigned long itv;
  182. unsigned long pmv;
  183. unsigned long cmcv;
  184. unsigned long rsv5[5];
  185. unsigned long lrr0;
  186. unsigned long lrr1;
  187. unsigned long rsv6[46];
  188. };
  189. };
  190. };
  191. struct kvm_regs {
  192. struct saved_vpd vpd;
  193. /*Arch-regs*/
  194. int mp_state;
  195. unsigned long vmm_rr;
  196. /* TR and TC. */
  197. struct thash_data itrs[NITRS];
  198. struct thash_data dtrs[NDTRS];
  199. /* Bit is set if there is a tr/tc for the region. */
  200. unsigned char itr_regions;
  201. unsigned char dtr_regions;
  202. unsigned char tc_regions;
  203. char irq_check;
  204. unsigned long saved_itc;
  205. unsigned long itc_check;
  206. unsigned long timer_check;
  207. unsigned long timer_pending;
  208. unsigned long last_itc;
  209. unsigned long vrr[8];
  210. unsigned long ibr[8];
  211. unsigned long dbr[8];
  212. unsigned long insvc[4]; /* Interrupt in service. */
  213. unsigned long xtp;
  214. unsigned long metaphysical_rr0; /* from kvm_arch (so is pinned) */
  215. unsigned long metaphysical_rr4; /* from kvm_arch (so is pinned) */
  216. unsigned long metaphysical_saved_rr0; /* from kvm_arch */
  217. unsigned long metaphysical_saved_rr4; /* from kvm_arch */
  218. unsigned long fp_psr; /*used for lazy float register */
  219. unsigned long saved_gp;
  220. /*for phycial emulation */
  221. union context saved_guest;
  222. unsigned long reserved[64]; /* for future use */
  223. };
  224. struct kvm_sregs {
  225. };
  226. struct kvm_fpu {
  227. };
  228. #define KVM_IA64_VCPU_STACK_SHIFT 16
  229. #define KVM_IA64_VCPU_STACK_SIZE (1UL << KVM_IA64_VCPU_STACK_SHIFT)
  230. struct kvm_ia64_vcpu_stack {
  231. unsigned char stack[KVM_IA64_VCPU_STACK_SIZE];
  232. };
  233. struct kvm_debug_exit_arch {
  234. };
  235. /* for KVM_SET_GUEST_DEBUG */
  236. struct kvm_guest_debug_arch {
  237. };
  238. /* definition of registers in kvm_run */
  239. struct kvm_sync_regs {
  240. };
  241. #endif