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