diff mbox

[v2,2/2] swiotlb-xen: implement xen_swiotlb_get_sgtable callback

Message ID 1484565592-24897-3-git-send-email-andrii.anisov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrii Anisov Jan. 16, 2017, 11:19 a.m. UTC
From: Andrii Anisov <andrii_anisov@epam.com>

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
---
 arch/arm/xen/mm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox

Patch

diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
index ff812a2..dc83a35 100644
--- a/arch/arm/xen/mm.c
+++ b/arch/arm/xen/mm.c
@@ -176,6 +176,16 @@  static int xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
+static int xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
+				 void *cpu_addr, dma_addr_t handle, size_t size,
+				 unsigned long attrs)
+{
+	if (__generic_dma_ops(dev)->get_sgtable)
+		return __generic_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr, handle,
+								 size, attrs);
+	return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size);
+}
+
 int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
 				 unsigned int address_bits,
 				 dma_addr_t *dma_handle)
@@ -212,6 +222,7 @@  static struct dma_map_ops xen_swiotlb_dma_ops = {
 	.dma_supported = xen_swiotlb_dma_supported,
 	.set_dma_mask = xen_swiotlb_set_dma_mask,
 	.mmap = xen_swiotlb_dma_mmap,
+	.get_sgtable = xen_swiotlb_get_sgtable,
 };
 
 int __init xen_mm_init(void)