# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175895177 -3600
# Node ID aeb9a84e46d9ddcbd155a6b28f825588473f8eb0
# Parent eb3e430242ac8732d665b0a1f929bc324bc9fcdd
# Parent f76df7aa0e451acd010d8cccf4fe6c10006edcd9
Merge with xen-ia64-unstable.hg.
---
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c | 2
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h | 36
+++++-----
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h | 8 +-
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h | 4 +
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c | 4 -
xen/arch/x86/mm/shadow/common.c | 3
xen/arch/x86/traps.c | 15 ----
xen/arch/x86/x86_32/entry.S | 1
xen/arch/x86/x86_64/compat/entry.S | 4 -
xen/arch/x86/x86_64/entry.S | 6 +
xen/arch/x86/x86_64/traps.c | 12 ++-
xen/arch/x86/x86_emulate.c | 2
xen/common/page_alloc.c | 14 +++
xen/include/asm-x86/desc.h | 2
xen/include/asm-x86/processor.h | 1
xen/include/asm-x86/x86_32/asm_defns.h | 10 ++
xen/include/asm-x86/x86_64/asm_defns.h | 10 ++
17 files changed, 83 insertions(+), 51 deletions(-)
diff -r eb3e430242ac -r aeb9a84e46d9
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Fri Apr 06 10:08:30
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Fri Apr 06 22:32:57
2007 +0100
@@ -353,6 +353,7 @@ int xen_create_contiguous_region(
return success ? 0 : -ENOMEM;
}
+EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
{
@@ -437,6 +438,7 @@ void xen_destroy_contiguous_region(unsig
balloon_unlock(flags);
}
+EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
#ifdef __i386__
int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
diff -r eb3e430242ac -r aeb9a84e46d9
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h Fri Apr
06 10:08:30 2007 -0600
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h Fri Apr
06 22:32:57 2007 +0100
@@ -153,23 +153,6 @@ static inline paddr_t pte_machine_to_phy
}
#endif
-#else /* !CONFIG_XEN */
-
-#define pfn_to_mfn(pfn) (pfn)
-#define mfn_to_pfn(mfn) (mfn)
-#define mfn_to_local_pfn(mfn) (mfn)
-#define set_phys_to_machine(pfn, mfn) ((void)0)
-#define phys_to_machine_mapping_valid(pfn) (1)
-#define phys_to_machine(phys) ((maddr_t)(phys))
-#define machine_to_phys(mach) ((paddr_t)(mach))
-
-#endif /* !CONFIG_XEN */
-
-/* VIRT <-> MACHINE conversion */
-#define virt_to_machine(v) (phys_to_machine(__pa(v)))
-#define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
-#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
-
#ifdef CONFIG_X86_PAE
static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
{
@@ -188,4 +171,23 @@ static inline pte_t pfn_pte_ma(unsigned
#define __pte_ma(x) ((pte_t) { (x) } )
+#else /* !CONFIG_XEN */
+
+#define pfn_to_mfn(pfn) (pfn)
+#define mfn_to_pfn(mfn) (mfn)
+#define mfn_to_local_pfn(mfn) (mfn)
+#define set_phys_to_machine(pfn, mfn) ((void)0)
+#define phys_to_machine_mapping_valid(pfn) (1)
+#define phys_to_machine(phys) ((maddr_t)(phys))
+#define machine_to_phys(mach) ((paddr_t)(mach))
+#define pfn_pte_ma(pfn, prot) pfn_pte(pfn, prot)
+#define __pte_ma(x) __pte(x)
+
+#endif /* !CONFIG_XEN */
+
+/* VIRT <-> MACHINE conversion */
+#define virt_to_machine(v) (phys_to_machine(__pa(v)))
+#define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
+#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
+
#endif /* _I386_MADDR_H */
diff -r eb3e430242ac -r aeb9a84e46d9
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h Fri Apr
06 10:08:30 2007 -0600
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h Fri Apr
06 22:32:57 2007 +0100
@@ -135,6 +135,9 @@ static inline paddr_t pte_machine_to_phy
return phys;
}
+#define __pte_ma(x) ((pte_t) { (x) } )
+#define pfn_pte_ma(pfn, prot) __pte_ma((((pfn) << PAGE_SHIFT) |
pgprot_val(prot)) & __supported_pte_mask)
+
#else /* !CONFIG_XEN */
#define pfn_to_mfn(pfn) (pfn)
@@ -144,6 +147,8 @@ static inline paddr_t pte_machine_to_phy
#define phys_to_machine_mapping_valid(pfn) (1)
#define phys_to_machine(phys) ((maddr_t)(phys))
#define machine_to_phys(mach) ((paddr_t)(mach))
+#define pfn_pte_ma(pfn, prot) pfn_pte(pfn, prot)
+#define __pte_ma(x) __pte(x)
#endif /* !CONFIG_XEN */
@@ -152,8 +157,5 @@ static inline paddr_t pte_machine_to_phy
#define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
-#define __pte_ma(x) ((pte_t) { (x) } )
-#define pfn_pte_ma(pfn, prot) __pte_ma((((pfn) << PAGE_SHIFT) |
pgprot_val(prot)) & __supported_pte_mask)
-
#endif /* _X86_64_MADDR_H */
diff -r eb3e430242ac -r aeb9a84e46d9
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
--- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h Fri Apr
06 10:08:30 2007 -0600
+++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h Fri Apr
06 22:32:57 2007 +0100
@@ -96,6 +96,10 @@ extern char *kasprintf(gfp_t gfp, const
#define handle_sysrq(x,y,z) handle_sysrq(x,y)
#endif
+#if defined(_PAGE_PRESENT) && !defined(_PAGE_NX)
+#define _PAGE_NX 0
+#endif
+
/*
* This variable at present is referenced by netfront, but only in code that
* is dead when running in hvm guests. To detect potential active uses of it
diff -r eb3e430242ac -r aeb9a84e46d9
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c Fri Apr 06
10:08:30 2007 -0600
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c Fri Apr 06
22:32:57 2007 +0100
@@ -1,6 +1,6 @@
/******************************************************************************
- * evtchn-pci.c
- * xen event channel fake PCI device driver
+ * platform-pci.c
+ * Xen platform PCI device driver
* Copyright (C) 2005, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/mm/shadow/common.c Fri Apr 06 22:32:57 2007 +0100
@@ -1245,9 +1245,6 @@ static unsigned int sh_set_allocation(st
list_del(&sp->list);
d->arch.paging.shadow.free_pages -= 1<<SHADOW_MAX_ORDER;
d->arch.paging.shadow.total_pages -= 1<<SHADOW_MAX_ORDER;
- for ( j = 0; j < 1<<SHADOW_MAX_ORDER; j++ )
- /* Keep the page allocator happy */
- ((struct page_info *)sp)[j].count_info = 0;
free_domheap_pages((struct page_info *)sp, SHADOW_MAX_ORDER);
}
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/traps.c Fri Apr 06 22:32:57 2007 +0100
@@ -268,21 +268,6 @@ void show_stack(struct cpu_user_regs *re
printk("\n");
show_trace(regs);
-}
-
-void show_xen_trace()
-{
- struct cpu_user_regs regs;
-#ifdef __x86_64
- __asm__("movq %%rsp,%0" : "=m" (regs.rsp));
- __asm__("movq %%rbp,%0" : "=m" (regs.rbp));
- __asm__("leaq 0(%%rip),%0" : "=a" (regs.rip));
-#else
- __asm__("movl %%esp,%0" : "=m" (regs.esp));
- __asm__("movl %%ebp,%0" : "=m" (regs.ebp));
- __asm__("call 1f; 1: popl %0" : "=a" (regs.eip));
-#endif
- show_trace(®s);
}
void show_stack_overflow(unsigned int cpu, unsigned long esp)
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/x86_32/entry.S Fri Apr 06 22:32:57 2007 +0100
@@ -283,6 +283,7 @@ bad_hypercall:
/* %edx == trap_bounce, %ebx == struct vcpu */
/* %eax,%ecx are clobbered. %gs:%esi contain new UREGS_ss/UREGS_esp. */
create_bounce_frame:
+ ASSERT_INTERRUPTS_ENABLED
movl UREGS_eflags+4(%esp),%ecx
movb UREGS_cs+4(%esp),%cl
testl $(2|X86_EFLAGS_VM),%ecx
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/x86_64/compat/entry.S Fri Apr 06 22:32:57 2007 +0100
@@ -137,6 +137,7 @@ compat_bad_hypercall:
/* %rbx: struct vcpu, interrupts disabled */
compat_restore_all_guest:
+ ASSERT_INTERRUPTS_DISABLED
RESTORE_ALL
addq $8,%rsp
.Lft0: iretq
@@ -188,13 +189,14 @@ ENTRY(compat_post_handle_exception)
ENTRY(compat_int80_direct_trap)
call compat_create_bounce_frame
- jmp compat_restore_all_guest
+ jmp compat_test_all_events
/* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK: */
/* {[ERRCODE,] EIP, CS, EFLAGS, [ESP, SS]} */
/* %rdx: trap_bounce, %rbx: struct vcpu */
/* On return only %rbx is guaranteed non-clobbered. */
compat_create_bounce_frame:
+ ASSERT_INTERRUPTS_ENABLED
mov %fs,%edi
testb $2,UREGS_cs+8(%rsp)
jz 1f
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/x86_64/entry.S Fri Apr 06 22:32:57 2007 +0100
@@ -38,6 +38,7 @@ 1: call create_bounce_frame
/* %rbx: struct vcpu, interrupts disabled */
restore_all_guest:
+ ASSERT_INTERRUPTS_DISABLED
RESTORE_ALL
testw $TRAP_syscall,4(%rsp)
jz iret_exit_to_guest
@@ -230,7 +231,7 @@ ENTRY(int80_direct_trap)
/* Check that the callback is non-null. */
leaq VCPU_int80_bounce(%rbx),%rdx
- cmp $0, TRAPBOUNCE_flags(%rdx)
+ cmp $0,TRAPBOUNCE_flags(%rdx)
jz int80_slow_path
movq VCPU_domain(%rbx),%rax
@@ -238,7 +239,7 @@ ENTRY(int80_direct_trap)
jnz compat_int80_direct_trap
call create_bounce_frame
- jmp restore_all_guest
+ jmp test_all_events
int80_slow_path:
/*
@@ -256,6 +257,7 @@ int80_slow_path:
/* %rdx: trap_bounce, %rbx: struct vcpu */
/* On return only %rbx is guaranteed non-clobbered. */
create_bounce_frame:
+ ASSERT_INTERRUPTS_ENABLED
testb $TF_kernel_mode,VCPU_thread_flags(%rbx)
jnz 1f
/* Push new frame at registered guest-OS stack base. */
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/x86_64/traps.c Fri Apr 06 22:32:57 2007 +0100
@@ -170,7 +170,8 @@ asmlinkage void do_double_fault(struct c
regs->r9, regs->r10, regs->r11);
printk("r12: %016lx r13: %016lx r14: %016lx\n",
regs->r12, regs->r13, regs->r14);
- printk("r15: %016lx\n", regs->r15);
+ printk("r15: %016lx cs: %016lx ss: %016lx\n",
+ regs->r15, (long)regs->cs, (long)regs->ss);
show_stack_overflow(cpu, regs->rsp);
panic("DOUBLE FAULT -- system shutdown\n");
@@ -260,11 +261,14 @@ void __init percpu_traps_init(void)
idt_table[TRAP_double_fault].a |= 1UL << 32; /* IST1 */
idt_table[TRAP_nmi].a |= 2UL << 32; /* IST2 */
-#ifdef CONFIG_COMPAT
- /* The hypercall entry vector is only accessible from ring 1. */
+ /*
+ * The 32-on-64 hypercall entry vector is only accessible from ring 1.
+ * Also note that this is a trap gate, not an interrupt gate.
+ */
_set_gate(idt_table+HYPERCALL_VECTOR, 15, 1, &compat_hypercall);
+
+ /* Fast trap for int80 (faster than taking the #GP-fixup path). */
_set_gate(idt_table+0x80, 15, 3, &int80_direct_trap);
-#endif
}
stack_bottom = (char *)get_stack_bottom();
diff -r eb3e430242ac -r aeb9a84e46d9 xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/arch/x86/x86_emulate.c Fri Apr 06 22:32:57 2007 +0100
@@ -2413,7 +2413,7 @@ x86_emulate(
goto writeback;
cannot_emulate:
-#ifdef __XEN__
+#if 0
gdprintk(XENLOG_DEBUG, "Instr:");
for ( ea.mem.off = ctxt->regs->eip; ea.mem.off < _regs.eip; ea.mem.off++ )
{
diff -r eb3e430242ac -r aeb9a84e46d9 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/common/page_alloc.c Fri Apr 06 22:32:57 2007 +0100
@@ -445,7 +445,19 @@ static void free_heap_pages(
for ( i = 0; i < (1 << order); i++ )
{
- BUG_ON(pg[i].count_info != 0);
+ /*
+ * Cannot assume that count_info == 0, as there are some corner cases
+ * where it isn't the case and yet it isn't a bug:
+ * 1. page_get_owner() is NULL
+ * 2. page_get_owner() is a domain that was never accessible by
+ * its domid (e.g., failed to fully construct the domain).
+ * 3. page was never addressable by the guest (e.g., it's an
+ * auto-translate-physmap guest and the page was never included
+ * in its pseudophysical address space).
+ * In all the above cases there can be no guest mappings of this page.
+ */
+ pg[i].count_info = 0;
+
if ( (d = page_get_owner(&pg[i])) != NULL )
{
pg[i].tlbflush_timestamp = tlbflush_current_time();
diff -r eb3e430242ac -r aeb9a84e46d9 xen/include/asm-x86/desc.h
--- a/xen/include/asm-x86/desc.h Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/include/asm-x86/desc.h Fri Apr 06 22:32:57 2007 +0100
@@ -106,7 +106,7 @@
((((sel)>>3) < FIRST_RESERVED_GDT_ENTRY) || /* Guest seg? */ \
((sel) == (!IS_COMPAT(d) ? \
FLAT_KERNEL_CS : /* Xen default seg? */ \
- FLAT_COMPAT_KERNEL_CS)) || /* Xen default compat seg? */
\
+ FLAT_COMPAT_KERNEL_CS)) || \
((sel) & 4)) /* LDT seg? */
#endif /* __ASSEMBLY__ */
diff -r eb3e430242ac -r aeb9a84e46d9 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/include/asm-x86/processor.h Fri Apr 06 22:32:57 2007 +0100
@@ -552,7 +552,6 @@ extern always_inline void prefetchw(cons
#endif
void show_stack(struct cpu_user_regs *regs);
-void show_xen_trace(void);
void show_stack_overflow(unsigned int cpu, unsigned long esp);
void show_registers(struct cpu_user_regs *regs);
void show_execution_state(struct cpu_user_regs *regs);
diff -r eb3e430242ac -r aeb9a84e46d9 xen/include/asm-x86/x86_32/asm_defns.h
--- a/xen/include/asm-x86/x86_32/asm_defns.h Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/include/asm-x86/x86_32/asm_defns.h Fri Apr 06 22:32:57 2007 +0100
@@ -8,9 +8,19 @@
#define SETUP_EXCEPTION_FRAME_POINTER \
movl %esp,%ebp; \
notl %ebp
+#define ASSERT_INTERRUPT_STATUS(x) \
+ pushf; \
+ testb $X86_EFLAGS_IF>>8,1(%esp); \
+ j##x 1f; \
+ ud2a; \
+1: addl $4,%esp;
#else
#define SETUP_EXCEPTION_FRAME_POINTER
+#define ASSERT_INTERRUPT_STATUS(x)
#endif
+
+#define ASSERT_INTERRUPTS_ENABLED ASSERT_INTERRUPT_STATUS(nz)
+#define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z)
#define __SAVE_ALL_PRE \
cld; \
diff -r eb3e430242ac -r aeb9a84e46d9 xen/include/asm-x86/x86_64/asm_defns.h
--- a/xen/include/asm-x86/x86_64/asm_defns.h Fri Apr 06 10:08:30 2007 -0600
+++ b/xen/include/asm-x86/x86_64/asm_defns.h Fri Apr 06 22:32:57 2007 +0100
@@ -8,9 +8,19 @@
#define SETUP_EXCEPTION_FRAME_POINTER \
movq %rsp,%rbp; \
notq %rbp
+#define ASSERT_INTERRUPT_STATUS(x) \
+ pushf; \
+ testb $X86_EFLAGS_IF>>8,1(%rsp); \
+ j##x 1f; \
+ ud2a; \
+1: addq $8,%rsp;
#else
#define SETUP_EXCEPTION_FRAME_POINTER
+#define ASSERT_INTERRUPT_STATUS(x)
#endif
+
+#define ASSERT_INTERRUPTS_ENABLED ASSERT_INTERRUPT_STATUS(nz)
+#define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z)
#define SAVE_ALL \
cld; \
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|