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-changelog

[Xen-changelog] Introduce page_to_bus() and use it in pci-dma-xen.c and

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Introduce page_to_bus() and use it in pci-dma-xen.c and swiotlb.c. On
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Apr 2006 13:16:07 +0000
Delivery-date: Mon, 10 Apr 2006 06:16:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b765c96f8127581208840cb93ea1c35d92535e6d
# Parent  1c03c45d0c062c6de7b9e94bf72128926ed32e84
Introduce page_to_bus() and use it in pci-dma-xen.c and swiotlb.c. On
xen/ia64 with the P2M/VP model pseudo physical address(gpaddr) is
fully virtualized so it defines
xen_features(XENFEAT_auto_translated_physmap) = 1.  In this case
page_to_phys(page) should return pseudo physical address like
pfn_to_mfn() and its families.  However dma is not virtualized, it
can't be used for pci-dma-xen.c, swiotlb.c.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 1c03c45d0c06 -r b765c96f8127 
linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c       Mon Apr 10 
09:57:38 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c       Mon Apr 10 
10:39:32 2006
@@ -69,7 +69,7 @@
        } else {
                for (i = 0; i < nents; i++ ) {
                        sg[i].dma_address =
-                               page_to_phys(sg[i].page) + sg[i].offset;
+                               page_to_bus(sg[i].page) + sg[i].offset;
                        sg[i].dma_length  = sg[i].length;
                        BUG_ON(!sg[i].page);
                        IOMMU_BUG_ON(address_needs_mapping(
@@ -105,7 +105,7 @@
                dma_addr = swiotlb_map_page(
                        dev, page, offset, size, direction);
        } else {
-               dma_addr = page_to_phys(page) + offset;
+               dma_addr = page_to_bus(page) + offset;
                IOMMU_BUG_ON(address_needs_mapping(dev, dma_addr));
        }
 
diff -r 1c03c45d0c06 -r b765c96f8127 
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Mon Apr 10 09:57:38 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Mon Apr 10 10:39:32 2006
@@ -32,7 +32,7 @@
 
 #define OFFSET(val,align) ((unsigned long)((val) & ( (align) - 1)))
 
-#define SG_ENT_PHYS_ADDRESS(sg)        (page_to_phys((sg)->page) + 
(sg)->offset)
+#define SG_ENT_PHYS_ADDRESS(sg)        (page_to_bus((sg)->page) + (sg)->offset)
 
 /*
  * Maximum allowable number of contiguous slabs to map,
@@ -607,7 +607,7 @@
        dma_addr_t dev_addr;
        char *map;
 
-       dev_addr = page_to_phys(page) + offset;
+       dev_addr = page_to_bus(page) + offset;
        if (address_needs_mapping(hwdev, dev_addr)) {
                buffer.page   = page;
                buffer.offset = offset;
diff -r 1c03c45d0c06 -r b765c96f8127 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h   Mon Apr 10 
09:57:38 2006
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h   Mon Apr 10 
10:39:32 2006
@@ -102,6 +102,7 @@
  */
 #define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 #define page_to_phys(page)      (phys_to_machine(page_to_pseudophys(page)))
+#define page_to_bus(page)       (phys_to_machine(page_to_pseudophys(page)))
 
 #define bio_to_pseudophys(bio)  (page_to_pseudophys(bio_page((bio))) + \
                                  (unsigned long) bio_offset((bio)))
diff -r 1c03c45d0c06 -r b765c96f8127 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h Mon Apr 10 
09:57:38 2006
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h Mon Apr 10 
10:39:32 2006
@@ -130,6 +130,7 @@
  */
 #define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 #define page_to_phys(page)      (phys_to_machine(page_to_pseudophys(page)))
+#define page_to_bus(page)       (phys_to_machine(page_to_pseudophys(page)))
 
 #define bio_to_pseudophys(bio)  (page_to_pseudophys(bio_page((bio))) + \
                                  (unsigned long) bio_offset((bio)))

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Introduce page_to_bus() and use it in pci-dma-xen.c and swiotlb.c. On, Xen patchbot -unstable <=