ia64/xen-unstable

changeset 5402:e982699aa8cd

bitkeeper revision 1.1704 (42a885cb3_kkMMOYtYN_PaWP3tupbA)

Merge Scotts's pte_mfn patch with some extra merging between xen/i386
and xen/x86_64. An obvious further step is to fix xen/x86_64's
pci-dma.c and pci-nommu.c to be closer to native x86_64 versions.
Signed-off-by: Scott Parish <srparish@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 09 18:09:15 2005 +0000 (2005-06-09)
parents 260c108b2c0b
children 8d70990f0858
files .rootkeys linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/Makefile linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/hypervisor.c linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/synch_bitops.h linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h linux-2.6.11-xen-sparse/include/asm-xen/synch_bitops.h
line diff
     1.1 --- a/.rootkeys	Thu Jun 09 17:52:08 2005 +0000
     1.2 +++ b/.rootkeys	Thu Jun 09 18:09:15 2005 +0000
     1.3 @@ -291,7 +291,6 @@ 424efaa6sJsuHdGIGxm0r-ugsss3OQ linux-2.6
     1.4  424efaa6xbX9LkKyaXvgbL9s_39Trw linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/x8664_ksyms.c
     1.5  424efaa670zlQTtnOYK_aNgqhmSx-Q linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/Makefile
     1.6  424efaa6HUC68-hBHgiWOMDfKZogIA linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/fault.c
     1.7 -424f001d6S-OiHsk1n9gv1jGwws-9w linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/hypervisor.c
     1.8  424efaa65ELRJ3JfgQQKLzW6y0ECYQ linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/init.c
     1.9  424efaa60dTbHfv65JBLVhNLcNPcRA linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/ioremap.c
    1.10  424efaa6uMX8YJASAVJT8ral74dz9Q linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/pageattr.c
    1.11 @@ -400,7 +399,6 @@ 424efa21wPKwwFR1fcqrPD0_o3GKWA linux-2.6
    1.12  424efa20fTFqmaE0stH6lfB_4yN_lA linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/ptrace.h
    1.13  424efa21fY4IvK0luYgDJHKV-MD3eQ linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/segment.h
    1.14  424efa21KcupuJlHgmPiTk_T214FrA linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/smp.h
    1.15 -424f001eT-7wjT_7K5AMlNVigIcuHA linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/synch_bitops.h
    1.16  424efa210ZRt2U_8WmtyI7g74Nz-4Q linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h
    1.17  424f001eBp9fMbZ0Mo2kRJQ84gMgRw linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/timer.h
    1.18  424efa21Xk2acvaHYnpyTCLE6nU6hw linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/tlbflush.h
    1.19 @@ -415,6 +413,7 @@ 40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6
    1.20  3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.11-xen-sparse/include/asm-xen/linux-public/privcmd.h
    1.21  3fa8e3f0kBLeE4To2vpdi3cpJbIkbQ linux-2.6.11-xen-sparse/include/asm-xen/linux-public/suspend.h
    1.22  4122466356eIBnC9ot44WSVVIFyhQA linux-2.6.11-xen-sparse/include/asm-xen/queues.h
    1.23 +42a885cawNQ18_b7i5-G7ekMsZ48hw linux-2.6.11-xen-sparse/include/asm-xen/synch_bitops.h
    1.24  3f689063BoW-HWV3auUJ-OqXfcGArw linux-2.6.11-xen-sparse/include/asm-xen/xen_proc.h
    1.25  419b4e93z2S0gR17XTy8wg09JEwAhg linux-2.6.11-xen-sparse/include/linux/gfp.h
    1.26  42305f545Vc5SLCUewZ2-n-P9JJhEQ linux-2.6.11-xen-sparse/include/linux/highmem.h
     2.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c	Thu Jun 09 17:52:08 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c	Thu Jun 09 18:09:15 2005 +0000
     2.3 @@ -24,53 +24,6 @@ struct dma_coherent_mem {
     2.4  	unsigned long	*bitmap;
     2.5  };
     2.6  
     2.7 -static void
     2.8 -xen_contig_memory(unsigned long vstart, unsigned int order)
     2.9 -{
    2.10 -	/*
    2.11 -	 * Ensure multi-page extents are contiguous in machine memory.
    2.12 -	 * This code could be cleaned up some, and the number of
    2.13 -	 * hypercalls reduced.
    2.14 -	 */
    2.15 -	pgd_t         *pgd; 
    2.16 -	pud_t         *pud; 
    2.17 -	pmd_t         *pmd;
    2.18 -	pte_t         *pte;
    2.19 -	unsigned long  pfn, i, flags;
    2.20 -
    2.21 -	scrub_pages(vstart, 1 << order);
    2.22 -
    2.23 -        balloon_lock(flags);
    2.24 -
    2.25 -	/* 1. Zap current PTEs, giving away the underlying pages. */
    2.26 -	for (i = 0; i < (1<<order); i++) {
    2.27 -		pgd = pgd_offset_k(vstart + (i*PAGE_SIZE));
    2.28 -		pud = pud_offset(pgd, vstart + (i*PAGE_SIZE));
    2.29 -		pmd = pmd_offset(pud, vstart + (i*PAGE_SIZE));
    2.30 -		pte = pte_offset_kernel(pmd, vstart + (i*PAGE_SIZE));
    2.31 -		pfn = pte_val_ma(*pte) >> PAGE_SHIFT;
    2.32 -		HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE),
    2.33 -					     __pte_ma(0), 0);
    2.34 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
    2.35 -			INVALID_P2M_ENTRY;
    2.36 -		if (HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, 
    2.37 -					  &pfn, 1, 0) != 1) BUG();
    2.38 -	}
    2.39 -	/* 2. Get a new contiguous memory extent. */
    2.40 -	if (HYPERVISOR_dom_mem_op(MEMOP_increase_reservation,
    2.41 -				  &pfn, 1, order) != 1) BUG();
    2.42 -	/* 3. Map the new extent in place of old pages. */
    2.43 -	for (i = 0; i < (1<<order); i++) {
    2.44 -		HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE),
    2.45 -			__pte_ma(((pfn+i)<<PAGE_SHIFT)|__PAGE_KERNEL), 0);
    2.46 -		xen_machphys_update(pfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
    2.47 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = pfn+i;
    2.48 -	}
    2.49 -	flush_tlb_all();
    2.50 -
    2.51 -	balloon_unlock(flags);
    2.52 -}
    2.53 -
    2.54  void *dma_alloc_coherent(struct device *dev, size_t size,
    2.55  			   dma_addr_t *dma_handle, int gfp)
    2.56  {
     3.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c	Thu Jun 09 17:52:08 2005 +0000
     3.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c	Thu Jun 09 18:09:15 2005 +0000
     3.3 @@ -44,8 +44,10 @@
     3.4  #define pte_offset_kernel pte_offset
     3.5  #define pud_t pgd_t
     3.6  #define pud_offset(d, va) d
     3.7 +#elif defined(CONFIG_X86_64)
     3.8 +#define pmd_val_ma(v) (v).pmd
     3.9  #else
    3.10 -#define pmd_val_ma(v) (v).pud.pgd.pgd;
    3.11 +#define pmd_val_ma(v) (v).pud.pgd.pgd
    3.12  #endif
    3.13  
    3.14  #ifndef CONFIG_XEN_SHADOW_MODE
    3.15 @@ -64,7 +66,25 @@ void xen_l2_entry_update(pmd_t *ptr, pmd
    3.16      u.val = pmd_val_ma(val);
    3.17      BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    3.18  }
    3.19 -#endif
    3.20 +
    3.21 +#ifdef CONFIG_X86_64
    3.22 +void xen_l3_entry_update(pud_t *ptr, pud_t val)
    3.23 +{
    3.24 +    mmu_update_t u;
    3.25 +    u.ptr = virt_to_machine(ptr);
    3.26 +    u.val = val.pud;
    3.27 +    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    3.28 +}
    3.29 +
    3.30 +void xen_l4_entry_update(pgd_t *ptr, pgd_t val)
    3.31 +{
    3.32 +    mmu_update_t u;
    3.33 +    u.ptr = virt_to_machine(ptr);
    3.34 +    u.val = val.pgd;
    3.35 +    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    3.36 +}
    3.37 +#endif /* CONFIG_X86_64 */
    3.38 +#endif /* CONFIG_XEN_SHADOW_MODE */
    3.39  
    3.40  void xen_machphys_update(unsigned long mfn, unsigned long pfn)
    3.41  {
    3.42 @@ -82,6 +102,14 @@ void xen_pt_switch(unsigned long ptr)
    3.43      BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.44  }
    3.45  
    3.46 +void xen_new_user_pt(unsigned long ptr)
    3.47 +{
    3.48 +    struct mmuext_op op;
    3.49 +    op.cmd = MMUEXT_NEW_USER_BASEPTR;
    3.50 +    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    3.51 +    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.52 +}
    3.53 +
    3.54  void xen_tlb_flush(void)
    3.55  {
    3.56      struct mmuext_op op;
    3.57 @@ -141,7 +169,11 @@ void xen_invlpg_mask(cpumask_t *mask, un
    3.58  void xen_pgd_pin(unsigned long ptr)
    3.59  {
    3.60      struct mmuext_op op;
    3.61 +#ifdef CONFIG_X86_64
    3.62 +    op.cmd = MMUEXT_PIN_L4_TABLE;
    3.63 +#else
    3.64      op.cmd = MMUEXT_PIN_L2_TABLE;
    3.65 +#endif
    3.66      op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    3.67      BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.68  }
    3.69 @@ -169,7 +201,41 @@ void xen_pte_unpin(unsigned long ptr)
    3.70      op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    3.71      BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.72  }
    3.73 -#endif
    3.74 +
    3.75 +#ifdef CONFIG_X86_64
    3.76 +void xen_pud_pin(unsigned long ptr)
    3.77 +{
    3.78 +    struct mmuext_op op;
    3.79 +    op.cmd = MMUEXT_PIN_L3_TABLE;
    3.80 +    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    3.81 +    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.82 +}
    3.83 +
    3.84 +void xen_pud_unpin(unsigned long ptr)
    3.85 +{
    3.86 +    struct mmuext_op op;
    3.87 +    op.cmd = MMUEXT_UNPIN_TABLE;
    3.88 +    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    3.89 +    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.90 +}
    3.91 +
    3.92 +void xen_pmd_pin(unsigned long ptr)
    3.93 +{
    3.94 +    struct mmuext_op op;
    3.95 +    op.cmd = MMUEXT_PIN_L2_TABLE;
    3.96 +    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    3.97 +    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    3.98 +}
    3.99 +
   3.100 +void xen_pmd_unpin(unsigned long ptr)
   3.101 +{
   3.102 +    struct mmuext_op op;
   3.103 +    op.cmd = MMUEXT_UNPIN_TABLE;
   3.104 +    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   3.105 +    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   3.106 +}
   3.107 +#endif /* CONFIG_X86_64 */
   3.108 +#endif /* CONFIG_XEN_SHADOW_MODE */
   3.109  
   3.110  void xen_set_ldt(unsigned long ptr, unsigned long len)
   3.111  {
   3.112 @@ -180,11 +246,60 @@ void xen_set_ldt(unsigned long ptr, unsi
   3.113      BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   3.114  }
   3.115  
   3.116 +void xen_contig_memory(unsigned long vstart, unsigned int order)
   3.117 +{
   3.118 +    /*
   3.119 +     * Ensure multi-page extents are contiguous in machine memory. This code 
   3.120 +     * could be cleaned up some, and the number of hypercalls reduced.
   3.121 +     */
   3.122 +    pgd_t         *pgd; 
   3.123 +    pud_t         *pud; 
   3.124 +    pmd_t         *pmd;
   3.125 +    pte_t         *pte;
   3.126 +    unsigned long  mfn, i, flags;
   3.127 +
   3.128 +    scrub_pages(vstart, 1 << order);
   3.129 +
   3.130 +    balloon_lock(flags);
   3.131 +
   3.132 +    /* 1. Zap current PTEs, giving away the underlying pages. */
   3.133 +    for (i = 0; i < (1<<order); i++) {
   3.134 +        pgd = pgd_offset_k(vstart + (i*PAGE_SIZE));
   3.135 +        pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
   3.136 +        pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
   3.137 +        pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
   3.138 +        mfn = pte_mfn(*pte);
   3.139 +        HYPERVISOR_update_va_mapping(
   3.140 +            vstart + (i*PAGE_SIZE), __pte_ma(0), 0);
   3.141 +        phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
   3.142 +            INVALID_P2M_ENTRY;
   3.143 +        BUG_ON(HYPERVISOR_dom_mem_op(
   3.144 +            MEMOP_decrease_reservation, &mfn, 1, 0) != 1);
   3.145 +    }
   3.146 +
   3.147 +    /* 2. Get a new contiguous memory extent. */
   3.148 +    BUG_ON(HYPERVISOR_dom_mem_op(
   3.149 +        MEMOP_increase_reservation, &mfn, 1, order) != 1);
   3.150 +
   3.151 +    /* 3. Map the new extent in place of old pages. */
   3.152 +    for (i = 0; i < (1<<order); i++) {
   3.153 +        HYPERVISOR_update_va_mapping(
   3.154 +            vstart + (i*PAGE_SIZE),
   3.155 +            __pte_ma(((mfn+i)<<PAGE_SHIFT)|__PAGE_KERNEL), 0);
   3.156 +        xen_machphys_update(mfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
   3.157 +        phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn+i;
   3.158 +    }
   3.159 +
   3.160 +    flush_tlb_all();
   3.161 +
   3.162 +    balloon_unlock(flags);
   3.163 +}
   3.164 +
   3.165  #ifdef CONFIG_XEN_PHYSDEV_ACCESS
   3.166  
   3.167  unsigned long allocate_empty_lowmem_region(unsigned long pages)
   3.168  {
   3.169 -    pgd_t         *pgd; 
   3.170 +    pgd_t         *pgd;
   3.171      pud_t         *pud; 
   3.172      pmd_t         *pmd;
   3.173      pte_t         *pte;
   3.174 @@ -209,8 +324,12 @@ unsigned long allocate_empty_lowmem_regi
   3.175          pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
   3.176          pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
   3.177          pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE))); 
   3.178 -        pfn_array[i] = pte->pte_low >> PAGE_SHIFT;
   3.179 +        pfn_array[i] = pte_mfn(*pte);
   3.180 +#ifdef CONFIG_X86_64
   3.181 +        xen_l1_entry_update(pte, 0);
   3.182 +#else
   3.183          HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE), __pte_ma(0), 0);
   3.184 +#endif
   3.185          phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
   3.186              INVALID_P2M_ENTRY;
   3.187      }
     4.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Thu Jun 09 17:52:08 2005 +0000
     4.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Thu Jun 09 18:09:15 2005 +0000
     4.3 @@ -37,7 +37,7 @@
     4.4  #include <asm/atomic.h>
     4.5  #include <asm/system.h>
     4.6  #include <asm/ptrace.h>
     4.7 -#include <asm/synch_bitops.h>
     4.8 +#include <asm-xen/synch_bitops.h>
     4.9  #include <asm-xen/xen-public/event_channel.h>
    4.10  #include <asm-xen/xen-public/physdev.h>
    4.11  #include <asm-xen/ctrl_if.h>
     5.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c	Thu Jun 09 17:52:08 2005 +0000
     5.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c	Thu Jun 09 18:09:15 2005 +0000
     5.3 @@ -19,7 +19,7 @@
     5.4  #include <asm-xen/xen_proc.h>
     5.5  #include <asm-xen/linux-public/privcmd.h>
     5.6  #include <asm-xen/gnttab.h>
     5.7 -#include <asm/synch_bitops.h>
     5.8 +#include <asm-xen/synch_bitops.h>
     5.9  
    5.10  #if 1
    5.11  #define ASSERT(_p) \
     6.1 --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c	Thu Jun 09 17:52:08 2005 +0000
     6.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c	Thu Jun 09 18:09:15 2005 +0000
     6.3 @@ -66,59 +66,6 @@ struct dma_coherent_mem {
     6.4  	unsigned long	*bitmap;
     6.5  };
     6.6  
     6.7 -static void
     6.8 -xen_contig_memory(unsigned long vstart, unsigned int order)
     6.9 -{
    6.10 -	/*
    6.11 -	 * Ensure multi-page extents are contiguous in machine memory.
    6.12 -	 * This code could be cleaned up some, and the number of
    6.13 -	 * hypercalls reduced.
    6.14 -	 */
    6.15 -	pgd_t         *pgd; 
    6.16 -	pud_t         *pud; 
    6.17 -	pmd_t         *pmd;
    6.18 -	pte_t         *pte;
    6.19 -	unsigned long  pfn, i, flags;
    6.20 -
    6.21 -	scrub_pages(vstart, 1 << order);
    6.22 -
    6.23 -        balloon_lock(flags);
    6.24 -
    6.25 -	/* 1. Zap current PTEs, giving away the underlying pages. */
    6.26 -	for (i = 0; i < (1<<order); i++) {
    6.27 -                pgd = pgd_offset_k(   (vstart + (i*PAGE_SIZE)));
    6.28 -		pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
    6.29 -		pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
    6.30 -		pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
    6.31 -		pfn = pte->pte >> PAGE_SHIFT;
    6.32 -		xen_l1_entry_update(pte, 0);
    6.33 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
    6.34 -			(u32)INVALID_P2M_ENTRY;
    6.35 -		if (HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, 
    6.36 -					  &pfn, 1, 0) != 1) BUG();
    6.37 -	}
    6.38 -	/* 2. Get a new contiguous memory extent. */
    6.39 -	if (HYPERVISOR_dom_mem_op(MEMOP_increase_reservation,
    6.40 -				  &pfn, 1, order) != 1) BUG();
    6.41 -	/* 3. Map the new extent in place of old pages. */
    6.42 -	for (i = 0; i < (1<<order); i++) {
    6.43 -		pgd = pgd_offset_k(   (vstart + (i*PAGE_SIZE)));
    6.44 -		pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
    6.45 -		pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
    6.46 -		pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
    6.47 -		xen_l1_entry_update(
    6.48 -			pte, ((pfn+i)<<PAGE_SHIFT)|__PAGE_KERNEL);
    6.49 -		xen_machphys_update(
    6.50 -			pfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
    6.51 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
    6.52 -			pfn+i;
    6.53 -	}
    6.54 -	/* Flush updates through and flush the TLB. */
    6.55 -	xen_tlb_flush();
    6.56 -
    6.57 -        balloon_unlock(flags);
    6.58 -}
    6.59 -
    6.60  void *dma_alloc_coherent(struct device *dev, size_t size,
    6.61  			   dma_addr_t *dma_handle, unsigned gfp)
    6.62  {
     7.1 --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/Makefile	Thu Jun 09 17:52:08 2005 +0000
     7.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/Makefile	Thu Jun 09 18:09:15 2005 +0000
     7.3 @@ -6,9 +6,11 @@ XENARCH	:= $(subst ",,$(CONFIG_XENARCH))
     7.4  
     7.5  CFLAGS	+= -Iarch/$(XENARCH)/mm
     7.6  
     7.7 -obj-y	:= init.o fault.o ioremap.o pageattr.o hypervisor.o
     7.8 +obj-y	:= init.o fault.o ioremap.o pageattr.o
     7.9  c-obj-y	:= extable.o
    7.10  
    7.11 +i386-obj-y := hypervisor.o
    7.12 +
    7.13  #obj-y	 := init.o fault.o ioremap.o extable.o pageattr.o
    7.14  #c-obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
    7.15  c-obj-$(CONFIG_DISCONTIGMEM) += numa.o
    7.16 @@ -21,6 +23,9 @@ c-link	:=
    7.17  $(patsubst %.o,$(obj)/%.c,$(c-obj-y) $(c-link)):
    7.18  	@ln -fsn $(srctree)/arch/x86_64/mm/$(notdir $@) $@
    7.19  
    7.20 -obj-y	+= $(c-obj-y)
    7.21 +$(patsubst %.o,$(obj)/%.c,$(i386-obj-y)):
    7.22 +	ln -fsn $(srctree)/arch/xen/i386/mm/$(notdir $@) $@
    7.23  
    7.24 -clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link))
    7.25 +obj-y	+= $(c-obj-y) $(i386-obj-y)
    7.26 +
    7.27 +clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link) $(i386-obj-y))
     8.1 --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/hypervisor.c	Thu Jun 09 17:52:08 2005 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,275 +0,0 @@
     8.4 -/******************************************************************************
     8.5 - * mm/hypervisor.c
     8.6 - * 
     8.7 - * Update page tables via the hypervisor.
     8.8 - * 
     8.9 - * Copyright (c) 2002-2004, K A Fraser
    8.10 - * 
    8.11 - * This file may be distributed separately from the Linux kernel, or
    8.12 - * incorporated into other software packages, subject to the following license:
    8.13 - * 
    8.14 - * Permission is hereby granted, free of charge, to any person obtaining a copy
    8.15 - * of this source file (the "Software"), to deal in the Software without
    8.16 - * restriction, including without limitation the rights to use, copy, modify,
    8.17 - * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    8.18 - * and to permit persons to whom the Software is furnished to do so, subject to
    8.19 - * the following conditions:
    8.20 - * 
    8.21 - * The above copyright notice and this permission notice shall be included in
    8.22 - * all copies or substantial portions of the Software.
    8.23 - * 
    8.24 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    8.25 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    8.26 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    8.27 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    8.28 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    8.29 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    8.30 - * IN THE SOFTWARE.
    8.31 - */
    8.32 -/*
    8.33 - * Jun Nakajima <jun.nakajima@intel.com>
    8.34 - *   Added hypercalls for x86-64.
    8.35 - *
    8.36 - */
    8.37 -
    8.38 -#include <linux/config.h>
    8.39 -#include <linux/sched.h>
    8.40 -#include <linux/mm.h>
    8.41 -#include <linux/vmalloc.h>
    8.42 -#include <asm/page.h>
    8.43 -#include <asm/pgtable.h>
    8.44 -#include <asm/tlbflush.h>
    8.45 -#include <asm-xen/hypervisor.h>
    8.46 -#include <asm-xen/balloon.h>
    8.47 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    8.48 -#include <linux/percpu.h>
    8.49 -#endif
    8.50 -
    8.51 -void xen_l1_entry_update(pte_t *ptr, unsigned long val)
    8.52 -{
    8.53 -    mmu_update_t u;
    8.54 -    u.ptr = virt_to_machine(ptr);
    8.55 -    u.val = val;
    8.56 -    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    8.57 -}
    8.58 -
    8.59 -void xen_l2_entry_update(pmd_t *ptr, pmd_t val)
    8.60 -{
    8.61 -    mmu_update_t u;
    8.62 -    u.ptr = virt_to_machine(ptr);
    8.63 -    u.val = val.pmd;
    8.64 -    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    8.65 -}
    8.66 -
    8.67 -void xen_l3_entry_update(pud_t *ptr, pud_t val)
    8.68 -{
    8.69 -    mmu_update_t u;
    8.70 -    u.ptr = virt_to_machine(ptr);
    8.71 -    u.val = val.pud;
    8.72 -    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    8.73 -}
    8.74 -
    8.75 -void xen_l4_entry_update(pgd_t *ptr, pgd_t val)
    8.76 -{
    8.77 -    mmu_update_t u;
    8.78 -    u.ptr = virt_to_machine(ptr);
    8.79 -    u.val = val.pgd;
    8.80 -    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    8.81 -}
    8.82 -
    8.83 -void xen_pt_switch(unsigned long ptr)
    8.84 -{
    8.85 -    struct mmuext_op op;
    8.86 -    op.cmd = MMUEXT_NEW_BASEPTR;
    8.87 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    8.88 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    8.89 -}
    8.90 -
    8.91 -void xen_new_user_pt(unsigned long ptr)
    8.92 -{
    8.93 -    struct mmuext_op op;
    8.94 -    op.cmd = MMUEXT_NEW_USER_BASEPTR;
    8.95 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
    8.96 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    8.97 -}
    8.98 -
    8.99 -void xen_tlb_flush(void)
   8.100 -{
   8.101 -    struct mmuext_op op;
   8.102 -    op.cmd = MMUEXT_TLB_FLUSH_LOCAL;
   8.103 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.104 -}
   8.105 -
   8.106 -void xen_invlpg(unsigned long ptr)
   8.107 -{
   8.108 -    struct mmuext_op op;
   8.109 -    op.cmd = MMUEXT_INVLPG_LOCAL;
   8.110 -    op.linear_addr = ptr & PAGE_MASK;
   8.111 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.112 -}
   8.113 -
   8.114 -#ifdef CONFIG_SMP
   8.115 -void xen_tlb_flush_all(void)
   8.116 -{
   8.117 -    struct mmuext_op op;
   8.118 -    op.cmd = MMUEXT_TLB_FLUSH_ALL;
   8.119 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.120 -}
   8.121 -
   8.122 -void xen_tlb_flush_mask(cpumask_t *mask)
   8.123 -{
   8.124 -    struct mmuext_op op;
   8.125 -    if ( cpus_empty(*mask) )
   8.126 -        return;
   8.127 -    op.cmd = MMUEXT_TLB_FLUSH_MULTI;
   8.128 -    op.vcpumask = mask->bits;
   8.129 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.130 -}
   8.131 -
   8.132 -void xen_invlpg_all(unsigned long ptr)
   8.133 -{
   8.134 -    struct mmuext_op op;
   8.135 -    op.cmd = MMUEXT_INVLPG_ALL;
   8.136 -    op.linear_addr = ptr & PAGE_MASK;
   8.137 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.138 -}
   8.139 -
   8.140 -void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr)
   8.141 -{
   8.142 -    struct mmuext_op op;
   8.143 -    if ( cpus_empty(*mask) )
   8.144 -        return;
   8.145 -    op.cmd = MMUEXT_INVLPG_MULTI;
   8.146 -    op.vcpumask = mask->bits;
   8.147 -    op.linear_addr = ptr & PAGE_MASK;
   8.148 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.149 -}
   8.150 -#endif
   8.151 -
   8.152 -void xen_pgd_pin(unsigned long ptr)
   8.153 -{
   8.154 -    struct mmuext_op op;
   8.155 -    op.cmd = MMUEXT_PIN_L4_TABLE;
   8.156 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.157 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.158 -}
   8.159 -
   8.160 -void xen_pgd_unpin(unsigned long ptr)
   8.161 -{
   8.162 -    struct mmuext_op op;
   8.163 -    op.cmd = MMUEXT_UNPIN_TABLE;
   8.164 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.165 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.166 -}
   8.167 -
   8.168 -void xen_pud_pin(unsigned long ptr)
   8.169 -{
   8.170 -    struct mmuext_op op;
   8.171 -    op.cmd = MMUEXT_PIN_L3_TABLE;
   8.172 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.173 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.174 -}
   8.175 -
   8.176 -void xen_pud_unpin(unsigned long ptr)
   8.177 -{
   8.178 -    struct mmuext_op op;
   8.179 -    op.cmd = MMUEXT_UNPIN_TABLE;
   8.180 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.181 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.182 -}
   8.183 -
   8.184 -void xen_pmd_pin(unsigned long ptr)
   8.185 -{
   8.186 -    struct mmuext_op op;
   8.187 -    op.cmd = MMUEXT_PIN_L2_TABLE;
   8.188 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.189 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.190 -}
   8.191 -
   8.192 -void xen_pmd_unpin(unsigned long ptr)
   8.193 -{
   8.194 -    struct mmuext_op op;
   8.195 -    op.cmd = MMUEXT_UNPIN_TABLE;
   8.196 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.197 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.198 -}
   8.199 -
   8.200 -void xen_pte_pin(unsigned long ptr)
   8.201 -{
   8.202 -    struct mmuext_op op;
   8.203 -    op.cmd = MMUEXT_PIN_L1_TABLE;
   8.204 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.205 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.206 -
   8.207 -}
   8.208 -
   8.209 -void xen_pte_unpin(unsigned long ptr)
   8.210 -{
   8.211 -    struct mmuext_op op;
   8.212 -    op.cmd = MMUEXT_UNPIN_TABLE;
   8.213 -    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
   8.214 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.215 -}
   8.216 -
   8.217 -void xen_set_ldt(unsigned long ptr, unsigned long len)
   8.218 -{
   8.219 -    struct mmuext_op op;
   8.220 -    op.cmd = MMUEXT_SET_LDT;
   8.221 -    op.linear_addr = ptr;
   8.222 -    op.nr_ents = len;
   8.223 -    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
   8.224 -}
   8.225 -
   8.226 -void xen_machphys_update(unsigned long mfn, unsigned long pfn)
   8.227 -{
   8.228 -    mmu_update_t u;
   8.229 -    u.ptr = (mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
   8.230 -    u.val = pfn;
   8.231 -    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
   8.232 -}
   8.233 -
   8.234 -#ifdef CONFIG_XEN_PHYSDEV_ACCESS
   8.235 -unsigned long allocate_empty_lowmem_region(unsigned long pages)
   8.236 -{
   8.237 -    pgd_t         *pgd;
   8.238 -    pud_t         *pud; 
   8.239 -    pmd_t         *pmd;
   8.240 -    pte_t         *pte;
   8.241 -    unsigned long *pfn_array;
   8.242 -    unsigned long  vstart;
   8.243 -    unsigned long  i;
   8.244 -    unsigned int   order = get_order(pages*PAGE_SIZE);
   8.245 -
   8.246 -    vstart = __get_free_pages(GFP_KERNEL, order);
   8.247 -    if ( vstart == 0 )
   8.248 -        return 0UL;
   8.249 -
   8.250 -    scrub_pages(vstart, 1 << order);
   8.251 -
   8.252 -    pfn_array = vmalloc((1<<order) * sizeof(*pfn_array));
   8.253 -    if ( pfn_array == NULL )
   8.254 -        BUG();
   8.255 -
   8.256 -    for ( i = 0; i < (1<<order); i++ )
   8.257 -    {
   8.258 -        pgd = pgd_offset_k(   (vstart + (i*PAGE_SIZE)));
   8.259 -        pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
   8.260 -        pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
   8.261 -        pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE))); 
   8.262 -        pfn_array[i] = pte->pte >> PAGE_SHIFT;
   8.263 -        xen_l1_entry_update(pte, 0);
   8.264 -        phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
   8.265 -            (u32)INVALID_P2M_ENTRY;
   8.266 -    }
   8.267 -
   8.268 -    /* Flush updates through and flush the TLB. */
   8.269 -    flush_tlb_all();
   8.270 -
   8.271 -    balloon_put_pages(pfn_array, 1 << order);
   8.272 -
   8.273 -    vfree(pfn_array);
   8.274 -
   8.275 -    return vstart;
   8.276 -}
   8.277 -
   8.278 -#endif /* CONFIG_XEN_PHYSDEV_ACCESS */
     9.1 --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/init.c	Thu Jun 09 17:52:08 2005 +0000
     9.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/x86_64/mm/init.c	Thu Jun 09 18:09:15 2005 +0000
     9.3 @@ -395,7 +395,7 @@ unsigned long get_machine_pfn(unsigned l
     9.4          pmd_t* pmd = pmd_offset(pud, addr);
     9.5          pte_t *pte = pte_offset_kernel(pmd, addr);
     9.6          
     9.7 -        return (pte->pte >> PAGE_SHIFT);
     9.8 +        return pte_mfn(*pte);
     9.9  } 
    9.10  
    9.11  #define ALIGN_TO_4K __attribute__((section(".data.page_aligned")))
    10.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Thu Jun 09 17:52:08 2005 +0000
    10.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Thu Jun 09 18:09:15 2005 +0000
    10.3 @@ -46,9 +46,10 @@
    10.4   */
    10.5  #define INVALID_P2M_ENTRY (~0U)
    10.6  #define FOREIGN_FRAME(_m) ((_m) | (1UL<<((sizeof(unsigned long)*8)-1)))
    10.7 +#define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT)
    10.8  #define pte_pfn(_pte)							\
    10.9  ({									\
   10.10 -	unsigned long mfn = (_pte).pte_low >> PAGE_SHIFT;		\
   10.11 +	unsigned long mfn = pte_mfn(_pte);				\
   10.12  	unsigned long pfn = mfn_to_pfn(mfn);				\
   10.13  	if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))		\
   10.14  		pfn = max_mapnr; /* special: force !pfn_valid() */	\
    11.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h	Thu Jun 09 17:52:08 2005 +0000
    11.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h	Thu Jun 09 18:09:15 2005 +0000
    11.3 @@ -89,6 +89,22 @@ static inline unsigned long __synch_cmpx
    11.4  				       "0"(old)
    11.5  				     : "memory");
    11.6  		return prev;
    11.7 +#ifdef CONFIG_X86_64
    11.8 +	case 4:
    11.9 +		__asm__ __volatile__("lock; cmpxchgl %k1,%2"
   11.10 +				     : "=a"(prev)
   11.11 +				     : "q"(new), "m"(*__synch_xg(ptr)),
   11.12 +				       "0"(old)
   11.13 +				     : "memory");
   11.14 +		return prev;
   11.15 +	case 8:
   11.16 +		__asm__ __volatile__("lock; cmpxchgq %1,%2"
   11.17 +				     : "=a"(prev)
   11.18 +				     : "q"(new), "m"(*__synch_xg(ptr)),
   11.19 +				       "0"(old)
   11.20 +				     : "memory");
   11.21 +		return prev;
   11.22 +#else
   11.23  	case 4:
   11.24  		__asm__ __volatile__("lock; cmpxchgl %1,%2"
   11.25  				     : "=a"(prev)
   11.26 @@ -96,6 +112,7 @@ static inline unsigned long __synch_cmpx
   11.27  				       "0"(old)
   11.28  				     : "memory");
   11.29  		return prev;
   11.30 +#endif
   11.31  	}
   11.32  	return old;
   11.33  }
    12.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h	Thu Jun 09 17:52:08 2005 +0000
    12.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h	Thu Jun 09 18:09:15 2005 +0000
    12.3 @@ -4,7 +4,7 @@
    12.4  #include <linux/config.h>
    12.5  #include <linux/kernel.h>
    12.6  #include <linux/bitops.h>
    12.7 -#include <asm/synch_bitops.h>
    12.8 +#include <asm-xen/synch_bitops.h>
    12.9  #include <asm/segment.h>
   12.10  #include <asm/cpufeature.h>
   12.11  #include <asm-xen/hypervisor.h>
    13.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Thu Jun 09 17:52:08 2005 +0000
    13.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Thu Jun 09 18:09:15 2005 +0000
    13.3 @@ -275,11 +275,12 @@ static inline unsigned long pud_bad(pud_
    13.4   *      require. In all the cases we care about, the high bit gets shifted out
    13.5   *      (e.g., phys_to_machine()) so behaviour there is correct.
    13.6   */
    13.7 -#define INVALID_P2M_ENTRY (~0UL)
    13.8 +#define INVALID_P2M_ENTRY (~0U)
    13.9  #define FOREIGN_FRAME(_m) ((_m) | (1UL<<((sizeof(unsigned long)*8)-1)))
   13.10 +#define pte_mfn(_pte) (((_pte).pte & PTE_MASK) >> PAGE_SHIFT)
   13.11  #define pte_pfn(_pte)							\
   13.12  ({									\
   13.13 -	unsigned long mfn = (_pte).pte >> PAGE_SHIFT;                   \
   13.14 +	unsigned long mfn = pte_mfn(_pte);                              \
   13.15  	unsigned pfn = mfn_to_pfn(mfn);                                 \
   13.16  	if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))		\
   13.17  		pfn = max_mapnr; /* special: force !pfn_valid() */	\
    14.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/synch_bitops.h	Thu Jun 09 17:52:08 2005 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,85 +0,0 @@
    14.4 -#ifndef __XEN_SYNCH_BITOPS_H__
    14.5 -#define __XEN_SYNCH_BITOPS_H__
    14.6 -
    14.7 -/*
    14.8 - * Copyright 1992, Linus Torvalds.
    14.9 - * Heavily modified to provide guaranteed strong synchronisation
   14.10 - * when communicating with Xen or other guest OSes running on other CPUs.
   14.11 - * 
   14.12 - * Copyed from asm-xen/asm-i386
   14.13 - */
   14.14 -
   14.15 -#include <linux/config.h>
   14.16 -
   14.17 -#define ADDR (*(volatile long *) addr)
   14.18 -
   14.19 -static __inline__ void synch_set_bit(int nr, volatile void * addr)
   14.20 -{
   14.21 -    __asm__ __volatile__ ( 
   14.22 -        "lock btsl %1,%0"
   14.23 -        : "=m" (ADDR) : "Ir" (nr) : "memory" );
   14.24 -}
   14.25 -
   14.26 -static __inline__ void synch_clear_bit(int nr, volatile void * addr)
   14.27 -{
   14.28 -    __asm__ __volatile__ (
   14.29 -        "lock btrl %1,%0"
   14.30 -        : "=m" (ADDR) : "Ir" (nr) : "memory" );
   14.31 -}
   14.32 -
   14.33 -static __inline__ void synch_change_bit(int nr, volatile void * addr)
   14.34 -{
   14.35 -    __asm__ __volatile__ (
   14.36 -        "lock btcl %1,%0"
   14.37 -        : "=m" (ADDR) : "Ir" (nr) : "memory" );
   14.38 -}
   14.39 -
   14.40 -static __inline__ int synch_test_and_set_bit(int nr, volatile void * addr)
   14.41 -{
   14.42 -    int oldbit;
   14.43 -    __asm__ __volatile__ (
   14.44 -        "lock btsl %2,%1\n\tsbbl %0,%0"
   14.45 -        : "=r" (oldbit), "=m" (ADDR) : "Ir" (nr) : "memory");
   14.46 -    return oldbit;
   14.47 -}
   14.48 -
   14.49 -static __inline__ int synch_test_and_clear_bit(int nr, volatile void * addr)
   14.50 -{
   14.51 -    int oldbit;
   14.52 -    __asm__ __volatile__ (
   14.53 -        "lock btrl %2,%1\n\tsbbl %0,%0"
   14.54 -        : "=r" (oldbit), "=m" (ADDR) : "Ir" (nr) : "memory");
   14.55 -    return oldbit;
   14.56 -}
   14.57 -
   14.58 -static __inline__ int synch_test_and_change_bit(int nr, volatile void * addr)
   14.59 -{
   14.60 -    int oldbit;
   14.61 -
   14.62 -    __asm__ __volatile__ (
   14.63 -        "lock btcl %2,%1\n\tsbbl %0,%0"
   14.64 -        : "=r" (oldbit), "=m" (ADDR) : "Ir" (nr) : "memory");
   14.65 -    return oldbit;
   14.66 -}
   14.67 -
   14.68 -static __inline__ int synch_const_test_bit(int nr, const volatile void * addr)
   14.69 -{
   14.70 -    return ((1UL << (nr & 31)) & 
   14.71 -            (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
   14.72 -}
   14.73 -
   14.74 -static __inline__ int synch_var_test_bit(int nr, volatile void * addr)
   14.75 -{
   14.76 -    int oldbit;
   14.77 -    __asm__ __volatile__ (
   14.78 -        "btl %2,%1\n\tsbbl %0,%0"
   14.79 -        : "=r" (oldbit) : "m" (ADDR), "Ir" (nr) );
   14.80 -    return oldbit;
   14.81 -}
   14.82 -
   14.83 -#define synch_test_bit(nr,addr) \
   14.84 -(__builtin_constant_p(nr) ? \
   14.85 - synch_const_test_bit((nr),(addr)) : \
   14.86 - synch_var_test_bit((nr),(addr)))
   14.87 -
   14.88 -#endif /* __XEN_SYNCH_BITOPS_H__ */
    15.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h	Thu Jun 09 17:52:08 2005 +0000
    15.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h	Thu Jun 09 18:09:15 2005 +0000
    15.3 @@ -4,7 +4,7 @@
    15.4  #include <linux/config.h>
    15.5  #include <linux/kernel.h>
    15.6  #include <asm/segment.h>
    15.7 -#include <asm/synch_bitops.h>
    15.8 +#include <asm-xen/synch_bitops.h>
    15.9  #include <asm-xen/hypervisor.h>
   15.10  #include <asm-xen/xen-public/arch-x86_64.h>
   15.11  
    16.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h	Thu Jun 09 17:52:08 2005 +0000
    16.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h	Thu Jun 09 18:09:15 2005 +0000
    16.3 @@ -34,7 +34,7 @@
    16.4  #include <linux/config.h>
    16.5  #include <asm-xen/hypervisor.h>
    16.6  #include <asm/ptrace.h>
    16.7 -#include <asm/synch_bitops.h>
    16.8 +#include <asm-xen/synch_bitops.h>
    16.9  #include <asm-xen/xen-public/event_channel.h>
   16.10  #include <linux/smp.h>
   16.11  
    17.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h	Thu Jun 09 17:52:08 2005 +0000
    17.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h	Thu Jun 09 18:09:15 2005 +0000
    17.3 @@ -130,6 +130,8 @@ void xen_invlpg_mask(cpumask_t *mask, un
    17.4  #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
    17.5  #endif /* linux < 2.6.0 */
    17.6  
    17.7 +void xen_contig_memory(unsigned long vstart, unsigned int order);
    17.8 +
    17.9  #ifdef CONFIG_XEN_PHYSDEV_ACCESS
   17.10  /* Allocate a contiguous empty region of low memory. Return virtual start. */
   17.11  unsigned long allocate_empty_lowmem_region(unsigned long pages);
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/synch_bitops.h	Thu Jun 09 18:09:15 2005 +0000
    18.3 @@ -0,0 +1,2 @@
    18.4 +
    18.5 +#include <asm-i386/synch_bitops.h>