aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-12 12:09:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-12 12:09:41 -0400
commit26f0cf91813bdc8e61595f8ad6660251e2ee9cf6 (patch)
treedb129d45fba03e3e59392410d0f35ba7d3e438e6 /include/xen
parentd862b13bc8cbab9692fbe0ef44c40d0488b81af1 (diff)
parentfe96eb404e33b59bb39f7050205f7c56c1c7d686 (diff)
Merge branch 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
* 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: x86: Detect whether we should use Xen SWIOTLB. pci-swiotlb-xen: Add glue code to setup dma_ops utilizing xen_swiotlb_* functions. swiotlb-xen: SWIOTLB library for Xen PV guest with PCI passthrough. xen/mmu: inhibit vmap aliases rather than trying to clear them out vmap: add flag to allow lazy unmap to be disabled at runtime xen: Add xen_create_contiguous_region xen: Rename the balloon lock xen: Allow unprivileged Xen domains to create iomap pages xen: use _PAGE_IOMAP in ioremap to do machine mappings Fix up trivial conflicts (adding both xen swiotlb and xen pci platform driver setup close to each other) in drivers/xen/{Kconfig,Makefile} and include/xen/xen-ops.h
Diffstat (limited to 'include/xen')
-rw-r--r--include/xen/interface/memory.h50
-rw-r--r--include/xen/swiotlb-xen.h65
-rw-r--r--include/xen/xen-ops.h6
3 files changed, 121 insertions, 0 deletions
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index af36ead16817..d3938d3e71f8 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -9,6 +9,8 @@
9#ifndef __XEN_PUBLIC_MEMORY_H__ 9#ifndef __XEN_PUBLIC_MEMORY_H__
10#define __XEN_PUBLIC_MEMORY_H__ 10#define __XEN_PUBLIC_MEMORY_H__
11 11
12#include <linux/spinlock.h>
13
12/* 14/*
13 * Increase or decrease the specified domain's memory reservation. Returns a 15 * Increase or decrease the specified domain's memory reservation. Returns a
14 * -ve errcode on failure, or the # extents successfully allocated or freed. 16 * -ve errcode on failure, or the # extents successfully allocated or freed.
@@ -53,6 +55,48 @@ struct xen_memory_reservation {
53DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation); 55DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
54 56
55/* 57/*
58 * An atomic exchange of memory pages. If return code is zero then
59 * @out.extent_list provides GMFNs of the newly-allocated memory.
60 * Returns zero on complete success, otherwise a negative error code.
61 * On complete success then always @nr_exchanged == @in.nr_extents.
62 * On partial success @nr_exchanged indicates how much work was done.
63 */
64#define XENMEM_exchange 11
65struct xen_memory_exchange {
66 /*
67 * [IN] Details of memory extents to be exchanged (GMFN bases).
68 * Note that @in.address_bits is ignored and unused.
69 */
70 struct xen_memory_reservation in;
71
72 /*
73 * [IN/OUT] Details of new memory extents.
74 * We require that:
75 * 1. @in.domid == @out.domid
76 * 2. @in.nr_extents << @in.extent_order ==
77 * @out.nr_extents << @out.extent_order
78 * 3. @in.extent_start and @out.extent_start lists must not overlap
79 * 4. @out.extent_start lists GPFN bases to be populated
80 * 5. @out.extent_start is overwritten with allocated GMFN bases
81 */
82 struct xen_memory_reservation out;
83
84 /*
85 * [OUT] Number of input extents that were successfully exchanged:
86 * 1. The first @nr_exchanged input extents were successfully
87 * deallocated.
88 * 2. The corresponding first entries in the output extent list correctly
89 * indicate the GMFNs that were successfully exchanged.
90 * 3. All other input and output extents are untouched.
91 * 4. If not all input exents are exchanged then the return code of this
92 * command will be non-zero.
93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
94 */
95 unsigned long nr_exchanged;
96};
97
98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
99/*
56 * Returns the maximum machine frame number of mapped RAM in this system. 100 * Returns the maximum machine frame number of mapped RAM in this system.
57 * This command always succeeds (it never returns an error code). 101 * This command always succeeds (it never returns an error code).
58 * arg == NULL. 102 * arg == NULL.
@@ -142,4 +186,10 @@ struct xen_translate_gpfn_list {
142}; 186};
143DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); 187DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
144 188
189
190/*
191 * Prevent the balloon driver from changing the memory reservation
192 * during a driver critical region.
193 */
194extern spinlock_t xen_reservation_lock;
145#endif /* __XEN_PUBLIC_MEMORY_H__ */ 195#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
new file mode 100644
index 000000000000..2ea2fdc79c16
--- /dev/null
+++ b/include/xen/swiotlb-xen.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_SWIOTLB_XEN_H
2#define __LINUX_SWIOTLB_XEN_H
3
4#include <linux/swiotlb.h>
5
6extern void xen_swiotlb_init(int verbose);
7
8extern void
9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
10 dma_addr_t *dma_handle, gfp_t flags);
11
12extern void
13xen_swiotlb_free_coherent(struct device *hwdev, size_t size,
14 void *vaddr, dma_addr_t dma_handle);
15
16extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
17 unsigned long offset, size_t size,
18 enum dma_data_direction dir,
19 struct dma_attrs *attrs);
20
21extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
22 size_t size, enum dma_data_direction dir,
23 struct dma_attrs *attrs);
24/*
25extern int
26xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
27 enum dma_data_direction dir);
28
29extern void
30xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
31 enum dma_data_direction dir);
32*/
33extern int
34xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
35 int nelems, enum dma_data_direction dir,
36 struct dma_attrs *attrs);
37
38extern void
39xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
40 int nelems, enum dma_data_direction dir,
41 struct dma_attrs *attrs);
42
43extern void
44xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
45 size_t size, enum dma_data_direction dir);
46
47extern void
48xen_swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
49 int nelems, enum dma_data_direction dir);
50
51extern void
52xen_swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
53 size_t size, enum dma_data_direction dir);
54
55extern void
56xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
57 int nelems, enum dma_data_direction dir);
58
59extern int
60xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
61
62extern int
63xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
64
65#endif /* __LINUX_SWIOTLB_XEN_H */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 46bc81ef74c6..351f4051f6d8 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -17,4 +17,10 @@ void xen_arch_resume(void);
17 17
18int xen_setup_shutdown_event(void); 18int xen_setup_shutdown_event(void);
19 19
20extern unsigned long *xen_contiguous_bitmap;
21int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
22 unsigned int address_bits);
23
24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
25
20#endif /* INCLUDE_XEN_OPS_H */ 26#endif /* INCLUDE_XEN_OPS_H */