diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-02 21:36:15 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-02 21:36:15 -0500 |
| commit | 3a7142371efdc95f4c5b5ffc188b18efdc4e64dd (patch) | |
| tree | 29f2fbc9b0932ebeeb85dad6b309c1a22f9b1026 | |
| parent | ec1890c5df451799dec969a3581ff72e1934b5ee (diff) | |
| parent | c7fb577e2a6cb04732541f2dc402bd46747f7558 (diff) | |
Merge branch 'swiotlb' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
| -rw-r--r-- | arch/ia64/Kconfig | 4 | ||||
| -rw-r--r-- | arch/ia64/lib/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86_64/kernel/Makefile | 2 | ||||
| -rw-r--r-- | include/asm-x86_64/dma-mapping.h | 31 | ||||
| -rw-r--r-- | include/asm-x86_64/swiotlb.h | 8 | ||||
| -rw-r--r-- | lib/Makefile | 2 | ||||
| -rw-r--r-- | lib/swiotlb.c (renamed from arch/ia64/lib/swiotlb.c) | 142 |
7 files changed, 139 insertions, 52 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 1642375fb14e..3b4248cff9a7 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
| @@ -26,6 +26,10 @@ config MMU | |||
| 26 | bool | 26 | bool |
| 27 | default y | 27 | default y |
| 28 | 28 | ||
| 29 | config SWIOTLB | ||
| 30 | bool | ||
| 31 | default y | ||
| 32 | |||
| 29 | config RWSEM_XCHGADD_ALGORITHM | 33 | config RWSEM_XCHGADD_ALGORITHM |
| 30 | bool | 34 | bool |
| 31 | default y | 35 | default y |
diff --git a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile index cb1af597370b..ac64664a1807 100644 --- a/arch/ia64/lib/Makefile +++ b/arch/ia64/lib/Makefile | |||
| @@ -9,7 +9,7 @@ lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \ | |||
| 9 | bitop.o checksum.o clear_page.o csum_partial_copy.o \ | 9 | bitop.o checksum.o clear_page.o csum_partial_copy.o \ |
| 10 | clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ | 10 | clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ |
| 11 | flush.o ip_fast_csum.o do_csum.o \ | 11 | flush.o ip_fast_csum.o do_csum.o \ |
| 12 | memset.o strlen.o swiotlb.o | 12 | memset.o strlen.o |
| 13 | 13 | ||
| 14 | lib-$(CONFIG_ITANIUM) += copy_page.o copy_user.o memcpy.o | 14 | lib-$(CONFIG_ITANIUM) += copy_page.o copy_user.o memcpy.o |
| 15 | lib-$(CONFIG_MCKINLEY) += copy_page_mck.o memcpy_mck.o | 15 | lib-$(CONFIG_MCKINLEY) += copy_page_mck.o memcpy_mck.o |
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index bcdd0a805fe7..14328cab5d3a 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile | |||
| @@ -27,7 +27,6 @@ obj-$(CONFIG_CPU_FREQ) += cpufreq/ | |||
| 27 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 27 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
| 28 | obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o | 28 | obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o |
| 29 | obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o | 29 | obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o |
| 30 | obj-$(CONFIG_SWIOTLB) += swiotlb.o | ||
| 31 | obj-$(CONFIG_KPROBES) += kprobes.o | 30 | obj-$(CONFIG_KPROBES) += kprobes.o |
| 32 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o | 31 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o |
| 33 | 32 | ||
| @@ -41,7 +40,6 @@ CFLAGS_vsyscall.o := $(PROFILING) -g0 | |||
| 41 | bootflag-y += ../../i386/kernel/bootflag.o | 40 | bootflag-y += ../../i386/kernel/bootflag.o |
| 42 | cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o | 41 | cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o |
| 43 | topology-y += ../../i386/mach-default/topology.o | 42 | topology-y += ../../i386/mach-default/topology.o |
| 44 | swiotlb-$(CONFIG_SWIOTLB) += ../../ia64/lib/swiotlb.o | ||
| 45 | microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o | 43 | microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o |
| 46 | intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o | 44 | intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o |
| 47 | quirks-y += ../../i386/kernel/quirks.o | 45 | quirks-y += ../../i386/kernel/quirks.o |
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h index 54a380efed41..36d16dfbac88 100644 --- a/include/asm-x86_64/dma-mapping.h +++ b/include/asm-x86_64/dma-mapping.h | |||
| @@ -85,10 +85,33 @@ static inline void dma_sync_single_for_device(struct device *hwdev, | |||
| 85 | flush_write_buffers(); | 85 | flush_write_buffers(); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | #define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \ | 88 | static inline void dma_sync_single_range_for_cpu(struct device *hwdev, |
| 89 | dma_sync_single_for_cpu(dev, dma_handle, size, dir) | 89 | dma_addr_t dma_handle, |
| 90 | #define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \ | 90 | unsigned long offset, |
| 91 | dma_sync_single_for_device(dev, dma_handle, size, dir) | 91 | size_t size, int direction) |
| 92 | { | ||
| 93 | if (direction == DMA_NONE) | ||
| 94 | out_of_line_bug(); | ||
| 95 | |||
| 96 | if (swiotlb) | ||
| 97 | return swiotlb_sync_single_range_for_cpu(hwdev,dma_handle,offset,size,direction); | ||
| 98 | |||
| 99 | flush_write_buffers(); | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline void dma_sync_single_range_for_device(struct device *hwdev, | ||
| 103 | dma_addr_t dma_handle, | ||
| 104 | unsigned long offset, | ||
| 105 | size_t size, int direction) | ||
| 106 | { | ||
| 107 | if (direction == DMA_NONE) | ||
| 108 | out_of_line_bug(); | ||
| 109 | |||
| 110 | if (swiotlb) | ||
| 111 | return swiotlb_sync_single_range_for_device(hwdev,dma_handle,offset,size,direction); | ||
| 112 | |||
| 113 | flush_write_buffers(); | ||
| 114 | } | ||
| 92 | 115 | ||
| 93 | static inline void dma_sync_sg_for_cpu(struct device *hwdev, | 116 | static inline void dma_sync_sg_for_cpu(struct device *hwdev, |
| 94 | struct scatterlist *sg, | 117 | struct scatterlist *sg, |
diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h index 7cbfd10ecc3c..dddf1b218681 100644 --- a/include/asm-x86_64/swiotlb.h +++ b/include/asm-x86_64/swiotlb.h | |||
| @@ -15,6 +15,14 @@ extern void swiotlb_sync_single_for_cpu(struct device *hwdev, | |||
| 15 | extern void swiotlb_sync_single_for_device(struct device *hwdev, | 15 | extern void swiotlb_sync_single_for_device(struct device *hwdev, |
| 16 | dma_addr_t dev_addr, | 16 | dma_addr_t dev_addr, |
| 17 | size_t size, int dir); | 17 | size_t size, int dir); |
| 18 | extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev, | ||
| 19 | dma_addr_t dev_addr, | ||
| 20 | unsigned long offset, | ||
| 21 | size_t size, int dir); | ||
| 22 | extern void swiotlb_sync_single_range_for_device(struct device *hwdev, | ||
| 23 | dma_addr_t dev_addr, | ||
| 24 | unsigned long offset, | ||
| 25 | size_t size, int dir); | ||
| 18 | extern void swiotlb_sync_sg_for_cpu(struct device *hwdev, | 26 | extern void swiotlb_sync_sg_for_cpu(struct device *hwdev, |
| 19 | struct scatterlist *sg, int nelems, | 27 | struct scatterlist *sg, int nelems, |
| 20 | int dir); | 28 | int dir); |
diff --git a/lib/Makefile b/lib/Makefile index 44a46750690a..8535f4d7d1c3 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -44,6 +44,8 @@ obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o | |||
| 44 | obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o | 44 | obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o |
| 45 | obj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o | 45 | obj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o |
| 46 | 46 | ||
| 47 | obj-$(CONFIG_SWIOTLB) += swiotlb.o | ||
| 48 | |||
| 47 | hostprogs-y := gen_crc32table | 49 | hostprogs-y := gen_crc32table |
| 48 | clean-files := crc32table.h | 50 | clean-files := crc32table.h |
| 49 | 51 | ||
diff --git a/arch/ia64/lib/swiotlb.c b/lib/swiotlb.c index 96edcc0fdcd9..57216f3544ca 100644 --- a/arch/ia64/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Dynamic DMA mapping support. | 2 | * Dynamic DMA mapping support. |
| 3 | * | 3 | * |
| 4 | * This implementation is for IA-64 platforms that do not support | 4 | * This implementation is for IA-64 and EM64T platforms that do not support |
| 5 | * I/O TLBs (aka DMA address translation hardware). | 5 | * I/O TLBs (aka DMA address translation hardware). |
| 6 | * Copyright (C) 2000 Asit Mallick <Asit.K.Mallick@intel.com> | 6 | * Copyright (C) 2000 Asit Mallick <Asit.K.Mallick@intel.com> |
| 7 | * Copyright (C) 2000 Goutham Rao <goutham.rao@intel.com> | 7 | * Copyright (C) 2000 Goutham Rao <goutham.rao@intel.com> |
| @@ -11,21 +11,23 @@ | |||
| 11 | * 03/05/07 davidm Switch from PCI-DMA to generic device DMA API. | 11 | * 03/05/07 davidm Switch from PCI-DMA to generic device DMA API. |
| 12 | * 00/12/13 davidm Rename to swiotlb.c and add mark_clean() to avoid | 12 | * 00/12/13 davidm Rename to swiotlb.c and add mark_clean() to avoid |
| 13 | * unnecessary i-cache flushing. | 13 | * unnecessary i-cache flushing. |
| 14 | * 04/07/.. ak Better overflow handling. Assorted fixes. | 14 | * 04/07/.. ak Better overflow handling. Assorted fixes. |
| 15 | * 05/09/10 linville Add support for syncing ranges, support syncing for | ||
| 16 | * DMA_BIDIRECTIONAL mappings, miscellaneous cleanup. | ||
| 15 | */ | 17 | */ |
| 16 | 18 | ||
| 17 | #include <linux/cache.h> | 19 | #include <linux/cache.h> |
| 20 | #include <linux/dma-mapping.h> | ||
| 18 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
| 19 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 20 | #include <linux/pci.h> | ||
| 21 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
| 22 | #include <linux/string.h> | 24 | #include <linux/string.h> |
| 23 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 24 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
| 25 | 27 | ||
| 26 | #include <asm/io.h> | 28 | #include <asm/io.h> |
| 27 | #include <asm/pci.h> | ||
| 28 | #include <asm/dma.h> | 29 | #include <asm/dma.h> |
| 30 | #include <asm/scatterlist.h> | ||
| 29 | 31 | ||
| 30 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 31 | #include <linux/bootmem.h> | 33 | #include <linux/bootmem.h> |
| @@ -58,6 +60,14 @@ | |||
| 58 | */ | 60 | */ |
| 59 | #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT) | 61 | #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT) |
| 60 | 62 | ||
| 63 | /* | ||
| 64 | * Enumeration for sync targets | ||
| 65 | */ | ||
| 66 | enum dma_sync_target { | ||
