diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-04-01 08:58:50 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-04-02 07:31:08 -0400 |
commit | 5d7c94c3f4f20964b217d64ee44a9a08320c315a (patch) | |
tree | f8100a32e161166db6547d92819fbb64cc28e73a /drivers/iommu/amd_iommu.c | |
parent | 71b390e9bec5121d25c45326ff0b0b96a143f9a8 (diff) |
iommu/amd: Optimize alloc_new_range for new fetch_pte interface
Now that fetch_pte returns the page-size of the pte, the
call in this function can also be optimized a little bit.
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-rw-r--r-- | drivers/iommu/amd_iommu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index c9ee444d8209..f97441b6aaad 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -1591,7 +1591,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom, | |||
1591 | { | 1591 | { |
1592 | int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; | 1592 | int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; |
1593 | struct amd_iommu *iommu; | 1593 | struct amd_iommu *iommu; |
1594 | unsigned long i, old_size; | 1594 | unsigned long i, old_size, pte_pgsize; |
1595 | 1595 | ||
1596 | #ifdef CONFIG_IOMMU_STRESS | 1596 | #ifdef CONFIG_IOMMU_STRESS |
1597 | populate = false; | 1597 | populate = false; |
@@ -1664,13 +1664,13 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom, | |||
1664 | */ | 1664 | */ |
1665 | for (i = dma_dom->aperture[index]->offset; | 1665 | for (i = dma_dom->aperture[index]->offset; |
1666 | i < dma_dom->aperture_size; | 1666 | i < dma_dom->aperture_size; |
1667 | i += PAGE_SIZE) { | 1667 | i += pte_pgsize) { |
1668 | unsigned long pte_pgsize; | ||
1669 | u64 *pte = fetch_pte(&dma_dom->domain, i, &pte_pgsize); | 1668 | u64 *pte = fetch_pte(&dma_dom->domain, i, &pte_pgsize); |
1670 | if (!pte || !IOMMU_PTE_PRESENT(*pte)) | 1669 | if (!pte || !IOMMU_PTE_PRESENT(*pte)) |
1671 | continue; | 1670 | continue; |
1672 | 1671 | ||
1673 | dma_ops_reserve_addresses(dma_dom, i >> PAGE_SHIFT, 1); | 1672 | dma_ops_reserve_addresses(dma_dom, i >> PAGE_SHIFT, |
1673 | pte_pgsize >> 12); | ||
1674 | } | 1674 | } |
1675 | 1675 | ||
1676 | update_domain(&dma_dom->domain); | 1676 | update_domain(&dma_dom->domain); |