kvm.h 4.9 KB

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