*参照元 [#cc849f98]
#backlinks

*説明 [#fc12557e]
-パス: 複数あり
--CONFIG_IOMMU_API 有効: [[linux-4.4.1/drivers/iommu/iommu.c]]
--CONFIG_IOMMU_API 無効: [[linux-4.4.1/include/linux/iommu.h]]


-FIXME: これは何?
--説明


**引数 [#m3ce1a8f]
-struct iommu_domain *domain
--
--[[linux-4.4.1/iommu_domain]]
-unsigned long iova
--
-size_t size
--


**返り値 [#c0c5f8d8]
-size_t
--


**参考 [#ob674011]

map

-[[linux-4.4.1/iommu_map()]]


*実装 [#vfa8a87c]

**CONFIG_IOMMU_API 有効: [[linux-4.4.1/drivers/iommu/iommu.c]] [#f823a065]

 size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
 {
 	size_t unmapped_page, unmapped = 0;
 	unsigned int min_pagesz;
 	unsigned long orig_iova = iova;
 
 	if (unlikely(domain->ops->unmap == NULL ||
 		     domain->ops->pgsize_bitmap == 0UL))
 		return -ENODEV;
 
 	if (unlikely(!(domain->type & __IOMMU_DOMAIN_PAGING)))
 		return -EINVAL;
 
-
--domain->ops は const struct iommu_ops * 型
--[[linux-4.4.1/iommu_ops]]
--[[linux-4.4.1/unlikely()]]

 	/* find out the minimum page size supported */
 	min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap);
 
-
--[[linux-4.4.1/__ffs()]]

 	/*
 	 * The virtual address, as well as the size of the mapping, must be
 	 * aligned (at least) to the size of the smallest page supported
 	 * by the hardware
 	 */
 	if (!IS_ALIGNED(iova | size, min_pagesz)) {
 		pr_err("unaligned: iova 0x%lx size 0x%zx min_pagesz 0x%x\n",
 		       iova, size, min_pagesz);
 		return -EINVAL;
 	}
 
 	pr_debug("unmap this: iova 0x%lx size 0x%zx\n", iova, size);
 
-
--[[linux-4.4.1/IS_ALIGNED()]]
--[[linux-4.4.1/pr_err()]]
--[[linux-4.4.1/pr_debug()]]

 	/*
 	 * Keep iterating until we either unmap 'size' bytes (or more)
 	 * or we hit an area that isn't mapped.
 	 */
 	while (unmapped < size) {
 		size_t pgsize = iommu_pgsize(domain, iova, size - unmapped);
 
 		unmapped_page = domain->ops->unmap(domain, iova, pgsize);
 		if (!unmapped_page)
 			break;
 
-
--domain->ops は const struct iommu_ops * 型
--[[linux-4.4.1/iommu_ops]]
--[[linux-4.4.1/iommu_pgsize()]]

 		pr_debug("unmapped: iova 0x%lx size 0x%zx\n",
 			 iova, unmapped_page);
 
 		iova += unmapped_page;
 		unmapped += unmapped_page;
 	}
 
 	trace_unmap(orig_iova, size, unmapped);
 	return unmapped;
-
--[[linux-4.4.1/trace_unmap()]]

 }
 EXPORT_SYMBOL_GPL(iommu_unmap);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]


**CONFIG_IOMMU_API 無効: [[linux-4.4.1/include/linux/iommu.h]] [#g1b92bd6]

 static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
 			      int gfp_order)
 {
 	return -ENODEV;
 }


*コメント [#a2d0d857]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS