This API can set a flag whether a device requires iova contiguous strictly. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> --- include/linux/device.h | 1 + include/linux/dma-mapping.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index e85264f..a33d611 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -752,6 +752,7 @@ struct device_dma_parameters { */ unsigned int max_segment_size; unsigned long segment_boundary_mask; + bool iova_contiguous; }; /** diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 6309a72..cdb4e75 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -729,6 +729,22 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) return -EIO; } +static inline int dma_get_iova_contiguous(struct device *dev) +{ + if (dev->dma_parms) + return dev->dma_parms->iova_contiguous; + return false; +} + +static inline int dma_set_iova_contiguous(struct device *dev, bool contiguous) +{ + if (dev->dma_parms) { + dev->dma_parms->iova_contiguous = contiguous; + return 0; + } + return -EIO; +} + #ifndef dma_max_pfn static inline unsigned long dma_max_pfn(struct device *dev) { -- 2.7.4