aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-07-14 03:46:10 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-07-14 14:45:29 -0400
commit5dfe8660a3d7f1ee1265c3536433ee53da3f98a3 (patch)
treec58232b88741ba1d8cce417b62f3f658369ad9c2 /drivers/pci/intel-iommu.c
parentfc769a8e70a3348d5de49e5f69f6aff810157360 (diff)
bootmem: Replace work_with_active_regions() with for_each_mem_pfn_range()
Callback based iteration is cumbersome and much less useful than for_each_*() iterator. This patch implements for_each_mem_pfn_range() which replaces work_with_active_regions(). All the current users of work_with_active_regions() are converted. This simplifies walking over early_node_map and will allow converting internal logics in page_alloc to use iterator instead of walking early_node_map directly, which in turn will enable moving node information to memblock. powerpc change is only compile tested. Signed-off-by: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/20110714074610.GD3455@htj.dyndns.org Cc: Yinghai Lu <yinghai@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index f02c34d26d1b..8ec352077e1a 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2178,18 +2178,6 @@ static inline void iommu_prepare_isa(void)
2178 2178
2179static int md_domain_init(struct dmar_domain *domain, int guest_width); 2179static int md_domain_init(struct dmar_domain *domain, int guest_width);
2180 2180
2181static int __init si_domain_work_fn(unsigned long start_pfn,
2182 unsigned long end_pfn, void *datax)
2183{
2184 int *ret = datax;
2185
2186 *ret = iommu_domain_identity_map(si_domain,
2187 (uint64_t)start_pfn << PAGE_SHIFT,
2188 (uint64_t)end_pfn << PAGE_SHIFT);
2189 return *ret;
2190
2191}
2192
2193static int __init si_domain_init(int hw) 2181static int __init si_domain_init(int hw)
2194{ 2182{
2195 struct dmar_drhd_unit *drhd; 2183 struct dmar_drhd_unit *drhd;
@@ -2221,9 +2209,15 @@ static int __init si_domain_init(int hw)
2221 return 0; 2209 return 0;
2222 2210
2223 for_each_online_node(nid) { 2211 for_each_online_node(nid) {
2224 work_with_active_regions(nid, si_domain_work_fn, &ret); 2212 unsigned long start_pfn, end_pfn;
2225 if (ret) 2213 int i;
2226 return ret; 2214
2215 for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) {
2216 ret = iommu_domain_identity_map(si_domain,
2217 PFN_PHYS(start_pfn), PFN_PHYS(end_pfn));
2218 if (ret)
2219 return ret;
2220 }
2227 } 2221 }
2228 2222
2229 return 0; 2223 return 0;