diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-04 09:08:36 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-04 09:12:01 -0400 |
commit | 736768325efcbee7b0861d62670d01a54c2d158b (patch) | |
tree | c0f235e88302ebaac1184aa3097c7f9c7cc2f1c8 /drivers/pci/intel-iommu.c | |
parent | 62edf5dc4a524e4cb525e6020b955a1ad593d9ba (diff) |
intel-iommu: No mapping for non-PCI devices
This should fix kernel.org bug #11821, where the dcdbas driver makes up
a platform device and then uses dma_alloc_coherent() on it, in an
attempt to get memory < 4GiB.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r-- | drivers/pci/intel-iommu.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 5ee8305257ea..fa052dd89913 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -2457,10 +2457,15 @@ static int iommu_should_identity_map(struct pci_dev *pdev) | |||
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ | 2459 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ |
2460 | static int iommu_no_mapping(struct pci_dev *pdev) | 2460 | static int iommu_no_mapping(struct device *dev) |
2461 | { | 2461 | { |
2462 | struct pci_dev *pdev; | ||
2462 | int found; | 2463 | int found; |
2463 | 2464 | ||
2465 | if (unlikely(dev->bus != &pci_bus_type)) | ||
2466 | return 1; | ||
2467 | |||
2468 | pdev = to_pci_dev(dev); | ||
2464 | if (iommu_dummy(pdev)) | 2469 | if (iommu_dummy(pdev)) |
2465 | return 1; | 2470 | return 1; |
2466 | 2471 | ||
@@ -2516,7 +2521,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2516 | 2521 | ||
2517 | BUG_ON(dir == DMA_NONE); | 2522 | BUG_ON(dir == DMA_NONE); |
2518 | 2523 | ||
2519 | if (iommu_no_mapping(pdev)) | 2524 | if (iommu_no_mapping(hwdev)) |
2520 | return paddr; | 2525 | return paddr; |
2521 | 2526 | ||
2522 | domain = get_valid_domain_for_dev(pdev); | 2527 | domain = get_valid_domain_for_dev(pdev); |
@@ -2656,7 +2661,7 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, | |||
2656 | struct iova *iova; | 2661 | struct iova *iova; |
2657 | struct intel_iommu *iommu; | 2662 | struct intel_iommu *iommu; |
2658 | 2663 | ||
2659 | if (iommu_no_mapping(pdev)) | 2664 | if (iommu_no_mapping(dev)) |
2660 | return; | 2665 | return; |
2661 | 2666 | ||
2662 | domain = find_domain(pdev); | 2667 | domain = find_domain(pdev); |
@@ -2747,7 +2752,7 @@ static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, | |||
2747 | struct iova *iova; | 2752 | struct iova *iova; |
2748 | struct intel_iommu *iommu; | 2753 | struct intel_iommu *iommu; |
2749 | 2754 | ||
2750 | if (iommu_no_mapping(pdev)) | 2755 | if (iommu_no_mapping(hwdev)) |
2751 | return; | 2756 | return; |
2752 | 2757 | ||
2753 | domain = find_domain(pdev); | 2758 | domain = find_domain(pdev); |
@@ -2806,7 +2811,7 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne | |||
2806 | struct intel_iommu *iommu; | 2811 | struct intel_iommu *iommu; |
2807 | 2812 | ||
2808 | BUG_ON(dir == DMA_NONE); | 2813 | BUG_ON(dir == DMA_NONE); |
2809 | if (iommu_no_mapping(pdev)) | 2814 | if (iommu_no_mapping(hwdev)) |
2810 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); | 2815 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); |
2811 | 2816 | ||
2812 | domain = get_valid_domain_for_dev(pdev); | 2817 | domain = get_valid_domain_for_dev(pdev); |