kvm.h 6.1 KB

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