Commit c8259b67 authored by Zheng Chongzhen's avatar Zheng Chongzhen Committed by guzitao
Browse files

sw64: iommu: fix dma_supported of dma_ops

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBDJNZ



--------------------------------

Since commit <6b3a638de236> ("sw64: correct the definition of
MAX_DMA_ADDRESS"), the implementation of dma_supported is incorrect,
and now we modify it to the public dma-direct implementation.

Signed-off-by: default avatarZheng Chongzhen <zhengchongzhen@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 88f9e2f4
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/log2.h>
#include <linux/dma-mapping.h>
#include <linux/dma-map-ops.h>
#include <linux/dma-direct.h>
#include <linux/dma-iommu.h>
#include <linux/iommu.h>
#include <linux/iommu-helper.h>
@@ -1298,14 +1299,6 @@ sunway_unmap_sg(struct device *dev, struct scatterlist *sgl,
	}
}

static int sunway_supported(struct device *dev, u64 mask)
{
	if (MAX_DMA_ADDRESS - PAGE_OFFSET - 1 <= mask)
		return 1;

	return 0;
}

static const struct dma_map_ops sunway_dma_ops = {
	.alloc = sunway_alloc_coherent,
	.free = sunway_free_coherent,
@@ -1313,7 +1306,7 @@ static const struct dma_map_ops sunway_dma_ops = {
	.unmap_sg = sunway_unmap_sg,
	.map_page = sunway_map_page,
	.unmap_page = sunway_unmap_page,
	.dma_supported = sunway_supported,
	.dma_supported = dma_direct_supported,
};

/**********************************************************************