direct-io.hg

changeset 8693:491a8798945e

Remove shadow-translate Linux patches for now. We'll merge this stuff
in piecemeal.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Jan 28 12:09:45 2006 +0100 (2006-01-28)
parents 3e7bcf1b6f70
children ce057aa33cad
files linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c linux-2.6-xen-sparse/arch/xen/i386/mm/init.c linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h linux-2.6-xen-sparse/include/asm-xen/gnttab.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c	Sat Jan 28 11:09:18 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c	Sat Jan 28 12:09:45 2006 +0100
     1.3 @@ -59,8 +59,8 @@ static int alloc_ldt(mm_context_t *pc, i
     1.4  		cpumask_t mask;
     1.5  		preempt_disable();
     1.6  #endif
     1.7 -		make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
     1.8 -				    PAGE_SIZE);
     1.9 +		make_mmu_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
    1.10 +					PAGE_SIZE);
    1.11  		load_LDT(pc);
    1.12  #ifdef CONFIG_SMP
    1.13  		mask = cpumask_of_cpu(smp_processor_id());
    1.14 @@ -70,7 +70,7 @@ static int alloc_ldt(mm_context_t *pc, i
    1.15  #endif
    1.16  	}
    1.17  	if (oldsize) {
    1.18 -		make_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
    1.19 +		make_mmu_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
    1.20  			PAGE_SIZE);
    1.21  		if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
    1.22  			vfree(oldldt);
    1.23 @@ -86,8 +86,8 @@ static inline int copy_ldt(mm_context_t 
    1.24  	if (err < 0)
    1.25  		return err;
    1.26  	memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
    1.27 -	make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
    1.28 -			    PAGE_SIZE);
    1.29 +	make_mmu_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
    1.30 +				PAGE_SIZE);
    1.31  	return 0;
    1.32  }
    1.33  
    1.34 @@ -119,9 +119,9 @@ void destroy_context(struct mm_struct *m
    1.35  	if (mm->context.size) {
    1.36  		if (mm == current->active_mm)
    1.37  			clear_LDT();
    1.38 -		make_pages_writable(mm->context.ldt,
    1.39 -				    (mm->context.size * LDT_ENTRY_SIZE) /
    1.40 -				    PAGE_SIZE);
    1.41 +		make_mmu_pages_writable(mm->context.ldt,
    1.42 +					(mm->context.size * LDT_ENTRY_SIZE) /
    1.43 +					PAGE_SIZE);
    1.44  		if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
    1.45  			vfree(mm->context.ldt);
    1.46  		else
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Sat Jan 28 11:09:18 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Sat Jan 28 12:09:45 2006 +0100
     2.3 @@ -113,20 +113,6 @@ void xen_pt_switch(unsigned long ptr)
     2.4  	BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
     2.5  }
     2.6  
     2.7 -unsigned long xen_pfn_hole_start(void)
     2.8 -{
     2.9 -	struct mmuext_op op;
    2.10 -	op.cmd = MMUEXT_PFN_HOLE_BASE;
    2.11 -	return HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF);
    2.12 -}
    2.13 -
    2.14 -unsigned long xen_pfn_hole_size(void)
    2.15 -{
    2.16 -	struct mmuext_op op;
    2.17 -	op.cmd = MMUEXT_PFN_HOLE_SIZE;
    2.18 -	return HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF);
    2.19 -}
    2.20 -
    2.21  void xen_new_user_pt(unsigned long ptr)
    2.22  {
    2.23  	struct mmuext_op op;
    2.24 @@ -279,7 +265,6 @@ void xen_set_ldt(unsigned long ptr, unsi
    2.25   */
    2.26  unsigned long *contiguous_bitmap;
    2.27  
    2.28 -#ifndef CONFIG_XEN_SHADOW_MODE
    2.29  static void contiguous_bitmap_set(
    2.30  	unsigned long first_page, unsigned long nr_pages)
    2.31  {
    2.32 @@ -452,19 +437,6 @@ void xen_destroy_contiguous_region(unsig
    2.33  
    2.34  	balloon_unlock(flags);
    2.35  }
    2.36 -#else
    2.37 -int xen_create_contiguous_region(
    2.38 -       unsigned long vstat, unsigned int order, unsigned int address_bits)
    2.39 -{
    2.40 -       if (order >= 1)
    2.41 -               BUG();
    2.42 -       return 0;
    2.43 -}
    2.44 -
    2.45 -void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
    2.46 -{
    2.47 -}
    2.48 -#endif
    2.49  
    2.50  #ifdef __i386__
    2.51  int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Sat Jan 28 11:09:18 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Sat Jan 28 12:09:45 2006 +0100
     3.3 @@ -597,7 +597,6 @@ void __init mem_init(void)
     3.4  	int tmp;
     3.5  	int bad_ppro;
     3.6  	unsigned long pfn;
     3.7 -        unsigned long hole_start, hole_size;
     3.8  
     3.9  	contiguous_bitmap = alloc_bootmem_low_pages(
    3.10  		(max_low_pfn + 2*BITS_PER_LONG) >> 3);
    3.11 @@ -645,12 +644,6 @@ void __init mem_init(void)
    3.12  		totalram_pages++;
    3.13  	}
    3.14  
    3.15 -        /* Make the Xen hole reserved. */
    3.16 -        hole_size = xen_pfn_hole_size();
    3.17 -        hole_start = xen_pfn_hole_start();
    3.18 -        for (pfn = hole_start; pfn < hole_start + hole_size; pfn++)
    3.19 -                SetPageReserved(pfn_to_page(pfn));
    3.20 -
    3.21  	reservedpages = 0;
    3.22  	for (tmp = 0; tmp < max_low_pfn; tmp++)
    3.23  		/*
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c	Sat Jan 28 11:09:18 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c	Sat Jan 28 12:09:45 2006 +0100
     4.3 @@ -389,35 +389,43 @@ void pgd_free(pgd_t *pgd)
     4.4  	kmem_cache_free(pgd_cache, pgd);
     4.5  }
     4.6  
     4.7 -
     4.8 -void make_lowmem_page_readonly(void *va)
     4.9 +#ifndef CONFIG_XEN_SHADOW_MODE
    4.10 +void make_lowmem_mmu_page_readonly(void *va)
    4.11  {
    4.12  	pte_t *pte;
    4.13  	int rc;
    4.14  
    4.15 +	if (xen_feature(writable_mmu_structures))
    4.16 +		return;
    4.17 +
    4.18  	pte = virt_to_ptep(va);
    4.19  	rc = HYPERVISOR_update_va_mapping(
    4.20  		(unsigned long)va, pte_wrprotect(*pte), 0);
    4.21  	BUG_ON(rc);
    4.22  }
    4.23  
    4.24 -void make_lowmem_page_writable(void *va)
    4.25 +void make_lowmem_mmu_page_writable(void *va)
    4.26  {
    4.27  	pte_t *pte;
    4.28  	int rc;
    4.29  
    4.30 +	if (xen_feature(writable_mmu_structures))
    4.31 +		return;
    4.32 +
    4.33  	pte = virt_to_ptep(va);
    4.34  	rc = HYPERVISOR_update_va_mapping(
    4.35  		(unsigned long)va, pte_mkwrite(*pte), 0);
    4.36  	BUG_ON(rc);
    4.37  }
    4.38  
    4.39 -
    4.40 -void make_page_readonly(void *va)
    4.41 +void make_mmu_page_readonly(void *va)
    4.42  {
    4.43  	pte_t *pte;
    4.44  	int rc;
    4.45  
    4.46 +	if (xen_feature(writable_mmu_structures))
    4.47 +		return;
    4.48 +
    4.49  	pte = virt_to_ptep(va);
    4.50  	rc = HYPERVISOR_update_va_mapping(
    4.51  		(unsigned long)va, pte_wrprotect(*pte), 0);
    4.52 @@ -430,16 +438,19 @@ void make_page_readonly(void *va)
    4.53  			kmap_flush_unused(); /* flush stale writable kmaps */
    4.54  		else
    4.55  #endif
    4.56 -			make_lowmem_page_readonly(
    4.57 +			make_lowmem_mmu_page_readonly(
    4.58  				phys_to_virt(pfn << PAGE_SHIFT)); 
    4.59  	}
    4.60  }
    4.61  
    4.62 -void make_page_writable(void *va)
    4.63 +void make_mmu_page_writable(void *va)
    4.64  {
    4.65  	pte_t *pte;
    4.66  	int rc;
    4.67  
    4.68 +	if (xen_feature(writable_mmu_structures))
    4.69 +		return;
    4.70 +
    4.71  	pte = virt_to_ptep(va);
    4.72  	rc = HYPERVISOR_update_va_mapping(
    4.73  		(unsigned long)va, pte_mkwrite(*pte), 0);
    4.74 @@ -450,70 +461,32 @@ void make_page_writable(void *va)
    4.75  #ifdef CONFIG_HIGHMEM
    4.76  		if (pfn < highstart_pfn)
    4.77  #endif
    4.78 -			make_lowmem_page_writable(
    4.79 +			make_lowmem_mmu_page_writable(
    4.80  				phys_to_virt(pfn << PAGE_SHIFT)); 
    4.81  	}
    4.82  }
    4.83  
    4.84 -void make_pages_readonly(void *va, unsigned nr)
    4.85 -{
    4.86 -	while (nr-- != 0) {
    4.87 -		make_page_readonly(va);
    4.88 -		va = (void *)((unsigned long)va + PAGE_SIZE);
    4.89 -	}
    4.90 -}
    4.91 -
    4.92 -void make_pages_writable(void *va, unsigned nr)
    4.93 -{
    4.94 -	while (nr-- != 0) {
    4.95 -		make_page_writable(va);
    4.96 -		va = (void *)((unsigned long)va + PAGE_SIZE);
    4.97 -	}
    4.98 -}
    4.99 -
   4.100 -#ifndef CONFIG_XEN_SHADOW_MODE
   4.101 -void make_lowmem_mmu_page_readonly(void *va)
   4.102 -{
   4.103 -	if (xen_feature(writable_mmu_structures))
   4.104 -		return;
   4.105 -	make_lowmem_page_readonly(va);
   4.106 -}
   4.107 -
   4.108 -void make_lowmem_mmu_page_writable(void *va)
   4.109 -{
   4.110 -	if (xen_feature(writable_mmu_structures))
   4.111 -		return;
   4.112 -	make_lowmem_page_writable(va);
   4.113 -}
   4.114 -
   4.115 -void make_mmu_page_readonly(void *va)
   4.116 -{
   4.117 -	if (xen_feature(writable_mmu_structures))
   4.118 -		return;
   4.119 -	make_page_readonly(va);
   4.120 -}
   4.121 -
   4.122 -void make_mmu_page_writable(void *va)
   4.123 -{
   4.124 -	if (xen_feature(writable_mmu_structures))
   4.125 -		return;
   4.126 -	make_page_writable(va);
   4.127 -}
   4.128 -
   4.129  void make_mmu_pages_readonly(void *va, unsigned int nr)
   4.130  {
   4.131  	if (xen_feature(writable_mmu_structures))
   4.132  		return;
   4.133 -	make_pages_readonly(va, nr);
   4.134 +
   4.135 +	while (nr-- != 0) {
   4.136 +		make_mmu_page_readonly(va);
   4.137 +		va = (void *)((unsigned long)va + PAGE_SIZE);
   4.138 +	}
   4.139  }
   4.140  
   4.141  void make_mmu_pages_writable(void *va, unsigned int nr)
   4.142  {
   4.143  	if (xen_feature(writable_mmu_structures))
   4.144  		return;
   4.145 -	make_pages_writable(va, nr);
   4.146 +	while (nr-- != 0) {
   4.147 +		make_mmu_page_writable(va);
   4.148 +		va = (void *)((unsigned long)va + PAGE_SIZE);
   4.149 +	}
   4.150  }
   4.151 -#endif
   4.152 +#endif /* CONFIG_XEN_SHADOW_MODE */
   4.153  
   4.154  static inline void pgd_walk_set_prot(void *pt, pgprot_t flags)
   4.155  {
   4.156 @@ -564,8 +537,7 @@ static void pgd_walk(pgd_t *pgd_base, pg
   4.157  
   4.158  static void __pgd_pin(pgd_t *pgd)
   4.159  {
   4.160 -	if (!xen_feature(writable_mmu_structures))
   4.161 -		pgd_walk(pgd, PAGE_KERNEL_RO);
   4.162 +	pgd_walk(pgd, PAGE_KERNEL_RO);
   4.163  	xen_pgd_pin(__pa(pgd));
   4.164  	set_bit(PG_pinned, &virt_to_page(pgd)->flags);
   4.165  }
   4.166 @@ -573,8 +545,7 @@ static void __pgd_pin(pgd_t *pgd)
   4.167  static void __pgd_unpin(pgd_t *pgd)
   4.168  {
   4.169  	xen_pgd_unpin(__pa(pgd));
   4.170 -	if (!xen_feature(writable_mmu_structures))
   4.171 -		pgd_walk(pgd, PAGE_KERNEL);
   4.172 +	pgd_walk(pgd, PAGE_KERNEL);
   4.173  	clear_bit(PG_pinned, &virt_to_page(pgd)->flags);
   4.174  }
   4.175  
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c	Sat Jan 28 11:09:18 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c	Sat Jan 28 12:09:45 2006 +0100
     5.3 @@ -201,22 +201,25 @@ gnttab_end_foreign_access(grant_ref_t re
     5.4  }
     5.5  
     5.6  int
     5.7 -gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn)
     5.8 +gnttab_grant_foreign_transfer(domid_t domid)
     5.9  {
    5.10  	int ref;
    5.11  
    5.12  	if (unlikely((ref = get_free_entry()) == -1))
    5.13  		return -ENOSPC;
    5.14 -	gnttab_grant_foreign_transfer_ref(ref, domid, pfn);
    5.15 +
    5.16 +	shared[ref].frame = 0;
    5.17 +	shared[ref].domid = domid;
    5.18 +	wmb();
    5.19 +	shared[ref].flags = GTF_accept_transfer;
    5.20  
    5.21  	return ref;
    5.22  }
    5.23  
    5.24  void
    5.25 -gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid,
    5.26 -				  unsigned long pfn)
    5.27 +gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid)
    5.28  {
    5.29 -	shared[ref].frame = pfn;
    5.30 +	shared[ref].frame = 0;
    5.31  	shared[ref].domid = domid;
    5.32  	wmb();
    5.33  	shared[ref].flags = GTF_accept_transfer;
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Sat Jan 28 11:09:18 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Sat Jan 28 12:09:45 2006 +0100
     6.3 @@ -74,7 +74,6 @@ static DECLARE_WORK(shutdown_work, __shu
     6.4  #endif
     6.5  
     6.6  
     6.7 -#ifndef CONFIG_XEN_SHADOW_MODE
     6.8  static int __do_suspend(void *ignore)
     6.9  {
    6.10  	int i, j, k, fpp;
    6.11 @@ -217,13 +216,6 @@ static int __do_suspend(void *ignore)
    6.12  
    6.13  	return err;
    6.14  }
    6.15 -#else
    6.16 -static int __do_suspend(void *ignore)
    6.17 -{
    6.18 -	printk(KERN_WARNING "Don't do suspend in shadow mode\n");
    6.19 -	return -EOPNOTSUPP;
    6.20 -}
    6.21 -#endif
    6.22  
    6.23  static int shutdown_process(void *__unused)
    6.24  {
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c	Sat Jan 28 11:09:18 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c	Sat Jan 28 12:09:45 2006 +0100
     7.3 @@ -239,7 +239,7 @@ void __init smp_prepare_cpus(unsigned in
     7.4  		memcpy((void *)cpu_gdt_descr[cpu].address,
     7.5  		       (void *)cpu_gdt_descr[0].address,
     7.6  		       cpu_gdt_descr[0].size);
     7.7 -		make_page_readonly((void *)cpu_gdt_descr[cpu].address);
     7.8 +		make_mmu_page_readonly((void *)cpu_gdt_descr[cpu].address);
     7.9  
    7.10  		cpu_set(cpu, cpu_possible_map);
    7.11  #ifdef CONFIG_HOTPLUG_CPU
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Sat Jan 28 11:09:18 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Sat Jan 28 12:09:45 2006 +0100
     8.3 @@ -93,11 +93,14 @@ static void early_make_mmu_page_readonly
     8.4  		BUG();
     8.5  }
     8.6  
     8.7 -void make_page_readonly(void *va)
     8.8 +void make_mmu_page_readonly(void *va)
     8.9  {
    8.10  	pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
    8.11  	unsigned long addr = (unsigned long) va;
    8.12  
    8.13 +	if (xen_feature(writable_mmu_structures))
    8.14 +		return;
    8.15 +
    8.16  	pgd = pgd_offset_k(addr);
    8.17  	pud = pud_offset(pgd, addr);
    8.18  	pmd = pmd_offset(pud, addr);
    8.19 @@ -108,21 +111,17 @@ void make_page_readonly(void *va)
    8.20  		xen_l1_entry_update(ptep, pte); /* fallback */
    8.21  
    8.22  	if ((addr >= VMALLOC_START) && (addr < VMALLOC_END))
    8.23 -		make_page_readonly(__va(pte_pfn(pte) << PAGE_SHIFT));
    8.24 +		make_mmu_page_readonly(__va(pte_pfn(pte) << PAGE_SHIFT));
    8.25  }
    8.26  
    8.27 -void make_mmu_page_readonly(void *va)
    8.28 -{
    8.29 -	if (xen_feature(writable_mmu_structures))
    8.30 -		return;
    8.31 -	make_page_readonly(va);
    8.32 -}
    8.33 -
    8.34 -void make_page_writable(void *va)
    8.35 +void make_mmu_page_writable(void *va)
    8.36  {
    8.37  	pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
    8.38  	unsigned long addr = (unsigned long) va;
    8.39  
    8.40 +	if (xen_feature(writable_mmu_structures))
    8.41 +		return;
    8.42 +
    8.43  	pgd = pgd_offset_k(addr);
    8.44  	pud = pud_offset(pgd, addr);
    8.45  	pmd = pmd_offset(pud, addr);
    8.46 @@ -133,35 +132,16 @@ void make_page_writable(void *va)
    8.47  		xen_l1_entry_update(ptep, pte); /* fallback */
    8.48  
    8.49  	if ((addr >= VMALLOC_START) && (addr < VMALLOC_END))
    8.50 -		make_page_writable(__va(pte_pfn(pte) << PAGE_SHIFT));
    8.51 -}
    8.52 -
    8.53 -void make_mmu_page_writable(void *va)
    8.54 -{
    8.55 -	if (xen_feature(writable_mmu_structures))
    8.56 -		return;
    8.57 -	make_page_writable(va);
    8.58 -}
    8.59 -
    8.60 -void make_pages_readonly(void *va, unsigned nr)
    8.61 -{
    8.62 -	while (nr-- != 0) {
    8.63 -		make_page_readonly(va);
    8.64 -		va = (void*)((unsigned long)va + PAGE_SIZE);
    8.65 -	}
    8.66 +		make_mmu_page_writable(__va(pte_pfn(pte) << PAGE_SHIFT));
    8.67  }
    8.68  
    8.69  void make_mmu_pages_readonly(void *va, unsigned nr)
    8.70  {
    8.71  	if (xen_feature(writable_mmu_structures))
    8.72  		return;
    8.73 -	make_pages_readonly(va, nr);
    8.74 -}
    8.75  
    8.76 -void make_pages_writable(void *va, unsigned nr)
    8.77 -{
    8.78  	while (nr-- != 0) {
    8.79 -		make_page_writable(va);
    8.80 +		make_mmu_page_readonly(va);
    8.81  		va = (void*)((unsigned long)va + PAGE_SIZE);
    8.82  	}
    8.83  }
    8.84 @@ -170,7 +150,10 @@ void make_mmu_pages_writable(void *va, u
    8.85  {
    8.86  	if (xen_feature(writable_mmu_structures))
    8.87  		return;
    8.88 -	make_pages_writable(va, nr);
    8.89 +	while (nr-- != 0) {
    8.90 +		make_mmu_page_writable(va);
    8.91 +		va = (void*)((unsigned long)va + PAGE_SIZE);
    8.92 +	}
    8.93  }
    8.94  
    8.95  /*
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Sat Jan 28 11:09:18 2006 +0100
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Sat Jan 28 12:09:45 2006 +0100
     9.3 @@ -107,22 +107,9 @@ static struct timer_list balloon_timer;
     9.4  #define WPRINTK(fmt, args...) \
     9.5  	printk(KERN_WARNING "xen_mem: " fmt, ##args)
     9.6  
     9.7 -static int page_is_xen_hole(unsigned long pfn)
     9.8 -{
     9.9 -	static unsigned long hole_start, hole_len = -1;
    9.10 -	if (hole_len == -1) {
    9.11 -		hole_start = xen_pfn_hole_start();
    9.12 -		hole_len = xen_pfn_hole_size();
    9.13 -	}
    9.14 -	return pfn >= hole_start && pfn < hole_start + hole_len;
    9.15 -}
    9.16 -
    9.17  /* balloon_append: add the given page to the balloon. */
    9.18  static void balloon_append(struct page *page)
    9.19  {
    9.20 -	if (page_is_xen_hole(page_to_pfn(page)))
    9.21 -		panic("Attempt to add Xen-reserved pfn %lx to balloon.\n",
    9.22 -		       page_to_pfn(page));
    9.23  	/* Lowmem is re-populated first, so highmem pages go at list tail. */
    9.24  	if (PageHighMem(page)) {
    9.25  		list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
    9.26 @@ -204,7 +191,6 @@ static int increase_reservation(unsigned
    9.27  	for (i = 0; i < nr_pages; i++) {
    9.28  		BUG_ON(page == NULL);
    9.29  		frame_list[i] = page_to_pfn(page);;
    9.30 -		BUG_ON(page_is_xen_hole(frame_list[i]));
    9.31  		page = balloon_next_page(page);
    9.32  	}
    9.33  
    9.34 @@ -229,15 +215,12 @@ static int increase_reservation(unsigned
    9.35  		BUG_ON(page == NULL);
    9.36  
    9.37  		pfn = page_to_pfn(page);
    9.38 -#ifndef CONFIG_XEN_SHADOW_MODE
    9.39 -		/* In shadow mode, Xen handles this part for us. */
    9.40  		BUG_ON(phys_to_machine_mapping_valid(pfn));
    9.41  
    9.42  		/* Update P->M and M->P tables. */
    9.43  		set_phys_to_machine(pfn, frame_list[i]);
    9.44  		xen_machphys_update(frame_list[i], pfn);
    9.45 -#endif
    9.46 -
    9.47 +            
    9.48  		/* Link back into the page tables if not highmem. */
    9.49  		if (pfn < max_low_pfn) {
    9.50  			int ret;
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Sat Jan 28 11:09:18 2006 +0100
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Sat Jan 28 12:09:45 2006 +0100
    10.3 @@ -586,8 +586,7 @@ static void network_alloc_rx_buffers(str
    10.4  		BUG_ON((signed short)ref < 0);
    10.5  		np->grant_rx_ref[id] = ref;
    10.6  		gnttab_grant_foreign_transfer_ref(ref,
    10.7 -						  np->xbdev->otherend_id,
    10.8 -						  __pa(skb->head) >> PAGE_SHIFT);
    10.9 +						  np->xbdev->otherend_id);
   10.10  		RING_GET_REQUEST(&np->rx, req_prod + i)->gref = ref;
   10.11  		rx_pfn_array[i] = virt_to_mfn(skb->head);
   10.12  
   10.13 @@ -803,11 +802,9 @@ static int netif_poll(struct net_device 
   10.14  		np->stats.rx_bytes += rx->status;
   10.15  
   10.16  		/* Remap the page. */
   10.17 -#ifndef CONFIG_XEN_SHADOW_MODE
   10.18  		mmu->ptr = ((maddr_t)mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
   10.19  		mmu->val  = __pa(skb->head) >> PAGE_SHIFT;
   10.20  		mmu++;
   10.21 -#endif
   10.22  		MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
   10.23  					pfn_pte_ma(mfn, PAGE_KERNEL), 0);
   10.24  		mcl++;
   10.25 @@ -1002,8 +999,7 @@ static void network_connect(struct net_d
   10.26  		if ((unsigned long)np->rx_skbs[i] < __PAGE_OFFSET)
   10.27  			continue;
   10.28  		gnttab_grant_foreign_transfer_ref(
   10.29 -			np->grant_rx_ref[i], np->xbdev->otherend_id,
   10.30 -			__pa(np->rx_skbs[i]->data) >> PAGE_SHIFT);
   10.31 +			np->grant_rx_ref[i], np->xbdev->otherend_id);
   10.32  		RING_GET_REQUEST(&np->rx, requeue_idx)->gref =
   10.33  			np->grant_rx_ref[i];
   10.34  		RING_GET_REQUEST(&np->rx, requeue_idx)->id = i;
    11.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h	Sat Jan 28 11:09:18 2006 +0100
    11.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h	Sat Jan 28 12:09:45 2006 +0100
    11.3 @@ -101,9 +101,6 @@ void xen_pte_unpin(unsigned long ptr);
    11.4  void xen_set_ldt(unsigned long ptr, unsigned long bytes);
    11.5  void xen_machphys_update(unsigned long mfn, unsigned long pfn);
    11.6  
    11.7 -unsigned long xen_pfn_hole_start(void);
    11.8 -unsigned long xen_pfn_hole_size(void);
    11.9 -
   11.10  #ifdef CONFIG_SMP
   11.11  #include <linux/cpumask.h>
   11.12  void xen_tlb_flush_all(void);
    12.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h	Sat Jan 28 11:09:18 2006 +0100
    12.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h	Sat Jan 28 12:09:45 2006 +0100
    12.3 @@ -59,18 +59,8 @@
    12.4  #define clear_user_page(page, vaddr, pg)	clear_page(page)
    12.5  #define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)
    12.6  
    12.7 -/* Definitions for machine and pseudophysical addresses. */
    12.8 -#ifdef CONFIG_X86_PAE
    12.9 -typedef unsigned long long paddr_t;
   12.10 -typedef unsigned long long maddr_t;
   12.11 -#else
   12.12 -typedef unsigned long paddr_t;
   12.13 -typedef unsigned long maddr_t;
   12.14 -#endif
   12.15 -
   12.16  /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
   12.17  #define INVALID_P2M_ENTRY	(~0UL)
   12.18 -#ifndef CONFIG_XEN_SHADOW_MODE
   12.19  #define FOREIGN_FRAME(m)	((m) | (1UL<<31))
   12.20  extern unsigned long *phys_to_machine_mapping;
   12.21  #define pfn_to_mfn(pfn)	\
   12.22 @@ -103,6 +93,15 @@ static inline void set_phys_to_machine(u
   12.23  	phys_to_machine_mapping[pfn] = mfn;
   12.24  }
   12.25  
   12.26 +/* Definitions for machine and pseudophysical addresses. */
   12.27 +#ifdef CONFIG_X86_PAE
   12.28 +typedef unsigned long long paddr_t;
   12.29 +typedef unsigned long long maddr_t;
   12.30 +#else
   12.31 +typedef unsigned long paddr_t;
   12.32 +typedef unsigned long maddr_t;
   12.33 +#endif
   12.34 +
   12.35  static inline maddr_t phys_to_machine(paddr_t phys)
   12.36  {
   12.37  	maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
   12.38 @@ -115,16 +114,7 @@ static inline paddr_t machine_to_phys(ma
   12.39  	phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
   12.40  	return phys;
   12.41  }
   12.42 -#else
   12.43 -#define pfn_to_mfn(p) (p)
   12.44 -#define mfn_to_pfn(m) (m)
   12.45 -#define phys_to_machine(p) (p)
   12.46 -#define machine_to_phys(m) (m)
   12.47 -static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
   12.48 -{
   12.49 -       BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
   12.50 -}
   12.51 -#endif
   12.52 +
   12.53  /*
   12.54   * These are used to make use of C type-checking..
   12.55   */
    13.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Sat Jan 28 11:09:18 2006 +0100
    13.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Sat Jan 28 12:09:45 2006 +0100
    13.3 @@ -64,7 +64,7 @@
    13.4  ({									\
    13.5  	unsigned long mfn = pte_mfn(_pte);				\
    13.6  	unsigned long pfn = mfn_to_pfn(mfn);				\
    13.7 -	if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))             \
    13.8 +	if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
    13.9  		pfn = max_mapnr; /* special: force !pfn_valid() */	\
   13.10  	pfn;								\
   13.11  })
    14.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h	Sat Jan 28 11:09:18 2006 +0100
    14.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h	Sat Jan 28 12:09:45 2006 +0100
    14.3 @@ -149,7 +149,7 @@ static inline int pte_none(pte_t pte)
    14.4  ({                                                                     \
    14.5         unsigned long mfn = pte_mfn(_pte);                              \
    14.6         unsigned long pfn = mfn_to_pfn(mfn);                            \
    14.7 -       if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))             \
    14.8 +       if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
    14.9                 pfn = max_mapnr; /* special: force !pfn_valid() */      \
   14.10         pfn;                                                            \
   14.11  })
    15.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Sat Jan 28 11:09:18 2006 +0100
    15.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Sat Jan 28 12:09:45 2006 +0100
    15.3 @@ -412,12 +412,6 @@ do {				  					\
    15.4  	ptep_set_access_flags(__vma, __address, __ptep, __entry, 1);	\
    15.5  } while (0)
    15.6  
    15.7 -void make_lowmem_page_readonly(void *va);
    15.8 -void make_lowmem_page_writable(void *va);
    15.9 -void make_page_readonly(void *va);
   15.10 -void make_page_writable(void *va);
   15.11 -void make_pages_readonly(void *va, unsigned int nr);
   15.12 -void make_pages_writable(void *va, unsigned int nr);
   15.13  #ifndef CONFIG_XEN_SHADOW_MODE
   15.14  void make_lowmem_mmu_page_readonly(void *va);
   15.15  void make_lowmem_mmu_page_writable(void *va);
    16.1 --- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h	Sat Jan 28 11:09:18 2006 +0100
    16.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h	Sat Jan 28 12:09:45 2006 +0100
    16.3 @@ -50,7 +50,7 @@ int gnttab_end_foreign_access_ref(grant_
    16.4  void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
    16.5  			       unsigned long page);
    16.6  
    16.7 -int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
    16.8 +int gnttab_grant_foreign_transfer(domid_t domid);
    16.9  
   16.10  unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
   16.11  unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
   16.12 @@ -77,8 +77,7 @@ void gnttab_request_free_callback(struct
   16.13  void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
   16.14  				     unsigned long frame, int readonly);
   16.15  
   16.16 -void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
   16.17 -				       unsigned long pfn);
   16.18 +void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid);
   16.19  
   16.20  #ifdef __ia64__
   16.21  #define gnttab_map_vaddr(map) __va(map.dev_bus_addr)