ia64/xen-unstable

changeset 14770:aeb9a84e46d9

Merge with xen-ia64-unstable.hg.
author kfraser@localhost.localdomain
date Fri Apr 06 22:32:57 2007 +0100 (2007-04-06)
parents eb3e430242ac f76df7aa0e45
children b0aaa113a60f
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Fri Apr 06 10:08:30 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Fri Apr 06 22:32:57 2007 +0100
     1.3 @@ -353,6 +353,7 @@ int xen_create_contiguous_region(
     1.4  
     1.5  	return success ? 0 : -ENOMEM;
     1.6  }
     1.7 +EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
     1.8  
     1.9  void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
    1.10  {
    1.11 @@ -437,6 +438,7 @@ void xen_destroy_contiguous_region(unsig
    1.12  
    1.13  	balloon_unlock(flags);
    1.14  }
    1.15 +EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
    1.16  
    1.17  #ifdef __i386__
    1.18  int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
     2.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h	Fri Apr 06 10:08:30 2007 -0600
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h	Fri Apr 06 22:32:57 2007 +0100
     2.3 @@ -153,23 +153,6 @@ static inline paddr_t pte_machine_to_phy
     2.4  }
     2.5  #endif
     2.6  
     2.7 -#else /* !CONFIG_XEN */
     2.8 -
     2.9 -#define pfn_to_mfn(pfn) (pfn)
    2.10 -#define mfn_to_pfn(mfn) (mfn)
    2.11 -#define mfn_to_local_pfn(mfn) (mfn)
    2.12 -#define set_phys_to_machine(pfn, mfn) ((void)0)
    2.13 -#define phys_to_machine_mapping_valid(pfn) (1)
    2.14 -#define phys_to_machine(phys) ((maddr_t)(phys))
    2.15 -#define machine_to_phys(mach) ((paddr_t)(mach))
    2.16 -
    2.17 -#endif /* !CONFIG_XEN */
    2.18 -
    2.19 -/* VIRT <-> MACHINE conversion */
    2.20 -#define virt_to_machine(v)	(phys_to_machine(__pa(v)))
    2.21 -#define virt_to_mfn(v)		(pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
    2.22 -#define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
    2.23 -
    2.24  #ifdef CONFIG_X86_PAE
    2.25  static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
    2.26  {
    2.27 @@ -188,4 +171,23 @@ static inline pte_t pfn_pte_ma(unsigned 
    2.28  
    2.29  #define __pte_ma(x)	((pte_t) { (x) } )
    2.30  
    2.31 +#else /* !CONFIG_XEN */
    2.32 +
    2.33 +#define pfn_to_mfn(pfn) (pfn)
    2.34 +#define mfn_to_pfn(mfn) (mfn)
    2.35 +#define mfn_to_local_pfn(mfn) (mfn)
    2.36 +#define set_phys_to_machine(pfn, mfn) ((void)0)
    2.37 +#define phys_to_machine_mapping_valid(pfn) (1)
    2.38 +#define phys_to_machine(phys) ((maddr_t)(phys))
    2.39 +#define machine_to_phys(mach) ((paddr_t)(mach))
    2.40 +#define pfn_pte_ma(pfn, prot) pfn_pte(pfn, prot)
    2.41 +#define __pte_ma(x) __pte(x)
    2.42 +
    2.43 +#endif /* !CONFIG_XEN */
    2.44 +
    2.45 +/* VIRT <-> MACHINE conversion */
    2.46 +#define virt_to_machine(v)	(phys_to_machine(__pa(v)))
    2.47 +#define virt_to_mfn(v)		(pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
    2.48 +#define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
    2.49 +
    2.50  #endif /* _I386_MADDR_H */
     3.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h	Fri Apr 06 10:08:30 2007 -0600
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h	Fri Apr 06 22:32:57 2007 +0100
     3.3 @@ -135,6 +135,9 @@ static inline paddr_t pte_machine_to_phy
     3.4  	return phys;
     3.5  }
     3.6  
     3.7 +#define __pte_ma(x)     ((pte_t) { (x) } )
     3.8 +#define pfn_pte_ma(pfn, prot)	__pte_ma((((pfn) << PAGE_SHIFT) | pgprot_val(prot)) & __supported_pte_mask)
     3.9 +
    3.10  #else /* !CONFIG_XEN */
    3.11  
    3.12  #define pfn_to_mfn(pfn) (pfn)
    3.13 @@ -144,6 +147,8 @@ static inline paddr_t pte_machine_to_phy
    3.14  #define phys_to_machine_mapping_valid(pfn) (1)
    3.15  #define phys_to_machine(phys) ((maddr_t)(phys))
    3.16  #define machine_to_phys(mach) ((paddr_t)(mach))
    3.17 +#define pfn_pte_ma(pfn, prot) pfn_pte(pfn, prot)
    3.18 +#define __pte_ma(x) __pte(x)
    3.19  
    3.20  #endif /* !CONFIG_XEN */
    3.21  
    3.22 @@ -152,8 +157,5 @@ static inline paddr_t pte_machine_to_phy
    3.23  #define virt_to_mfn(v)		(pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
    3.24  #define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
    3.25  
    3.26 -#define __pte_ma(x)     ((pte_t) { (x) } )
    3.27 -#define pfn_pte_ma(pfn, prot)	__pte_ma((((pfn) << PAGE_SHIFT) | pgprot_val(prot)) & __supported_pte_mask)
    3.28 -
    3.29  #endif /* _X86_64_MADDR_H */
    3.30  
     4.1 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Fri Apr 06 10:08:30 2007 -0600
     4.2 +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Fri Apr 06 22:32:57 2007 +0100
     4.3 @@ -96,6 +96,10 @@ extern char *kasprintf(gfp_t gfp, const 
     4.4  #define handle_sysrq(x,y,z) handle_sysrq(x,y)
     4.5  #endif
     4.6  
     4.7 +#if defined(_PAGE_PRESENT) && !defined(_PAGE_NX)
     4.8 +#define _PAGE_NX 0
     4.9 +#endif
    4.10 +
    4.11  /*
    4.12   * This variable at present is referenced by netfront, but only in code that
    4.13   * is dead when running in hvm guests. To detect potential active uses of it
     5.1 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Fri Apr 06 10:08:30 2007 -0600
     5.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Fri Apr 06 22:32:57 2007 +0100
     5.3 @@ -1,6 +1,6 @@
     5.4  /******************************************************************************
     5.5 - * evtchn-pci.c
     5.6 - * xen event channel fake PCI device driver
     5.7 + * platform-pci.c
     5.8 + * Xen platform PCI device driver
     5.9   * Copyright (C) 2005, Intel Corporation.
    5.10   *
    5.11   * This program is free software; you can redistribute it and/or modify it
     6.1 --- a/xen/arch/x86/mm/shadow/common.c	Fri Apr 06 10:08:30 2007 -0600
     6.2 +++ b/xen/arch/x86/mm/shadow/common.c	Fri Apr 06 22:32:57 2007 +0100
     6.3 @@ -1245,9 +1245,6 @@ static unsigned int sh_set_allocation(st
     6.4              list_del(&sp->list);
     6.5              d->arch.paging.shadow.free_pages -= 1<<SHADOW_MAX_ORDER;
     6.6              d->arch.paging.shadow.total_pages -= 1<<SHADOW_MAX_ORDER;
     6.7 -            for ( j = 0; j < 1<<SHADOW_MAX_ORDER; j++ ) 
     6.8 -                /* Keep the page allocator happy */
     6.9 -                ((struct page_info *)sp)[j].count_info = 0;
    6.10              free_domheap_pages((struct page_info *)sp, SHADOW_MAX_ORDER);
    6.11          }
    6.12  
     7.1 --- a/xen/arch/x86/traps.c	Fri Apr 06 10:08:30 2007 -0600
     7.2 +++ b/xen/arch/x86/traps.c	Fri Apr 06 22:32:57 2007 +0100
     7.3 @@ -270,21 +270,6 @@ void show_stack(struct cpu_user_regs *re
     7.4      show_trace(regs);
     7.5  }
     7.6  
     7.7 -void show_xen_trace()
     7.8 -{
     7.9 -    struct cpu_user_regs regs;
    7.10 -#ifdef __x86_64
    7.11 -    __asm__("movq %%rsp,%0" : "=m" (regs.rsp));
    7.12 -    __asm__("movq %%rbp,%0" : "=m" (regs.rbp));
    7.13 -    __asm__("leaq 0(%%rip),%0" : "=a" (regs.rip));
    7.14 -#else
    7.15 -    __asm__("movl %%esp,%0" : "=m" (regs.esp));
    7.16 -    __asm__("movl %%ebp,%0" : "=m" (regs.ebp));
    7.17 -    __asm__("call 1f; 1: popl %0" : "=a" (regs.eip));
    7.18 -#endif
    7.19 -    show_trace(&regs);
    7.20 -}
    7.21 -
    7.22  void show_stack_overflow(unsigned int cpu, unsigned long esp)
    7.23  {
    7.24  #ifdef MEMORY_GUARD
     8.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Apr 06 10:08:30 2007 -0600
     8.2 +++ b/xen/arch/x86/x86_32/entry.S	Fri Apr 06 22:32:57 2007 +0100
     8.3 @@ -283,6 +283,7 @@ bad_hypercall:
     8.4  /* %edx == trap_bounce, %ebx == struct vcpu                       */
     8.5  /* %eax,%ecx are clobbered. %gs:%esi contain new UREGS_ss/UREGS_esp. */
     8.6  create_bounce_frame:
     8.7 +        ASSERT_INTERRUPTS_ENABLED
     8.8          movl UREGS_eflags+4(%esp),%ecx
     8.9          movb UREGS_cs+4(%esp),%cl
    8.10          testl $(2|X86_EFLAGS_VM),%ecx
     9.1 --- a/xen/arch/x86/x86_64/compat/entry.S	Fri Apr 06 10:08:30 2007 -0600
     9.2 +++ b/xen/arch/x86/x86_64/compat/entry.S	Fri Apr 06 22:32:57 2007 +0100
     9.3 @@ -137,6 +137,7 @@ compat_bad_hypercall:
     9.4  
     9.5  /* %rbx: struct vcpu, interrupts disabled */
     9.6  compat_restore_all_guest:
     9.7 +        ASSERT_INTERRUPTS_DISABLED
     9.8          RESTORE_ALL
     9.9          addq  $8,%rsp
    9.10  .Lft0:  iretq
    9.11 @@ -188,13 +189,14 @@ ENTRY(compat_post_handle_exception)
    9.12  
    9.13  ENTRY(compat_int80_direct_trap)
    9.14          call  compat_create_bounce_frame
    9.15 -        jmp   compat_restore_all_guest
    9.16 +        jmp   compat_test_all_events
    9.17  
    9.18  /* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK:            */
    9.19  /*   {[ERRCODE,] EIP, CS, EFLAGS, [ESP, SS]}                             */
    9.20  /* %rdx: trap_bounce, %rbx: struct vcpu                                  */
    9.21  /* On return only %rbx is guaranteed non-clobbered.                      */
    9.22  compat_create_bounce_frame:
    9.23 +        ASSERT_INTERRUPTS_ENABLED
    9.24          mov   %fs,%edi
    9.25          testb $2,UREGS_cs+8(%rsp)
    9.26          jz    1f
    10.1 --- a/xen/arch/x86/x86_64/entry.S	Fri Apr 06 10:08:30 2007 -0600
    10.2 +++ b/xen/arch/x86/x86_64/entry.S	Fri Apr 06 22:32:57 2007 +0100
    10.3 @@ -38,6 +38,7 @@ 1:      call  create_bounce_frame
    10.4  
    10.5  /* %rbx: struct vcpu, interrupts disabled */
    10.6  restore_all_guest:
    10.7 +        ASSERT_INTERRUPTS_DISABLED
    10.8          RESTORE_ALL
    10.9          testw $TRAP_syscall,4(%rsp)
   10.10          jz    iret_exit_to_guest
   10.11 @@ -230,7 +231,7 @@ ENTRY(int80_direct_trap)
   10.12  
   10.13          /* Check that the callback is non-null. */
   10.14          leaq  VCPU_int80_bounce(%rbx),%rdx
   10.15 -        cmp   $0, TRAPBOUNCE_flags(%rdx)
   10.16 +        cmp   $0,TRAPBOUNCE_flags(%rdx)
   10.17          jz    int80_slow_path
   10.18  
   10.19          movq  VCPU_domain(%rbx),%rax
   10.20 @@ -238,7 +239,7 @@ ENTRY(int80_direct_trap)
   10.21          jnz   compat_int80_direct_trap
   10.22  
   10.23          call  create_bounce_frame
   10.24 -        jmp   restore_all_guest
   10.25 +        jmp   test_all_events
   10.26  
   10.27  int80_slow_path:
   10.28          /* 
   10.29 @@ -256,6 +257,7 @@ int80_slow_path:
   10.30  /* %rdx: trap_bounce, %rbx: struct vcpu                           */
   10.31  /* On return only %rbx is guaranteed non-clobbered.                      */
   10.32  create_bounce_frame:
   10.33 +        ASSERT_INTERRUPTS_ENABLED
   10.34          testb $TF_kernel_mode,VCPU_thread_flags(%rbx)
   10.35          jnz   1f
   10.36          /* Push new frame at registered guest-OS stack base. */
    11.1 --- a/xen/arch/x86/x86_64/traps.c	Fri Apr 06 10:08:30 2007 -0600
    11.2 +++ b/xen/arch/x86/x86_64/traps.c	Fri Apr 06 22:32:57 2007 +0100
    11.3 @@ -170,7 +170,8 @@ asmlinkage void do_double_fault(struct c
    11.4             regs->r9,  regs->r10, regs->r11);
    11.5      printk("r12: %016lx   r13: %016lx   r14: %016lx\n",
    11.6             regs->r12, regs->r13, regs->r14);
    11.7 -    printk("r15: %016lx\n", regs->r15);
    11.8 +    printk("r15: %016lx    cs: %016lx    ss: %016lx\n",
    11.9 +           regs->r15, (long)regs->cs, (long)regs->ss);
   11.10      show_stack_overflow(cpu, regs->rsp);
   11.11  
   11.12      panic("DOUBLE FAULT -- system shutdown\n");
   11.13 @@ -260,11 +261,14 @@ void __init percpu_traps_init(void)
   11.14          idt_table[TRAP_double_fault].a |= 1UL << 32; /* IST1 */
   11.15          idt_table[TRAP_nmi].a          |= 2UL << 32; /* IST2 */
   11.16  
   11.17 -#ifdef CONFIG_COMPAT
   11.18 -        /* The hypercall entry vector is only accessible from ring 1. */
   11.19 +        /*
   11.20 +         * The 32-on-64 hypercall entry vector is only accessible from ring 1.
   11.21 +         * Also note that this is a trap gate, not an interrupt gate.
   11.22 +         */
   11.23          _set_gate(idt_table+HYPERCALL_VECTOR, 15, 1, &compat_hypercall);
   11.24 +
   11.25 +        /* Fast trap for int80 (faster than taking the #GP-fixup path). */
   11.26          _set_gate(idt_table+0x80, 15, 3, &int80_direct_trap);
   11.27 -#endif
   11.28      }
   11.29  
   11.30      stack_bottom = (char *)get_stack_bottom();
    12.1 --- a/xen/arch/x86/x86_emulate.c	Fri Apr 06 10:08:30 2007 -0600
    12.2 +++ b/xen/arch/x86/x86_emulate.c	Fri Apr 06 22:32:57 2007 +0100
    12.3 @@ -2413,7 +2413,7 @@ x86_emulate(
    12.4      goto writeback;
    12.5  
    12.6   cannot_emulate:
    12.7 -#ifdef __XEN__
    12.8 +#if 0
    12.9      gdprintk(XENLOG_DEBUG, "Instr:");
   12.10      for ( ea.mem.off = ctxt->regs->eip; ea.mem.off < _regs.eip; ea.mem.off++ )
   12.11      {
    13.1 --- a/xen/common/page_alloc.c	Fri Apr 06 10:08:30 2007 -0600
    13.2 +++ b/xen/common/page_alloc.c	Fri Apr 06 22:32:57 2007 +0100
    13.3 @@ -445,7 +445,19 @@ static void free_heap_pages(
    13.4  
    13.5      for ( i = 0; i < (1 << order); i++ )
    13.6      {
    13.7 -        BUG_ON(pg[i].count_info != 0);
    13.8 +        /*
    13.9 +         * Cannot assume that count_info == 0, as there are some corner cases
   13.10 +         * where it isn't the case and yet it isn't a bug:
   13.11 +         *  1. page_get_owner() is NULL
   13.12 +         *  2. page_get_owner() is a domain that was never accessible by
   13.13 +         *     its domid (e.g., failed to fully construct the domain).
   13.14 +         *  3. page was never addressable by the guest (e.g., it's an
   13.15 +         *     auto-translate-physmap guest and the page was never included
   13.16 +         *     in its pseudophysical address space).
   13.17 +         * In all the above cases there can be no guest mappings of this page.
   13.18 +         */
   13.19 +        pg[i].count_info = 0;
   13.20 +
   13.21          if ( (d = page_get_owner(&pg[i])) != NULL )
   13.22          {
   13.23              pg[i].tlbflush_timestamp = tlbflush_current_time();
    14.1 --- a/xen/include/asm-x86/desc.h	Fri Apr 06 10:08:30 2007 -0600
    14.2 +++ b/xen/include/asm-x86/desc.h	Fri Apr 06 22:32:57 2007 +0100
    14.3 @@ -106,7 +106,7 @@
    14.4      ((((sel)>>3) < FIRST_RESERVED_GDT_ENTRY) || /* Guest seg? */        \
    14.5       ((sel) == (!IS_COMPAT(d) ?                                         \
    14.6                  FLAT_KERNEL_CS :                /* Xen default seg? */  \
    14.7 -                FLAT_COMPAT_KERNEL_CS)) ||      /* Xen default compat seg? */  \
    14.8 +                FLAT_COMPAT_KERNEL_CS)) ||                              \
    14.9       ((sel) & 4))                               /* LDT seg? */
   14.10  
   14.11  #endif /* __ASSEMBLY__ */
    15.1 --- a/xen/include/asm-x86/processor.h	Fri Apr 06 10:08:30 2007 -0600
    15.2 +++ b/xen/include/asm-x86/processor.h	Fri Apr 06 22:32:57 2007 +0100
    15.3 @@ -552,7 +552,6 @@ extern always_inline void prefetchw(cons
    15.4  #endif
    15.5  
    15.6  void show_stack(struct cpu_user_regs *regs);
    15.7 -void show_xen_trace(void);
    15.8  void show_stack_overflow(unsigned int cpu, unsigned long esp);
    15.9  void show_registers(struct cpu_user_regs *regs);
   15.10  void show_execution_state(struct cpu_user_regs *regs);
    16.1 --- a/xen/include/asm-x86/x86_32/asm_defns.h	Fri Apr 06 10:08:30 2007 -0600
    16.2 +++ b/xen/include/asm-x86/x86_32/asm_defns.h	Fri Apr 06 22:32:57 2007 +0100
    16.3 @@ -8,10 +8,20 @@
    16.4  #define SETUP_EXCEPTION_FRAME_POINTER           \
    16.5          movl  %esp,%ebp;                        \
    16.6          notl  %ebp
    16.7 +#define ASSERT_INTERRUPT_STATUS(x)              \
    16.8 +        pushf;                                  \
    16.9 +        testb $X86_EFLAGS_IF>>8,1(%esp);        \
   16.10 +        j##x  1f;                               \
   16.11 +        ud2a;                                   \
   16.12 +1:      addl  $4,%esp;
   16.13  #else
   16.14  #define SETUP_EXCEPTION_FRAME_POINTER
   16.15 +#define ASSERT_INTERRUPT_STATUS(x)
   16.16  #endif
   16.17  
   16.18 +#define ASSERT_INTERRUPTS_ENABLED  ASSERT_INTERRUPT_STATUS(nz)
   16.19 +#define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z)
   16.20 +
   16.21  #define __SAVE_ALL_PRE                                  \
   16.22          cld;                                            \
   16.23          pushl %eax;                                     \
    17.1 --- a/xen/include/asm-x86/x86_64/asm_defns.h	Fri Apr 06 10:08:30 2007 -0600
    17.2 +++ b/xen/include/asm-x86/x86_64/asm_defns.h	Fri Apr 06 22:32:57 2007 +0100
    17.3 @@ -8,10 +8,20 @@
    17.4  #define SETUP_EXCEPTION_FRAME_POINTER           \
    17.5          movq  %rsp,%rbp;                        \
    17.6          notq  %rbp
    17.7 +#define ASSERT_INTERRUPT_STATUS(x)              \
    17.8 +        pushf;                                  \
    17.9 +        testb $X86_EFLAGS_IF>>8,1(%rsp);        \
   17.10 +        j##x  1f;                               \
   17.11 +        ud2a;                                   \
   17.12 +1:      addq  $8,%rsp;
   17.13  #else
   17.14  #define SETUP_EXCEPTION_FRAME_POINTER
   17.15 +#define ASSERT_INTERRUPT_STATUS(x)
   17.16  #endif
   17.17  
   17.18 +#define ASSERT_INTERRUPTS_ENABLED  ASSERT_INTERRUPT_STATUS(nz)
   17.19 +#define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z)
   17.20 +
   17.21  #define SAVE_ALL                                \
   17.22          cld;                                    \
   17.23          pushq %rdi;                             \