Skip to content

Commit

Permalink
swiotlb-xen: introduce xen_swiotlb_set_dma_mask
Browse files Browse the repository at this point in the history
Implement xen_swiotlb_set_dma_mask, use it for set_dma_mask on arm.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
  • Loading branch information
Stefano Stabellini committed Oct 9, 2013
1 parent 83862cc commit eb1ddc0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/xen/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
.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)
Expand Down
12 changes: 12 additions & 0 deletions drivers/xen/swiotlb-xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,3 +608,15 @@ xen_swiotlb_dma_supported(struct device *hwdev, u64 mask)
return xen_virt_to_bus(xen_io_tlb_end - 1) <= mask;
}
EXPORT_SYMBOL_GPL(xen_swiotlb_dma_supported);

int
xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask)
{
if (!dev->dma_mask || !xen_swiotlb_dma_supported(dev, dma_mask))
return -EIO;

*dev->dma_mask = dma_mask;

return 0;
}
EXPORT_SYMBOL_GPL(xen_swiotlb_set_dma_mask);
2 changes: 2 additions & 0 deletions include/xen/swiotlb-xen.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
extern int
xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);

extern int
xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask);
#endif /* __LINUX_SWIOTLB_XEN_H */

0 comments on commit eb1ddc0

Please sign in to comment.