diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 16:41:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 16:41:00 -0400 |
commit | 712b0006bf3a9ed0b14a56c3291975e582127766 (patch) | |
tree | aff33e947673137ae21734321e1f036600297223 /drivers/pci/intel-iommu.c | |
parent | e1c502482853f84606928f5a2f2eb6da1993cda1 (diff) | |
parent | b0d44c0dbbd52effb731b1c0af9afd56215c48de (diff) |
Merge branch 'iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (60 commits)
dma-debug: make memory range checks more consistent
dma-debug: warn of unmapping an invalid dma address
dma-debug: fix dma_debug_add_bus() definition for !CONFIG_DMA_API_DEBUG
dma-debug/x86: register pci bus for dma-debug leak detection
dma-debug: add a check dma memory leaks
dma-debug: add checks for kernel text and rodata
dma-debug: print stacktrace of mapping path on unmap error
dma-debug: Documentation update
dma-debug: x86 architecture bindings
dma-debug: add function to dump dma mappings
dma-debug: add checks for sync_single_sg_*
dma-debug: add checks for sync_single_range_*
dma-debug: add checks for sync_single_*
dma-debug: add checking for [alloc|free]_coherent
dma-debug: add add checking for map/unmap_sg
dma-debug: add checking for map/unmap_page/single
dma-debug: add core checking functions
dma-debug: add debugfs interface
dma-debug: add kernel command line parameters
dma-debug: add initialization code
...
Fix trivial conflicts due to whitespace changes in arch/x86/kernel/pci-nommu.c
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r-- | drivers/pci/intel-iommu.c | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index ef167b8b047d..49402c399232 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -2124,11 +2124,13 @@ error: | |||
2124 | return 0; | 2124 | return 0; |
2125 | } | 2125 | } |
2126 | 2126 | ||
2127 | dma_addr_t intel_map_single(struct device *hwdev, phys_addr_t paddr, | 2127 | static dma_addr_t intel_map_page(struct device *dev, struct page *page, |
2128 | size_t size, int dir) | 2128 | unsigned long offset, size_t size, |
2129 | enum dma_data_direction dir, | ||
2130 | struct dma_attrs *attrs) | ||
2129 | { | 2131 | { |
2130 | return __intel_map_single(hwdev, paddr, size, dir, | 2132 | return __intel_map_single(dev, page_to_phys(page) + offset, size, |
2131 | to_pci_dev(hwdev)->dma_mask); | 2133 | dir, to_pci_dev(dev)->dma_mask); |
2132 | } | 2134 | } |
2133 | 2135 | ||
2134 | static void flush_unmaps(void) | 2136 | static void flush_unmaps(void) |
@@ -2192,8 +2194,9 @@ static void add_unmap(struct dmar_domain *dom, struct iova *iova) | |||
2192 | spin_unlock_irqrestore(&async_umap_flush_lock, flags); | 2194 | spin_unlock_irqrestore(&async_umap_flush_lock, flags); |
2193 | } | 2195 | } |
2194 | 2196 | ||
2195 | void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, size_t size, | 2197 | static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, |
2196 | int dir) | 2198 | size_t size, enum dma_data_direction dir, |
2199 | struct dma_attrs *attrs) | ||
2197 | { | 2200 | { |
2198 | struct pci_dev *pdev = to_pci_dev(dev); | 2201 | struct pci_dev *pdev = to_pci_dev(dev); |
2199 | struct dmar_domain *domain; | 2202 | struct dmar_domain *domain; |
@@ -2237,8 +2240,14 @@ void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, size_t size, | |||
2237 | } | 2240 | } |
2238 | } | 2241 | } |
2239 | 2242 | ||
2240 | void *intel_alloc_coherent(struct device *hwdev, size_t size, | 2243 | static void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, size_t size, |
2241 | dma_addr_t *dma_handle, gfp_t flags) | 2244 | int dir) |
2245 | { | ||
2246 | intel_unmap_page(dev, dev_addr, size, dir, NULL); | ||
2247 | } | ||
2248 | |||
2249 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, | ||
2250 | dma_addr_t *dma_handle, gfp_t flags) | ||
2242 | { | 2251 | { |
2243 | void *vaddr; | 2252 | void *vaddr; |
2244 | int order; | 2253 | int order; |
@@ -2261,8 +2270,8 @@ void *intel_alloc_coherent(struct device *hwdev, size_t size, | |||
2261 | return NULL; | 2270 | return NULL; |
2262 | } | 2271 | } |
2263 | 2272 | ||
2264 | void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 2273 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
2265 | dma_addr_t dma_handle) | 2274 | dma_addr_t dma_handle) |
2266 | { | 2275 | { |
2267 | int order; | 2276 | int order; |
2268 | 2277 | ||
@@ -2275,8 +2284,9 @@ void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, | |||
2275 | 2284 | ||
2276 | #define SG_ENT_VIRT_ADDRESS(sg) (sg_virt((sg))) | 2285 | #define SG_ENT_VIRT_ADDRESS(sg) (sg_virt((sg))) |
2277 | 2286 | ||
2278 | void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, | 2287 | static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, |
2279 | int nelems, int dir) | 2288 | int nelems, enum dma_data_direction dir, |
2289 | struct dma_attrs *attrs) | ||
2280 | { | 2290 | { |
2281 | int i; | 2291 | int i; |
2282 | struct pci_dev *pdev = to_pci_dev(hwdev); | 2292 | struct pci_dev *pdev = to_pci_dev(hwdev); |
@@ -2333,8 +2343,8 @@ static int intel_nontranslate_map_sg(struct device *hddev, | |||
2333 | return nelems; | 2343 | return nelems; |
2334 | } | 2344 | } |
2335 | 2345 | ||
2336 | int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int nelems, | 2346 | static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int nelems, |
2337 | int dir) | 2347 | enum dma_data_direction dir, struct dma_attrs *attrs) |
2338 | { | 2348 | { |
2339 | void *addr; | 2349 | void *addr; |
2340 | int i; | 2350 | int i; |
@@ -2414,13 +2424,19 @@ int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int nelems, | |||
2414 | return nelems; | 2424 | return nelems; |
2415 | } | 2425 | } |
2416 | 2426 | ||
2417 | static struct dma_mapping_ops intel_dma_ops = { | 2427 | static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr) |
2428 | { | ||
2429 | return !dma_addr; | ||
2430 | } | ||
2431 | |||
2432 | struct dma_map_ops intel_dma_ops = { | ||
2418 | .alloc_coherent = intel_alloc_coherent, | 2433 | .alloc_coherent = intel_alloc_coherent, |
2419 | .free_coherent = intel_free_coherent, | 2434 | .free_coherent = intel_free_coherent, |
2420 | .map_single = intel_map_single, | ||
2421 | .unmap_single = intel_unmap_single, | ||
2422 | .map_sg = intel_map_sg, | 2435 | .map_sg = intel_map_sg, |
2423 | .unmap_sg = intel_unmap_sg, | 2436 | .unmap_sg = intel_unmap_sg, |
2437 | .map_page = intel_map_page, | ||
2438 | .unmap_page = intel_unmap_page, | ||
2439 | .mapping_error = intel_mapping_error, | ||
2424 | }; | 2440 | }; |
2425 | 2441 | ||
2426 | static inline int iommu_domain_cache_init(void) | 2442 | static inline int iommu_domain_cache_init(void) |