diff options
author | Juergen Gross <jgross@suse.com> | 2014-09-17 00:12:35 -0400 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2014-10-03 07:34:52 -0400 |
commit | bca9b6855888d978d6e5399b0a8a8ed9a11e9236 (patch) | |
tree | 2052b57808d6425af8ea978269d4b52a8fb37cbd /include | |
parent | 8ab85eba49c6f4ad67b65fb61104b912f86a1546 (diff) |
xen: sync some headers with xen tree
To be able to use an initially unmapped initrd with xen the following
header files must be synced to a newer version from the xen tree:
include/xen/interface/elfnote.h
include/xen/interface/xen.h
As the KEXEC and DUMPCORE related ELFNOTES are not relevant for the
kernel they are omitted from elfnote.h.
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/xen/interface/elfnote.h | 48 | ||||
-rw-r--r-- | include/xen/interface/xen.h | 272 |
2 files changed, 294 insertions, 26 deletions
diff --git a/include/xen/interface/elfnote.h b/include/xen/interface/elfnote.h index 6f4eae328ca7..f90b03454659 100644 --- a/include/xen/interface/elfnote.h +++ b/include/xen/interface/elfnote.h | |||
@@ -3,6 +3,24 @@ | |||
3 | * | 3 | * |
4 | * Definitions used for the Xen ELF notes. | 4 | * Definitions used for the Xen ELF notes. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | * of this software and associated documentation files (the "Software"), to | ||
8 | * deal in the Software without restriction, including without limitation the | ||
9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
10 | * sell copies of the Software, and to permit persons to whom the Software is | ||
11 | * furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
6 | * Copyright (c) 2006, Ian Campbell, XenSource Ltd. | 24 | * Copyright (c) 2006, Ian Campbell, XenSource Ltd. |
7 | */ | 25 | */ |
8 | 26 | ||
@@ -18,12 +36,13 @@ | |||
18 | * | 36 | * |
19 | * LEGACY indicated the fields in the legacy __xen_guest string which | 37 | * LEGACY indicated the fields in the legacy __xen_guest string which |
20 | * this a note type replaces. | 38 | * this a note type replaces. |
39 | * | ||
40 | * String values (for non-legacy) are NULL terminated ASCII, also known | ||
41 | * as ASCIZ type. | ||
21 | */ | 42 | */ |
22 | 43 | ||
23 | /* | 44 | /* |
24 | * NAME=VALUE pair (string). | 45 | * NAME=VALUE pair (string). |
25 | * | ||
26 | * LEGACY: FEATURES and PAE | ||
27 | */ | 46 | */ |
28 | #define XEN_ELFNOTE_INFO 0 | 47 | #define XEN_ELFNOTE_INFO 0 |
29 | 48 | ||
@@ -137,10 +156,30 @@ | |||
137 | 156 | ||
138 | /* | 157 | /* |
139 | * Whether or not the guest supports cooperative suspend cancellation. | 158 | * Whether or not the guest supports cooperative suspend cancellation. |
159 | * This is a numeric value. | ||
160 | * | ||
161 | * Default is 0 | ||
140 | */ | 162 | */ |
141 | #define XEN_ELFNOTE_SUSPEND_CANCEL 14 | 163 | #define XEN_ELFNOTE_SUSPEND_CANCEL 14 |
142 | 164 | ||
143 | /* | 165 | /* |
166 | * The (non-default) location the initial phys-to-machine map should be | ||
167 | * placed at by the hypervisor (Dom0) or the tools (DomU). | ||
168 | * The kernel must be prepared for this mapping to be established using | ||
169 | * large pages, despite such otherwise not being available to guests. | ||
170 | * The kernel must also be able to handle the page table pages used for | ||
171 | * this mapping not being accessible through the initial mapping. | ||
172 | * (Only x86-64 supports this at present.) | ||
173 | */ | ||
174 | #define XEN_ELFNOTE_INIT_P2M 15 | ||
175 | |||
176 | /* | ||
177 | * Whether or not the guest can deal with being passed an initrd not | ||
178 | * mapped through its initial page tables. | ||
179 | */ | ||
180 | #define XEN_ELFNOTE_MOD_START_PFN 16 | ||
181 | |||
182 | /* | ||
144 | * The features supported by this kernel (numeric). | 183 | * The features supported by this kernel (numeric). |
145 | * | 184 | * |
146 | * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a | 185 | * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a |
@@ -153,6 +192,11 @@ | |||
153 | */ | 192 | */ |
154 | #define XEN_ELFNOTE_SUPPORTED_FEATURES 17 | 193 | #define XEN_ELFNOTE_SUPPORTED_FEATURES 17 |
155 | 194 | ||
195 | /* | ||
196 | * The number of the highest elfnote defined. | ||
197 | */ | ||
198 | #define XEN_ELFNOTE_MAX XEN_ELFNOTE_SUPPORTED_FEATURES | ||
199 | |||
156 | #endif /* __XEN_PUBLIC_ELFNOTE_H__ */ | 200 | #endif /* __XEN_PUBLIC_ELFNOTE_H__ */ |
157 | 201 | ||
158 | /* | 202 | /* |
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index de082130ba4b..f68719f405af 100644 --- a/include/xen/interface/xen.h +++ b/include/xen/interface/xen.h | |||
@@ -3,6 +3,24 @@ | |||
3 | * | 3 | * |
4 | * Guest OS interface to Xen. | 4 | * Guest OS interface to Xen. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | * of this software and associated documentation files (the "Software"), to | ||
8 | * deal in the Software without restriction, including without limitation the | ||
9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
10 | * sell copies of the Software, and to permit persons to whom the Software is | ||
11 | * furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
6 | * Copyright (c) 2004, K A Fraser | 24 | * Copyright (c) 2004, K A Fraser |
7 | */ | 25 | */ |
8 | 26 | ||
@@ -73,13 +91,23 @@ | |||
73 | * VIRTUAL INTERRUPTS | 91 | * VIRTUAL INTERRUPTS |
74 | * | 92 | * |
75 | * Virtual interrupts that a guest OS may receive from Xen. | 93 | * Virtual interrupts that a guest OS may receive from Xen. |
94 | * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a | ||
95 | * global VIRQ. The former can be bound once per VCPU and cannot be re-bound. | ||
96 | * The latter can be allocated only once per guest: they must initially be | ||
97 | * allocated to VCPU0 but can subsequently be re-bound. | ||
76 | */ | 98 | */ |
77 | #define VIRQ_TIMER 0 /* Timebase update, and/or requested timeout. */ | 99 | #define VIRQ_TIMER 0 /* V. Timebase update, and/or requested timeout. */ |
78 | #define VIRQ_DEBUG 1 /* Request guest to dump debug info. */ | 100 | #define VIRQ_DEBUG 1 /* V. Request guest to dump debug info. */ |
79 | #define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */ | 101 | #define VIRQ_CONSOLE 2 /* G. (DOM0) Bytes received on emergency console. */ |
80 | #define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */ | 102 | #define VIRQ_DOM_EXC 3 /* G. (DOM0) Exceptional event for some domain. */ |
81 | #define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */ | 103 | #define VIRQ_TBUF 4 /* G. (DOM0) Trace buffer has records available. */ |
82 | #define VIRQ_PCPU_STATE 9 /* (DOM0) PCPU state changed */ | 104 | #define VIRQ_DEBUGGER 6 /* G. (DOM0) A domain has paused for debugging. */ |
105 | #define VIRQ_XENOPROF 7 /* V. XenOprofile interrupt: new sample available */ | ||
106 | #define VIRQ_CON_RING 8 /* G. (DOM0) Bytes received on console */ | ||
107 | #define VIRQ_PCPU_STATE 9 /* G. (DOM0) PCPU state changed */ | ||
108 | #define VIRQ_MEM_EVENT 10 /* G. (DOM0) A memory event has occured */ | ||
109 | #define VIRQ_XC_RESERVED 11 /* G. Reserved for XenClient */ | ||
110 | #define VIRQ_ENOMEM 12 /* G. (DOM0) Low on heap memory */ | ||
83 | 111 | ||
84 | /* Architecture-specific VIRQ definitions. */ | 112 | /* Architecture-specific VIRQ definitions. */ |
85 | #define VIRQ_ARCH_0 16 | 113 | #define VIRQ_ARCH_0 16 |
@@ -92,24 +120,68 @@ | |||
92 | #define VIRQ_ARCH_7 23 | 120 | #define VIRQ_ARCH_7 23 |
93 | 121 | ||
94 | #define NR_VIRQS 24 | 122 | #define NR_VIRQS 24 |
123 | |||
95 | /* | 124 | /* |
96 | * MMU-UPDATE REQUESTS | 125 | * enum neg_errnoval HYPERVISOR_mmu_update(const struct mmu_update reqs[], |
97 | * | 126 | * unsigned count, unsigned *done_out, |
98 | * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs. | 127 | * unsigned foreigndom) |
99 | * A foreigndom (FD) can be specified (or DOMID_SELF for none). | 128 | * @reqs is an array of mmu_update_t structures ((ptr, val) pairs). |
100 | * Where the FD has some effect, it is described below. | 129 | * @count is the length of the above array. |
101 | * ptr[1:0] specifies the appropriate MMU_* command. | 130 | * @pdone is an output parameter indicating number of completed operations |
131 | * @foreigndom[15:0]: FD, the expected owner of data pages referenced in this | ||
132 | * hypercall invocation. Can be DOMID_SELF. | ||
133 | * @foreigndom[31:16]: PFD, the expected owner of pagetable pages referenced | ||
134 | * in this hypercall invocation. The value of this field | ||
135 | * (x) encodes the PFD as follows: | ||
136 | * x == 0 => PFD == DOMID_SELF | ||
137 | * x != 0 => PFD == x - 1 | ||
102 | * | 138 | * |
139 | * Sub-commands: ptr[1:0] specifies the appropriate MMU_* command. | ||
140 | * ------------- | ||
103 | * ptr[1:0] == MMU_NORMAL_PT_UPDATE: | 141 | * ptr[1:0] == MMU_NORMAL_PT_UPDATE: |
104 | * Updates an entry in a page table. If updating an L1 table, and the new | 142 | * Updates an entry in a page table belonging to PFD. If updating an L1 table, |
105 | * table entry is valid/present, the mapped frame must belong to the FD, if | 143 | * and the new table entry is valid/present, the mapped frame must belong to |
106 | * an FD has been specified. If attempting to map an I/O page then the | 144 | * FD. If attempting to map an I/O page then the caller assumes the privilege |
107 | * caller assumes the privilege of the FD. | 145 | * of the FD. |
108 | * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller. | 146 | * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller. |
109 | * FD == DOMID_XEN: Map restricted areas of Xen's heap space. | 147 | * FD == DOMID_XEN: Map restricted areas of Xen's heap space. |
110 | * ptr[:2] -- Machine address of the page-table entry to modify. | 148 | * ptr[:2] -- Machine address of the page-table entry to modify. |
111 | * val -- Value to write. | 149 | * val -- Value to write. |
112 | * | 150 | * |
151 | * There also certain implicit requirements when using this hypercall. The | ||
152 | * pages that make up a pagetable must be mapped read-only in the guest. | ||
153 | * This prevents uncontrolled guest updates to the pagetable. Xen strictly | ||
154 | * enforces this, and will disallow any pagetable update which will end up | ||
155 | * mapping pagetable page RW, and will disallow using any writable page as a | ||
156 | * pagetable. In practice it means that when constructing a page table for a | ||
157 | * process, thread, etc, we MUST be very dilligient in following these rules: | ||
158 | * 1). Start with top-level page (PGD or in Xen language: L4). Fill out | ||
159 | * the entries. | ||
160 | * 2). Keep on going, filling out the upper (PUD or L3), and middle (PMD | ||
161 | * or L2). | ||
162 | * 3). Start filling out the PTE table (L1) with the PTE entries. Once | ||
163 | * done, make sure to set each of those entries to RO (so writeable bit | ||
164 | * is unset). Once that has been completed, set the PMD (L2) for this | ||
165 | * PTE table as RO. | ||
166 | * 4). When completed with all of the PMD (L2) entries, and all of them have | ||
167 | * been set to RO, make sure to set RO the PUD (L3). Do the same | ||
168 | * operation on PGD (L4) pagetable entries that have a PUD (L3) entry. | ||
169 | * 5). Now before you can use those pages (so setting the cr3), you MUST also | ||
170 | * pin them so that the hypervisor can verify the entries. This is done | ||
171 | * via the HYPERVISOR_mmuext_op(MMUEXT_PIN_L4_TABLE, guest physical frame | ||
172 | * number of the PGD (L4)). And this point the HYPERVISOR_mmuext_op( | ||
173 | * MMUEXT_NEW_BASEPTR, guest physical frame number of the PGD (L4)) can be | ||
174 | * issued. | ||
175 | * For 32-bit guests, the L4 is not used (as there is less pagetables), so | ||
176 | * instead use L3. | ||
177 | * At this point the pagetables can be modified using the MMU_NORMAL_PT_UPDATE | ||
178 | * hypercall. Also if so desired the OS can also try to write to the PTE | ||
179 | * and be trapped by the hypervisor (as the PTE entry is RO). | ||
180 | * | ||
181 | * To deallocate the pages, the operations are the reverse of the steps | ||
182 | * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and the | ||
183 | * pagetable MUST not be in use (meaning that the cr3 is not set to it). | ||
184 | * | ||
113 | * ptr[1:0] == MMU_MACHPHYS_UPDATE: | 185 | * ptr[1:0] == MMU_MACHPHYS_UPDATE: |
114 | * Updates an entry in the machine->pseudo-physical mapping table. | 186 | * Updates an entry in the machine->pseudo-physical mapping table. |
115 | * ptr[:2] -- Machine address within the frame whose mapping to modify. | 187 | * ptr[:2] -- Machine address within the frame whose mapping to modify. |
@@ -119,6 +191,72 @@ | |||
119 | * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD: | 191 | * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD: |
120 | * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed | 192 | * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed |
121 | * with those in @val. | 193 | * with those in @val. |
194 | * | ||
195 | * @val is usually the machine frame number along with some attributes. | ||
196 | * The attributes by default follow the architecture defined bits. Meaning that | ||
197 | * if this is a X86_64 machine and four page table layout is used, the layout | ||
198 | * of val is: | ||
199 | * - 63 if set means No execute (NX) | ||
200 | * - 46-13 the machine frame number | ||
201 | * - 12 available for guest | ||
202 | * - 11 available for guest | ||
203 | * - 10 available for guest | ||
204 | * - 9 available for guest | ||
205 | * - 8 global | ||
206 | * - 7 PAT (PSE is disabled, must use hypercall to make 4MB or 2MB pages) | ||
207 | * - 6 dirty | ||
208 | * - 5 accessed | ||
209 | * - 4 page cached disabled | ||
210 | * - 3 page write through | ||
211 | * - 2 userspace accessible | ||
212 | * - 1 writeable | ||
213 | * - 0 present | ||
214 | * | ||
215 | * The one bits that does not fit with the default layout is the PAGE_PSE | ||
216 | * also called PAGE_PAT). The MMUEXT_[UN]MARK_SUPER arguments to the | ||
217 | * HYPERVISOR_mmuext_op serve as mechanism to set a pagetable to be 4MB | ||
218 | * (or 2MB) instead of using the PAGE_PSE bit. | ||
219 | * | ||
220 | * The reason that the PAGE_PSE (bit 7) is not being utilized is due to Xen | ||
221 | * using it as the Page Attribute Table (PAT) bit - for details on it please | ||
222 | * refer to Intel SDM 10.12. The PAT allows to set the caching attributes of | ||
223 | * pages instead of using MTRRs. | ||
224 | * | ||
225 | * The PAT MSR is as follows (it is a 64-bit value, each entry is 8 bits): | ||
226 | * PAT4 PAT0 | ||
227 | * +-----+-----+----+----+----+-----+----+----+ | ||
228 | * | UC | UC- | WC | WB | UC | UC- | WC | WB | <= Linux | ||
229 | * +-----+-----+----+----+----+-----+----+----+ | ||
230 | * | UC | UC- | WT | WB | UC | UC- | WT | WB | <= BIOS (default when machine boots) | ||
231 | * +-----+-----+----+----+----+-----+----+----+ | ||
232 | * | rsv | rsv | WP | WC | UC | UC- | WT | WB | <= Xen | ||
233 | * +-----+-----+----+----+----+-----+----+----+ | ||
234 | * | ||
235 | * The lookup of this index table translates to looking up | ||
236 | * Bit 7, Bit 4, and Bit 3 of val entry: | ||
237 | * | ||
238 | * PAT/PSE (bit 7) ... PCD (bit 4) .. PWT (bit 3). | ||
239 | * | ||
240 | * If all bits are off, then we are using PAT0. If bit 3 turned on, | ||
241 | * then we are using PAT1, if bit 3 and bit 4, then PAT2.. | ||
242 | * | ||
243 | * As you can see, the Linux PAT1 translates to PAT4 under Xen. Which means | ||
244 | * that if a guest that follows Linux's PAT setup and would like to set Write | ||
245 | * Combined on pages it MUST use PAT4 entry. Meaning that Bit 7 (PAGE_PAT) is | ||
246 | * set. For example, under Linux it only uses PAT0, PAT1, and PAT2 for the | ||
247 | * caching as: | ||
248 | * | ||
249 | * WB = none (so PAT0) | ||
250 | * WC = PWT (bit 3 on) | ||
251 | * UC = PWT | PCD (bit 3 and 4 are on). | ||
252 | * | ||
253 | * To make it work with Xen, it needs to translate the WC bit as so: | ||
254 | * | ||
255 | * PWT (so bit 3 on) --> PAT (so bit 7 is on) and clear bit 3 | ||
256 | * | ||
257 | * And to translate back it would: | ||
258 | * | ||
259 | * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7. | ||
122 | */ | 260 | */ |
123 | #define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */ | 261 | #define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */ |
124 | #define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */ | 262 | #define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */ |
@@ -127,7 +265,12 @@ | |||
127 | /* | 265 | /* |
128 | * MMU EXTENDED OPERATIONS | 266 | * MMU EXTENDED OPERATIONS |
129 | * | 267 | * |
130 | * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures. | 268 | * enum neg_errnoval HYPERVISOR_mmuext_op(mmuext_op_t uops[], |
269 | * unsigned int count, | ||
270 | * unsigned int *pdone, | ||
271 | * unsigned int foreigndom) | ||
272 | */ | ||
273 | /* HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures. | ||
131 | * A foreigndom (FD) can be specified (or DOMID_SELF for none). | 274 | * A foreigndom (FD) can be specified (or DOMID_SELF for none). |
132 | * Where the FD has some effect, it is described below. | 275 | * Where the FD has some effect, it is described below. |
133 | * | 276 | * |
@@ -164,9 +307,23 @@ | |||
164 | * cmd: MMUEXT_FLUSH_CACHE | 307 | * cmd: MMUEXT_FLUSH_CACHE |
165 | * No additional arguments. Writes back and flushes cache contents. | 308 | * No additional arguments. Writes back and flushes cache contents. |
166 | * | 309 | * |
310 | * cmd: MMUEXT_FLUSH_CACHE_GLOBAL | ||
311 | * No additional arguments. Writes back and flushes cache contents | ||
312 | * on all CPUs in the system. | ||
313 | * | ||
167 | * cmd: MMUEXT_SET_LDT | 314 | * cmd: MMUEXT_SET_LDT |
168 | * linear_addr: Linear address of LDT base (NB. must be page-aligned). | 315 | * linear_addr: Linear address of LDT base (NB. must be page-aligned). |
169 | * nr_ents: Number of entries in LDT. | 316 | * nr_ents: Number of entries in LDT. |
317 | * | ||
318 | * cmd: MMUEXT_CLEAR_PAGE | ||
319 | * mfn: Machine frame number to be cleared. | ||
320 | * | ||
321 | * cmd: MMUEXT_COPY_PAGE | ||
322 | * mfn: Machine frame number of the destination page. | ||
323 | * src_mfn: Machine frame number of the source page. | ||
324 | * | ||
325 | * cmd: MMUEXT_[UN]MARK_SUPER | ||
326 | * mfn: Machine frame number of head of superpage to be [un]marked. | ||
170 | */ | 327 | */ |
171 | #define MMUEXT_PIN_L1_TABLE 0 | 328 | #define MMUEXT_PIN_L1_TABLE 0 |
172 | #define MMUEXT_PIN_L2_TABLE 1 | 329 | #define MMUEXT_PIN_L2_TABLE 1 |
@@ -183,12 +340,18 @@ | |||
183 | #define MMUEXT_FLUSH_CACHE 12 | 340 | #define MMUEXT_FLUSH_CACHE 12 |
184 | #define MMUEXT_SET_LDT 13 | 341 | #define MMUEXT_SET_LDT 13 |
185 | #define MMUEXT_NEW_USER_BASEPTR 15 | 342 | #define MMUEXT_NEW_USER_BASEPTR 15 |
343 | #define MMUEXT_CLEAR_PAGE 16 | ||
344 | #define MMUEXT_COPY_PAGE 17 | ||
345 | #define MMUEXT_FLUSH_CACHE_GLOBAL 18 | ||
346 | #define MMUEXT_MARK_SUPER 19 | ||
347 | #define MMUEXT_UNMARK_SUPER 20 | ||
186 | 348 | ||
187 | #ifndef __ASSEMBLY__ | 349 | #ifndef __ASSEMBLY__ |
188 | struct mmuext_op { | 350 | struct mmuext_op { |
189 | unsigned int cmd; | 351 | unsigned int cmd; |
190 | union { | 352 | union { |
191 | /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ | 353 | /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR |
354 | * CLEAR_PAGE, COPY_PAGE, [UN]MARK_SUPER */ | ||
192 | xen_pfn_t mfn; | 355 | xen_pfn_t mfn; |
193 | /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ | 356 | /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ |
194 | unsigned long linear_addr; | 357 | unsigned long linear_addr; |
@@ -198,6 +361,8 @@ struct mmuext_op { | |||
198 | unsigned int nr_ents; | 361 | unsigned int nr_ents; |
199 | /* TLB_FLUSH_MULTI, INVLPG_MULTI */ | 362 | /* TLB_FLUSH_MULTI, INVLPG_MULTI */ |
200 | void *vcpumask; | 363 | void *vcpumask; |
364 | /* COPY_PAGE */ | ||
365 | xen_pfn_t src_mfn; | ||
201 | } arg2; | 366 | } arg2; |
202 | }; | 367 | }; |
203 | DEFINE_GUEST_HANDLE_STRUCT(mmuext_op); | 368 | DEFINE_GUEST_HANDLE_STRUCT(mmuext_op); |
@@ -225,10 +390,23 @@ DEFINE_GUEST_HANDLE_STRUCT(mmuext_op); | |||
225 | */ | 390 | */ |
226 | #define VMASST_CMD_enable 0 | 391 | #define VMASST_CMD_enable 0 |
227 | #define VMASST_CMD_disable 1 | 392 | #define VMASST_CMD_disable 1 |
393 | |||
394 | /* x86/32 guests: simulate full 4GB segment limits. */ | ||
228 | #define VMASST_TYPE_4gb_segments 0 | 395 | #define VMASST_TYPE_4gb_segments 0 |
396 | |||
397 | /* x86/32 guests: trap (vector 15) whenever above vmassist is used. */ | ||
229 | #define VMASST_TYPE_4gb_segments_notify 1 | 398 | #define VMASST_TYPE_4gb_segments_notify 1 |
399 | |||
400 | /* | ||
401 | * x86 guests: support writes to bottom-level PTEs. | ||
402 | * NB1. Page-directory entries cannot be written. | ||
403 | * NB2. Guest must continue to remove all writable mappings of PTEs. | ||
404 | */ | ||
230 | #define VMASST_TYPE_writable_pagetables 2 | 405 | #define VMASST_TYPE_writable_pagetables 2 |
406 | |||
407 | /* x86/PAE guests: support PDPTs above 4GB. */ | ||
231 | #define VMASST_TYPE_pae_extended_cr3 3 | 408 | #define VMASST_TYPE_pae_extended_cr3 3 |
409 | |||
232 | #define MAX_VMASST_TYPE 3 | 410 | #define MAX_VMASST_TYPE 3 |
233 | 411 | ||
234 | #ifndef __ASSEMBLY__ | 412 | #ifndef __ASSEMBLY__ |
@@ -260,6 +438,15 @@ typedef uint16_t domid_t; | |||
260 | */ | 438 | */ |
261 | #define DOMID_XEN (0x7FF2U) | 439 | #define DOMID_XEN (0x7FF2U) |
262 | 440 | ||
441 | /* DOMID_COW is used as the owner of sharable pages */ | ||
442 | #define DOMID_COW (0x7FF3U) | ||
443 | |||
444 | /* DOMID_INVALID is used to identify pages with unknown owner. */ | ||
445 | #define DOMID_INVALID (0x7FF4U) | ||
446 | |||
447 | /* Idle domain. */ | ||
448 | #define DOMID_IDLE (0x7FFFU) | ||
449 | |||
263 | /* | 450 | /* |
264 | * Send an array of these to HYPERVISOR_mmu_update(). | 451 | * Send an array of these to HYPERVISOR_mmu_update(). |
265 | * NB. The fields are natural pointer/address size for this architecture. | 452 | * NB. The fields are natural pointer/address size for this architecture. |
@@ -272,7 +459,9 @@ DEFINE_GUEST_HANDLE_STRUCT(mmu_update); | |||
272 | 459 | ||
273 | /* | 460 | /* |
274 | * Send an array of these to HYPERVISOR_multicall(). | 461 | * Send an array of these to HYPERVISOR_multicall(). |
275 | * NB. The fields are natural register size for this architecture. | 462 | * NB. The fields are logically the natural register size for this |
463 | * architecture. In cases where xen_ulong_t is larger than this then | ||
464 | * any unused bits in the upper portion must be zero. | ||
276 | */ | 465 | */ |
277 | struct multicall_entry { | 466 | struct multicall_entry { |
278 | xen_ulong_t op; | 467 | xen_ulong_t op; |
@@ -442,8 +631,48 @@ struct start_info { | |||
442 | unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */ | 631 | unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */ |
443 | unsigned long mod_len; /* Size (bytes) of pre-loaded module. */ | 632 | unsigned long mod_len; /* Size (bytes) of pre-loaded module. */ |
444 | int8_t cmd_line[MAX_GUEST_CMDLINE]; | 633 | int8_t cmd_line[MAX_GUEST_CMDLINE]; |
634 | /* The pfn range here covers both page table and p->m table frames. */ | ||
635 | unsigned long first_p2m_pfn;/* 1st pfn forming initial P->M table. */ | ||
636 | unsigned long nr_p2m_frames;/* # of pfns forming initial P->M table. */ | ||
445 | }; | 637 | }; |
446 | 638 | ||
639 | /* These flags are passed in the 'flags' field of start_info_t. */ | ||
640 | #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */ | ||
641 | #define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */ | ||
642 | #define SIF_MULTIBOOT_MOD (1<<2) /* Is mod_start a multiboot module? */ | ||
643 | #define SIF_MOD_START_PFN (1<<3) /* Is mod_start a PFN? */ | ||
644 | #define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */ | ||
645 | |||
646 | /* | ||
647 | * A multiboot module is a package containing modules very similar to a | ||
648 | * multiboot module array. The only differences are: | ||
649 | * - the array of module descriptors is by convention simply at the beginning | ||
650 | * of the multiboot module, | ||
651 | * - addresses in the module descriptors are based on the beginning of the | ||
652 | * multiboot module, | ||
653 | * - the number of modules is determined by a termination descriptor that has | ||
654 | * mod_start == 0. | ||
655 | * | ||
656 | * This permits to both build it statically and reference it in a configuration | ||
657 | * file, and let the PV guest easily rebase the addresses to virtual addresses | ||
658 | * and at the same time count the number of modules. | ||
659 | */ | ||
660 | struct xen_multiboot_mod_list { | ||
661 | /* Address of first byte of the module */ | ||
662 | uint32_t mod_start; | ||
663 | /* Address of last byte of the module (inclusive) */ | ||
664 | uint32_t mod_end; | ||
665 | /* Address of zero-terminated command line */ | ||
666 | uint32_t cmdline; | ||
667 | /* Unused, must be zero */ | ||
668 | uint32_t pad; | ||
669 | }; | ||
670 | /* | ||
671 | * The console structure in start_info.console.dom0 | ||
672 | * | ||
673 | * This structure includes a variety of information required to | ||
674 | * have a working VGA/VESA console. | ||
675 | */ | ||
447 | struct dom0_vga_console_info { | 676 | struct dom0_vga_console_info { |
448 | uint8_t video_type; | 677 | uint8_t video_type; |
449 | #define XEN_VGATYPE_TEXT_MODE_3 0x03 | 678 | #define XEN_VGATYPE_TEXT_MODE_3 0x03 |
@@ -484,11 +713,6 @@ struct dom0_vga_console_info { | |||
484 | } u; | 713 | } u; |
485 | }; | 714 | }; |
486 | 715 | ||
487 | /* These flags are passed in the 'flags' field of start_info_t. */ | ||
488 | #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */ | ||
489 | #define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */ | ||
490 | #define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */ | ||
491 | |||
492 | typedef uint64_t cpumap_t; | 716 | typedef uint64_t cpumap_t; |
493 | 717 | ||
494 | typedef uint8_t xen_domain_handle_t[16]; | 718 | typedef uint8_t xen_domain_handle_t[16]; |