linux-4.4.1/iommu_dma_init_domain()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#y6a52341]
#backlinks
*説明 [#i3c4a9fe]
-パス: [[linux-4.4.1/drivers/iommu/dma-iommu.c]]
-FIXME: これは何?
--説明
**引数 [#p5014b5f]
-struct iommu_domain *domain
--
--[[linux-4.4.1/iommu_domain]]
-dma_addr_t base
--
--[[linux-4.4.1/dma_addr_t]]
-u64 size
--
**返り値 [#s5657385]
-int
--
**参考 [#q86b8eed]
*実装 [#e196c8a4]
/**
* iommu_dma_init_domain - Initialise a DMA mapping domain
* @domain: IOMMU domain previously prepared by iommu_ge...
* @base: IOVA at which the mappable address space starts
* @size: Size of IOVA space
*
* @base and @size should be exact multiples of IOMMU pa...
* avoid rounding surprises. If necessary, we reserve th...
* to ensure it is an invalid IOVA. It is safe to reinit...
* any change which could make prior IOVAs invalid will ...
*/
int iommu_dma_init_domain(struct iommu_domain *domain, d...
{
struct iova_domain *iovad = domain->iova_cookie;
unsigned long order, base_pfn, end_pfn;
-
--[[linux-4.4.1/iova_domain]]
if (!iovad)
return -ENODEV;
/* Use the smallest supported page size for IOVA granul...
order = __ffs(domain->ops->pgsize_bitmap);
base_pfn = max_t(unsigned long, 1, base >> order);
end_pfn = (base + size - 1) >> order;
-
--[[linux-4.4.1/__ffs()]]
--[[linux-4.4.1/max_t()]]
/* Check the domain allows at least some access to the ...
if (domain->geometry.force_aperture) {
if (base > domain->geometry.aperture_end ||
base + size <= domain->geometry.aperture_start) {
pr_warn("specified DMA range outside IOMMU capability...
return -EFAULT;
}
/* ...then finally give it a kicking to make sure it f...
base_pfn = max_t(unsigned long, base_pfn,
domain->geometry.aperture_start >> order);
end_pfn = min_t(unsigned long, end_pfn,
domain->geometry.aperture_end >> order);
}
-
--[[linux-4.4.1/pr_warn()]]
--[[linux-4.4.1/min_t()]]
/* All we can safely do with an existing domain is enla...
if (iovad->start_pfn) {
if (1UL << order != iovad->granule ||
base_pfn != iovad->start_pfn ||
end_pfn < iovad->dma_32bit_pfn) {
pr_warn("Incompatible range for DMA domain\n");
return -EFAULT;
}
iovad->dma_32bit_pfn = end_pfn;
} else {
init_iova_domain(iovad, 1UL << order, base_pfn, end_pf...
}
-
--[[linux-4.4.1/init_iova_domain()]]
return 0;
}
EXPORT_SYMBOL(iommu_dma_init_domain);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]
*コメント [#e2b6d751]
終了行:
*参照元 [#y6a52341]
#backlinks
*説明 [#i3c4a9fe]
-パス: [[linux-4.4.1/drivers/iommu/dma-iommu.c]]
-FIXME: これは何?
--説明
**引数 [#p5014b5f]
-struct iommu_domain *domain
--
--[[linux-4.4.1/iommu_domain]]
-dma_addr_t base
--
--[[linux-4.4.1/dma_addr_t]]
-u64 size
--
**返り値 [#s5657385]
-int
--
**参考 [#q86b8eed]
*実装 [#e196c8a4]
/**
* iommu_dma_init_domain - Initialise a DMA mapping domain
* @domain: IOMMU domain previously prepared by iommu_ge...
* @base: IOVA at which the mappable address space starts
* @size: Size of IOVA space
*
* @base and @size should be exact multiples of IOMMU pa...
* avoid rounding surprises. If necessary, we reserve th...
* to ensure it is an invalid IOVA. It is safe to reinit...
* any change which could make prior IOVAs invalid will ...
*/
int iommu_dma_init_domain(struct iommu_domain *domain, d...
{
struct iova_domain *iovad = domain->iova_cookie;
unsigned long order, base_pfn, end_pfn;
-
--[[linux-4.4.1/iova_domain]]
if (!iovad)
return -ENODEV;
/* Use the smallest supported page size for IOVA granul...
order = __ffs(domain->ops->pgsize_bitmap);
base_pfn = max_t(unsigned long, 1, base >> order);
end_pfn = (base + size - 1) >> order;
-
--[[linux-4.4.1/__ffs()]]
--[[linux-4.4.1/max_t()]]
/* Check the domain allows at least some access to the ...
if (domain->geometry.force_aperture) {
if (base > domain->geometry.aperture_end ||
base + size <= domain->geometry.aperture_start) {
pr_warn("specified DMA range outside IOMMU capability...
return -EFAULT;
}
/* ...then finally give it a kicking to make sure it f...
base_pfn = max_t(unsigned long, base_pfn,
domain->geometry.aperture_start >> order);
end_pfn = min_t(unsigned long, end_pfn,
domain->geometry.aperture_end >> order);
}
-
--[[linux-4.4.1/pr_warn()]]
--[[linux-4.4.1/min_t()]]
/* All we can safely do with an existing domain is enla...
if (iovad->start_pfn) {
if (1UL << order != iovad->granule ||
base_pfn != iovad->start_pfn ||
end_pfn < iovad->dma_32bit_pfn) {
pr_warn("Incompatible range for DMA domain\n");
return -EFAULT;
}
iovad->dma_32bit_pfn = end_pfn;
} else {
init_iova_domain(iovad, 1UL << order, base_pfn, end_pf...
}
-
--[[linux-4.4.1/init_iova_domain()]]
return 0;
}
EXPORT_SYMBOL(iommu_dma_init_domain);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]
*コメント [#e2b6d751]
ページ名: