kvm.h 4.9 KB

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