ia64/xen-unstable

changeset 11041:29ef650eb22a

[IA64] fix non-CONFIG_XEN sparse tree build

This patch fixes some over-zealous code removal with the P==M
cleanup. Some of the P==M code was shared with the bare metal kernel.
Also cleaned up a couple places we should have used CONFIG_XEN.

From: Juan Quintela <quintela@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Wed Aug 16 09:15:17 2006 -0600 (2006-08-16)
parents 92c62a897c82
children e6eede7648ee
files linux-2.6-xen-sparse/arch/ia64/kernel/setup.c linux-2.6-xen-sparse/include/asm-ia64/agp.h linux-2.6-xen-sparse/include/asm-ia64/dma-mapping.h linux-2.6-xen-sparse/include/asm-ia64/io.h linux-2.6-xen-sparse/include/asm-ia64/machvec.h linux-2.6-xen-sparse/include/asm-ia64/page.h linux-2.6-xen-sparse/include/asm-ia64/pgalloc.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Wed Aug 16 09:13:03 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Wed Aug 16 09:15:17 2006 -0600
     1.3 @@ -565,7 +565,9 @@ setup_arch (char **cmdline_p)
     1.4  
     1.5  	platform_setup(cmdline_p);
     1.6  	paging_init();
     1.7 +#ifdef CONFIG_XEN
     1.8  	contiguous_bitmap_init(max_pfn);
     1.9 +#endif
    1.10  }
    1.11  
    1.12  /*
     2.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/agp.h	Wed Aug 16 09:13:03 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/agp.h	Wed Aug 16 09:15:17 2006 -0600
     2.3 @@ -19,10 +19,21 @@
     2.4  #define flush_agp_cache()		mb()
     2.5  
     2.6  /* Convert a physical address to an address suitable for the GART. */
     2.7 +#ifndef CONFIG_XEN
     2.8 +#define phys_to_gart(x) (x)
     2.9 +#define gart_to_phys(x) (x)
    2.10 +#else
    2.11  #define phys_to_gart(x) phys_to_machine_for_dma(x)
    2.12  #define gart_to_phys(x) machine_to_phys_for_dma(x)
    2.13 +#endif
    2.14  
    2.15  /* GATT allocation. Returns/accepts GATT kernel virtual address. */
    2.16 +#ifndef CONFIG_XEN
    2.17 +#define alloc_gatt_pages(order)		\
    2.18 +	((char *)__get_free_pages(GFP_KERNEL, (order)))
    2.19 +#define free_gatt_pages(table, order)	\
    2.20 +	free_pages((unsigned long)(table), (order))
    2.21 +#else
    2.22  #include <asm/hypervisor.h>
    2.23  static inline char*
    2.24  alloc_gatt_pages(unsigned int order)
    2.25 @@ -46,5 +57,6 @@ free_gatt_pages(void* table, unsigned in
    2.26  	xen_destroy_contiguous_region((unsigned long)table, order);
    2.27  	free_pages((unsigned long)table, order);
    2.28  }
    2.29 +#endif /* CONFIG_XEN */
    2.30  
    2.31  #endif /* _ASM_IA64_AGP_H */
     3.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/dma-mapping.h	Wed Aug 16 09:13:03 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/dma-mapping.h	Wed Aug 16 09:15:17 2006 -0600
     3.3 @@ -7,11 +7,28 @@
     3.4   */
     3.5  #include <linux/config.h>
     3.6  #include <asm/machvec.h>
     3.7 +#ifdef CONFIG_XEN
     3.8  /* Needed for arch/i386/kernel/swiotlb.c and arch/i386/kernel/pci-dma-xen.c */
     3.9  #include <asm/hypervisor.h>
    3.10  /* Needed for arch/i386/kernel/swiotlb.c */
    3.11  #include <asm-i386/mach-xen/asm/swiotlb.h>
    3.12 +#endif
    3.13  
    3.14 +#ifndef CONFIG_XEN
    3.15 +#define dma_alloc_coherent	platform_dma_alloc_coherent
    3.16 +#define dma_alloc_noncoherent	platform_dma_alloc_coherent	/* coherent mem. is cheap */
    3.17 +#define dma_free_coherent	platform_dma_free_coherent
    3.18 +#define dma_free_noncoherent	platform_dma_free_coherent
    3.19 +#define dma_map_single		platform_dma_map_single
    3.20 +#define dma_map_sg		platform_dma_map_sg
    3.21 +#define dma_unmap_single	platform_dma_unmap_single
    3.22 +#define dma_unmap_sg		platform_dma_unmap_sg
    3.23 +#define dma_sync_single_for_cpu	platform_dma_sync_single_for_cpu
    3.24 +#define dma_sync_sg_for_cpu	platform_dma_sync_sg_for_cpu
    3.25 +#define dma_sync_single_for_device platform_dma_sync_single_for_device
    3.26 +#define dma_sync_sg_for_device	platform_dma_sync_sg_for_device
    3.27 +#define dma_mapping_error	platform_dma_mapping_error
    3.28 +#else
    3.29  int dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
    3.30                 enum dma_data_direction direction);
    3.31  void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
    3.32 @@ -50,6 +67,7 @@ dma_sync_sg_for_device(struct device *de
    3.33  		swiotlb_sync_sg_for_device(dev,sg,nelems,direction);
    3.34  	flush_write_buffers();
    3.35  }
    3.36 +#endif
    3.37  
    3.38  #define dma_map_page(dev, pg, off, size, dir)				\
    3.39  	dma_map_single(dev, page_address(pg) + (off), (size), (dir))
    3.40 @@ -91,6 +109,7 @@ dma_cache_sync (void *vaddr, size_t size
    3.41  
    3.42  #define dma_is_consistent(dma_handle)	(1)	/* all we do is coherent memory... */
    3.43  
    3.44 +#ifdef CONFIG_XEN
    3.45  /* arch/i386/kernel/swiotlb.o requires */
    3.46  void contiguous_bitmap_init(unsigned long end_pfn);
    3.47  
    3.48 @@ -111,5 +130,6 @@ range_straddles_page_boundary(void *p, s
    3.49  	return (((((unsigned long)p & ~PAGE_MASK) + size) > PAGE_SIZE) &&
    3.50  	        !test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap));
    3.51  }
    3.52 +#endif
    3.53  
    3.54  #endif /* _ASM_IA64_DMA_MAPPING_H */
     4.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/io.h	Wed Aug 16 09:13:03 2006 -0600
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/io.h	Wed Aug 16 09:15:17 2006 -0600
     4.3 @@ -97,6 +97,11 @@ extern int valid_mmap_phys_addr_range (u
     4.4   * The following two macros are deprecated and scheduled for removal.
     4.5   * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
     4.6   */
     4.7 +#ifndef CONFIG_XEN
     4.8 +#define bus_to_virt	phys_to_virt
     4.9 +#define virt_to_bus	virt_to_phys
    4.10 +#define page_to_bus	page_to_phys
    4.11 +#else
    4.12  #define bus_to_virt(bus)	\
    4.13  	phys_to_virt(machine_to_phys_for_dma(bus))
    4.14  #define virt_to_bus(virt)	\
    4.15 @@ -124,6 +129,7 @@ extern int valid_mmap_phys_addr_range (u
    4.16  	(((bvec_to_bus((vec1)) + (vec1)->bv_len) == bvec_to_bus((vec2))) && \
    4.17  	 ((bvec_to_pseudophys((vec1)) + (vec1)->bv_len) ==		\
    4.18  	  bvec_to_pseudophys((vec2))))
    4.19 +#endif /* CONFIG_XEN */
    4.20  
    4.21  # endif /* KERNEL */
    4.22  
     5.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/machvec.h	Wed Aug 16 09:13:03 2006 -0600
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/machvec.h	Wed Aug 16 09:15:17 2006 -0600
     5.3 @@ -247,6 +247,7 @@ extern void machvec_init (const char *na
     5.4  #  error Unknown configuration.  Update asm-ia64/machvec.h.
     5.5  # endif /* CONFIG_IA64_GENERIC */
     5.6  
     5.7 +#ifdef CONFIG_XEN
     5.8  # define platform_dma_map_sg		dma_map_sg
     5.9  # define platform_dma_unmap_sg		dma_unmap_sg
    5.10  # define platform_dma_mapping_error	dma_mapping_error
    5.11 @@ -259,6 +260,7 @@ extern void machvec_init (const char *na
    5.12  					dma_sync_single_for_cpu
    5.13  # define platform_dma_sync_single_for_device \
    5.14  					dma_sync_single_for_device
    5.15 +#endif
    5.16  
    5.17  /*
    5.18   * Declare default routines which aren't declared anywhere else:
     6.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/page.h	Wed Aug 16 09:13:03 2006 -0600
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/page.h	Wed Aug 16 09:15:17 2006 -0600
     6.3 @@ -117,6 +117,9 @@ extern unsigned long max_low_pfn;
     6.4  # define pfn_to_page(pfn)	(vmem_map + (pfn))
     6.5  #endif
     6.6  
     6.7 +#ifndef CONFIG_XEN
     6.8 +#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
     6.9 +#endif
    6.10  #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
    6.11  #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
    6.12  
     7.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/pgalloc.h	Wed Aug 16 09:13:03 2006 -0600
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/pgalloc.h	Wed Aug 16 09:15:17 2006 -0600
     7.3 @@ -126,7 +126,11 @@ static inline void pmd_free(pmd_t * pmd)
     7.4  static inline void
     7.5  pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
     7.6  {
     7.7 +#ifndef CONFIG_XEN
     7.8 +	pmd_val(*pmd_entry) = page_to_phys(pte);
     7.9 +#else
    7.10  	pmd_val(*pmd_entry) = page_to_pseudophys(pte);
    7.11 +#endif
    7.12  }
    7.13  
    7.14  static inline void