linux: Add trivial forwarding of dma_{, un}map_page when not using highmem
PATCH 1/1 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 <[email protected]>
arch/i386/kernel/swiotlb.c +4 -2
@@ -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_cpEXPORT_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);
arch/i386/kernel/pci-dma-xen.c +2 -8
@@ -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)
include/asm-i386/mach-xen/asm/dma-mapping.h +6 -0
@@ -53,6 +53,7 @@ extern int dma_map_sg(struct device *hwdextern 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, structextern 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,
include/asm-i386/mach-xen/asm/swiotlb.h +2 -0
@@ -26,11 +26,13 @@ extern int swiotlb_map_sg(struct deviceextern 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 );