kvm.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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_DEVICE_ASSIGNMENT
  27. /* Architectural interrupt line count. */
  28. #define KVM_NR_INTERRUPTS 256
  29. #define KVM_IOAPIC_NUM_PINS 48
  30. struct kvm_ioapic_state {
  31. __u64 base_address;
  32. __u32 ioregsel;
  33. __u32 id;
  34. __u32 irr;
  35. __u32 pad;
  36. union {
  37. __u64 bits;
  38. struct {
  39. __u8 vector;
  40. __u8 delivery_mode:3;
  41. __u8 dest_mode:1;
  42. __u8 delivery_status:1;
  43. __u8 polarity:1;
  44. __u8 remote_irr:1;
  45. __u8 trig_mode:1;
  46. __u8 mask:1;
  47. __u8 reserve:7;
  48. __u8 reserved[4];
  49. __u8 dest_id;
  50. } fields;
  51. } redirtbl[KVM_IOAPIC_NUM_PINS];
  52. };
  53. #define KVM_IRQCHIP_PIC_MASTER 0
  54. #define KVM_IRQCHIP_PIC_SLAVE 1
  55. #define KVM_IRQCHIP_IOAPIC 2
  56. #define KVM_CONTEXT_SIZE 8*1024
  57. struct kvm_fpreg {
  58. union {
  59. unsigned long bits[2];
  60. long double __dummy; /* force 16-byte alignment */
  61. } u;
  62. };
  63. union context {
  64. /* 8K size */
  65. char dummy[KVM_CONTEXT_SIZE];
  66. struct {
  67. unsigned long psr;
  68. unsigned long pr;
  69. unsigned long caller_unat;
  70. unsigned long pad;
  71. unsigned long gr[32];
  72. unsigned long ar[128];
  73. unsigned long br[8];
  74. unsigned long cr[128];
  75. unsigned long rr[8];
  76. unsigned long ibr[8];
  77. unsigned long dbr[8];
  78. unsigned long pkr[8];
  79. struct kvm_fpreg fr[128];
  80. };
  81. };
  82. struct thash_data {
  83. union {
  84. struct {
  85. unsigned long p : 1; /* 0 */
  86. unsigned long rv1 : 1; /* 1 */
  87. unsigned long ma : 3; /* 2-4 */
  88. unsigned long a : 1; /* 5 */
  89. unsigned long d : 1; /* 6 */
  90. unsigned long pl : 2; /* 7-8 */
  91. unsigned long ar : 3; /* 9-11 */
  92. unsigned long ppn : 38; /* 12-49 */
  93. unsigned long rv2 : 2; /* 50-51 */
  94. unsigned long ed : 1; /* 52 */
  95. unsigned long ig1 : 11; /* 53-63 */
  96. };
  97. struct {
  98. unsigned long __rv1 : 53; /* 0-52 */
  99. unsigned long contiguous : 1; /*53 */
  100. unsigned long tc : 1; /* 54 TR or TC */
  101. unsigned long cl : 1;
  102. /* 55 I side or D side cache line */
  103. unsigned long len : 4; /* 56-59 */
  104. unsigned long io : 1; /* 60 entry is for io or not */
  105. unsigned long nomap : 1;
  106. /* 61 entry cann't be inserted into machine TLB.*/
  107. unsigned long checked : 1;
  108. /* 62 for VTLB/VHPT sanity check */
  109. unsigned long invalid : 1;
  110. /* 63 invalid entry */
  111. };
  112. unsigned long page_flags;
  113. }; /* same for VHPT and TLB */
  114. union {
  115. struct {
  116. unsigned long rv3 : 2;
  117. unsigned long ps : 6;
  118. unsigned long key : 24;
  119. unsigned long rv4 : 32;
  120. };
  121. unsigned long itir;
  122. };
  123. union {
  124. struct {
  125. unsigned long ig2 : 12;
  126. unsigned long vpn : 49;
  127. unsigned long vrn : 3;
  128. };
  129. unsigned long ifa;
  130. unsigned long vadr;
  131. struct {
  132. unsigned long tag : 63;
  133. unsigned long ti : 1;
  134. };
  135. unsigned long etag;
  136. };
  137. union {
  138. struct thash_data *next;
  139. unsigned long rid;
  140. unsigned long gpaddr;
  141. };
  142. };
  143. #define NITRS 8
  144. #define NDTRS 8
  145. struct saved_vpd {
  146. unsigned long vhpi;
  147. unsigned long vgr[16];
  148. unsigned long vbgr[16];
  149. unsigned long vnat;
  150. unsigned long vbnat;
  151. unsigned long vcpuid[5];
  152. unsigned long vpsr;
  153. unsigned long vpr;
  154. union {
  155. unsigned long vcr[128];
  156. struct {
  157. unsigned long dcr;
  158. unsigned long itm;
  159. unsigned long iva;
  160. unsigned long rsv1[5];
  161. unsigned long pta;
  162. unsigned long rsv2[7];
  163. unsigned long ipsr;
  164. unsigned long isr;
  165. unsigned long rsv3;
  166. unsigned long iip;
  167. unsigned long ifa;
  168. unsigned long itir;
  169. unsigned long iipa;
  170. unsigned long ifs;
  171. unsigned long iim;
  172. unsigned long iha;
  173. unsigned long rsv4[38];
  174. unsigned long lid;
  175. unsigned long ivr;
  176. unsigned long tpr;
  177. unsigned long eoi;
  178. unsigned long irr[4];
  179. unsigned long itv;
  180. unsigned long pmv;
  181. unsigned long cmcv;
  182. unsigned long rsv5[5];
  183. unsigned long lrr0;
  184. unsigned long lrr1;
  185. unsigned long rsv6[46];
  186. };
  187. };
  188. };
  189. struct kvm_regs {
  190. struct saved_vpd vpd;
  191. /*Arch-regs*/
  192. int mp_state;
  193. unsigned long vmm_rr;
  194. /* TR and TC. */
  195. struct thash_data itrs[NITRS];
  196. struct thash_data dtrs[NDTRS];
  197. /* Bit is set if there is a tr/tc for the region. */
  198. unsigned char itr_regions;
  199. unsigned char dtr_regions;
  200. unsigned char tc_regions;
  201. char irq_check;
  202. unsigned long saved_itc;
  203. unsigned long itc_check;
  204. unsigned long timer_check;
  205. unsigned long timer_pending;
  206. unsigned long last_itc;
  207. unsigned long vrr[8];
  208. unsigned long ibr[8];
  209. unsigned long dbr[8];
  210. unsigned long insvc[4]; /* Interrupt in service. */
  211. unsigned long xtp;
  212. unsigned long metaphysical_rr0; /* from kvm_arch (so is pinned) */
  213. unsigned long metaphysical_rr4; /* from kvm_arch (so is pinned) */
  214. unsigned long metaphysical_saved_rr0; /* from kvm_arch */
  215. unsigned long metaphysical_saved_rr4; /* from kvm_arch */
  216. unsigned long fp_psr; /*used for lazy float register */
  217. unsigned long saved_gp;
  218. /*for phycial emulation */
  219. union context saved_guest;
  220. unsigned long reserved[64]; /* for future use */
  221. };
  222. struct kvm_sregs {
  223. };
  224. struct kvm_fpu {
  225. };
  226. #define KVM_IA64_VCPU_STACK_SHIFT 16
  227. #define KVM_IA64_VCPU_STACK_SIZE (1UL << KVM_IA64_VCPU_STACK_SHIFT)
  228. struct kvm_ia64_vcpu_stack {
  229. unsigned char stack[KVM_IA64_VCPU_STACK_SIZE];
  230. };
  231. struct kvm_debug_exit_arch {
  232. };
  233. /* for KVM_SET_GUEST_DEBUG */
  234. struct kvm_guest_debug_arch {
  235. };
  236. #endif