On 06/05/2019 02:11 PM, Yoshihiro Shimoda wrote:

> This patch adds a new capable IOMMU_CAP_MERGING to check whether
> the IOVA would be contiguous strictly if a device requires and
> the IOMMU driver has the capable.

   s/has/is/? Or capable what?

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com>
> ---
>  drivers/iommu/dma-iommu.c | 26 ++++++++++++++++++++++++--
>  include/linux/iommu.h     |  1 +
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 034caae..ecf1a04 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
[...]
> @@ -867,6 +872,13 @@ static int iommu_dma_map_sg(struct device *dev, struct 
> scatterlist *sg,
>               sg_dma_len(s) = s_length;
>               s->offset -= s_iova_off;
>               s_length = iova_align(iovad, s_length + s_iova_off);
> +             /*
> +              * Check whether the IOVA would be contiguous strictly if
> +              * a device requires and the IOMMU driver has the capable.

   Same question here...

> +              */
> +             if (iova_contiguous && i > 0 &&
> +                 (s_iova_off || s->length != s_length))
> +                     return 0;
>               s->length = s_length;
>  
>               /*
> @@ -902,8 +914,18 @@ static int iommu_dma_map_sg(struct device *dev, struct 
> scatterlist *sg,
>       if (iommu_map_sg(domain, iova, sg, nents, prot) < iova_len)
>               goto out_free_iova;
>  
> -     return __finalise_sg(dev, sg, nents, iova);
> +     ret = __finalise_sg(dev, sg, nents, iova);
> +     /*
> +      * Check whether the sg entry is single if a device requires and
> +      * the IOMMU driver has the capable.

   You  meant capability perhaps?

[...]

MBR, Sergei

Reply via email to