Loading arch/x86/kernel/amd_iommu.c +15 −12 Original line number Diff line number Diff line Loading @@ -788,11 +788,11 @@ static u64 *fetch_pte(struct protection_domain *domain, * aperture in case of dma_ops domain allocation or address allocation * failure. */ static int alloc_new_range(struct amd_iommu *iommu, struct dma_ops_domain *dma_dom, static int alloc_new_range(struct dma_ops_domain *dma_dom, bool populate, gfp_t gfp) { int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; struct amd_iommu *iommu; int i; #ifdef CONFIG_IOMMU_STRESS Loading Loading @@ -832,15 +832,18 @@ static int alloc_new_range(struct amd_iommu *iommu, dma_dom->aperture_size += APERTURE_RANGE_SIZE; /* Intialize the exclusion range if necessary */ for_each_iommu(iommu) { if (iommu->exclusion_start && iommu->exclusion_start >= dma_dom->aperture[index]->offset && iommu->exclusion_start < dma_dom->aperture_size) { unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT; iommu->exclusion_start >= dma_dom->aperture[index]->offset && iommu->exclusion_start < dma_dom->aperture_size) { unsigned long startpage; int pages = iommu_num_pages(iommu->exclusion_start, iommu->exclusion_length, PAGE_SIZE); startpage = iommu->exclusion_start >> PAGE_SHIFT; dma_ops_reserve_addresses(dma_dom, startpage, pages); } } /* * Check for areas already mapped as present in the new aperture Loading Loading @@ -1143,7 +1146,7 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu) add_domain_to_list(&dma_dom->domain); if (alloc_new_range(iommu, dma_dom, true, GFP_KERNEL)) if (alloc_new_range(dma_dom, true, GFP_KERNEL)) goto free_dma_dom; /* Loading Loading @@ -1686,7 +1689,7 @@ static dma_addr_t __map_single(struct device *dev, */ dma_dom->next_address = dma_dom->aperture_size; if (alloc_new_range(iommu, dma_dom, false, GFP_ATOMIC)) if (alloc_new_range(dma_dom, false, GFP_ATOMIC)) goto out; /* Loading Loading
arch/x86/kernel/amd_iommu.c +15 −12 Original line number Diff line number Diff line Loading @@ -788,11 +788,11 @@ static u64 *fetch_pte(struct protection_domain *domain, * aperture in case of dma_ops domain allocation or address allocation * failure. */ static int alloc_new_range(struct amd_iommu *iommu, struct dma_ops_domain *dma_dom, static int alloc_new_range(struct dma_ops_domain *dma_dom, bool populate, gfp_t gfp) { int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; struct amd_iommu *iommu; int i; #ifdef CONFIG_IOMMU_STRESS Loading Loading @@ -832,15 +832,18 @@ static int alloc_new_range(struct amd_iommu *iommu, dma_dom->aperture_size += APERTURE_RANGE_SIZE; /* Intialize the exclusion range if necessary */ for_each_iommu(iommu) { if (iommu->exclusion_start && iommu->exclusion_start >= dma_dom->aperture[index]->offset && iommu->exclusion_start < dma_dom->aperture_size) { unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT; iommu->exclusion_start >= dma_dom->aperture[index]->offset && iommu->exclusion_start < dma_dom->aperture_size) { unsigned long startpage; int pages = iommu_num_pages(iommu->exclusion_start, iommu->exclusion_length, PAGE_SIZE); startpage = iommu->exclusion_start >> PAGE_SHIFT; dma_ops_reserve_addresses(dma_dom, startpage, pages); } } /* * Check for areas already mapped as present in the new aperture Loading Loading @@ -1143,7 +1146,7 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu) add_domain_to_list(&dma_dom->domain); if (alloc_new_range(iommu, dma_dom, true, GFP_KERNEL)) if (alloc_new_range(dma_dom, true, GFP_KERNEL)) goto free_dma_dom; /* Loading Loading @@ -1686,7 +1689,7 @@ static dma_addr_t __map_single(struct device *dev, */ dma_dom->next_address = dma_dom->aperture_size; if (alloc_new_range(iommu, dma_dom, false, GFP_ATOMIC)) if (alloc_new_range(dma_dom, false, GFP_ATOMIC)) goto out; /* Loading