|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [linux-2.6.18-xen] [IA64] avoid unnecessarily SWIOTLB bo
# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1207152177 21600
# Node ID ec6e3e18ea314e9520ee6bba898e30228bf3bda4
# Parent ad7ad9af265e3276d084f8074192bec9d3867747
[IA64] avoid unnecessarily SWIOTLB bounce buffering
x86 improved range_straddles_page_boundary() by the c/s 501:5486a234923d.
The same discussion applies to ia64. This patch is ia64 counter part of it.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
arch/ia64/xen/xen_dma.c | 35 +++++++++++++++++++++++++++++++++++
include/asm-ia64/maddr.h | 12 +-----------
2 files changed, 36 insertions(+), 11 deletions(-)
diff -r ad7ad9af265e -r ec6e3e18ea31 arch/ia64/xen/xen_dma.c
--- a/arch/ia64/xen/xen_dma.c Tue Apr 01 11:29:31 2008 -0600
+++ b/arch/ia64/xen/xen_dma.c Wed Apr 02 10:02:57 2008 -0600
@@ -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 -r ad7ad9af265e -r ec6e3e18ea31 include/asm-ia64/maddr.h
--- a/include/asm-ia64/maddr.h Tue Apr 01 11:29:31 2008 -0600
+++ b/include/asm-ia64/maddr.h Wed Apr 02 10:02:57 2008 -0600
@@ -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
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [linux-2.6.18-xen] [IA64] avoid unnecessarily SWIOTLB bounce buffering,
Xen patchbot-linux-2.6.18-xen <=
|
|
|
|
|