forked from wandboard-org/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'stefano/swiotlb-xen-9.1' into stable/fo…
…r-linus-3.13 * stefano/swiotlb-xen-9.1: swiotlb-xen: fix error code returned by xen_swiotlb_map_sg_attrs swiotlb-xen: static inline xen_phys_to_bus, xen_bus_to_phys, xen_virt_to_bus and range_straddles_page_boundary grant-table: call set_phys_to_machine after mapping grant refs arm,arm64: do not always merge biovec if we are running on Xen swiotlb: print a warning when the swiotlb is full swiotlb-xen: use xen_dma_map/unmap_page, xen_dma_sync_single_for_cpu/device xen: introduce xen_dma_map/unmap_page and xen_dma_sync_single_for_cpu/device swiotlb-xen: use xen_alloc/free_coherent_pages xen: introduce xen_alloc/free_coherent_pages arm64/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain arm/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain swiotlb-xen: introduce xen_swiotlb_set_dma_mask xen/arm,arm64: enable SWIOTLB_XEN xen: make xen_create_contiguous_region return the dma address xen/x86: allow __set_phys_to_machine for autotranslate guests arm/xen,arm64/xen: introduce p2m arm64: define DMA_ERROR_CODE arm: make SWIOTLB available Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> Conflicts: arch/arm/include/asm/dma-mapping.h drivers/xen/swiotlb-xen.c [Conflicts arose b/c "arm: make SWIOTLB available" v8 was in Stefano's branch, while I had v9 + Ack from Russel. I also fixed up white-space issues]
- Loading branch information
Showing
24 changed files
with
661 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef _ASM_ARM_XEN_PAGE_COHERENT_H | ||
#define _ASM_ARM_XEN_PAGE_COHERENT_H | ||
|
||
#include <asm/page.h> | ||
#include <linux/dma-attrs.h> | ||
#include <linux/dma-mapping.h> | ||
|
||
static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | ||
dma_addr_t *dma_handle, gfp_t flags, | ||
struct dma_attrs *attrs) | ||
{ | ||
return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs); | ||
} | ||
|
||
static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | ||
void *cpu_addr, dma_addr_t dma_handle, | ||
struct dma_attrs *attrs) | ||
{ | ||
__generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs); | ||
} | ||
|
||
static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | ||
unsigned long offset, size_t size, enum dma_data_direction dir, | ||
struct dma_attrs *attrs) | ||
{ | ||
__generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); | ||
} | ||
|
||
static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
size_t size, enum dma_data_direction dir, | ||
struct dma_attrs *attrs) | ||
{ | ||
if (__generic_dma_ops(hwdev)->unmap_page) | ||
__generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); | ||
} | ||
|
||
static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
{ | ||
if (__generic_dma_ops(hwdev)->sync_single_for_cpu) | ||
__generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); | ||
} | ||
|
||
static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
{ | ||
if (__generic_dma_ops(hwdev)->sync_single_for_device) | ||
__generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); | ||
} | ||
#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
obj-y := enlighten.o hypercall.o grant-table.o | ||
obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include <linux/bootmem.h> | ||
#include <linux/gfp.h> | ||
#include <linux/export.h> | ||
#include <linux/slab.h> | ||
#include <linux/types.h> | ||
#include <linux/dma-mapping.h> | ||
#include <linux/vmalloc.h> | ||
#include <linux/swiotlb.h> | ||
|
||
#include <xen/xen.h> | ||
#include <xen/interface/memory.h> | ||
#include <xen/swiotlb-xen.h> | ||
|
||
#include <asm/cacheflush.h> | ||
#include <asm/xen/page.h> | ||
#include <asm/xen/hypercall.h> | ||
#include <asm/xen/interface.h> | ||
|
||
int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, | ||
unsigned int address_bits, | ||
dma_addr_t *dma_handle) | ||
{ | ||
if (!xen_initial_domain()) | ||
return -EINVAL; | ||
|
||
/* we assume that dom0 is mapped 1:1 for now */ | ||
*dma_handle = pstart; | ||
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(xen_create_contiguous_region); | ||
|
||
void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) | ||
{ | ||
return; | ||
} | ||
EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region); | ||
|
||
struct dma_map_ops *xen_dma_ops; | ||
EXPORT_SYMBOL_GPL(xen_dma_ops); | ||
|
||
static struct dma_map_ops xen_swiotlb_dma_ops = { | ||
.mapping_error = xen_swiotlb_dma_mapping_error, | ||
.alloc = xen_swiotlb_alloc_coherent, | ||
.free = xen_swiotlb_free_coherent, | ||
.sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu, | ||
.sync_single_for_device = xen_swiotlb_sync_single_for_device, | ||
.sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu, | ||
.sync_sg_for_device = xen_swiotlb_sync_sg_for_device, | ||
.map_sg = xen_swiotlb_map_sg_attrs, | ||
.unmap_sg = xen_swiotlb_unmap_sg_attrs, | ||
.map_page = xen_swiotlb_map_page, | ||
.unmap_page = xen_swiotlb_unmap_page, | ||
.dma_supported = xen_swiotlb_dma_supported, | ||
.set_dma_mask = xen_swiotlb_set_dma_mask, | ||
}; | ||
|
||
int __init xen_mm_init(void) | ||
{ | ||
if (!xen_initial_domain()) | ||
return 0; | ||
xen_swiotlb_init(1, false); | ||
xen_dma_ops = &xen_swiotlb_dma_ops; | ||
return 0; | ||
} | ||
arch_initcall(xen_mm_init); |
Oops, something went wrong.