ia64/xen-unstable

changeset 8984:d161c07014a3

Make the fixmap area moveable in kernel address space.

From: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Feb 23 15:59:54 2006 +0000 (2006-02-23)
parents 822a27d28afe
children b40aefd658c0
files linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Thu Feb 23 15:22:19 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Thu Feb 23 15:59:54 2006 +0000
     1.3 @@ -13,6 +13,7 @@
     1.4  #include <linux/slab.h>
     1.5  #include <linux/pagemap.h>
     1.6  #include <linux/spinlock.h>
     1.7 +#include <linux/module.h>
     1.8  
     1.9  #include <asm/system.h>
    1.10  #include <asm/pgtable.h>
    1.11 @@ -184,6 +185,10 @@ void set_pmd_pfn(unsigned long vaddr, un
    1.12  	__flush_tlb_one(vaddr);
    1.13  }
    1.14  
    1.15 +static int nr_fixmaps = 0;
    1.16 +unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE);
    1.17 +EXPORT_SYMBOL(__FIXADDR_TOP);
    1.18 +
    1.19  void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags)
    1.20  {
    1.21  	unsigned long address = __fix_to_virt(idx);
    1.22 @@ -203,6 +208,13 @@ void __set_fixmap (enum fixed_addresses 
    1.23  		set_pte_pfn_ma(address, phys >> PAGE_SHIFT, flags);
    1.24  		break;
    1.25  	}
    1.26 +	nr_fixmaps++;
    1.27 +}
    1.28 +
    1.29 +void set_fixaddr_top(unsigned long top)
    1.30 +{
    1.31 +	BUG_ON(nr_fixmaps > 0);
    1.32 +	__FIXADDR_TOP = top - PAGE_SIZE;
    1.33  }
    1.34  
    1.35  pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
     2.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h	Thu Feb 23 15:22:19 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h	Thu Feb 23 15:59:54 2006 +0000
     2.3 @@ -20,7 +20,7 @@
     2.4   * Leave one empty page between vmalloc'ed areas and
     2.5   * the start of the fixmap.
     2.6   */
     2.7 -#define __FIXADDR_TOP	(HYPERVISOR_VIRT_START - 2 * PAGE_SIZE)
     2.8 +extern unsigned long __FIXADDR_TOP;
     2.9  
    2.10  #ifndef __ASSEMBLY__
    2.11  #include <linux/kernel.h>
    2.12 @@ -98,8 +98,10 @@ enum fixed_addresses {
    2.13  	__end_of_fixed_addresses
    2.14  };
    2.15  
    2.16 -extern void __set_fixmap(
    2.17 -	enum fixed_addresses idx, maddr_t phys, pgprot_t flags);
    2.18 +extern void __set_fixmap(enum fixed_addresses idx,
    2.19 +					maddr_t phys, pgprot_t flags);
    2.20 +
    2.21 +extern void set_fixaddr_top(unsigned long top);
    2.22  
    2.23  #define set_fixmap(idx, phys) \
    2.24  		__set_fixmap(idx, phys, PAGE_KERNEL)
     3.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h	Thu Feb 23 15:22:19 2006 +0000
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h	Thu Feb 23 15:59:54 2006 +0000
     3.3 @@ -294,7 +294,7 @@ extern int page_is_ram(unsigned long pag
     3.4  
     3.5  #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
     3.6  #define VMALLOC_RESERVE		((unsigned long)__VMALLOC_RESERVE)
     3.7 -#define MAXMEM			(HYPERVISOR_VIRT_START-__PAGE_OFFSET-__VMALLOC_RESERVE)
     3.8 +#define MAXMEM			(__FIXADDR_TOP-__PAGE_OFFSET-__VMALLOC_RESERVE)
     3.9  #define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
    3.10  #define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
    3.11  #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
     4.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Thu Feb 23 15:22:19 2006 +0000
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Thu Feb 23 15:59:54 2006 +0000
     4.3 @@ -33,6 +33,8 @@ extern void nmi(void);
     4.4  
     4.5  static void __init machine_specific_arch_setup(void)
     4.6  {
     4.7 +	struct xen_platform_parameters pp;
     4.8 +
     4.9  	HYPERVISOR_set_callbacks(
    4.10  	    __KERNEL_CS, (unsigned long)hypervisor_callback,
    4.11  	    __KERNEL_CS, (unsigned long)failsafe_callback);
    4.12 @@ -40,4 +42,8 @@ static void __init machine_specific_arch
    4.13  	HYPERVISOR_nmi_op(XENNMI_register_callback, (unsigned long)&nmi);
    4.14  
    4.15  	machine_specific_modify_cpu_capabilities(&boot_cpu_data);
    4.16 +
    4.17 +	if (HYPERVISOR_xen_version(XENVER_platform_parameters,
    4.18 +				   &pp) == 0)
    4.19 +		set_fixaddr_top(pp.virt_start - PAGE_SIZE);
    4.20  }