[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-ia64-devel] [PATCH] linux: ia64 counter part of 501:5486a234923d
# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1207174068 25200 # Node ID d664f2f992527714c323ea55dae662d0ff0b9078 # Parent c88b34aaff3ef008f3ee2b6be96b6275e62cc8de ia64: ia64 counter part of c/s 501:5486a234923d. x86 improved range_straddles_page_boundary() by the c/s 501:5486a234923d. The same discussin applies to ia64. This patch is ia64 counter part of it. Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx> diff --git a/arch/ia64/xen/xen_dma.c b/arch/ia64/xen/xen_dma.c --- a/arch/ia64/xen/xen_dma.c +++ b/arch/ia64/xen/xen_dma.c @@ -37,6 +37,41 @@ do { \ } \ } while (0) +static int check_pages_physically_contiguous(unsigned long pfn, + unsigned int offset, + size_t length) +{ + unsigned long next_bus; + int i; + int nr_pages; + + next_bus = pfn_to_mfn_for_dma(pfn); + nr_pages = (offset + length + PAGE_SIZE-1) >> PAGE_SHIFT; + + for (i = 1; i < nr_pages; i++) { + if (pfn_to_mfn_for_dma(++pfn) != ++next_bus) + return 0; + } + return 1; +} + +int range_straddles_page_boundary(paddr_t p, size_t size) +{ + extern unsigned long *contiguous_bitmap; + unsigned long pfn = p >> PAGE_SHIFT; + unsigned int offset = p & ~PAGE_MASK; + + if (!is_running_on_xen()) + return 0; + + if (offset + size <= PAGE_SIZE) + return 0; + if (test_bit(pfn, contiguous_bitmap)) + return 0; + if (check_pages_physically_contiguous(pfn, offset, size)) + return 0; + return 1; +} /* * This should be broken out of swiotlb and put in a common place diff --git a/include/asm-ia64/maddr.h b/include/asm-ia64/maddr.h --- a/include/asm-ia64/maddr.h +++ b/include/asm-ia64/maddr.h @@ -108,17 +108,7 @@ 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)); -} +int range_straddles_page_boundary(paddr_t p, size_t size); #else #define range_straddles_page_boundary(addr, size) (0) #endif -- yamahata _______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ia64-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |