direct-io.hg

changeset 13367:c149ffa2fd1a

linux: Add trivial forwarding of dma_{,un}map_page when not using highmem

Use non-trivial dma_{un,}map_page only when CONFIG_HIGHMEM, allowing
to not compile swiotlb_{un,}map_page in that case, which in neither
case need exporting.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Fri Jan 12 15:35:52 2007 +0000 (2007-01-12)
parents ed73ff8440d8
children 819e9449db07
files linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/dma-mapping.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c	Fri Jan 12 15:34:30 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c	Fri Jan 12 15:35:52 2007 +0000
     1.3 @@ -94,13 +94,7 @@ dma_unmap_sg(struct device *hwdev, struc
     1.4  }
     1.5  EXPORT_SYMBOL(dma_unmap_sg);
     1.6  
     1.7 -/*
     1.8 - * XXX This file is also used by xenLinux/ia64. 
     1.9 - * "defined(__i386__) || defined (__x86_64__)" means "!defined(__ia64__)".
    1.10 - * This #if work around should be removed once this file is merbed back into
    1.11 - * i386' pci-dma or is moved to drivers/xen/core.
    1.12 - */
    1.13 -#if defined(__i386__) || defined(__x86_64__)
    1.14 +#ifdef CONFIG_HIGHMEM
    1.15  dma_addr_t
    1.16  dma_map_page(struct device *dev, struct page *page, unsigned long offset,
    1.17  	     size_t size, enum dma_data_direction direction)
    1.18 @@ -130,7 +124,7 @@ dma_unmap_page(struct device *dev, dma_a
    1.19  		swiotlb_unmap_page(dev, dma_address, size, direction);
    1.20  }
    1.21  EXPORT_SYMBOL(dma_unmap_page);
    1.22 -#endif /* defined(__i386__) || defined(__x86_64__) */
    1.23 +#endif /* CONFIG_HIGHMEM */
    1.24  
    1.25  int
    1.26  dma_mapping_error(dma_addr_t dma_addr)
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Fri Jan 12 15:34:30 2007 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Fri Jan 12 15:35:52 2007 +0000
     2.3 @@ -647,6 +647,8 @@ swiotlb_sync_sg_for_device(struct device
     2.4  				    sg->dma_length, dir);
     2.5  }
     2.6  
     2.7 +#ifdef CONFIG_HIGHMEM
     2.8 +
     2.9  dma_addr_t
    2.10  swiotlb_map_page(struct device *hwdev, struct page *page,
    2.11  		 unsigned long offset, size_t size,
    2.12 @@ -680,6 +682,8 @@ swiotlb_unmap_page(struct device *hwdev,
    2.13  		unmap_single(hwdev, bus_to_virt(dma_address), size, direction);
    2.14  }
    2.15  
    2.16 +#endif
    2.17 +
    2.18  int
    2.19  swiotlb_dma_mapping_error(dma_addr_t dma_addr)
    2.20  {
    2.21 @@ -707,7 +711,5 @@ EXPORT_SYMBOL(swiotlb_sync_single_for_cp
    2.22  EXPORT_SYMBOL(swiotlb_sync_single_for_device);
    2.23  EXPORT_SYMBOL(swiotlb_sync_sg_for_cpu);
    2.24  EXPORT_SYMBOL(swiotlb_sync_sg_for_device);
    2.25 -EXPORT_SYMBOL(swiotlb_map_page);
    2.26 -EXPORT_SYMBOL(swiotlb_unmap_page);
    2.27  EXPORT_SYMBOL(swiotlb_dma_mapping_error);
    2.28  EXPORT_SYMBOL(swiotlb_dma_supported);
     3.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/dma-mapping.h	Fri Jan 12 15:34:30 2007 +0000
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/dma-mapping.h	Fri Jan 12 15:35:52 2007 +0000
     3.3 @@ -53,6 +53,7 @@ extern int dma_map_sg(struct device *hwd
     3.4  extern void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg,
     3.5  			 int nents, enum dma_data_direction direction);
     3.6  
     3.7 +#ifdef CONFIG_HIGHMEM
     3.8  extern dma_addr_t
     3.9  dma_map_page(struct device *dev, struct page *page, unsigned long offset,
    3.10  	     size_t size, enum dma_data_direction direction);
    3.11 @@ -60,6 +61,11 @@ dma_map_page(struct device *dev, struct 
    3.12  extern void
    3.13  dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
    3.14  	       enum dma_data_direction direction);
    3.15 +#else
    3.16 +#define dma_map_page(dev, page, offset, size, dir) \
    3.17 +	dma_map_single(dev, page_address(page) + (offset), (size), (dir))
    3.18 +#define dma_unmap_page dma_unmap_single
    3.19 +#endif
    3.20  
    3.21  extern void
    3.22  dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
     4.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h	Fri Jan 12 15:34:30 2007 +0000
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h	Fri Jan 12 15:35:52 2007 +0000
     4.3 @@ -26,11 +26,13 @@ extern int swiotlb_map_sg(struct device 
     4.4  extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
     4.5  			 int nents, int direction);
     4.6  extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr);
     4.7 +#ifdef CONFIG_HIGHMEM
     4.8  extern dma_addr_t swiotlb_map_page(struct device *hwdev, struct page *page,
     4.9                                     unsigned long offset, size_t size,
    4.10                                     enum dma_data_direction direction);
    4.11  extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dma_address,
    4.12                                 size_t size, enum dma_data_direction direction);
    4.13 +#endif
    4.14  extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
    4.15  extern void swiotlb_init(void);
    4.16