From: Joerg Roedel Date: Tue, 11 May 2010 15:40:57 +0000 (+0200) Subject: Merge branch 'iommu/largepages' into amd-iommu/2.6.35 X-Git-Tag: v3.12-rc1~10331^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=795e74f7a69f9c08afa4fa7c86cc4f18a62bd630;p=kernel%2Fkernel-generic.git Merge branch 'iommu/largepages' into amd-iommu/2.6.35 Conflicts: arch/x86/kernel/amd_iommu.c --- 795e74f7a69f9c08afa4fa7c86cc4f18a62bd630 diff --cc arch/x86/kernel/amd_iommu.c index f854d89b,d8da998..fa5a1474 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c @@@ -2439,58 -2506,31 +2506,41 @@@ static int amd_iommu_attach_device(stru return ret; } - static int amd_iommu_map_range(struct iommu_domain *dom, - unsigned long iova, phys_addr_t paddr, - size_t size, int iommu_prot) + static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, + phys_addr_t paddr, int gfp_order, int iommu_prot) { + unsigned long page_size = 0x1000UL << gfp_order; struct protection_domain *domain = dom->priv; - unsigned long i, npages = iommu_num_pages(paddr, size, PAGE_SIZE); int prot = 0; + int ret; if (iommu_prot & IOMMU_READ) prot |= IOMMU_PROT_IR; if (iommu_prot & IOMMU_WRITE) prot |= IOMMU_PROT_IW; - iova &= PAGE_MASK; - paddr &= PAGE_MASK; - - return iommu_map_page(domain, iova, paddr, prot, page_size); + mutex_lock(&domain->api_lock); - - for (i = 0; i < npages; ++i) { - ret = iommu_map_page(domain, iova, paddr, prot, PM_MAP_4k); - if (ret) - return ret; - - iova += PAGE_SIZE; - paddr += PAGE_SIZE; - } - ++ ret = iommu_map_page(domain, iova, paddr, prot, page_size); + mutex_unlock(&domain->api_lock); + - return 0; ++ return ret; } - static void amd_iommu_unmap_range(struct iommu_domain *dom, - unsigned long iova, size_t size) + static int amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, + int gfp_order) { - struct protection_domain *domain = dom->priv; - unsigned long i, npages = iommu_num_pages(iova, size, PAGE_SIZE); + unsigned long page_size, unmap_size; - iova &= PAGE_MASK; + page_size = 0x1000UL << gfp_order; + + mutex_lock(&domain->api_lock); - - for (i = 0; i < npages; ++i) { - iommu_unmap_page(domain, iova, PM_MAP_4k); - iova += PAGE_SIZE; - } + unmap_size = iommu_unmap_page(domain, iova, page_size); ++ mutex_unlock(&domain->api_lock); + + iommu_flush_tlb_pde(domain); - mutex_unlock(&domain->api_lock); + return get_order(unmap_size); } static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,