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