direct-io.hg

changeset 12366:f6b7ae6ed504

[LINUX] Support variable hypervisor_virt_start.

Introduce a new elfnote that specifies the lower boundary the kernel
wants to tolerate for the hypervisor hole.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Fri Nov 10 17:35:09 2006 +0000 (2006-11-10)
parents ca75b51d69c7
children b7ffbec0e307
files linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S linux-2.6-xen-sparse/arch/i386/mm/fault-xen.c linux-2.6-xen-sparse/arch/i386/mm/init-xen.c 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/hypervisor.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h xen/include/public/elfnote.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S	Fri Nov 10 17:21:54 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S	Fri Nov 10 17:35:09 2006 +0000
     1.3 @@ -9,7 +9,7 @@
     1.4  #include <asm/page.h>
     1.5  #include <asm/thread_info.h>
     1.6  #include <asm/asm-offsets.h>
     1.7 -#include <xen/interface/arch-x86_32.h>
     1.8 +#include <xen/interface/xen.h>
     1.9  #include <xen/interface/elfnote.h>
    1.10  
    1.11  /*
    1.12 @@ -192,6 +192,7 @@ ENTRY(cpu_gdt_table)
    1.13  #endif /* !CONFIG_XEN_COMPAT_030002 */
    1.14  	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
    1.15  	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
    1.16 +	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long,  HYPERVISOR_VIRT_START)
    1.17  	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
    1.18  #ifdef CONFIG_X86_PAE
    1.19  	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/fault-xen.c	Fri Nov 10 17:21:54 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/fault-xen.c	Fri Nov 10 17:35:09 2006 +0000
     2.3 @@ -282,12 +282,6 @@ static int spurious_fault(struct pt_regs
     2.4  	pmd_t *pmd;
     2.5  	pte_t *pte;
     2.6  
     2.7 -#ifdef CONFIG_XEN
     2.8 -	/* Faults in hypervisor area are never spurious. */
     2.9 -	if (address >= HYPERVISOR_VIRT_START)
    2.10 -		return 0;
    2.11 -#endif
    2.12 -
    2.13  	/* Reserved-bit violation or user access to kernel space? */
    2.14  	if (error_code & 0x0c)
    2.15  		return 0;
    2.16 @@ -372,7 +366,7 @@ fastcall void __kprobes do_page_fault(st
    2.17  	if (unlikely(address >= TASK_SIZE)) { 
    2.18  #ifdef CONFIG_XEN
    2.19  		/* Faults in hypervisor area can never be patched up. */
    2.20 -		if (address >= HYPERVISOR_VIRT_START)
    2.21 +		if (address >= hypervisor_virt_start)
    2.22  			goto bad_area_nosemaphore;
    2.23  #endif
    2.24  		if (!(error_code & 5))
     3.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c	Fri Nov 10 17:21:54 2006 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c	Fri Nov 10 17:35:09 2006 +0000
     3.3 @@ -130,7 +130,7 @@ static void __init page_table_range_init
     3.4  		pud = pud_offset(pgd, vaddr);
     3.5  		pmd = pmd_offset(pud, vaddr);
     3.6  		for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); pmd++, pmd_idx++) {
     3.7 -			if (vaddr < HYPERVISOR_VIRT_START && pmd_none(*pmd)) 
     3.8 +			if (vaddr < hypervisor_virt_start && pmd_none(*pmd))
     3.9  				one_page_table_init(pmd);
    3.10  
    3.11  			vaddr += PMD_SIZE;
    3.12 @@ -187,7 +187,7 @@ static void __init kernel_physical_mappi
    3.13  		pmd += pmd_idx;
    3.14  		for (; pmd_idx < PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_idx++) {
    3.15  			unsigned int address = pfn * PAGE_SIZE + PAGE_OFFSET;
    3.16 -			if (address >= HYPERVISOR_VIRT_START)
    3.17 +			if (address >= hypervisor_virt_start)
    3.18  				continue;
    3.19  
    3.20  			/* Map with big pages if possible, otherwise create normal page tables. */
    3.21 @@ -410,7 +410,7 @@ static void __init pagetable_init (void)
    3.22  	 * created - mappings will be set by set_fixmap():
    3.23  	 */
    3.24  	vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
    3.25 -	page_table_range_init(vaddr, 0, pgd_base);
    3.26 +	page_table_range_init(vaddr, hypervisor_virt_start, pgd_base);
    3.27  
    3.28  	permanent_kmaps_init(pgd_base);
    3.29  }
     4.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Fri Nov 10 17:21:54 2006 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Fri Nov 10 17:35:09 2006 +0000
     4.3 @@ -186,9 +186,16 @@ void set_pmd_pfn(unsigned long vaddr, un
     4.4  }
     4.5  
     4.6  static int nr_fixmaps = 0;
     4.7 +unsigned long hypervisor_virt_start = HYPERVISOR_VIRT_START;
     4.8  unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE);
     4.9  EXPORT_SYMBOL(__FIXADDR_TOP);
    4.10  
    4.11 +void __init set_fixaddr_top()
    4.12 +{
    4.13 +	BUG_ON(nr_fixmaps > 0);
    4.14 +	__FIXADDR_TOP = hypervisor_virt_start - 2 * PAGE_SIZE;
    4.15 +}
    4.16 +
    4.17  void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags)
    4.18  {
    4.19  	unsigned long address = __fix_to_virt(idx);
    4.20 @@ -211,12 +218,6 @@ void __set_fixmap (enum fixed_addresses 
    4.21  	nr_fixmaps++;
    4.22  }
    4.23  
    4.24 -void set_fixaddr_top(unsigned long top)
    4.25 -{
    4.26 -	BUG_ON(nr_fixmaps > 0);
    4.27 -	__FIXADDR_TOP = top - PAGE_SIZE;
    4.28 -}
    4.29 -
    4.30  pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
    4.31  {
    4.32  	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
     5.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h	Fri Nov 10 17:21:54 2006 +0000
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h	Fri Nov 10 17:35:09 2006 +0000
     5.3 @@ -98,7 +98,7 @@ enum fixed_addresses {
     5.4  extern void __set_fixmap(enum fixed_addresses idx,
     5.5  					maddr_t phys, pgprot_t flags);
     5.6  
     5.7 -extern void set_fixaddr_top(unsigned long top);
     5.8 +extern void set_fixaddr_top(void);
     5.9  
    5.10  #define set_fixmap(idx, phys) \
    5.11  		__set_fixmap(idx, phys, PAGE_KERNEL)
     6.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri Nov 10 17:21:54 2006 +0000
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri Nov 10 17:35:09 2006 +0000
     6.3 @@ -56,6 +56,10 @@
     6.4  
     6.5  extern shared_info_t *HYPERVISOR_shared_info;
     6.6  
     6.7 +#ifdef CONFIG_X86_32
     6.8 +extern unsigned long hypervisor_virt_start;
     6.9 +#endif
    6.10 +
    6.11  /* arch/xen/i386/kernel/setup.c */
    6.12  extern start_info_t *xen_start_info;
    6.13  #ifdef CONFIG_XEN_PRIVILEGED_GUEST
     7.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	Fri Nov 10 17:21:54 2006 +0000
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	Fri Nov 10 17:35:09 2006 +0000
     7.3 @@ -9,7 +9,6 @@
     7.4  
     7.5  #define PGDIR_SHIFT	22
     7.6  #define PTRS_PER_PGD	1024
     7.7 -#define PTRS_PER_PGD_NO_HV	(HYPERVISOR_VIRT_START >> PGDIR_SHIFT)
     7.8  
     7.9  /*
    7.10   * the i386 is two-level, so we don't really have any
     8.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	Fri Nov 10 17:21:54 2006 +0000
     8.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	Fri Nov 10 17:35:09 2006 +0000
     8.3 @@ -8,7 +8,6 @@
     8.4   */
     8.5  #define PGDIR_SHIFT	30
     8.6  #define PTRS_PER_PGD	4
     8.7 -#define PTRS_PER_PGD_NO_HV 4
     8.8  
     8.9  /*
    8.10   * PMD_SHIFT determines the size of the area a middle-level
     9.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Fri Nov 10 17:21:54 2006 +0000
     9.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Fri Nov 10 17:35:09 2006 +0000
     9.3 @@ -92,8 +92,10 @@ static void __init machine_specific_arch
     9.4  #endif
     9.5  
     9.6  	if (HYPERVISOR_xen_version(XENVER_platform_parameters,
     9.7 -				   &pp) == 0)
     9.8 -		set_fixaddr_top(pp.virt_start - PAGE_SIZE);
     9.9 +				   &pp) == 0) {
    9.10 +		hypervisor_virt_start = pp.virt_start;
    9.11 +		set_fixaddr_top();
    9.12 +	}
    9.13  
    9.14  	machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
    9.15  	machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
    10.1 --- a/xen/include/public/elfnote.h	Fri Nov 10 17:21:54 2006 +0000
    10.2 +++ b/xen/include/public/elfnote.h	Fri Nov 10 17:35:09 2006 +0000
    10.3 @@ -138,6 +138,15 @@
    10.4   */
    10.5  #define XEN_ELFNOTE_BSD_SYMTAB    11
    10.6  
    10.7 +/*
    10.8 + * The lowest address the hypervisor hole can begin at (numeric).
    10.9 + *
   10.10 + * This must not be set higher than HYPERVISOR_VIRT_START. Its presence
   10.11 + * also indicates to the hypervisor that the kernel can deal with the
   10.12 + * hole starting at a higher address.
   10.13 + */
   10.14 +#define XEN_ELFNOTE_HV_START_LOW  12
   10.15 +
   10.16  #endif /* __XEN_PUBLIC_ELFNOTE_H__ */
   10.17  
   10.18  /*