[PATCH] x86_64: Use function pointers to call DMA mapping functions
AK: I hacked Muli's original patch a lot and there were a lot of changes - all bugs are probably to blame on me now. There were also some changes in the fall back behaviour for swiotlb - in particular it doesn't try to use GFP_DMA now anymore. Also all DMA mapping operations use the same core dma_alloc_coherent code with proper fallbacks now. And various other changes and cleanups. Known problems: iommu=force swiotlb=force together breaks needs more testing. This patch cleans up x86_64's DMA mapping dispatching code. Right now we have three possible IOMMU types: AGP GART, swiotlb and nommu, and in the future we will also have Xen's x86_64 swiotlb and other HW IOMMUs for x86_64. In order to support all of them cleanly, this patch: - introduces a struct dma_mapping_ops with function pointers for each of the DMA mapping operations of gart (AMD HW IOMMU), swiotlb (software IOMMU) and nommu (no IOMMU). - gets rid of: if (swiotlb) return swiotlb_xxx(); - PCI_DMA_BUS_IS_PHYS is now checked against the dma_ops being set This makes swiotlb faster by avoiding double copying in some cases. Signed-Off-By:Muli Ben-Yehuda <mulix@mulix.org> Signed-Off-By:
Jon D. Mason <jdmason@us.ibm.com> Signed-off-by:
Andi Kleen <ak@suse.de> Signed-off-by:
Linus Torvalds <torvalds@osdl.org>
Showing
- arch/x86_64/Kconfig 5 additions, 13 deletionsarch/x86_64/Kconfig
- arch/x86_64/kernel/Makefile 2 additions, 2 deletionsarch/x86_64/kernel/Makefile
- arch/x86_64/kernel/pci-dma.c 246 additions, 40 deletionsarch/x86_64/kernel/pci-dma.c
- arch/x86_64/kernel/pci-gart.c 97 additions, 314 deletionsarch/x86_64/kernel/pci-gart.c
- arch/x86_64/kernel/pci-nommu.c 74 additions, 70 deletionsarch/x86_64/kernel/pci-nommu.c
- arch/x86_64/kernel/pci-swiotlb.c 42 additions, 0 deletionsarch/x86_64/kernel/pci-swiotlb.c
- arch/x86_64/kernel/setup.c 3 additions, 7 deletionsarch/x86_64/kernel/setup.c
- arch/x86_64/mm/init.c 8 additions, 5 deletionsarch/x86_64/mm/init.c
- include/asm-x86_64/dma-mapping.h 121 additions, 100 deletionsinclude/asm-x86_64/dma-mapping.h
- include/asm-x86_64/gart-mapping.h 16 additions, 0 deletionsinclude/asm-x86_64/gart-mapping.h
- include/asm-x86_64/pci.h 6 additions, 5 deletionsinclude/asm-x86_64/pci.h
- include/asm-x86_64/proto.h 9 additions, 2 deletionsinclude/asm-x86_64/proto.h
- include/asm-x86_64/swiotlb.h 11 additions, 5 deletionsinclude/asm-x86_64/swiotlb.h
- lib/swiotlb.c 1 addition, 1 deletionlib/swiotlb.c
Loading
Please register or sign in to comment