Jan Beulich
2007-Jan-02 14:30 UTC
[Xen-devel] [PATCH] 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> Index: sle10-sp1-2006-12-21/arch/i386/kernel/swiotlb.c ==================================================================--- sle10-sp1-2006-12-21.orig/arch/i386/kernel/swiotlb.c 2007-01-02 12:48:40.000000000 +0100 +++ sle10-sp1-2006-12-21/arch/i386/kernel/swiotlb.c 2007-01-02 14:01:59.000000000 +0100 @@ -617,6 +617,8 @@ swiotlb_sync_sg_for_device(struct device sg->dma_length, dir); } +#ifdef CONFIG_HIGHMEM + dma_addr_t swiotlb_map_page(struct device *hwdev, struct page *page, unsigned long offset, size_t size, @@ -650,6 +652,8 @@ swiotlb_unmap_page(struct device *hwdev, unmap_single(hwdev, bus_to_virt(dma_address), size, direction); } +#endif + int swiotlb_dma_mapping_error(dma_addr_t dma_addr) { @@ -677,7 +681,5 @@ EXPORT_SYMBOL(swiotlb_sync_single_for_cp EXPORT_SYMBOL(swiotlb_sync_single_for_device); EXPORT_SYMBOL(swiotlb_sync_sg_for_cpu); EXPORT_SYMBOL(swiotlb_sync_sg_for_device); -EXPORT_SYMBOL(swiotlb_map_page); -EXPORT_SYMBOL(swiotlb_unmap_page); EXPORT_SYMBOL(swiotlb_dma_mapping_error); EXPORT_SYMBOL(swiotlb_dma_supported); Index: sle10-sp1-2006-12-21/arch/i386/kernel/pci-dma-xen.c ==================================================================--- sle10-sp1-2006-12-21.orig/arch/i386/kernel/pci-dma-xen.c 2007-01-02 10:32:16.000000000 +0100 +++ sle10-sp1-2006-12-21/arch/i386/kernel/pci-dma-xen.c 2007-01-02 14:01:59.000000000 +0100 @@ -94,13 +94,7 @@ dma_unmap_sg(struct device *hwdev, struc } EXPORT_SYMBOL(dma_unmap_sg); -/* - * XXX This file is also used by xenLinux/ia64. - * "defined(__i386__) || defined (__x86_64__)" means "!defined(__ia64__)". - * This #if work around should be removed once this file is merbed back into - * i386'' pci-dma or is moved to drivers/xen/core. - */ -#if defined(__i386__) || defined(__x86_64__) +#ifdef CONFIG_HIGHMEM dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction) @@ -130,7 +124,7 @@ dma_unmap_page(struct device *dev, dma_a swiotlb_unmap_page(dev, dma_address, size, direction); } EXPORT_SYMBOL(dma_unmap_page); -#endif /* defined(__i386__) || defined(__x86_64__) */ +#endif /* CONFIG_HIGHMEM */ int dma_mapping_error(dma_addr_t dma_addr) Index: sle10-sp1-2006-12-21/include/asm-i386/mach-xen/asm/dma-mapping.h ==================================================================--- sle10-sp1-2006-12-21.orig/include/asm-i386/mach-xen/asm/dma-mapping.h 2007-01-02 14:26:42.000000000 +0100 +++ sle10-sp1-2006-12-21/include/asm-i386/mach-xen/asm/dma-mapping.h 2007-01-02 14:01:59.000000000 +0100 @@ -53,6 +53,7 @@ extern int dma_map_sg(struct device *hwd extern void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, enum dma_data_direction direction); +#ifdef CONFIG_HIGHMEM extern dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction); @@ -60,6 +61,11 @@ dma_map_page(struct device *dev, struct extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, enum dma_data_direction direction); +#else +#define dma_map_page(dev, page, offset, size, dir) \ + dma_map_single(dev, page_address(page) + (offset), (size), (dir)) +#define dma_unmap_page dma_unmap_single +#endif extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, Index: sle10-sp1-2006-12-21/include/asm-i386/mach-xen/asm/swiotlb.h ==================================================================--- sle10-sp1-2006-12-21.orig/include/asm-i386/mach-xen/asm/swiotlb.h 2007-01-02 10:28:31.000000000 +0100 +++ sle10-sp1-2006-12-21/include/asm-i386/mach-xen/asm/swiotlb.h 2007-01-02 14:01:59.000000000 +0100 @@ -26,11 +26,13 @@ extern int swiotlb_map_sg(struct device extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction); extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr); +#ifdef CONFIG_HIGHMEM extern dma_addr_t swiotlb_map_page(struct device *hwdev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction); extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dma_address, size_t size, enum dma_data_direction direction); +#endif extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); extern void swiotlb_init(void); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel