ia64/xen-unstable

changeset 4732:593703cf4935

bitkeeper revision 1.1327.1.19 (427664a4ddicjiXeRHKCKKrSnBvjug)

Last round of cleanup (for now)
author djm@kirby.fc.hp.com
date Mon May 02 17:34:28 2005 +0000 (2005-05-02)
parents f232d7893e76
children e47e0444dcb7
files .rootkeys xen/arch/ia64/Makefile xen/arch/ia64/patch/linux-2.6.11/page.h xen/arch/ia64/patch/linux-2.6.11/pgalloc.h xen/arch/ia64/patch/linux-2.6.11/setup.c xen/arch/ia64/patch/linux-2.6.11/swiotlb.c xen/arch/ia64/patch/linux-2.6.11/system.h xen/arch/ia64/patch/linux-2.6.11/time.c xen/arch/ia64/patch/linux-2.6.11/tlb.c xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/.rootkeys	Fri Apr 29 22:31:36 2005 +0000
     1.2 +++ b/.rootkeys	Mon May 02 17:34:28 2005 +0000
     1.3 @@ -1100,7 +1100,6 @@ 425ae516QfmjiF_a-mabAXqV8Imzkg xen/arch/
     1.4  425ae516EWaNOBEnc1xnphTbRmNZsw xen/arch/ia64/patch/linux-2.6.11/processor.h
     1.5  425ae516LecDyXlwh3NLBtHZKXmMcA xen/arch/ia64/patch/linux-2.6.11/series
     1.6  425ae516RFiPn2CGkpJ21LM-1lJcQg xen/arch/ia64/patch/linux-2.6.11/setup.c
     1.7 -425ae516FX_10YaKGMU8Ysf7kkdm_A xen/arch/ia64/patch/linux-2.6.11/swiotlb.c
     1.8  425ae516p4ICTkjqNYEfYFxqULj4dw xen/arch/ia64/patch/linux-2.6.11/system.h
     1.9  425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c
    1.10  425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c
     2.1 --- a/xen/arch/ia64/Makefile	Fri Apr 29 22:31:36 2005 +0000
     2.2 +++ b/xen/arch/ia64/Makefile	Mon May 02 17:34:28 2005 +0000
     2.3 @@ -7,7 +7,7 @@ OBJS = xensetup.o setup.o time.o irq.o i
     2.4  	machvec.o dom0_ops.o domain.o \
     2.5  	idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \
     2.6  	xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \
     2.7 -	extable.o linuxextable.o xenirq.o \
     2.8 +	extable.o linuxextable.o xenirq.o xentime.o \
     2.9  	regionreg.o entry.o unaligned.o privop.o vcpu.o \
    2.10  	irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o
    2.11  # perfmon.o
     3.1 --- a/xen/arch/ia64/patch/linux-2.6.11/page.h	Fri Apr 29 22:31:36 2005 +0000
     3.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/page.h	Mon May 02 17:34:28 2005 +0000
     3.3 @@ -1,52 +1,34 @@
     3.4 - page.h |   42 +++++++++++++++++++++++++++++++++++++++---
     3.5 - 1 files changed, 39 insertions(+), 3 deletions(-)
     3.6 -
     3.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h
     3.8 -===================================================================
     3.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/page.h	2005-04-06 22:58:07.597539393 -0500
    3.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/page.h	2005-04-06 23:06:15.908576975 -0500
    3.11 -@@ -12,6 +12,9 @@
    3.12 - #include <asm/intrinsics.h>
    3.13 - #include <asm/types.h>
    3.14 - 
    3.15 -+#ifndef __ASSEMBLY__
    3.16 -+#include <asm/flushtlb.h>
    3.17 -+#endif
    3.18 - /*
    3.19 -  * PAGE_SHIFT determines the actual kernel page size.
    3.20 -  */
    3.21 -@@ -95,9 +98,11 @@ extern int ia64_pfn_valid (unsigned long
    3.22 +--- ../../linux-2.6.11/include/asm-ia64/page.h	2005-03-02 00:37:48.000000000 -0700
    3.23 ++++ include/asm-ia64/page.h	2005-05-02 11:25:33.000000000 -0600
    3.24 +@@ -95,9 +95,15 @@
    3.25   #endif
    3.26   
    3.27   #ifndef CONFIG_DISCONTIGMEM
    3.28  +#ifdef XEN
    3.29 -+#define pfn_valid(pfn)		(0)
    3.30 ++# define pfn_valid(pfn)		(0)
    3.31 ++# define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
    3.32 ++# define pfn_to_page(_pfn)	(frame_table + (_pfn))
    3.33  +#else
    3.34   # define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
    3.35 --# define page_to_pfn(page)	((unsigned long) (page - mem_map))
    3.36 --# define pfn_to_page(pfn)	(mem_map + (pfn))
    3.37 + # define page_to_pfn(page)	((unsigned long) (page - mem_map))
    3.38 + # define pfn_to_page(pfn)	(mem_map + (pfn))
    3.39  +#endif
    3.40   #else
    3.41   extern struct page *vmem_map;
    3.42   extern unsigned long max_low_pfn;
    3.43 -@@ -106,9 +111,15 @@ extern unsigned long max_low_pfn;
    3.44 - # define pfn_to_page(pfn)	(vmem_map + (pfn))
    3.45 - #endif
    3.46 - 
    3.47 --#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
    3.48 -+#define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
    3.49 -+#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
    3.50 -+
    3.51 -+#define page_to_phys(_page)	(page_to_pfn(_page) << PAGE_SHIFT)
    3.52 +@@ -109,6 +115,11 @@
    3.53 + #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
    3.54   #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
    3.55   
    3.56 -+#define pfn_to_page(_pfn)	(frame_table + (_pfn))
    3.57 ++#ifdef XEN
    3.58 ++#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
    3.59  +#define phys_to_page(kaddr)	pfn_to_page(((kaddr) >> PAGE_SHIFT))
    3.60 ++#endif
    3.61  +
    3.62   typedef union ia64_va {
    3.63   	struct {
    3.64   		unsigned long off : 61;		/* intra-region offset */
    3.65 -@@ -124,8 +135,25 @@ typedef union ia64_va {
    3.66 +@@ -124,8 +135,23 @@
    3.67    * expressed in this way to ensure they result in a single "dep"
    3.68    * instruction.
    3.69    */
    3.70 @@ -63,8 +45,6 @@ Index: linux-2.6.11-xendiffs/include/asm
    3.71  +// xen/drivers/console.c uses __va in a declaration (should be fixed!)
    3.72  +#define __pa(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
    3.73  +#define __va(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
    3.74 -+//# define __pa(x)	((unsigned long)(((unsigned long)x) - PAGE_OFFSET))
    3.75 -+//# define __va(x)	((void *)((char *)(x) + PAGE_OFFSET))
    3.76  +#else
    3.77   #define __pa(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
    3.78   #define __va(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
    3.79 @@ -72,7 +52,7 @@ Index: linux-2.6.11-xendiffs/include/asm
    3.80   
    3.81   #define REGION_NUMBER(x)	({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
    3.82   #define REGION_OFFSET(x)	({ia64_va _v; _v.l = (long) (x); _v.f.off;})
    3.83 -@@ -197,11 +225,19 @@ get_order (unsigned long size)
    3.84 +@@ -197,7 +223,11 @@
    3.85   # define __pgprot(x)	(x)
    3.86   #endif /* !STRICT_MM_TYPECHECKS */
    3.87   
    3.88 @@ -84,11 +64,3 @@ Index: linux-2.6.11-xendiffs/include/asm
    3.89   
    3.90   #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE |					\
    3.91   					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |		\
    3.92 - 					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
    3.93 - 					  ? VM_EXEC : 0))
    3.94 - 
    3.95 -+#ifdef XEN
    3.96 -+#define __flush_tlb() do {} while(0);
    3.97 -+#endif
    3.98 -+
    3.99 - #endif /* _ASM_IA64_PAGE_H */
     4.1 --- a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Fri Apr 29 22:31:36 2005 +0000
     4.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Mon May 02 17:34:28 2005 +0000
     4.3 @@ -1,78 +1,72 @@
     4.4 - pgalloc.h |   17 +++++++++++------
     4.5 - 1 files changed, 11 insertions(+), 6 deletions(-)
     4.6 -
     4.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h
     4.8 -===================================================================
     4.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/pgalloc.h	2005-04-08 11:57:30.909774800 -0500
    4.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h	2005-04-08 11:58:08.102711219 -0500
    4.11 -@@ -18,6 +18,7 @@
    4.12 - #include <linux/compiler.h>
    4.13 - #include <linux/mm.h>
    4.14 - #include <linux/page-flags.h>
    4.15 -+#include <linux/preempt.h>
    4.16 - #include <linux/threads.h>
    4.17 - 
    4.18 - #include <asm/mmu_context.h>
    4.19 -@@ -34,6 +35,10 @@
    4.20 - #define pmd_quicklist		(local_cpu_data->pmd_quick)
    4.21 - #define pgtable_cache_size	(local_cpu_data->pgtable_cache_sz)
    4.22 - 
    4.23 -+/* FIXME: Later 3 level page table should be over, to create 
    4.24 -+ * new interface upon xen memory allocator. To simplify first
    4.25 -+ * effort moving to xen allocator, use xenheap pages temporarily. 
    4.26 -+ */
    4.27 - static inline pgd_t*
    4.28 - pgd_alloc_one_fast (struct mm_struct *mm)
    4.29 - {
    4.30 -@@ -61,7 +66,7 @@ pgd_alloc (struct mm_struct *mm)
    4.31 +--- ../../linux-2.6.11/include/asm-ia64/pgalloc.h	2005-03-02 00:37:31.000000000 -0700
    4.32 ++++ include/asm-ia64/pgalloc.h	2005-04-29 17:09:20.000000000 -0600
    4.33 +@@ -61,7 +61,11 @@
    4.34   	pgd_t *pgd = pgd_alloc_one_fast(mm);
    4.35   
    4.36   	if (unlikely(pgd == NULL)) {
    4.37 --		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
    4.38 ++#ifdef XEN
    4.39  +		pgd = (pgd_t *)alloc_xenheap_page();
    4.40 ++#else
    4.41 + 		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
    4.42 ++#endif
    4.43   	}
    4.44   	return pgd;
    4.45   }
    4.46 -@@ -104,7 +109,7 @@ pmd_alloc_one_fast (struct mm_struct *mm
    4.47 +@@ -104,7 +108,11 @@
    4.48   static inline pmd_t*
    4.49   pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
    4.50   {
    4.51 --	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
    4.52 ++#ifdef XEN
    4.53  +	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
    4.54 ++#else
    4.55 + 	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
    4.56 ++#endif
    4.57   
    4.58   	return pmd;
    4.59   }
    4.60 -@@ -136,7 +141,7 @@ pmd_populate_kernel (struct mm_struct *m
    4.61 +@@ -136,7 +144,11 @@
    4.62   static inline struct page *
    4.63   pte_alloc_one (struct mm_struct *mm, unsigned long addr)
    4.64   {
    4.65 --	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
    4.66 ++#ifdef XEN
    4.67  +	struct page *pte = alloc_xenheap_page();
    4.68 ++#else
    4.69 + 	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
    4.70 ++#endif
    4.71   
    4.72   	return pte;
    4.73   }
    4.74 -@@ -144,7 +149,7 @@ pte_alloc_one (struct mm_struct *mm, uns
    4.75 +@@ -144,7 +156,11 @@
    4.76   static inline pte_t *
    4.77   pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
    4.78   {
    4.79 --	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
    4.80 ++#ifdef XEN
    4.81  +	pte_t *pte = (pte_t *)alloc_xenheap_page();
    4.82 ++#else
    4.83 + 	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
    4.84 ++#endif
    4.85   
    4.86   	return pte;
    4.87   }
    4.88 -@@ -152,13 +157,13 @@ pte_alloc_one_kernel (struct mm_struct *
    4.89 +@@ -152,13 +168,21 @@
    4.90   static inline void
    4.91   pte_free (struct page *pte)
    4.92   {
    4.93 --	__free_page(pte);
    4.94 ++#ifdef XEN
    4.95  +	free_xenheap_page(pte);
    4.96 ++#else
    4.97 + 	__free_page(pte);
    4.98 ++#endif
    4.99   }
   4.100   
   4.101   static inline void
   4.102   pte_free_kernel (pte_t *pte)
   4.103   {
   4.104 --	free_page((unsigned long) pte);
   4.105 ++#ifdef XEN
   4.106  +	free_xenheap_page((unsigned long) pte);
   4.107 ++#else
   4.108 + 	free_page((unsigned long) pte);
   4.109 ++#endif
   4.110   }
   4.111   
   4.112   #define __pte_free_tlb(tlb, pte)	tlb_remove_page((tlb), (pte))
     5.1 --- a/xen/arch/ia64/patch/linux-2.6.11/setup.c	Fri Apr 29 22:31:36 2005 +0000
     5.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/setup.c	Mon May 02 17:34:28 2005 +0000
     5.3 @@ -1,191 +1,96 @@
     5.4 - setup.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------
     5.5 - 1 files changed, 58 insertions(+), 14 deletions(-)
     5.6 -
     5.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c
     5.8 -===================================================================
     5.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/setup.c	2005-04-07 17:44:13.294980153 -0500
    5.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c	2005-04-07 17:46:37.157717072 -0500
    5.11 -@@ -21,6 +21,9 @@
    5.12 - #include <linux/init.h>
    5.13 - 
    5.14 - #include <linux/acpi.h>
    5.15 -+#ifdef XEN
    5.16 -+#include <xen/sched.h>
    5.17 -+#endif
    5.18 - #include <linux/bootmem.h>
    5.19 - #include <linux/console.h>
    5.20 - #include <linux/delay.h>
    5.21 -@@ -30,13 +33,17 @@
    5.22 - #include <linux/seq_file.h>
    5.23 - #include <linux/string.h>
    5.24 - #include <linux/threads.h>
    5.25 -+#ifndef XEN
    5.26 - #include <linux/tty.h>
    5.27 - #include <linux/serial.h>
    5.28 - #include <linux/serial_core.h>
    5.29 -+#endif
    5.30 - #include <linux/efi.h>
    5.31 - #include <linux/initrd.h>
    5.32 +--- ../../linux-2.6.11/arch/ia64/kernel/setup.c	2005-03-02 00:37:49.000000000 -0700
    5.33 ++++ arch/ia64/setup.c	2005-05-02 10:04:03.000000000 -0600
    5.34 +@@ -127,7 +127,16 @@
    5.35 + 		range_end   = min(end, rsvd_region[i].start);
    5.36   
    5.37 -+#ifndef XEN
    5.38 - #include <asm/ia32.h>
    5.39 -+#endif
    5.40 - #include <asm/machvec.h>
    5.41 - #include <asm/mca.h>
    5.42 - #include <asm/meminit.h>
    5.43 -@@ -51,6 +58,12 @@
    5.44 - #include <asm/smp.h>
    5.45 - #include <asm/system.h>
    5.46 - #include <asm/unistd.h>
    5.47 + 		if (range_start < range_end)
    5.48  +#ifdef XEN
    5.49 -+#include <linux/mm.h>
    5.50 -+#include <asm/mmu_context.h>
    5.51 -+extern unsigned long loops_per_jiffy;		// from linux/init/main.c
    5.52 -+char saved_command_line[COMMAND_LINE_SIZE];	// from linux/init/main.c
    5.53 -+#endif
    5.54 - 
    5.55 - #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
    5.56 - # error "struct cpuinfo_ia64 too big!"
    5.57 -@@ -66,7 +79,9 @@ DEFINE_PER_CPU(unsigned long, local_per_
    5.58 - DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
    5.59 - unsigned long ia64_cycles_per_usec;
    5.60 - struct ia64_boot_param *ia64_boot_param;
    5.61 -+#ifndef XEN
    5.62 - struct screen_info screen_info;
    5.63 -+#endif
    5.64 - 
    5.65 - unsigned long ia64_max_cacheline_size;
    5.66 - unsigned long ia64_iobase;	/* virtual address for I/O accesses */
    5.67 -@@ -95,7 +110,6 @@ EXPORT_SYMBOL(ia64_max_iommu_merge_mask)
    5.68 - struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
    5.69 - int num_rsvd_regions;
    5.70 - 
    5.71 --
    5.72 - /*
    5.73 -  * Filter incoming memory segments based on the primitive map created from the boot
    5.74 -  * parameters. Segments contained in the map are removed from the memory ranges. A
    5.75 -@@ -125,9 +139,12 @@ filter_rsvd_memory (unsigned long start,
    5.76 - 	for (i = 0; i < num_rsvd_regions; ++i) {
    5.77 - 		range_start = max(start, prev_start);
    5.78 - 		range_end   = min(end, rsvd_region[i].start);
    5.79 --
    5.80 --		if (range_start < range_end)
    5.81 --			call_pernode_memory(__pa(range_start), range_end - range_start, func);
    5.82 ++		{
    5.83  +		/* init_boot_pages requires "ps, pe" */
    5.84 -+		if (range_start < range_end) {
    5.85  +			printk("Init boot pages: 0x%lx -> 0x%lx.\n",
    5.86  +				__pa(range_start), __pa(range_end));
    5.87  +			(*func)(__pa(range_start), __pa(range_end), 0);
    5.88  +		}
    5.89 ++#else
    5.90 + 			call_pernode_memory(__pa(range_start), range_end - range_start, func);
    5.91 ++#endif
    5.92   
    5.93   		/* nothing more available in this segment */
    5.94   		if (range_end == end) return 0;
    5.95 -@@ -184,17 +201,17 @@ reserve_memory (void)
    5.96 - 				+ strlen(__va(ia64_boot_param->command_line)) + 1);
    5.97 - 	n++;
    5.98 - 
    5.99 -+	/* Reserve xen image/bitmap/xen-heap */
   5.100 - 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
   5.101 --	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
   5.102 -+	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
   5.103 +@@ -185,7 +194,12 @@
   5.104   	n++;
   5.105   
   5.106 --#ifdef CONFIG_BLK_DEV_INITRD
   5.107 -+	/* This is actually dom0 image */
   5.108 - 	if (ia64_boot_param->initrd_start) {
   5.109 - 		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
   5.110 - 		rsvd_region[n].end   = rsvd_region[n].start + ia64_boot_param->initrd_size;
   5.111 - 		n++;
   5.112 - 	}
   5.113 --#endif
   5.114 + 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
   5.115 ++#ifdef XEN
   5.116 ++	/* Reserve xen image/bitmap/xen-heap */
   5.117 ++	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
   5.118 ++#else
   5.119 + 	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
   5.120 ++#endif
   5.121 + 	n++;
   5.122   
   5.123 - 	/* end of memory marker */
   5.124 - 	rsvd_region[n].start = ~0UL;
   5.125 -@@ -204,6 +221,16 @@ reserve_memory (void)
   5.126 - 	num_rsvd_regions = n;
   5.127 - 
   5.128 - 	sort_regions(rsvd_region, num_rsvd_regions);
   5.129 -+
   5.130 -+	{
   5.131 -+		int i;
   5.132 -+		printk("Reserved regions: \n");
   5.133 -+		for (i = 0; i < num_rsvd_regions; i++)
   5.134 -+			printk("  [%d] -> [0x%lx, 0x%lx]\n",
   5.135 -+				i,
   5.136 -+				rsvd_region[i].start,
   5.137 -+				rsvd_region[i].end);
   5.138 -+	}
   5.139 + #ifdef CONFIG_BLK_DEV_INITRD
   5.140 +@@ -299,7 +313,11 @@
   5.141   }
   5.142   
   5.143 - /**
   5.144 -@@ -298,18 +325,17 @@ mark_bsp_online (void)
   5.145 - #endif
   5.146 - }
   5.147 - 
   5.148 + void __init
   5.149  +#ifdef XEN
   5.150 - void __init
   5.151 --setup_arch (char **cmdline_p)
   5.152  +early_setup_arch (char **cmdline_p)
   5.153 ++#else
   5.154 + setup_arch (char **cmdline_p)
   5.155 ++#endif
   5.156   {
   5.157   	unw_init();
   5.158   
   5.159 --	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
   5.160 --
   5.161 +@@ -308,8 +326,14 @@
   5.162   	*cmdline_p = __va(ia64_boot_param->command_line);
   5.163   	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
   5.164 + 
   5.165 ++#ifdef XEN
   5.166  +	cmdline_parse(*cmdline_p);
   5.167 - 
   5.168 ++#undef CONFIG_ACPI_BOOT
   5.169 ++#endif
   5.170   	efi_init();
   5.171 --	io_port_init();
   5.172 ++#ifndef XEN
   5.173 + 	io_port_init();
   5.174 ++#endif
   5.175   
   5.176   #ifdef CONFIG_IA64_GENERIC
   5.177   	{
   5.178 -@@ -339,6 +365,10 @@ setup_arch (char **cmdline_p)
   5.179 - 	if (early_console_setup(*cmdline_p) == 0)
   5.180 - 		mark_bsp_online();
   5.181 +@@ -351,8 +375,17 @@
   5.182 + # endif
   5.183 + #endif /* CONFIG_APCI_BOOT */
   5.184   
   5.185 -+#ifdef XEN
   5.186 ++#ifndef XEN
   5.187 + 	find_memory();
   5.188 ++#else
   5.189 ++	io_port_init();
   5.190 ++}
   5.191 + 
   5.192 ++void __init
   5.193 ++late_setup_arch (char **cmdline_p)
   5.194 ++{
   5.195  +#undef CONFIG_ACPI_BOOT
   5.196  +#endif
   5.197 -+
   5.198 - #ifdef CONFIG_ACPI_BOOT
   5.199 - 	/* Initialize the ACPI boot-time table parser */
   5.200 - 	acpi_table_init();
   5.201 -@@ -350,9 +380,13 @@ setup_arch (char **cmdline_p)
   5.202 - 	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
   5.203 - # endif
   5.204 - #endif /* CONFIG_APCI_BOOT */
   5.205 -+	io_port_init();
   5.206 -+}
   5.207 -+#endif
   5.208 - 
   5.209 --	find_memory();
   5.210 --
   5.211 -+void __init
   5.212 -+setup_arch (void)
   5.213 -+{
   5.214   	/* process SAL system table: */
   5.215   	ia64_sal_init(efi.sal_systab);
   5.216   
   5.217 -@@ -388,7 +422,6 @@ setup_arch (char **cmdline_p)
   5.218 - 	if (!strstr(saved_command_line, "nomca"))
   5.219 - 		ia64_mca_init();
   5.220 - 
   5.221 --	platform_setup(cmdline_p);
   5.222 - 	paging_init();
   5.223 +@@ -492,12 +525,14 @@
   5.224 + {
   5.225   }
   5.226   
   5.227 -@@ -448,6 +481,9 @@ show_cpuinfo (struct seq_file *m, void *
   5.228 - 		sprintf(cp, " 0x%lx", mask);
   5.229 - 	}
   5.230 ++#ifndef XEN
   5.231 + struct seq_operations cpuinfo_op = {
   5.232 + 	.start =	c_start,
   5.233 + 	.next =		c_next,
   5.234 + 	.stop =		c_stop,
   5.235 + 	.show =		show_cpuinfo
   5.236 + };
   5.237 ++#endif
   5.238   
   5.239 -+#ifdef XEN
   5.240 -+#define seq_printf(a,b...) printf(b)
   5.241 -+#endif
   5.242 - 	seq_printf(m,
   5.243 - 		   "processor  : %d\n"
   5.244 - 		   "vendor     : %s\n"
   5.245 -@@ -659,11 +695,17 @@ cpu_init (void)
   5.246 + void
   5.247 + identify_cpu (struct cpuinfo_ia64 *c)
   5.248 +@@ -659,7 +694,11 @@
   5.249   					| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
   5.250   	atomic_inc(&init_mm.mm_count);
   5.251   	current->active_mm = &init_mm;
   5.252 @@ -197,18 +102,3 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
   5.253   		BUG();
   5.254   
   5.255   	ia64_mmu_init(ia64_imva(cpu_data));
   5.256 -+#ifndef XEN
   5.257 - 	ia64_mca_cpu_init(ia64_imva(cpu_data));
   5.258 -+#endif
   5.259 - 
   5.260 - #ifdef CONFIG_IA32_SUPPORT
   5.261 - 	ia32_cpu_init();
   5.262 -@@ -711,6 +753,8 @@ cpu_init (void)
   5.263 - void
   5.264 - check_bugs (void)
   5.265 - {
   5.266 -+#ifndef XEN
   5.267 - 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
   5.268 - 			       (unsigned long) __end___mckinley_e9_bundles);
   5.269 -+#endif
   5.270 - }
     6.1 --- a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c	Fri Apr 29 22:31:36 2005 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,77 +0,0 @@
     6.4 - swiotlb.c |   21 +++++++++++++--------
     6.5 - 1 files changed, 13 insertions(+), 8 deletions(-)
     6.6 -
     6.7 -Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c
     6.8 -===================================================================
     6.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c	2005-04-08 12:13:54.040202667 -0500
    6.10 -+++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c	2005-04-08 12:19:09.170367318 -0500
    6.11 -@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d
    6.12 - 	/*
    6.13 - 	 * Get IO TLB memory from the low pages
    6.14 - 	 */
    6.15 --	io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs *
    6.16 --					       (1 << IO_TLB_SHIFT));
    6.17 -+	/* FIXME: Do we really need swiotlb in HV? If all memory trunks
    6.18 -+	 * presented to guest as <4G, are actually <4G in machine range,
    6.19 -+	 * no DMA intevention from HV...
    6.20 -+	 */
    6.21 -+	io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT)));
    6.22 - 	if (!io_tlb_start)
    6.23 - 		panic("Cannot allocate SWIOTLB buffer");
    6.24 - 	io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
    6.25 -@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d
    6.26 - 	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
    6.27 - 	 * between io_tlb_start and io_tlb_end.
    6.28 - 	 */
    6.29 --	io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int));
    6.30 -+	io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int)));
    6.31 - 	for (i = 0; i < io_tlb_nslabs; i++)
    6.32 -  		io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
    6.33 - 	io_tlb_index = 0;
    6.34 --	io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
    6.35 -+	io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *)));
    6.36 - 
    6.37 - 	/*
    6.38 - 	 * Get the overflow emergency buffer
    6.39 - 	 */
    6.40 --	io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
    6.41 -+	io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow));
    6.42 - 	printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n",
    6.43 - 	       virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
    6.44 - }
    6.45 -@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw
    6.46 - 	 */
    6.47 - 	flags |= GFP_DMA;
    6.48 - 
    6.49 --	ret = (void *)__get_free_pages(flags, order);
    6.50 -+	ret = (void *)alloc_xenheap_pages(get_order(size));
    6.51 - 	if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) {
    6.52 - 		/*
    6.53 - 		 * The allocated memory isn't reachable by the device.
    6.54 - 		 * Fall back on swiotlb_map_single().
    6.55 - 		 */
    6.56 --		free_pages((unsigned long) ret, order);
    6.57 -+		free_xenheap_pages((unsigned long) ret, order);
    6.58 - 		ret = NULL;
    6.59 - 	}
    6.60 - 	if (!ret) {
    6.61 -@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd
    6.62 - {
    6.63 - 	if (!(vaddr >= (void *)io_tlb_start
    6.64 -                     && vaddr < (void *)io_tlb_end))
    6.65 --		free_pages((unsigned long) vaddr, get_order(size));
    6.66 -+		free_xenheap_pages((unsigned long) vaddr, get_order(size));
    6.67 - 	else
    6.68 - 		/* DMA_TO_DEVICE to avoid memcpy in unmap_single */
    6.69 - 		swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE);
    6.70 -@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t 
    6.71 - 	 * When the mapping is small enough return a static buffer to limit
    6.72 - 	 * the damage, or panic when the transfer is too big.
    6.73 - 	 */
    6.74 -+#ifndef XEN
    6.75 - 	printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at "
    6.76 - 	       "device %s\n", size, dev ? dev->bus_id : "?");
    6.77 -+#endif
    6.78 - 
    6.79 - 	if (size > io_tlb_overflow && do_panic) {
    6.80 - 		if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
     7.1 --- a/xen/arch/ia64/patch/linux-2.6.11/system.h	Fri Apr 29 22:31:36 2005 +0000
     7.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/system.h	Mon May 02 17:34:28 2005 +0000
     7.3 @@ -1,16 +1,10 @@
     7.4 - system.h |   15 +++++++++++++++
     7.5 - 1 files changed, 15 insertions(+)
     7.6 -
     7.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h
     7.8 -===================================================================
     7.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/system.h	2005-04-07 10:39:11.066701457 -0500
    7.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/system.h	2005-04-07 10:40:19.540544127 -0500
    7.11 -@@ -24,8 +24,16 @@
    7.12 +--- ../../linux-2.6.11/include/asm-ia64/system.h	2005-03-02 00:38:07.000000000 -0700
    7.13 ++++ include/asm-ia64/system.h	2005-05-02 10:18:30.000000000 -0600
    7.14 +@@ -24,8 +24,15 @@
    7.15    * 0xa000000000000000+2*PERCPU_PAGE_SIZE
    7.16    * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
    7.17    */
    7.18  +#ifdef XEN
    7.19 -+//#define KERNEL_START		 0xf000000100000000
    7.20  +#define KERNEL_START		 0xf000000004000000
    7.21  +#define PERCPU_ADDR		 0xf100000000000000-PERCPU_PAGE_SIZE
    7.22  +#define SHAREDINFO_ADDR		 0xf100000000000000
    7.23 @@ -22,7 +16,7 @@ Index: linux-2.6.11-xendiffs/include/asm
    7.24   
    7.25   #ifndef __ASSEMBLY__
    7.26   
    7.27 -@@ -218,9 +226,13 @@ extern void ia64_load_extra (struct task
    7.28 +@@ -218,9 +225,13 @@
    7.29   # define PERFMON_IS_SYSWIDE() (0)
    7.30   #endif
    7.31   
    7.32 @@ -36,13 +30,3 @@ Index: linux-2.6.11-xendiffs/include/asm
    7.33   
    7.34   #define __switch_to(prev,next,last) do {							 \
    7.35   	if (IA64_HAS_EXTRA_STATE(prev))								 \
    7.36 -@@ -249,6 +261,9 @@ extern void ia64_load_extra (struct task
    7.37 - #else
    7.38 - # define switch_to(prev,next,last)	__switch_to(prev, next, last)
    7.39 - #endif
    7.40 -+//#ifdef XEN
    7.41 -+//#undef switch_to
    7.42 -+//#endif
    7.43 - 
    7.44 - /*
    7.45 -  * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
     8.1 --- a/xen/arch/ia64/patch/linux-2.6.11/time.c	Fri Apr 29 22:31:36 2005 +0000
     8.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c	Mon May 02 17:34:28 2005 +0000
     8.3 @@ -1,259 +1,32 @@
     8.4  --- ../../linux-2.6.11/arch/ia64/kernel/time.c	2005-03-02 00:37:50.000000000 -0700
     8.5 -+++ arch/ia64/time.c	2005-04-28 14:29:58.000000000 -0600
     8.6 -@@ -10,16 +10,22 @@
     8.7 -  */
     8.8 - #include <linux/config.h>
     8.9 - 
    8.10 -+#ifndef XEN
    8.11 - #include <linux/cpu.h>
    8.12 -+#endif
    8.13 - #include <linux/init.h>
    8.14 - #include <linux/kernel.h>
    8.15 - #include <linux/module.h>
    8.16 -+#ifndef XEN
    8.17 - #include <linux/profile.h>
    8.18 -+#endif
    8.19 - #include <linux/sched.h>
    8.20 - #include <linux/time.h>
    8.21 - #include <linux/interrupt.h>
    8.22 - #include <linux/efi.h>
    8.23 -+#ifndef XEN
    8.24 - #include <linux/profile.h>
    8.25 -+#endif
    8.26 - #include <linux/timex.h>
    8.27 - 
    8.28 - #include <asm/machvec.h>
    8.29 -@@ -29,10 +35,19 @@
    8.30 ++++ arch/ia64/time.c	2005-05-02 11:19:29.000000000 -0600
    8.31 +@@ -29,6 +29,9 @@
    8.32   #include <asm/sal.h>
    8.33   #include <asm/sections.h>
    8.34   #include <asm/system.h>
    8.35  +#ifdef XEN
    8.36 -+#include <asm/ia64_int.h>
    8.37 ++#include <linux/jiffies.h>	// not included by xen/sched.h
    8.38  +#endif
    8.39   
    8.40   extern unsigned long wall_jiffies;
    8.41   
    8.42 -+#ifndef XEN
    8.43 - u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
    8.44 -+#else
    8.45 -+#define INITIAL_JIFFIES 0
    8.46 -+u64 jiffies_64 = INITIAL_JIFFIES;
    8.47 -+#define CPU_PROFILING 0
    8.48 -+#endif
    8.49 - 
    8.50 - EXPORT_SYMBOL(jiffies_64);
    8.51 - 
    8.52 -@@ -45,33 +60,155 @@
    8.53 +@@ -45,6 +48,7 @@
    8.54   
    8.55   #endif
    8.56   
    8.57 -+#ifdef XEN
    8.58 -+volatile unsigned long last_nsec_offset;
    8.59 -+extern seqlock_t xtime_lock;
    8.60 -+unsigned long cpu_khz;  /* Detected as we calibrate the TSC */
    8.61 -+static s_time_t        stime_irq;       /* System time at last 'time update' */
    8.62 -+
    8.63 -+static inline u64 get_time_delta(void)
    8.64 -+{
    8.65 -+	return ia64_get_itc();
    8.66 -+}
    8.67 -+
    8.68 -+s_time_t get_s_time(void)
    8.69 -+{
    8.70 -+    s_time_t now;
    8.71 -+    unsigned long flags;
    8.72 -+
    8.73 -+    read_lock_irqsave(&xtime_lock, flags);
    8.74 -+
    8.75 -+    now = stime_irq + get_time_delta();
    8.76 -+
    8.77 -+    /* Ensure that the returned system time is monotonically increasing. */
    8.78 -+    {
    8.79 -+        static s_time_t prev_now = 0;
    8.80 -+        if ( unlikely(now < prev_now) )
    8.81 -+            now = prev_now;
    8.82 -+        prev_now = now;
    8.83 -+    }
    8.84 -+
    8.85 -+    read_unlock_irqrestore(&xtime_lock, flags);
    8.86 -+
    8.87 -+    return now; 
    8.88 -+}
    8.89 -+
    8.90 -+void update_dom_time(struct exec_domain *ed)
    8.91 -+{
    8.92 -+// FIXME: implement this?
    8.93 -+//	printf("update_dom_time: called, not implemented, skipping\n");
    8.94 -+	return;
    8.95 -+}
    8.96 -+
    8.97 -+/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
    8.98 -+void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
    8.99 -+{
   8.100 -+// FIXME: Should this be do_settimeofday (from linux)???
   8.101 -+	printf("do_settime: called, not implemented, stopping\n");
   8.102 -+	dummy();
   8.103 -+}
   8.104 -+#endif
   8.105 -+
   8.106 -+#if 0	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   8.107 -+#endif	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   8.108 -+ 
   8.109  +#ifndef XEN
   8.110   static struct time_interpolator itc_interpolator = {
   8.111   	.shift = 16,
   8.112   	.mask = 0xffffffffffffffffLL,
   8.113 - 	.source = TIME_SOURCE_CPU
   8.114 - };
   8.115 -+#endif
   8.116 -+
   8.117 -+#ifdef XEN
   8.118 -+unsigned long domain0_ready = 0;	// FIXME (see below)
   8.119 -+#define typecheck(a,b)	1
   8.120 -+/* FROM linux/include/linux/jiffies.h */
   8.121 -+/*
   8.122 -+ *	These inlines deal with timer wrapping correctly. You are 
   8.123 -+ *	strongly encouraged to use them
   8.124 -+ *	1. Because people otherwise forget
   8.125 -+ *	2. Because if the timer wrap changes in future you won't have to
   8.126 -+ *	   alter your driver code.
   8.127 -+ *
   8.128 -+ * time_after(a,b) returns true if the time a is after time b.
   8.129 -+ *
   8.130 -+ * Do this with "<0" and ">=0" to only test the sign of the result. A
   8.131 -+ * good compiler would generate better code (and a really good compiler
   8.132 -+ * wouldn't care). Gcc is currently neither.
   8.133 -+ */
   8.134 -+#define time_after(a,b)		\
   8.135 -+	(typecheck(unsigned long, a) && \
   8.136 -+	 typecheck(unsigned long, b) && \
   8.137 -+	 ((long)(b) - (long)(a) < 0))
   8.138 -+#define time_before(a,b)	time_after(b,a)
   8.139 -+
   8.140 -+#define time_after_eq(a,b)	\
   8.141 -+	(typecheck(unsigned long, a) && \
   8.142 -+	 typecheck(unsigned long, b) && \
   8.143 -+	 ((long)(a) - (long)(b) >= 0))
   8.144 -+#define time_before_eq(a,b)	time_after_eq(b,a)
   8.145 -+#endif
   8.146 - 
   8.147 - static irqreturn_t
   8.148 - timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
   8.149 - {
   8.150 - 	unsigned long new_itm;
   8.151 - 
   8.152 -+#ifndef XEN
   8.153 - 	if (unlikely(cpu_is_offline(smp_processor_id()))) {
   8.154 - 		return IRQ_HANDLED;
   8.155 - 	}
   8.156 -+#endif
   8.157 -+#ifdef XEN
   8.158 -+	if (current->domain == dom0) {
   8.159 -+		// FIXME: there's gotta be a better way of doing this...
   8.160 -+		// We have to ensure that domain0 is launched before we
   8.161 -+		// call vcpu_timer_expired on it
   8.162 -+		//domain0_ready = 1; // moved to xensetup.c
   8.163 -+		current->vcpu_info->arch.pending_interruption = 1;
   8.164 -+	}
   8.165 -+	if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) {
   8.166 -+		vcpu_pend_timer(dom0->exec_domain[0]);
   8.167 -+		//vcpu_set_next_timer(dom0->exec_domain[0]);
   8.168 -+		domain_wake(dom0->exec_domain[0]);
   8.169 -+	}
   8.170 -+	if (!is_idle_task(current->domain) && current->domain != dom0) {
   8.171 -+		if (vcpu_timer_expired(current)) {
   8.172 -+			vcpu_pend_timer(current);
   8.173 -+			// ensure another timer interrupt happens even if domain doesn't
   8.174 -+			vcpu_set_next_timer(current);
   8.175 -+			domain_wake(current);
   8.176 -+		}
   8.177 -+	}
   8.178 -+	raise_actimer_softirq();
   8.179 -+#endif
   8.180 - 
   8.181 -+#ifndef XEN
   8.182 - 	platform_timer_interrupt(irq, dev_id, regs);
   8.183 +@@ -110,6 +114,7 @@
   8.184 + 	} while (time_after_eq(ia64_get_itc(), new_itm));
   8.185 + 	return IRQ_HANDLED;
   8.186 + }
   8.187  +#endif
   8.188   
   8.189 - 	new_itm = local_cpu_data->itm_next;
   8.190 - 
   8.191 - 	if (!time_after(ia64_get_itc(), new_itm))
   8.192 -+#ifdef XEN
   8.193 -+		return;
   8.194 -+#else
   8.195 - 		printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n",
   8.196 - 		       ia64_get_itc(), new_itm);
   8.197 -+#endif
   8.198 - 
   8.199 -+#ifdef XEN
   8.200 -+//	printf("GOT TO HERE!!!!!!!!!!!\n");
   8.201 -+	//while(1);
   8.202 -+#else
   8.203 - 	profile_tick(CPU_PROFILING, regs);
   8.204 -+#endif
   8.205 - 
   8.206 - 	while (1) {
   8.207 -+#ifndef XEN
   8.208 - 		update_process_times(user_mode(regs));
   8.209 -+#endif
   8.210 - 
   8.211 - 		new_itm += local_cpu_data->itm_delta;
   8.212 - 
   8.213 -@@ -82,10 +219,16 @@
   8.214 - 			 * another CPU. We need to avoid to SMP race by acquiring the
   8.215 - 			 * xtime_lock.
   8.216 - 			 */
   8.217 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   8.218 - 			write_seqlock(&xtime_lock);
   8.219 -+#endif
   8.220 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   8.221 - 			do_timer(regs);
   8.222 -+#endif
   8.223 - 			local_cpu_data->itm_next = new_itm;
   8.224 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   8.225 - 			write_sequnlock(&xtime_lock);
   8.226 -+#endif
   8.227 - 		} else
   8.228 - 			local_cpu_data->itm_next = new_itm;
   8.229 - 
   8.230 -@@ -105,7 +248,12 @@
   8.231 - 		 */
   8.232 - 		while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))
   8.233 - 			new_itm += local_cpu_data->itm_delta;
   8.234 -+//#ifdef XEN
   8.235 -+//		vcpu_set_next_timer(current);
   8.236 -+//#else
   8.237 -+//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm);
   8.238 - 		ia64_set_itm(new_itm);
   8.239 -+//#endif
   8.240 - 		/* double check, in case we got hit by a (slow) PMI: */
   8.241 - 	} while (time_after_eq(ia64_get_itc(), new_itm));
   8.242 - 	return IRQ_HANDLED;
   8.243 -@@ -120,6 +268,7 @@
   8.244 - 	int cpu = smp_processor_id();
   8.245 - 	unsigned long shift = 0, delta;
   8.246 - 
   8.247 -+printf("ia64_cpu_local_tick: about to call ia64_set_itv\n");
   8.248 - 	/* arrange for the cycle counter to generate a timer interrupt: */
   8.249 - 	ia64_set_itv(IA64_TIMER_VECTOR);
   8.250 - 
   8.251 -@@ -133,6 +282,7 @@
   8.252 - 		shift = (2*(cpu - hi) + 1) * delta/hi/2;
   8.253 - 	}
   8.254 - 	local_cpu_data->itm_next = ia64_get_itc() + delta + shift;
   8.255 -+printf("***** ia64_cpu_local_tick: Setting itm to %lx\n",local_cpu_data->itm_next);
   8.256 - 	ia64_set_itm(local_cpu_data->itm_next);
   8.257 - }
   8.258 - 
   8.259 -@@ -160,6 +310,7 @@
   8.260 - 	 * frequency and then a PAL call to determine the frequency ratio between the ITC
   8.261 - 	 * and the base frequency.
   8.262 - 	 */
   8.263 -+
   8.264 - 	status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
   8.265 - 				    &platform_base_freq, &platform_base_drift);
   8.266 - 	if (status != 0) {
   8.267 -@@ -212,6 +363,7 @@
   8.268 + /*
   8.269 +  * Encapsulate access to the itm structure for SMP.
   8.270 +@@ -212,6 +217,7 @@
   8.271   					+ itc_freq/2)/itc_freq;
   8.272   
   8.273   	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
   8.274 @@ -261,7 +34,7 @@
   8.275   		itc_interpolator.frequency = local_cpu_data->itc_freq;
   8.276   		itc_interpolator.drift = itc_drift;
   8.277   #ifdef CONFIG_SMP
   8.278 -@@ -228,6 +380,7 @@
   8.279 +@@ -228,12 +234,14 @@
   8.280   		if (!nojitter) itc_interpolator.jitter = 1;
   8.281   #endif
   8.282   		register_time_interpolator(&itc_interpolator);
   8.283 @@ -269,30 +42,15 @@
   8.284   	}
   8.285   
   8.286   	/* Setup the CPU local timer tick */
   8.287 -@@ -236,7 +389,9 @@
   8.288 + 	ia64_cpu_local_tick();
   8.289 + }
   8.290   
   8.291 ++#ifndef XEN
   8.292   static struct irqaction timer_irqaction = {
   8.293   	.handler =	timer_interrupt,
   8.294 -+#ifndef XEN
   8.295   	.flags =	SA_INTERRUPT,
   8.296 -+#endif
   8.297 - 	.name =		"timer"
   8.298 - };
   8.299 - 
   8.300 -@@ -244,12 +399,16 @@
   8.301 - time_init (void)
   8.302 - {
   8.303 - 	register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction);
   8.304 -+#ifndef XEN
   8.305 - 	efi_gettimeofday(&xtime);
   8.306 -+#endif
   8.307 - 	ia64_init_itm();
   8.308 - 
   8.309 -+#ifndef XEN
   8.310 - 	/*
   8.311 - 	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
   8.312 - 	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
   8.313 +@@ -253,3 +261,4 @@
   8.314   	 */
   8.315   	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
   8.316 + }
   8.317  +#endif
   8.318 - }
     9.1 --- a/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Fri Apr 29 22:31:36 2005 +0000
     9.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Mon May 02 17:34:28 2005 +0000
     9.3 @@ -1,21 +1,6 @@
     9.4 - tlb.c |   10 ++++++++++
     9.5 - 1 files changed, 10 insertions(+)
     9.6 -
     9.7 -Index: linux-2.6.11/arch/ia64/mm/tlb.c
     9.8 -===================================================================
     9.9 ---- linux-2.6.11.orig/arch/ia64/mm/tlb.c	2005-03-02 01:38:38.000000000 -0600
    9.10 -+++ linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-19 14:58:43.978400822 -0600
    9.11 -@@ -21,7 +21,9 @@
    9.12 - #include <asm/mmu_context.h>
    9.13 - #include <asm/pgalloc.h>
    9.14 - #include <asm/pal.h>
    9.15 -+#ifndef XEN
    9.16 - #include <asm/tlbflush.h>
    9.17 -+#endif
    9.18 - 
    9.19 - static struct {
    9.20 - 	unsigned long mask;	/* mask of supported purge page-sizes */
    9.21 -@@ -43,6 +45,9 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
    9.22 +--- ../../linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-02 00:38:38.000000000 -0700
    9.23 ++++ arch/ia64/tlb.c	2005-05-02 10:23:09.000000000 -0600
    9.24 +@@ -43,6 +43,9 @@
    9.25   void
    9.26   wrap_mmu_context (struct mm_struct *mm)
    9.27   {
    9.28 @@ -25,7 +10,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c
    9.29   	unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx;
    9.30   	struct task_struct *tsk;
    9.31   	int i;
    9.32 -@@ -83,6 +88,7 @@ wrap_mmu_context (struct mm_struct *mm)
    9.33 +@@ -83,6 +86,7 @@
    9.34   		put_cpu();
    9.35   	}
    9.36   	local_flush_tlb_all();
    9.37 @@ -33,7 +18,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c
    9.38   }
    9.39   
    9.40   void
    9.41 -@@ -132,6 +138,9 @@ EXPORT_SYMBOL(local_flush_tlb_all);
    9.42 +@@ -132,6 +136,9 @@
    9.43   void
    9.44   flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end)
    9.45   {
    9.46 @@ -43,7 +28,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c
    9.47   	struct mm_struct *mm = vma->vm_mm;
    9.48   	unsigned long size = end - start;
    9.49   	unsigned long nbits;
    9.50 -@@ -163,6 +172,7 @@ flush_tlb_range (struct vm_area_struct *
    9.51 +@@ -163,6 +170,7 @@
    9.52   # endif
    9.53   
    9.54   	ia64_srlz_i();			/* srlz.i implies srlz.d */
    10.1 --- a/xen/arch/ia64/tools/mkbuildtree	Fri Apr 29 22:31:36 2005 +0000
    10.2 +++ b/xen/arch/ia64/tools/mkbuildtree	Mon May 02 17:34:28 2005 +0000
    10.3 @@ -142,7 +142,7 @@ softlink arch/ia64/lib/strlen_user.S arc
    10.4  softlink arch/ia64/lib/strncpy_from_user.S arch/ia64/lib/strncpy_from_user.S
    10.5  softlink arch/ia64/lib/strnlen_user.S arch/ia64/lib/strnlen_user.S
    10.6  #softlink arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c
    10.7 -cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c
    10.8 +#cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c
    10.9  softlink arch/ia64/lib/xor.S arch/ia64/lib/xor.S
   10.10  
   10.11  softlink lib/cmdline.c arch/ia64/cmdline.c
   10.12 @@ -196,6 +196,8 @@ null include/asm-ia64/desc.h
   10.13  null include/asm-ia64/io_apic.h
   10.14  null include/asm-ia64/pdb.h
   10.15  null include/asm-ia64/module.h
   10.16 +null include/asm-ia64/ia32.h
   10.17 +null include/asm-ia64/tlbflush.h
   10.18  
   10.19  softlink include/asm-ia64/acpi.h include/asm-ia64/acpi.h
   10.20  softlink include/asm-ia64/asmmacro.h include/asm-ia64/asmmacro.h
   10.21 @@ -214,7 +216,7 @@ softlink include/asm-ia64/dma-mapping.h 
   10.22  softlink include/asm-ia64/errno.h include/asm-ia64/errno.h
   10.23  softlink include/asm-ia64/fpu.h include/asm-ia64/fpu.h
   10.24  softlink include/asm-ia64/hdreg.h include/asm-ia64/hdreg.h
   10.25 -softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h
   10.26 +#softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h
   10.27  softlink include/asm-ia64/ia64regs.h include/asm-ia64/ia64regs.h
   10.28  softlink include/asm-ia64/intrinsics.h include/asm-ia64/intrinsics.h
   10.29  softlink include/asm-ia64/ioctl.h include/asm-ia64/ioctl.h
   10.30 @@ -298,14 +300,15 @@ softlink include/linux/percpu.h include/
   10.31  softlink include/linux/preempt.h include/asm-ia64/linux/preempt.h
   10.32  softlink include/linux/rbtree.h include/asm-ia64/linux/rbtree.h
   10.33  softlink include/linux/rwsem.h include/asm-ia64/linux/rwsem.h
   10.34 -softlink include/linux/seq_file.h include/asm-ia64/linux/seq_file.h
   10.35 -softlink include/linux/serial_core.h include/asm-ia64/linux/serial_core.h
   10.36 +#softlink include/linux/seq_file.h include/asm-ia64/linux/seq_file.h
   10.37 +#softlink include/linux/serial_core.h include/asm-ia64/linux/serial_core.h
   10.38  softlink include/linux/stddef.h include/asm-ia64/linux/stddef.h
   10.39  softlink include/linux/thread_info.h include/asm-ia64/linux/thread_info.h
   10.40  softlink include/linux/threads.h include/asm-ia64/linux/threads.h
   10.41  softlink include/linux/timex.h include/asm-ia64/linux/timex.h
   10.42  softlink include/linux/topology.h include/asm-ia64/linux/topology.h
   10.43  softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
   10.44 +softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
   10.45  
   10.46  null include/asm-ia64/linux/file.h
   10.47  null include/asm-ia64/linux/module.h
   10.48 @@ -317,12 +320,15 @@ null include/asm-ia64/linux/profile.h
   10.49  null include/asm-ia64/linux/seqlock.h
   10.50  null include/asm-ia64/linux/smp_lock.h
   10.51  null include/asm-ia64/linux/tty.h
   10.52 -null include/asm-ia64/linux/jiffies.h
   10.53  null include/asm-ia64/linux/kernel_stat.h
   10.54  null include/asm-ia64/linux/ptrace.h
   10.55  null include/asm-ia64/linux/random.h
   10.56  null include/asm-ia64/linux/signal.h
   10.57  null include/asm-ia64/linux/bootmem.h
   10.58 +null include/asm-ia64/linux/serial.h
   10.59 +null include/asm-ia64/linux/serial_core.h
   10.60 +null include/asm-ia64/linux/seq_file.h
   10.61 +null include/asm-ia64/linux/cpu.h
   10.62  
   10.63  softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h
   10.64  softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h
    11.1 --- a/xen/arch/ia64/xenmisc.c	Fri Apr 29 22:31:36 2005 +0000
    11.2 +++ b/xen/arch/ia64/xenmisc.c	Mon May 02 17:34:28 2005 +0000
    11.3 @@ -27,7 +27,13 @@ unsigned int watchdog_on = 0;	// from ar
    11.4  
    11.5  void unw_init(void) { printf("unw_init() skipped (NEED FOR KERNEL UNWIND)\n"); }
    11.6  void ia64_mca_init(void) { printf("ia64_mca_init() skipped (Machine check abort handling)\n"); }
    11.7 -void hpsim_setup(char **x) { printf("hpsim_setup() skipped (MAY NEED FOR CONSOLE INPUT!!!)\n"); }	
    11.8 +void ia64_mca_cpu_init(void *x) { }
    11.9 +void ia64_patch_mckinley_e9(unsigned long a, unsigned long b) { }
   11.10 +void ia64_patch_vtop(unsigned long a, unsigned long b) { }
   11.11 +void hpsim_setup(char **x) { }
   11.12 +
   11.13 +// called from mem_init... don't think s/w I/O tlb is needed in Xen
   11.14 +void swiotlb_init(void) { }
   11.15  
   11.16  long
   11.17  is_platform_hp_ski(void)
    12.1 --- a/xen/arch/ia64/xensetup.c	Fri Apr 29 22:31:36 2005 +0000
    12.2 +++ b/xen/arch/ia64/xensetup.c	Mon May 02 17:34:28 2005 +0000
    12.3 @@ -18,9 +18,12 @@
    12.4  #include <xen/trace.h>
    12.5  #include <asm/meminit.h>
    12.6  #include <asm/page.h>
    12.7 +#include <asm/setup.h>
    12.8  
    12.9  unsigned long xenheap_phys_end;
   12.10  
   12.11 +char saved_command_line[COMMAND_LINE_SIZE];
   12.12 +
   12.13  struct exec_domain *idle_task[NR_CPUS] = { &idle0_exec_domain };
   12.14  
   12.15  #ifdef CLONE_DOMAIN0
   12.16 @@ -226,15 +229,15 @@ void start_kernel(void)
   12.17  	(xenheap_phys_end-__pa(heap_start)) >> 20,
   12.18  	(xenheap_phys_end-__pa(heap_start)) >> 10);
   12.19  
   12.20 -    setup_arch();
   12.21 +    late_setup_arch(&cmdline);
   12.22      setup_per_cpu_areas();
   12.23      mem_init();
   12.24  
   12.25  printk("About to call scheduler_init()\n");
   12.26      scheduler_init();
   12.27      local_irq_disable();
   12.28 -printk("About to call time_init()\n");
   12.29 -    time_init();
   12.30 +printk("About to call xen_time_init()\n");
   12.31 +    xen_time_init();
   12.32  printk("About to call ac_timer_init()\n");
   12.33      ac_timer_init();
   12.34  // init_xen_time(); ???
    13.1 --- a/xen/include/asm-ia64/config.h	Fri Apr 29 22:31:36 2005 +0000
    13.2 +++ b/xen/include/asm-ia64/config.h	Mon May 02 17:34:28 2005 +0000
    13.3 @@ -14,8 +14,6 @@
    13.4  // needed by include/asm-ia64/page.h
    13.5  #define	CONFIG_IA64_PAGE_SIZE_16KB	// 4KB doesn't work?!?
    13.6  #define	CONFIG_IA64_GRANULE_16MB
    13.7 -// needed in arch/ia64/setup.c to reserve memory for domain0
    13.8 -#define CONFIG_BLK_DEV_INITRD
    13.9  
   13.10  #ifndef __ASSEMBLY__
   13.11  
   13.12 @@ -134,6 +132,7 @@ struct page;
   13.13  #undef ____cacheline_aligned
   13.14  #undef ____cacheline_aligned_in_smp
   13.15  #define __cacheline_aligned
   13.16 +#define __cacheline_aligned_in_smp
   13.17  #define ____cacheline_aligned
   13.18  #define ____cacheline_aligned_in_smp
   13.19  #define ____cacheline_maxaligned_in_smp
   13.20 @@ -237,6 +236,20 @@ void sort_main_extable(void);
   13.21  typedef s64 time_t;
   13.22  typedef s64 suseconds_t;
   13.23  
   13.24 +// needed for include/linux/jiffies.h
   13.25 +typedef long clock_t;
   13.26 +
   13.27 +// from include/linux/kernel.h, needed by jiffies.h
   13.28 +#define typecheck(type,x) \
   13.29 +({	type __dummy; \
   13.30 +	typeof(x) __dummy2; \
   13.31 +	(void)(&__dummy == &__dummy2); \
   13.32 +	1; \
   13.33 +})
   13.34 +
   13.35 +// from include/linux/timex.h, needed by arch/ia64/time.c
   13.36 +#define	TIME_SOURCE_CPU 0
   13.37 +
   13.38  // used in common code
   13.39  #define softirq_pending(cpu)	(cpu_data(cpu)->softirq_pending)
   13.40  
   13.41 @@ -244,6 +257,13 @@ typedef s64 suseconds_t;
   13.42  #define	SA_SHIRQ	0x04000000
   13.43  #define	SA_INTERRUPT	0x20000000
   13.44  
   13.45 +// needed for setup.c
   13.46 +extern unsigned long loops_per_jiffy;
   13.47 +extern char saved_command_line[];
   13.48 +struct screen_info { };
   13.49 +#define seq_printf(a,b...) printf(b)
   13.50 +#define CONFIG_BLK_DEV_INITRD // needed to reserve memory for domain0
   13.51 +
   13.52  // these declarations got moved at some point, find a better place for them
   13.53  extern int opt_noht;
   13.54  extern int ht_per_core;