aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-04-10 11:39:32 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-04-10 11:39:32 +0100
commitd033b064ca456423fc0c55822497aa9354f6ecd8 (patch)
tree404c39d290fca8f78dbaa19701c4c870ccd519ed
parentd36204c3835c794d014c0da489eaf41c517f4fe6 (diff)
downloadxen-d033b064ca456423fc0c55822497aa9354f6ecd8.tar.gz
xen-d033b064ca456423fc0c55822497aa9354f6ecd8.tar.bz2
xen-d033b064ca456423fc0c55822497aa9354f6ecd8.zip
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@valinux.co.jp>
-rw-r--r--linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c4
-rw-r--r--linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c4
-rw-r--r--linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h1
-rw-r--r--linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h1
4 files changed, 6 insertions, 4 deletions
diff --git a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
index 4d96270261..eb616232c7 100644
--- a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
@@ -69,7 +69,7 @@ dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
} 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_map_page(struct device *dev, struct page *page, unsigned long offset,
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 --git a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
index e493e345c5..da0a0981ca 100644
--- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
@@ -32,7 +32,7 @@ EXPORT_SYMBOL(swiotlb);
#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 @@ swiotlb_map_page(struct device *hwdev, struct page *page,
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 --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h
index 5961a42a89..7f9b7cdd36 100644
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h
@@ -102,6 +102,7 @@ static inline void * phys_to_virt(unsigned long address)
*/
#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 --git a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
index c024447ae6..1ae9c89ba9 100644
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
@@ -130,6 +130,7 @@ static inline void * phys_to_virt(unsigned long address)
*/
#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)))