ia64/xen-unstable

changeset 2175:20558f1acfc7

bitkeeper revision 1.1159.19.1 (41190469aRywjSOUQv09SB13veEdJQ)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
into freefall.cl.cam.ac.uk:/local/scratch/cl349/xeno.bk-26dom0
author cl349@freefall.cl.cam.ac.uk
date Tue Aug 10 17:22:49 2004 +0000 (2004-08-10)
parents d000e4ddb729 66326f4bc8d2
children 9e5c2fef3f55
files .rootkeys linux-2.6.7-xen-sparse/arch/xen/i386/Kconfig linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile linux-2.6.7-xen-sparse/arch/xen/i386/mm/highmem.c linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/highmem.h linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h
line diff
     1.1 --- a/.rootkeys	Tue Aug 10 07:39:01 2004 +0000
     1.2 +++ b/.rootkeys	Tue Aug 10 17:22:49 2004 +0000
     1.3 @@ -155,6 +155,7 @@ 40f56238JypKAUG01ZojFwH7qnZ5uA linux-2.6
     1.4  40f56238wi6AdNQjm0RT57bSkwb6hg linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.lds
     1.5  40f56238a3w6-byOzexIlMgni76Lcg linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile
     1.6  40f56238ILx8xlbywNbzTdv5Zr4xXQ linux-2.6.7-xen-sparse/arch/xen/i386/mm/fault.c
     1.7 +4118cc35CbY8rfGVspF5O-7EkXBEAA linux-2.6.7-xen-sparse/arch/xen/i386/mm/highmem.c
     1.8  40f562383SKvDStdtrvzr5fyCbW4rw linux-2.6.7-xen-sparse/arch/xen/i386/mm/hypervisor.c
     1.9  40f56239xcNylAxuGsQHwi1AyMLV8w linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c
    1.10  41062ab7CjxC1UBaFhOMWWdhHkIUyg linux-2.6.7-xen-sparse/arch/xen/i386/mm/ioremap.c
    1.11 @@ -202,6 +203,7 @@ 40f56239YAjS52QG2FIAQpHDZAdGHg linux-2.6
    1.12  4107adf1E5O4ztGHNGMzCCNhcvqNow linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h
    1.13  40f5623anSzpuEHgiNmQ56fIRfCoaQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/e820.h
    1.14  40f5623akIoBsQ3KxSB2kufkbgONXQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h
    1.15 +4118b6a418gnL6AZsTdglC92YGqYTg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/highmem.h
    1.16  40f5623aJVXQwpJMOLE99XgvGsfQ8Q linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h
    1.17  40f5623am9BzluYFuV6EQfTd-so3dA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h
    1.18  40f5623adZQ1IZGPxbDXONjyZGYuTA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h
     2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/Kconfig	Tue Aug 10 07:39:01 2004 +0000
     2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/Kconfig	Tue Aug 10 17:22:49 2004 +0000
     2.3 @@ -555,14 +555,14 @@ config HAVE_ARCH_BOOTMEM_NODE
     2.4  	depends on NUMA
     2.5  	default y
     2.6  
     2.7 -config HIGHPTE
     2.8 -	bool "Allocate 3rd-level pagetables from highmem"
     2.9 -	depends on HIGHMEM4G || HIGHMEM64G
    2.10 -	help
    2.11 -	  The VM uses one page table entry for each page of physical memory.
    2.12 -	  For systems with a lot of RAM, this can be wasteful of precious
    2.13 -	  low memory.  Setting this option will put user-space page table
    2.14 -	  entries in high memory.
    2.15 +#config HIGHPTE
    2.16 +#	bool "Allocate 3rd-level pagetables from highmem"
    2.17 +#	depends on HIGHMEM4G || HIGHMEM64G
    2.18 +#	help
    2.19 +#	  The VM uses one page table entry for each page of physical memory.
    2.20 +#	  For systems with a lot of RAM, this can be wasteful of precious
    2.21 +#	  low memory.  Setting this option will put user-space page table
    2.22 +#	  entries in high memory.
    2.23  
    2.24  #config MTRR
    2.25  #	 bool "MTRR (Memory Type Range Register) support"
     3.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile	Tue Aug 10 07:39:01 2004 +0000
     3.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile	Tue Aug 10 17:22:49 2004 +0000
     3.3 @@ -11,7 +11,7 @@ c-obj-y	:= extable.o pageattr.o
     3.4  
     3.5  c-obj-$(CONFIG_DISCONTIGMEM)	+= discontig.o
     3.6  c-obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
     3.7 -c-obj-$(CONFIG_HIGHMEM) += highmem.o
     3.8 +obj-$(CONFIG_HIGHMEM) += highmem.o
     3.9  c-obj-$(CONFIG_BOOT_IOREMAP) += boot_ioremap.o
    3.10  
    3.11  c-link	:=
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/highmem.c	Tue Aug 10 17:22:49 2004 +0000
     4.3 @@ -0,0 +1,137 @@
     4.4 +#include <linux/highmem.h>
     4.5 +
     4.6 +void *kmap(struct page *page)
     4.7 +{
     4.8 +	might_sleep();
     4.9 +	if (page < highmem_start_page)
    4.10 +		return page_address(page);
    4.11 +	return kmap_high(page);
    4.12 +}
    4.13 +
    4.14 +void kunmap(struct page *page)
    4.15 +{
    4.16 +	if (in_interrupt())
    4.17 +		BUG();
    4.18 +	if (page < highmem_start_page)
    4.19 +		return;
    4.20 +	kunmap_high(page);
    4.21 +}
    4.22 +
    4.23 +/*
    4.24 + * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
    4.25 + * no global lock is needed and because the kmap code must perform a global TLB
    4.26 + * invalidation when the kmap pool wraps.
    4.27 + *
    4.28 + * However when holding an atomic kmap is is not legal to sleep, so atomic
    4.29 + * kmaps are appropriate for short, tight code paths only.
    4.30 + */
    4.31 +void *kmap_atomic(struct page *page, enum km_type type)
    4.32 +{
    4.33 +	enum fixed_addresses idx;
    4.34 +	unsigned long vaddr;
    4.35 +
    4.36 +	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
    4.37 +	inc_preempt_count();
    4.38 +	if (page < highmem_start_page)
    4.39 +		return page_address(page);
    4.40 +
    4.41 +	idx = type + KM_TYPE_NR*smp_processor_id();
    4.42 +	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
    4.43 +#ifdef CONFIG_DEBUG_HIGHMEM
    4.44 +	if (!pte_none(*(kmap_pte-idx)))
    4.45 +		BUG();
    4.46 +#endif
    4.47 +	set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
    4.48 +	__flush_tlb_one(vaddr);
    4.49 +
    4.50 +	return (void*) vaddr;
    4.51 +}
    4.52 +
    4.53 +/* Same as kmap_atomic but with PAGE_KERNEL_RO page protection */
    4.54 +void *kmap_atomic_pte(struct page *page, enum km_type type)
    4.55 +{
    4.56 +	enum fixed_addresses idx;
    4.57 +	unsigned long vaddr;
    4.58 +
    4.59 +	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
    4.60 +	inc_preempt_count();
    4.61 +	if (page < highmem_start_page)
    4.62 +		return page_address(page);
    4.63 +
    4.64 +	idx = type + KM_TYPE_NR*smp_processor_id();
    4.65 +	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
    4.66 +#ifdef CONFIG_DEBUG_HIGHMEM
    4.67 +	if (!pte_none(*(kmap_pte-idx)))
    4.68 +		BUG();
    4.69 +#endif
    4.70 +	set_pte(kmap_pte-idx, mk_pte(page, PAGE_KERNEL_RO));
    4.71 +	__flush_tlb_one(vaddr);
    4.72 +
    4.73 +	return (void*) vaddr;
    4.74 +}
    4.75 +
    4.76 +void kunmap_atomic(void *kvaddr, enum km_type type)
    4.77 +{
    4.78 +#ifdef CONFIG_DEBUG_HIGHMEM
    4.79 +	unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
    4.80 +	enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
    4.81 +
    4.82 +	if (vaddr < FIXADDR_START) { // FIXME
    4.83 +		dec_preempt_count();
    4.84 +		preempt_check_resched();
    4.85 +		return;
    4.86 +	}
    4.87 +
    4.88 +	if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
    4.89 +		BUG();
    4.90 +
    4.91 +	/*
    4.92 +	 * force other mappings to Oops if they'll try to access
    4.93 +	 * this pte without first remap it
    4.94 +	 */
    4.95 +	pte_clear(kmap_pte-idx);
    4.96 +	__flush_tlb_one(vaddr);
    4.97 +#endif
    4.98 +
    4.99 +	dec_preempt_count();
   4.100 +	preempt_check_resched();
   4.101 +}
   4.102 +
   4.103 +void kunmap_atomic_force(void *kvaddr, enum km_type type)
   4.104 +{
   4.105 +	unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
   4.106 +	enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
   4.107 +
   4.108 +	if (vaddr < FIXADDR_START) { // FIXME
   4.109 +		dec_preempt_count();
   4.110 +		preempt_check_resched();
   4.111 +		return;
   4.112 +	}
   4.113 +
   4.114 +	if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
   4.115 +		BUG();
   4.116 +
   4.117 +	/*
   4.118 +	 * force other mappings to Oops if they'll try to access
   4.119 +	 * this pte without first remap it
   4.120 +	 */
   4.121 +	pte_clear(kmap_pte-idx);
   4.122 +	__flush_tlb_one(vaddr);
   4.123 +
   4.124 +	dec_preempt_count();
   4.125 +	preempt_check_resched();
   4.126 +}
   4.127 +
   4.128 +struct page *kmap_atomic_to_page(void *ptr)
   4.129 +{
   4.130 +	unsigned long idx, vaddr = (unsigned long)ptr;
   4.131 +	pte_t *pte;
   4.132 +
   4.133 +	if (vaddr < FIXADDR_START)
   4.134 +		return virt_to_page(ptr);
   4.135 +
   4.136 +	idx = virt_to_fix(vaddr);
   4.137 +	pte = kmap_pte - (idx - FIX_KMAP_BEGIN);
   4.138 +	return pte_page(*pte);
   4.139 +}
   4.140 +
     5.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c	Tue Aug 10 07:39:01 2004 +0000
     5.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c	Tue Aug 10 17:22:49 2004 +0000
     5.3 @@ -194,9 +194,17 @@ struct page *pte_alloc_one(struct mm_str
     5.4  	pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
     5.5  #endif
     5.6  	if (pte) {
     5.7 +#ifdef CONFIG_HIGHPTE
     5.8 +		void *kaddr = kmap_atomic(pte, KM_USER0);
     5.9 +		clear_page(kaddr);
    5.10 +		kunmap_atomic_force(kaddr, KM_USER0);
    5.11 +#else
    5.12  		clear_highpage(pte);
    5.13 +#endif
    5.14 +#ifdef CONFIG_HIGHPTE
    5.15 +		if (pte < highmem_start_page)
    5.16 +#endif
    5.17  		__make_page_readonly(phys_to_virt(page_to_pseudophys(pte)));
    5.18 -				/* XXXcl highmem */
    5.19  	}
    5.20  	return pte;
    5.21  }
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/highmem.h	Tue Aug 10 17:22:49 2004 +0000
     6.3 @@ -0,0 +1,72 @@
     6.4 +/*
     6.5 + * highmem.h: virtual kernel memory mappings for high memory
     6.6 + *
     6.7 + * Used in CONFIG_HIGHMEM systems for memory pages which
     6.8 + * are not addressable by direct kernel virtual addresses.
     6.9 + *
    6.10 + * Copyright (C) 1999 Gerhard Wichert, Siemens AG
    6.11 + *		      Gerhard.Wichert@pdb.siemens.de
    6.12 + *
    6.13 + *
    6.14 + * Redesigned the x86 32-bit VM architecture to deal with 
    6.15 + * up to 16 Terabyte physical memory. With current x86 CPUs
    6.16 + * we now support up to 64 Gigabytes physical RAM.
    6.17 + *
    6.18 + * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
    6.19 + */
    6.20 +
    6.21 +#ifndef _ASM_HIGHMEM_H
    6.22 +#define _ASM_HIGHMEM_H
    6.23 +
    6.24 +#ifdef __KERNEL__
    6.25 +
    6.26 +#include <linux/config.h>
    6.27 +#include <linux/interrupt.h>
    6.28 +#include <linux/threads.h>
    6.29 +#include <asm/kmap_types.h>
    6.30 +#include <asm/tlbflush.h>
    6.31 +
    6.32 +/* declarations for highmem.c */
    6.33 +extern unsigned long highstart_pfn, highend_pfn;
    6.34 +
    6.35 +extern pte_t *kmap_pte;
    6.36 +extern pgprot_t kmap_prot;
    6.37 +extern pte_t *pkmap_page_table;
    6.38 +
    6.39 +extern void kmap_init(void);
    6.40 +
    6.41 +/*
    6.42 + * Right now we initialize only a single pte table. It can be extended
    6.43 + * easily, subsequent pte tables have to be allocated in one physical
    6.44 + * chunk of RAM.
    6.45 + */
    6.46 +#if NR_CPUS <= 32
    6.47 +#define PKMAP_BASE (HYPERVISOR_VIRT_START - (1<<23))
    6.48 +#else
    6.49 +#define PKMAP_BASE (HYPERVISOR_VIRT_START - (1<<23) - 0x200000UL)
    6.50 +#endif
    6.51 +#ifdef CONFIG_X86_PAE
    6.52 +#define LAST_PKMAP 512
    6.53 +#else
    6.54 +#define LAST_PKMAP 1024
    6.55 +#endif
    6.56 +#define LAST_PKMAP_MASK (LAST_PKMAP-1)
    6.57 +#define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
    6.58 +#define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
    6.59 +
    6.60 +extern void * FASTCALL(kmap_high(struct page *page));
    6.61 +extern void FASTCALL(kunmap_high(struct page *page));
    6.62 +
    6.63 +void *kmap(struct page *page);
    6.64 +void kunmap(struct page *page);
    6.65 +void *kmap_atomic(struct page *page, enum km_type type);
    6.66 +void *kmap_atomic_pte(struct page *page, enum km_type type);
    6.67 +void kunmap_atomic(void *kvaddr, enum km_type type);
    6.68 +void kunmap_atomic_force(void *kvaddr, enum km_type type);
    6.69 +struct page *kmap_atomic_to_page(void *ptr);
    6.70 +
    6.71 +#define flush_cache_kmaps()	do { } while (0)
    6.72 +
    6.73 +#endif /* __KERNEL__ */
    6.74 +
    6.75 +#endif /* _ASM_HIGHMEM_H */
     7.1 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Tue Aug 10 07:39:01 2004 +0000
     7.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Tue Aug 10 17:22:49 2004 +0000
     7.3 @@ -333,9 +333,11 @@ static inline pte_t pte_modify(pte_t pte
     7.4  
     7.5  #if defined(CONFIG_HIGHPTE)
     7.6  #define pte_offset_map(dir, address) \
     7.7 -	((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
     7.8 +	((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + \
     7.9 +	 pte_index(address))
    7.10  #define pte_offset_map_nested(dir, address) \
    7.11 -	((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address))
    7.12 +	((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE1) + \
    7.13 +	 pte_index(address))
    7.14  #define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
    7.15  #define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
    7.16  #else