# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1184141949 -32400 # Node ID e35c8f3cd28719337def64cae0404e333b840274 # Parent b6948c49743b2258a05426155c2c8fd2cb754442 ia64 counter part of changeset: 93:08cf42135056 PATCHNAME: ia64_counter_part_range_straddles_page_boundary Signed-off-by: Isaku Yamahata diff -r b6948c49743b -r e35c8f3cd287 arch/ia64/hp/common/sba_iommu.c --- a/arch/ia64/hp/common/sba_iommu.c Wed Jul 11 10:41:34 2007 +0900 +++ b/arch/ia64/hp/common/sba_iommu.c Wed Jul 11 17:19:09 2007 +0900 @@ -944,7 +944,7 @@ sba_map_single(struct device *dev, void ** Check if the PCI device can DMA to ptr... if so, just return ptr */ if (likely(pci_addr & ~to_pci_dev(dev)->dma_mask) == 0 && - !range_straddles_page_boundary(addr, size)) { + !range_straddles_page_boundary(__pa(addr), size)) { /* ** Device is bit capable of DMA'ing to the buffer... ** just return the PCI address of ptr diff -r b6948c49743b -r e35c8f3cd287 arch/ia64/xen/swiotlb.c --- a/arch/ia64/xen/swiotlb.c Wed Jul 11 10:41:34 2007 +0900 +++ b/arch/ia64/xen/swiotlb.c Wed Jul 11 17:19:09 2007 +0900 @@ -608,7 +608,7 @@ swiotlb_map_single(struct device *hwdev, * we can safely return the device addr and not worry about bounce * buffering it. */ - if (!range_straddles_page_boundary(ptr, size) && + if (!range_straddles_page_boundary(__pa(ptr), size) && !address_needs_mapping(hwdev, dev_addr) && !swiotlb_force) return dev_addr; @@ -781,7 +781,10 @@ swiotlb_map_sg(struct device *hwdev, str for (i = 0; i < nelems; i++, sg++) { addr = SG_ENT_VIRT_ADDRESS(sg); dev_addr = gnttab_dma_map_virt(addr); - if (swiotlb_force || address_needs_mapping(hwdev, dev_addr)) { + if (swiotlb_force || + range_straddles_page_boundary(page_to_pseudophys(sg->page) + + sg->offset, sg->length) || + address_needs_mapping(hwdev, dev_addr)) { void *map; __gnttab_dma_unmap_page(sg->page); map = map_single(hwdev, addr, sg->length, dir); diff -r b6948c49743b -r e35c8f3cd287 arch/ia64/xen/xen_dma.c --- a/arch/ia64/xen/xen_dma.c Wed Jul 11 10:41:34 2007 +0900 +++ b/arch/ia64/xen/xen_dma.c Wed Jul 11 17:19:09 2007 +0900 @@ -64,6 +64,9 @@ xen_map_sg(struct device *dev, struct sc sg[i].dma_length = sg[i].length; IOMMU_BUG_ON(address_needs_mapping(dev, sg[i].dma_address)); + IOMMU_BUG_ON(range_straddles_page_boundary( + page_to_pseudophys(sg[i].page) + sg[i].offset, + sg[i].length)); } return nents; @@ -136,7 +139,7 @@ xen_map_single(struct device *dev, void { dma_addr_t dma_addr = gnttab_dma_map_virt(ptr); - IOMMU_BUG_ON(range_straddles_page_boundary(ptr, size)); + IOMMU_BUG_ON(range_straddles_page_boundary(__pa(ptr), size)); IOMMU_BUG_ON(address_needs_mapping(dev, dma_addr)); return dma_addr; diff -r b6948c49743b -r e35c8f3cd287 include/asm-ia64/hypervisor.h --- a/include/asm-ia64/hypervisor.h Wed Jul 11 10:41:34 2007 +0900 +++ b/include/asm-ia64/hypervisor.h Wed Jul 11 17:19:09 2007 +0900 @@ -225,20 +225,4 @@ asmlinkage int xprintk(const char *fmt, #define is_initial_xendomain() 0 #endif -#ifdef CONFIG_XEN -static inline int -range_straddles_page_boundary(void *p, size_t size) -{ - extern unsigned long *contiguous_bitmap; - - if (!is_running_on_xen()) - return 0; - - return (((((unsigned long)p & ~PAGE_MASK) + size) > PAGE_SIZE) && - !test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap)); -} -#else -#define range_straddles_page_boundary(addr, size) (0) -#endif - #endif /* __HYPERVISOR_H__ */ diff -r b6948c49743b -r e35c8f3cd287 include/asm-ia64/maddr.h --- a/include/asm-ia64/maddr.h Wed Jul 11 10:41:34 2007 +0900 +++ b/include/asm-ia64/maddr.h Wed Jul 11 17:19:09 2007 +0900 @@ -107,4 +107,20 @@ typedef unsigned long paddr_t; typedef unsigned long paddr_t; #endif +#ifdef CONFIG_XEN +static inline int +range_straddles_page_boundary(paddr_t p, size_t size) +{ + extern unsigned long *contiguous_bitmap; + + if (!is_running_on_xen()) + return 0; + + return ((((p & ~PAGE_MASK) + size) > PAGE_SIZE) && + !test_bit(p >> PAGE_SHIFT, contiguous_bitmap)); +} +#else +#define range_straddles_page_boundary(addr, size) (0) +#endif + #endif /* _ASM_IA64_MADDR_H */