]> xenbits.xensource.com Git - people/ssmith/netchannel2-pvops.git/commitdiff
xen/swiotlb: add hook for swiotlb_arch_range_needs_mapping
authorIan Campbell <ian.campbell@citrix.com>
Mon, 9 Feb 2009 20:05:53 +0000 (12:05 -0800)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Fri, 26 Jun 2009 00:03:44 +0000 (17:03 -0700)
Add hook so that Xen can determine whether a particular address range needs
pfn<->mfn mapping.

[ Impact: make Xen DMA work ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Reviewed-by: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
arch/x86/kernel/pci-swiotlb.c
arch/x86/xen/pci-swiotlb.c
drivers/pci/xen-iommu.c
include/xen/swiotlb.h

index 3e2ffd6e6d8df4d7c2f2aaed22a541734a974c76..9640e17c69c41270194f70ce61a92b615231ac9c 100644 (file)
 
 int swiotlb __read_mostly;
 
-int __weak swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size)
-{
-       return 0;
-}
-
 static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
                                        dma_addr_t *dma_handle, gfp_t flags)
 {
index 3c6ac3bedf3ccb5b32bec594daaa105a261d20ed..e7e94144dd0feda9ed76e9d6f3f4448a72945973 100644 (file)
@@ -41,3 +41,11 @@ phys_addr_t swiotlb_bus_to_phys(struct device *hwdev, dma_addr_t baddr)
 
        return baddr;
 }
+
+int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size)
+{
+       if (xen_pv_domain())
+               return xen_range_needs_mapping(paddr, size);
+
+       return 0;
+}
index a5a3b329b41e0929eb323a8c34aaa2bab2fed1e6..be50f0f15909d75b9759b21a93a73f02b648d575 100644 (file)
@@ -119,6 +119,11 @@ static int range_straddles_page_boundary(phys_addr_t p, size_t size)
        return 1;
 }
 
+int xen_range_needs_mapping(phys_addr_t paddr, size_t size)
+{
+       return range_straddles_page_boundary(paddr, size);
+}
+
 static inline void xen_dma_unmap_page(struct page *page)
 {
        /* Xen TODO: 2.6.18 xen calls __gnttab_dma_unmap_page here
index 4229f27a25c7d1247a1daac08329f5ee15754214..8b51ff74855d762b35f37aa67f346e455bdbf760 100644 (file)
@@ -4,5 +4,6 @@
 extern void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs);
 extern phys_addr_t xen_bus_to_phys(dma_addr_t daddr);
 extern dma_addr_t xen_phys_to_bus(phys_addr_t paddr);
+extern int xen_range_needs_mapping(phys_addr_t phys, size_t size);
 
 #endif /* _XEN_SWIOTLB_H */