aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/xen/mm.c1
-rw-r--r--drivers/xen/swiotlb-xen.c12
-rw-r--r--include/xen/swiotlb-xen.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
index d56b8c6e4fbb..0d69b874d249 100644
--- a/arch/arm/xen/mm.c
+++ b/arch/arm/xen/mm.c
@@ -51,6 +51,7 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
51 .map_page = xen_swiotlb_map_page, 51 .map_page = xen_swiotlb_map_page,
52 .unmap_page = xen_swiotlb_unmap_page, 52 .unmap_page = xen_swiotlb_unmap_page,
53 .dma_supported = xen_swiotlb_dma_supported, 53 .dma_supported = xen_swiotlb_dma_supported,
54 .set_dma_mask = xen_swiotlb_set_dma_mask,
54}; 55};
55 56
56int __init xen_mm_init(void) 57int __init xen_mm_init(void)
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index f0fc1a4f565a..d8ef0bf577d2 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -608,3 +608,15 @@ xen_swiotlb_dma_supported(struct device *hwdev, u64 mask)
608 return xen_virt_to_bus(xen_io_tlb_end - 1) <= mask; 608 return xen_virt_to_bus(xen_io_tlb_end - 1) <= mask;
609} 609}
610EXPORT_SYMBOL_GPL(xen_swiotlb_dma_supported); 610EXPORT_SYMBOL_GPL(xen_swiotlb_dma_supported);
611
612int
613xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask)
614{
615 if (!dev->dma_mask || !xen_swiotlb_dma_supported(dev, dma_mask))
616 return -EIO;
617
618 *dev->dma_mask = dma_mask;
619
620 return 0;
621}
622EXPORT_SYMBOL_GPL(xen_swiotlb_set_dma_mask);
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index de8bcc641c49..7b644650d968 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -55,4 +55,6 @@ xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
55extern int 55extern int
56xen_swiotlb_dma_supported(struct device *hwdev, u64 mask); 56xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
57 57
58extern int
59xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask);
58#endif /* __LINUX_SWIOTLB_XEN_H */ 60#endif /* __LINUX_SWIOTLB_XEN_H */