ia64/xen-unstable

changeset 9646:b765c96f8127

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>
author kaf24@firebug.cl.cam.ac.uk
date Mon Apr 10 11:39:32 2006 +0100 (2006-04-10)
parents 1c03c45d0c06
children 4ed269ac7d84
files linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c	Mon Apr 10 10:57:38 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c	Mon Apr 10 11:39:32 2006 +0100
     1.3 @@ -69,7 +69,7 @@ dma_map_sg(struct device *hwdev, struct 
     1.4  	} else {
     1.5  		for (i = 0; i < nents; i++ ) {
     1.6  			sg[i].dma_address =
     1.7 -				page_to_phys(sg[i].page) + sg[i].offset;
     1.8 +				page_to_bus(sg[i].page) + sg[i].offset;
     1.9  			sg[i].dma_length  = sg[i].length;
    1.10  			BUG_ON(!sg[i].page);
    1.11  			IOMMU_BUG_ON(address_needs_mapping(
    1.12 @@ -105,7 +105,7 @@ dma_map_page(struct device *dev, struct 
    1.13  		dma_addr = swiotlb_map_page(
    1.14  			dev, page, offset, size, direction);
    1.15  	} else {
    1.16 -		dma_addr = page_to_phys(page) + offset;
    1.17 +		dma_addr = page_to_bus(page) + offset;
    1.18  		IOMMU_BUG_ON(address_needs_mapping(dev, dma_addr));
    1.19  	}
    1.20  
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Mon Apr 10 10:57:38 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Mon Apr 10 11:39:32 2006 +0100
     2.3 @@ -32,7 +32,7 @@ EXPORT_SYMBOL(swiotlb);
     2.4  
     2.5  #define OFFSET(val,align) ((unsigned long)((val) & ( (align) - 1)))
     2.6  
     2.7 -#define SG_ENT_PHYS_ADDRESS(sg)	(page_to_phys((sg)->page) + (sg)->offset)
     2.8 +#define SG_ENT_PHYS_ADDRESS(sg)	(page_to_bus((sg)->page) + (sg)->offset)
     2.9  
    2.10  /*
    2.11   * Maximum allowable number of contiguous slabs to map,
    2.12 @@ -607,7 +607,7 @@ swiotlb_map_page(struct device *hwdev, s
    2.13  	dma_addr_t dev_addr;
    2.14  	char *map;
    2.15  
    2.16 -	dev_addr = page_to_phys(page) + offset;
    2.17 +	dev_addr = page_to_bus(page) + offset;
    2.18  	if (address_needs_mapping(hwdev, dev_addr)) {
    2.19  		buffer.page   = page;
    2.20  		buffer.offset = offset;
     3.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h	Mon Apr 10 10:57:38 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h	Mon Apr 10 11:39:32 2006 +0100
     3.3 @@ -102,6 +102,7 @@ static inline void * phys_to_virt(unsign
     3.4   */
     3.5  #define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
     3.6  #define page_to_phys(page)	 (phys_to_machine(page_to_pseudophys(page)))
     3.7 +#define page_to_bus(page)	 (phys_to_machine(page_to_pseudophys(page)))
     3.8  
     3.9  #define bio_to_pseudophys(bio)	 (page_to_pseudophys(bio_page((bio))) + \
    3.10  				  (unsigned long) bio_offset((bio)))
     4.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h	Mon Apr 10 10:57:38 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h	Mon Apr 10 11:39:32 2006 +0100
     4.3 @@ -130,6 +130,7 @@ static inline void * phys_to_virt(unsign
     4.4   */
     4.5  #define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
     4.6  #define page_to_phys(page)	 (phys_to_machine(page_to_pseudophys(page)))
     4.7 +#define page_to_bus(page)	 (phys_to_machine(page_to_pseudophys(page)))
     4.8  
     4.9  #define bio_to_pseudophys(bio)	 (page_to_pseudophys(bio_page((bio))) + \
    4.10  				  (unsigned long) bio_offset((bio)))