# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1184528937 21600
# Node ID bf38300f5e6360aaabe0457f7bdd344fbe43357a
# Parent 34d01b3157e213516f599f11fc5379624c51a2d9
[IA64] counter part of changeset: 93:08cf42135056
"dma_map_sg() must handle multi-page segments."
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
arch/ia64/hp/common/sba_iommu.c | 2 +-
arch/ia64/xen/swiotlb.c | 7 +++++--
arch/ia64/xen/xen_dma.c | 5 ++++-
include/asm-ia64/hypervisor.h | 16 ----------------
include/asm-ia64/maddr.h | 16 ++++++++++++++++
5 files changed, 26 insertions(+), 20 deletions(-)
diff -r 34d01b3157e2 -r bf38300f5e63 arch/ia64/hp/common/sba_iommu.c
--- a/arch/ia64/hp/common/sba_iommu.c Sun Jul 15 13:44:09 2007 -0600
+++ b/arch/ia64/hp/common/sba_iommu.c Sun Jul 15 13:48:57 2007 -0600
@@ -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 34d01b3157e2 -r bf38300f5e63 arch/ia64/xen/swiotlb.c
--- a/arch/ia64/xen/swiotlb.c Sun Jul 15 13:44:09 2007 -0600
+++ b/arch/ia64/xen/swiotlb.c Sun Jul 15 13:48:57 2007 -0600
@@ -613,7 +613,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;
@@ -786,7 +786,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 34d01b3157e2 -r bf38300f5e63 arch/ia64/xen/xen_dma.c
--- a/arch/ia64/xen/xen_dma.c Sun Jul 15 13:44:09 2007 -0600
+++ b/arch/ia64/xen/xen_dma.c Sun Jul 15 13:48:57 2007 -0600
@@ -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 34d01b3157e2 -r bf38300f5e63 include/asm-ia64/hypervisor.h
--- a/include/asm-ia64/hypervisor.h Sun Jul 15 13:44:09 2007 -0600
+++ b/include/asm-ia64/hypervisor.h Sun Jul 15 13:48:57 2007 -0600
@@ -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 34d01b3157e2 -r bf38300f5e63 include/asm-ia64/maddr.h
--- a/include/asm-ia64/maddr.h Sun Jul 15 13:44:09 2007 -0600
+++ b/include/asm-ia64/maddr.h Sun Jul 15 13:48:57 2007 -0600
@@ -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 */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|