WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] [PATCH] linux: ia64 counter part of 501:5486a234923d

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH] linux: ia64 counter part of 501:5486a234923d
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Wed, 2 Apr 2008 15:24:34 +0900
Delivery-date: Tue, 01 Apr 2008 23:24:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
# 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

<Prev in Thread] Current Thread [Next in Thread>