From: Ingo Molnar Date: Fri, 10 Oct 2008 17:47:12 +0000 (+0200) Subject: Merge branches 'core/iommu', 'x86/amd-iommu' and 'x86/iommu' into x86-v28-for-linus... X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=725c25819e4a0dafdcf42a5f31bc569341919c7c;p=openwrt%2Fstaging%2Fblogic.git Merge branches 'core/iommu', 'x86/amd-iommu' and 'x86/iommu' into x86-v28-for-linus-phase3-B Conflicts: arch/x86/kernel/pci-gart_64.c include/asm-x86/dma-mapping.h --- 725c25819e4a0dafdcf42a5f31bc569341919c7c diff --cc MAINTAINERS index 8dae4555f10e,cad81a24e832,4c5e9fe0f7db,9ac82eab82ee..3c124d7989e0 --- a/MAINTAINERS +++ b/MAINTAINERS @@@@@ -2703,9 -2705,8 -2767,8 -2706,8 +2704,9 @@@@@ S: Supporte MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7 P: Michael Kerrisk M: mtk.manpages@gmail.com --W: http://www.kernel.org/doc/man-pages --S: Supported ++W: http://www.kernel.org/doc/man-pages +++L: linux-man@vger.kernel.org ++S: Supported MARVELL LIBERTAS WIRELESS DRIVER P: Dan Williams diff --cc arch/x86/kernel/amd_iommu.c index 042fdc27bc92,69b4d060b21c,de39e1f2ede5,3b346c6f5514..34e4d112b1ef --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c @@@@@ -1008,7 -998,7 -998,7 -1175,15 +1185,15 @@@@@ static void *alloc_coherent(struct devi struct protection_domain *domain; u16 devid; phys_addr_t paddr; +++ u64 dma_mask = dev->coherent_dma_mask; +++ +++ if (!check_device(dev)) +++ return NULL; + +++ if (!get_device_resources(dev, &iommu, &domain, &devid)) +++ flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); ++ +++ flag |= __GFP_ZERO; virt_addr = (void *)__get_free_pages(flag, get_order(size)); if (!virt_addr) return 0; diff --cc arch/x86/kernel/pci-gart_64.c index 1a895a582534,49285f8fd4d5,49285f8fd4d5,d077116fec1b..145f1c83369f --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c @@@@@ -80,10 -80,9 -80,9 -80,10 +80,10 @@@@@ AGPEXTERN int agp_memory_reserved AGPEXTERN __u32 *agp_gatt_table; static unsigned long next_bit; /* protected by iommu_bitmap_lock */ --- static int need_flush; /* global flush state. set for each gart wrap */ +++ static bool need_flush; /* global flush state. set for each gart wrap */ -- static unsigned long alloc_iommu(struct device *dev, int size) ++ static unsigned long alloc_iommu(struct device *dev, int size, ++ unsigned long align_mask) { unsigned long offset, flags; unsigned long boundary_size; @@@@@ -96,12 -95,11 -95,11 -96,12 +96,12 @@@@@ spin_lock_irqsave(&iommu_bitmap_lock, flags); offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit, -- size, base_index, boundary_size, 0); ++ size, base_index, boundary_size, align_mask); if (offset == -1) { --- need_flush = 1; +++ need_flush = true; offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0, -- size, base_index, boundary_size, 0); ++ size, base_index, boundary_size, ++ align_mask); } if (offset != -1) { next_bit = offset+size; @@@@@ -261,20 -259,16 -259,16 -252,6 +252,6 @@@@@ static dma_addr_t dma_map_area(struct d return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); } --- static dma_addr_t --- gart_map_simple(struct device *dev, phys_addr_t paddr, size_t size, int dir) --- { - dma_addr_t map; - unsigned long align_mask; - - align_mask = (1UL << get_order(size)) - 1; - map = dma_map_area(dev, paddr, size, dir, align_mask); -- dma_addr_t map = dma_map_area(dev, paddr, size, dir); --- --- flush_gart(); --- --- return map; --- } --- /* Map a single area into the IOMMU */ static dma_addr_t gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) diff --cc include/asm-x86/amd_iommu.h index 783f43e58052,30a12049353b,30a12049353b,2fd97cb250c7..041d0db7da27 --- a/include/asm-x86/amd_iommu.h +++ b/include/asm-x86/amd_iommu.h @@@@@ -17,9 -17,9 -17,9 -17,11 +17,11 @@@@@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ---#ifndef _ASM_X86_AMD_IOMMU_H ---#define _ASM_X86_AMD_IOMMU_H +++#ifndef ASM_X86__AMD_IOMMU_H +++#define ASM_X86__AMD_IOMMU_H ++ +++ #include + #ifdef CONFIG_AMD_IOMMU extern int amd_iommu_init(void); extern int amd_iommu_init_dma_ops(void); diff --cc include/asm-x86/dma-mapping.h index 5d200e78bd81,ad9cd6d49bfc,ad9cd6d49bfc,3b808e9bb72c..219c33d6361c --- a/include/asm-x86/dma-mapping.h +++ b/include/asm-x86/dma-mapping.h @@@@@ -68,7 -68,7 -68,7 -65,7 +65,7 @@@@@ static inline struct dma_mapping_ops *g return dma_ops; else return dev->archdata.dma_ops; ----#endif ++++#endif /* ASM_X86__DMA_MAPPING_H */ } /* Make sure we keep the same behaviour */ @@@@@ -247,7 -247,7 -247,7 -241,68 +241,68 @@@@@ static inline int dma_get_cache_alignme return boot_cpu_data.x86_clflush_size; } --- #define dma_is_consistent(d, h) (1) +++ static inline unsigned long dma_alloc_coherent_mask(struct device *dev, +++ gfp_t gfp) +++ { +++ unsigned long dma_mask = 0; ++ - #include - #endif /* ASM_X86__DMA_MAPPING_H */ +++ dma_mask = dev->coherent_dma_mask; +++ if (!dma_mask) +++ dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK; +++ +++ return dma_mask; +++ } +++ +++ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) +++ { +++ #ifdef CONFIG_X86_64 +++ unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp); +++ +++ if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) +++ gfp |= GFP_DMA32; +++ #endif +++ return gfp; +++ } +++ +++ static inline void * +++ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, +++ gfp_t gfp) +++ { +++ struct dma_mapping_ops *ops = get_dma_ops(dev); +++ void *memory; +++ +++ gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); +++ +++ if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) +++ return memory; +++ +++ if (!dev) { +++ dev = &x86_dma_fallback_dev; +++ gfp |= GFP_DMA; +++ } +++ +++ if (!is_device_dma_capable(dev)) +++ return NULL; +++ +++ if (!ops->alloc_coherent) +++ return NULL; +++ +++ return ops->alloc_coherent(dev, size, dma_handle, +++ dma_alloc_coherent_gfp_flags(dev, gfp)); +++ } +++ +++ static inline void dma_free_coherent(struct device *dev, size_t size, +++ void *vaddr, dma_addr_t bus) +++ { +++ struct dma_mapping_ops *ops = get_dma_ops(dev); +++ +++ WARN_ON(irqs_disabled()); /* for portability */ +++ +++ if (dma_release_from_coherent(dev, get_order(size), vaddr)) +++ return; +++ +++ if (ops->free_coherent) +++ ops->free_coherent(dev, size, vaddr, bus); +++ } + -- #include + #endif