aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 01:09:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 01:09:10 -0400
commit56d92aa5cf7c96c70f81d0350c94faf46a9fb76d (patch)
tree2fb5d5b891903cada4dff9c581c70d33340a3769 /include/xen
parent33c2a174120b2c1baec9d1dac513f9d4b761b26a (diff)
parentc341ca45ce56143804ef5a8f4db753e554e640b4 (diff)
Merge tag 'stable/for-linus-3.7-x86-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull Xen update from Konrad Rzeszutek Wilk: "Features: - When hotplugging PCI devices in a PV guest we can allocate Xen-SWIOTLB later. - Cleanup Xen SWIOTLB. - Support pages out grants from HVM domains in the backends. - Support wild cards in xen-pciback.hide=(BDF) arguments. - Update grant status updates with upstream hypervisor. - Boot PV guests with more than 128GB. - Cleanup Xen MMU code/add comments. - Obtain XENVERS using a preferred method. - Lay out generic changes to support Xen ARM. - Allow privcmd ioctl for HVM (used to do only PV). - Do v2 of mmap_batch for privcmd ioctls. - If hypervisor saves the LED keyboard light - we will now instruct the kernel about its state. Fixes: - More fixes to Xen PCI backend for various calls/FLR/etc. - With more than 4GB in a 64-bit PV guest disable native SWIOTLB. - Fix up smatch warnings. - Fix up various return values in privmcmd and mm." * tag 'stable/for-linus-3.7-x86-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: (48 commits) xen/pciback: Restore the PCI config space after an FLR. xen-pciback: properly clean up after calling pcistub_device_find() xen/vga: add the xen EFI video mode support xen/x86: retrieve keyboard shift status flags from hypervisor. xen/gndev: Xen backend support for paged out grant targets V4. xen-pciback: support wild cards in slot specifications xen/swiotlb: Fix compile warnings when using plain integer instead of NULL pointer. xen/swiotlb: Remove functions not needed anymore. xen/pcifront: Use Xen-SWIOTLB when initting if required. xen/swiotlb: For early initialization, return zero on success. xen/swiotlb: Use the swiotlb_late_init_with_tbl to init Xen-SWIOTLB late when PV PCI is used. xen/swiotlb: Move the error strings to its own function. xen/swiotlb: Move the nr_tbl determination in its own function. xen/arm: compile and run xenbus xen: resynchronise grant table status codes with upstream xen/privcmd: return -EFAULT on error xen/privcmd: Fix mmap batch ioctl error status copy back. xen/privcmd: add PRIVCMD_MMAPBATCH_V2 ioctl xen/mm: return more precise error from xen_remap_domain_range() xen/mmu: If the revector fails, don't attempt to revector anything else. ...
Diffstat (limited to 'include/xen')
-rw-r--r--include/xen/grant_table.h12
-rw-r--r--include/xen/interface/grant_table.h12
-rw-r--r--include/xen/interface/memory.h9
-rw-r--r--include/xen/interface/platform.h7
-rw-r--r--include/xen/interface/version.h3
-rw-r--r--include/xen/interface/xen.h8
-rw-r--r--include/xen/privcmd.h27
-rw-r--r--include/xen/swiotlb-xen.h11
8 files changed, 63 insertions, 26 deletions
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index f19fff8650e9..aecee9d112cb 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -190,4 +190,16 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
190 struct gnttab_map_grant_ref *kunmap_ops, 190 struct gnttab_map_grant_ref *kunmap_ops,
191 struct page **pages, unsigned int count); 191 struct page **pages, unsigned int count);
192 192
193/* Perform a batch of grant map/copy operations. Retry every batch slot
194 * for which the hypervisor returns GNTST_eagain. This is typically due
195 * to paged out target frames.
196 *
197 * Will retry for 1, 2, ... 255 ms, i.e. 256 times during 32 seconds.
198 *
199 * Return value in each iand every status field of the batch guaranteed
200 * to not be GNTST_eagain.
201 */
202void gnttab_batch_map(struct gnttab_map_grant_ref *batch, unsigned count);
203void gnttab_batch_copy(struct gnttab_copy *batch, unsigned count);
204
193#endif /* __ASM_GNTTAB_H__ */ 205#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index a17d84433e6a..f9f8b975ae74 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -338,7 +338,7 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_dump_table);
338#define GNTTABOP_transfer 4 338#define GNTTABOP_transfer 4
339struct gnttab_transfer { 339struct gnttab_transfer {
340 /* IN parameters. */ 340 /* IN parameters. */
341 unsigned long mfn; 341 xen_pfn_t mfn;
342 domid_t domid; 342 domid_t domid;
343 grant_ref_t ref; 343 grant_ref_t ref;
344 /* OUT parameters. */ 344 /* OUT parameters. */
@@ -375,7 +375,7 @@ struct gnttab_copy {
375 struct { 375 struct {
376 union { 376 union {
377 grant_ref_t ref; 377 grant_ref_t ref;
378 unsigned long gmfn; 378 xen_pfn_t gmfn;
379 } u; 379 } u;
380 domid_t domid; 380 domid_t domid;
381 uint16_t offset; 381 uint16_t offset;
@@ -519,7 +519,9 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
519#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */ 519#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */
520#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */ 520#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */
521#define GNTST_bad_page (-9) /* Specified page was invalid for op. */ 521#define GNTST_bad_page (-9) /* Specified page was invalid for op. */
522#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */ 522#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */
523#define GNTST_address_too_big (-11) /* transfer page address too large. */
524#define GNTST_eagain (-12) /* Operation not done; try again. */
523 525
524#define GNTTABOP_error_msgs { \ 526#define GNTTABOP_error_msgs { \
525 "okay", \ 527 "okay", \
@@ -532,7 +534,9 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
532 "no spare translation slot in the I/O MMU", \ 534 "no spare translation slot in the I/O MMU", \
533 "permission denied", \ 535 "permission denied", \
534 "bad page", \ 536 "bad page", \
535 "copy arguments cross page boundary" \ 537 "copy arguments cross page boundary", \
538 "page address size too large", \
539 "operation not done; try again" \
536} 540}
537 541
538#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */ 542#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index eac3ce153719..d8e33a93ea4d 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -31,7 +31,7 @@ struct xen_memory_reservation {
31 * OUT: GMFN bases of extents that were allocated 31 * OUT: GMFN bases of extents that were allocated
32 * (NB. This command also updates the mach_to_phys translation table) 32 * (NB. This command also updates the mach_to_phys translation table)
33 */ 33 */
34 GUEST_HANDLE(ulong) extent_start; 34 GUEST_HANDLE(xen_pfn_t) extent_start;
35 35
36 /* Number of extents, and size/alignment of each (2^extent_order pages). */ 36 /* Number of extents, and size/alignment of each (2^extent_order pages). */
37 unsigned long nr_extents; 37 unsigned long nr_extents;
@@ -130,7 +130,7 @@ struct xen_machphys_mfn_list {
130 * any large discontiguities in the machine address space, 2MB gaps in 130 * any large discontiguities in the machine address space, 2MB gaps in
131 * the machphys table will be represented by an MFN base of zero. 131 * the machphys table will be represented by an MFN base of zero.
132 */ 132 */
133 GUEST_HANDLE(ulong) extent_start; 133 GUEST_HANDLE(xen_pfn_t) extent_start;
134 134
135 /* 135 /*
136 * Number of extents written to the above array. This will be smaller 136 * Number of extents written to the above array. This will be smaller
@@ -163,6 +163,9 @@ struct xen_add_to_physmap {
163 /* Which domain to change the mapping for. */ 163 /* Which domain to change the mapping for. */
164 domid_t domid; 164 domid_t domid;
165 165
166 /* Number of pages to go through for gmfn_range */
167 uint16_t size;
168
166 /* Source mapping space. */ 169 /* Source mapping space. */
167#define XENMAPSPACE_shared_info 0 /* shared info page */ 170#define XENMAPSPACE_shared_info 0 /* shared info page */
168#define XENMAPSPACE_grant_table 1 /* grant table page */ 171#define XENMAPSPACE_grant_table 1 /* grant table page */
@@ -172,7 +175,7 @@ struct xen_add_to_physmap {
172 unsigned long idx; 175 unsigned long idx;
173 176
174 /* GPFN where the source mapping page should appear. */ 177 /* GPFN where the source mapping page should appear. */
175 unsigned long gpfn; 178 xen_pfn_t gpfn;
176}; 179};
177DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); 180DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
178 181
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index 61fa66160983..54ad6f9e4725 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -54,7 +54,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime_t);
54#define XENPF_add_memtype 31 54#define XENPF_add_memtype 31
55struct xenpf_add_memtype { 55struct xenpf_add_memtype {
56 /* IN variables. */ 56 /* IN variables. */
57 unsigned long mfn; 57 xen_pfn_t mfn;
58 uint64_t nr_mfns; 58 uint64_t nr_mfns;
59 uint32_t type; 59 uint32_t type;
60 /* OUT variables. */ 60 /* OUT variables. */
@@ -84,7 +84,7 @@ struct xenpf_read_memtype {
84 /* IN variables. */ 84 /* IN variables. */
85 uint32_t reg; 85 uint32_t reg;
86 /* OUT variables. */ 86 /* OUT variables. */
87 unsigned long mfn; 87 xen_pfn_t mfn;
88 uint64_t nr_mfns; 88 uint64_t nr_mfns;
89 uint32_t type; 89 uint32_t type;
90}; 90};
@@ -112,6 +112,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
112#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ 112#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ 113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
114#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ 114#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */
115#define XEN_FW_KBD_SHIFT_FLAGS 5 /* Int16, Fn02: Get keyboard shift flags. */
115struct xenpf_firmware_info { 116struct xenpf_firmware_info {
116 /* IN variables. */ 117 /* IN variables. */
117 uint32_t type; 118 uint32_t type;
@@ -142,6 +143,8 @@ struct xenpf_firmware_info {
142 /* must refer to 128-byte buffer */ 143 /* must refer to 128-byte buffer */
143 GUEST_HANDLE(uchar) edid; 144 GUEST_HANDLE(uchar) edid;
144 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ 145 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
146
147 uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */
145 } u; 148 } u;
146}; 149};
147DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t); 150DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
index e8b6519d47e9..dd58cf5ea3e4 100644
--- a/include/xen/interface/version.h
+++ b/include/xen/interface/version.h
@@ -60,4 +60,7 @@ struct xen_feature_info {
60/* arg == NULL; returns host memory page size. */ 60/* arg == NULL; returns host memory page size. */
61#define XENVER_pagesize 7 61#define XENVER_pagesize 7
62 62
63/* arg == xen_domain_handle_t. */
64#define XENVER_guest_handle 8
65
63#endif /* __XEN_PUBLIC_VERSION_H__ */ 66#endif /* __XEN_PUBLIC_VERSION_H__ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 0801468f9abe..886a5d80a18f 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -10,7 +10,6 @@
10#define __XEN_PUBLIC_XEN_H__ 10#define __XEN_PUBLIC_XEN_H__
11 11
12#include <asm/xen/interface.h> 12#include <asm/xen/interface.h>
13#include <asm/pvclock-abi.h>
14 13
15/* 14/*
16 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS). 15 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
@@ -190,7 +189,7 @@ struct mmuext_op {
190 unsigned int cmd; 189 unsigned int cmd;
191 union { 190 union {
192 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ 191 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
193 unsigned long mfn; 192 xen_pfn_t mfn;
194 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ 193 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
195 unsigned long linear_addr; 194 unsigned long linear_addr;
196 } arg1; 195 } arg1;
@@ -430,11 +429,11 @@ struct start_info {
430 unsigned long nr_pages; /* Total pages allocated to this domain. */ 429 unsigned long nr_pages; /* Total pages allocated to this domain. */
431 unsigned long shared_info; /* MACHINE address of shared info struct. */ 430 unsigned long shared_info; /* MACHINE address of shared info struct. */
432 uint32_t flags; /* SIF_xxx flags. */ 431 uint32_t flags; /* SIF_xxx flags. */
433 unsigned long store_mfn; /* MACHINE page number of shared page. */ 432 xen_pfn_t store_mfn; /* MACHINE page number of shared page. */
434 uint32_t store_evtchn; /* Event channel for store communication. */ 433 uint32_t store_evtchn; /* Event channel for store communication. */
435 union { 434 union {
436 struct { 435 struct {
437 unsigned long mfn; /* MACHINE page number of console page. */ 436 xen_pfn_t mfn; /* MACHINE page number of console page. */
438 uint32_t evtchn; /* Event channel for console page. */ 437 uint32_t evtchn; /* Event channel for console page. */
439 } domU; 438 } domU;
440 struct { 439 struct {
@@ -455,6 +454,7 @@ struct dom0_vga_console_info {
455 uint8_t video_type; 454 uint8_t video_type;
456#define XEN_VGATYPE_TEXT_MODE_3 0x03 455#define XEN_VGATYPE_TEXT_MODE_3 0x03
457#define XEN_VGATYPE_VESA_LFB 0x23 456#define XEN_VGATYPE_VESA_LFB 0x23
457#define XEN_VGATYPE_EFI_LFB 0x70
458 458
459 union { 459 union {
460 struct { 460 struct {
diff --git a/include/xen/privcmd.h b/include/xen/privcmd.h
index 17857fb4d550..a85316811d79 100644
--- a/include/xen/privcmd.h
+++ b/include/xen/privcmd.h
@@ -35,8 +35,7 @@
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/compiler.h> 37#include <linux/compiler.h>
38 38#include <xen/interface/xen.h>
39typedef unsigned long xen_pfn_t;
40 39
41struct privcmd_hypercall { 40struct privcmd_hypercall {
42 __u64 op; 41 __u64 op;
@@ -59,13 +58,33 @@ struct privcmd_mmapbatch {
59 int num; /* number of pages to populate */ 58 int num; /* number of pages to populate */
60 domid_t dom; /* target domain */ 59 domid_t dom; /* target domain */
61 __u64 addr; /* virtual address */ 60 __u64 addr; /* virtual address */
62 xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */ 61 xen_pfn_t __user *arr; /* array of mfns - or'd with
62 PRIVCMD_MMAPBATCH_*_ERROR on err */
63};
64
65#define PRIVCMD_MMAPBATCH_MFN_ERROR 0xf0000000U
66#define PRIVCMD_MMAPBATCH_PAGED_ERROR 0x80000000U
67
68struct privcmd_mmapbatch_v2 {
69 unsigned int num; /* number of pages to populate */
70 domid_t dom; /* target domain */
71 __u64 addr; /* virtual address */
72 const xen_pfn_t __user *arr; /* array of mfns */
73 int __user *err; /* array of error codes */
63}; 74};
64 75
65/* 76/*
66 * @cmd: IOCTL_PRIVCMD_HYPERCALL 77 * @cmd: IOCTL_PRIVCMD_HYPERCALL
67 * @arg: &privcmd_hypercall_t 78 * @arg: &privcmd_hypercall_t
68 * Return: Value returned from execution of the specified hypercall. 79 * Return: Value returned from execution of the specified hypercall.
80 *
81 * @cmd: IOCTL_PRIVCMD_MMAPBATCH_V2
82 * @arg: &struct privcmd_mmapbatch_v2
83 * Return: 0 on success (i.e., arg->err contains valid error codes for
84 * each frame). On an error other than a failed frame remap, -1 is
85 * returned and errno is set to EINVAL, EFAULT etc. As an exception,
86 * if the operation was otherwise successful but any frame failed with
87 * -ENOENT, then -1 is returned and errno is set to ENOENT.
69 */ 88 */
70#define IOCTL_PRIVCMD_HYPERCALL \ 89#define IOCTL_PRIVCMD_HYPERCALL \
71 _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall)) 90 _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall))
@@ -73,5 +92,7 @@ struct privcmd_mmapbatch {
73 _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap)) 92 _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap))
74#define IOCTL_PRIVCMD_MMAPBATCH \ 93#define IOCTL_PRIVCMD_MMAPBATCH \
75 _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch)) 94 _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch))
95#define IOCTL_PRIVCMD_MMAPBATCH_V2 \
96 _IOC(_IOC_NONE, 'P', 4, sizeof(struct privcmd_mmapbatch_v2))
76 97
77#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */ 98#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index 4f4d449f00f6..de8bcc641c49 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/swiotlb.h> 4#include <linux/swiotlb.h>
5 5
6extern void xen_swiotlb_init(int verbose); 6extern int xen_swiotlb_init(int verbose, bool early);
7 7
8extern void 8extern void
9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, 9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -23,15 +23,6 @@ extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
23extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, 23extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
24 size_t size, enum dma_data_direction dir, 24 size_t size, enum dma_data_direction dir,
25 struct dma_attrs *attrs); 25 struct dma_attrs *attrs);
26/*
27extern int
28xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
29 enum dma_data_direction dir);
30
31extern void
32xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
33 enum dma_data_direction dir);
34*/
35extern int 26extern int
36xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, 27xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
37 int nelems, enum dma_data_direction dir, 28 int nelems, enum dma_data_direction dir,