aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-06-28 09:01:43 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-29 08:34:24 -0400
commit0ab36de274ab094c3992b50c9c48c5c89072ec94 (patch)
tree62f7e197958fca2d846bb8821d22fc97e9675231 /drivers
parent61df744314079e8cb8cdec75f517cf0e704e41ef (diff)
intel-iommu: Use domain_pfn_mapping() in __intel_map_single()
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intel-iommu.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 7540ef91d5f7..dccd0a7b7a5f 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2477,14 +2477,12 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
2477 return 0; 2477 return 0;
2478 2478
2479 iommu = domain_get_iommu(domain); 2479 iommu = domain_get_iommu(domain);
2480 size = aligned_size((u64)paddr, size); 2480 size = aligned_size(paddr, size) >> VTD_PAGE_SHIFT;
2481 2481
2482 iova = __intel_alloc_iova(hwdev, domain, size, pdev->dma_mask); 2482 iova = __intel_alloc_iova(hwdev, domain, size << VTD_PAGE_SHIFT, pdev->dma_mask);
2483 if (!iova) 2483 if (!iova)
2484 goto error; 2484 goto error;
2485 2485
2486 start_paddr = (phys_addr_t)iova->pfn_lo << PAGE_SHIFT;
2487
2488 /* 2486 /*
2489 * Check if DMAR supports zero-length reads on write only 2487 * Check if DMAR supports zero-length reads on write only
2490 * mappings.. 2488 * mappings..
@@ -2500,20 +2498,20 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
2500 * might have two guest_addr mapping to the same host paddr, but this 2498 * might have two guest_addr mapping to the same host paddr, but this
2501 * is not a big problem 2499 * is not a big problem
2502 */ 2500 */
2503 ret = domain_page_mapping(domain, start_paddr, 2501 ret = domain_pfn_mapping(domain, mm_to_dma_pfn(iova->pfn_lo),
2504 ((u64)paddr) & PHYSICAL_PAGE_MASK, 2502 paddr >> VTD_PAGE_SHIFT, size, prot);
2505 size, prot);
2506 if (ret) 2503 if (ret)
2507 goto error; 2504 goto error;
2508 2505
2506 start_paddr = (phys_addr_t)iova->pfn_lo << PAGE_SHIFT;
2507
2509 /* it's a non-present to present mapping. Only flush if caching mode */ 2508 /* it's a non-present to present mapping. Only flush if caching mode */
2510 if (cap_caching_mode(iommu->cap)) 2509 if (cap_caching_mode(iommu->cap))
2511 iommu_flush_iotlb_psi(iommu, 0, start_paddr, 2510 iommu_flush_iotlb_psi(iommu, 0, start_paddr, size);
2512 size >> VTD_PAGE_SHIFT);
2513 else 2511 else
2514 iommu_flush_write_buffer(iommu); 2512 iommu_flush_write_buffer(iommu);
2515 2513
2516 return start_paddr + ((u64)paddr & (~PAGE_MASK)); 2514 return start_paddr + (paddr & (~PAGE_MASK));
2517 2515
2518error: 2516error:
2519 if (iova) 2517 if (iova)