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