/* Creates 1-n-1 mapping with given @sgt and returns @da. All @sgt element must be io page size aligned.  */
u32 iommu_vmap(struct iommu *obj, u32 da, const struct sg_table *sgt, u32 flags)
/* Creates 1-n-1 mapping with given @sgt and returns @da. All @sgt element must be io page size aligned.  */
u32 iommu_vmap(struct iommu *obj, u32 da, const struct sg_table *sgt, u32 flags)
{
	size_t bytes;
	void *va = NULL;
	if (!obj || !obj->dev || !sgt)
		return -EINVAL;
	bytes = sgtable_len(sgt);
	if (!bytes)
		return -EINVAL;
	bytes = PAGE_ALIGN(bytes);
	if (flags & IOVMF_MMIO) {
		va = vmap_sg(sgt);
		if (IS_ERR(va))
			return PTR_ERR(va);
	}
	flags &= IOVMF_HW_MASK;
	flags |= IOVMF_DISCONT;
	flags |= IOVMF_MMIO;
	flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
	da = __iommu_vmap(obj, da, sgt, va, bytes, flags);
	if (IS_ERR_VALUE(da))
		vunmap_sg(va);
	return da;
}