ia64/linux-2.6.18-xen.hg

changeset 525:ae505684a995

merge with linux-2.6.18-xen.hg
author Alex Williamson <alex.williamson@hp.com>
date Tue Apr 15 11:10:27 2008 -0600 (2008-04-15)
parents dbe8a35dcaf7 7f8b544237bf
children 5d938fac27a2
files
line diff
     1.1 --- a/arch/i386/kernel/acpi/sleep-xen.c	Mon Apr 14 13:29:37 2008 -0600
     1.2 +++ b/arch/i386/kernel/acpi/sleep-xen.c	Tue Apr 15 11:10:27 2008 -0600
     1.3 @@ -110,25 +110,4 @@ static int __init acpisleep_dmi_init(voi
     1.4  }
     1.5  
     1.6  core_initcall(acpisleep_dmi_init);
     1.7 -
     1.8 -#else /* CONFIG_ACPI_PV_SLEEP */
     1.9 -#include <asm/hypervisor.h>
    1.10 -#include <xen/interface/platform.h>
    1.11 -int acpi_notify_hypervisor_state(u8 sleep_state,
    1.12 -	u32 pm1a_cnt, u32 pm1b_cnt)
    1.13 -{
    1.14 -	struct xen_platform_op op = {
    1.15 -		.cmd = XENPF_enter_acpi_sleep,
    1.16 -		.interface_version = XENPF_INTERFACE_VERSION,
    1.17 -		.u = {
    1.18 -			.enter_acpi_sleep = {
    1.19 -				.pm1a_cnt_val = (u16)pm1a_cnt,
    1.20 -				.pm1b_cnt_val = (u16)pm1b_cnt,
    1.21 -				.sleep_state = sleep_state,
    1.22 -			},
    1.23 -		},
    1.24 -	};
    1.25 -
    1.26 -	return HYPERVISOR_platform_op(&op);
    1.27 -}
    1.28  #endif /* CONFIG_ACPI_PV_SLEEP */
     2.1 --- a/arch/i386/kernel/sysenter.c	Mon Apr 14 13:29:37 2008 -0600
     2.2 +++ b/arch/i386/kernel/sysenter.c	Tue Apr 15 11:10:27 2008 -0600
     2.3 @@ -109,11 +109,6 @@ int __init sysenter_setup(void)
     2.4  #ifdef CONFIG_COMPAT_VDSO
     2.5  	__set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY);
     2.6  	printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
     2.7 -#else
     2.8 -	/*
     2.9 -	 * In the non-compat case the ELF coredumping code needs the fixmap:
    2.10 -	 */
    2.11 -	__set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_KERNEL_RO);
    2.12  #endif
    2.13  
    2.14  	if (!boot_cpu_has(X86_FEATURE_SEP)) {
    2.15 @@ -176,6 +171,13 @@ int arch_setup_additional_pages(struct l
    2.16  	vma->vm_end = addr + PAGE_SIZE;
    2.17  	/* MAYWRITE to allow gdb to COW and set breakpoints */
    2.18  	vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
    2.19 +	/*
    2.20 +	 * Make sure the vDSO gets into every core dump.
    2.21 +	 * Dumping its contents makes post-mortem fully interpretable later
    2.22 +	 * without matching up the same kernel and hardware config to see
    2.23 +	 * what PC values meant.
    2.24 +	 */
    2.25 +	vma->vm_flags |= VM_ALWAYSDUMP;
    2.26  	vma->vm_flags |= mm->def_flags;
    2.27  	vma->vm_page_prot = protection_map[vma->vm_flags & 7];
    2.28  	vma->vm_ops = &syscall_vm_ops;
     3.1 --- a/arch/powerpc/kernel/vdso.c	Mon Apr 14 13:29:37 2008 -0600
     3.2 +++ b/arch/powerpc/kernel/vdso.c	Tue Apr 15 11:10:27 2008 -0600
     3.3 @@ -282,6 +282,13 @@ int arch_setup_additional_pages(struct l
     3.4  	 * pages though
     3.5  	 */
     3.6  	vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
     3.7 +	/*
     3.8 +	 * Make sure the vDSO gets into every core dump.
     3.9 +	 * Dumping its contents makes post-mortem fully interpretable later
    3.10 +	 * without matching up the same kernel and hardware config to see
    3.11 +	 * what PC values meant.
    3.12 +	 */
    3.13 +	vma->vm_flags |= VM_ALWAYSDUMP;
    3.14  	vma->vm_flags |= mm->def_flags;
    3.15  	vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
    3.16  	vma->vm_ops = &vdso_vmops;
     4.1 --- a/arch/x86_64/ia32/ia32_binfmt.c	Mon Apr 14 13:29:37 2008 -0600
     4.2 +++ b/arch/x86_64/ia32/ia32_binfmt.c	Tue Apr 15 11:10:27 2008 -0600
     4.3 @@ -65,55 +65,6 @@ typedef unsigned int elf_greg_t;
     4.4  #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
     4.5  typedef elf_greg_t elf_gregset_t[ELF_NGREG];
     4.6  
     4.7 -/*
     4.8 - * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
     4.9 - * extra segments containing the vsyscall DSO contents.  Dumping its
    4.10 - * contents makes post-mortem fully interpretable later without matching up
    4.11 - * the same kernel and hardware config to see what PC values meant.
    4.12 - * Dumping its extra ELF program headers includes all the other information
    4.13 - * a debugger needs to easily find how the vsyscall DSO was being used.
    4.14 - */
    4.15 -#define ELF_CORE_EXTRA_PHDRS	(find_vma(current->mm, VSYSCALL32_BASE) ?     \
    4.16 -    (VSYSCALL32_EHDR->e_phnum) : 0)
    4.17 -#define ELF_CORE_WRITE_EXTRA_PHDRS					      \
    4.18 -do {									      \
    4.19 -	if (find_vma(current->mm, VSYSCALL32_BASE)) { 			      \
    4.20 -		const struct elf32_phdr *const vsyscall_phdrs =		      \
    4.21 -			(const struct elf32_phdr *) (VSYSCALL32_BASE	      \
    4.22 -						   + VSYSCALL32_EHDR->e_phoff);\
    4.23 -		int i;							      \
    4.24 -		Elf32_Off ofs = 0;					      \
    4.25 -		for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) {	      \
    4.26 -			struct elf32_phdr phdr = vsyscall_phdrs[i];	      \
    4.27 -			if (phdr.p_type == PT_LOAD) {			      \
    4.28 -				BUG_ON(ofs != 0);			      \
    4.29 -				ofs = phdr.p_offset = offset;		      \
    4.30 -				phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);      \
    4.31 -				phdr.p_filesz = phdr.p_memsz;		      \
    4.32 -				offset += phdr.p_filesz;		      \
    4.33 -			}						      \
    4.34 -			else						      \
    4.35 -				phdr.p_offset += ofs;			      \
    4.36 -			phdr.p_paddr = 0; /* match other core phdrs */	      \
    4.37 -			DUMP_WRITE(&phdr, sizeof(phdr));		      \
    4.38 -		}							      \
    4.39 -	}								      \
    4.40 -} while (0)
    4.41 -#define ELF_CORE_WRITE_EXTRA_DATA					      \
    4.42 -do {									      \
    4.43 -	if (find_vma(current->mm, VSYSCALL32_BASE)) { 			      \
    4.44 -		const struct elf32_phdr *const vsyscall_phdrs =		      \
    4.45 -			(const struct elf32_phdr *) (VSYSCALL32_BASE	      \
    4.46 -						   + VSYSCALL32_EHDR->e_phoff);      \
    4.47 -		int i;							      \
    4.48 -		for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) {	      \
    4.49 -			if (vsyscall_phdrs[i].p_type == PT_LOAD)	      \
    4.50 -				DUMP_WRITE((void *) (u64) vsyscall_phdrs[i].p_vaddr,\
    4.51 -				    PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));   \
    4.52 -		}							      \
    4.53 -	}								      \
    4.54 -} while (0)
    4.55 -
    4.56  struct elf_siginfo
    4.57  {
    4.58  	int	si_signo;			/* signal number */
     5.1 --- a/arch/x86_64/ia32/syscall32.c	Mon Apr 14 13:29:37 2008 -0600
     5.2 +++ b/arch/x86_64/ia32/syscall32.c	Tue Apr 15 11:10:27 2008 -0600
     5.3 @@ -59,6 +59,13 @@ int syscall32_setup_pages(struct linux_b
     5.4  	vma->vm_end = VSYSCALL32_END;
     5.5  	/* MAYWRITE to allow gdb to COW and set breakpoints */
     5.6  	vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
     5.7 +	/*
     5.8 +	 * Make sure the vDSO gets into every core dump.
     5.9 +	 * Dumping its contents makes post-mortem fully interpretable later
    5.10 +	 * without matching up the same kernel and hardware config to see
    5.11 +	 * what PC values meant.
    5.12 +	 */
    5.13 +	vma->vm_flags |= VM_ALWAYSDUMP;
    5.14  	vma->vm_flags |= mm->def_flags;
    5.15  	vma->vm_page_prot = protection_map[vma->vm_flags & 7];
    5.16  	vma->vm_ops = &syscall32_vm_ops;
     6.1 --- a/arch/x86_64/kernel/acpi/sleep-xen.c	Mon Apr 14 13:29:37 2008 -0600
     6.2 +++ b/arch/x86_64/kernel/acpi/sleep-xen.c	Tue Apr 15 11:10:27 2008 -0600
     6.3 @@ -137,27 +137,6 @@ static int __init acpi_sleep_setup(char 
     6.4  }
     6.5  
     6.6  __setup("acpi_sleep=", acpi_sleep_setup);
     6.7 -
     6.8 -#else /* CONFIG_ACPI_PV_SLEEP */
     6.9 -#include <asm/hypervisor.h>
    6.10 -#include <xen/interface/platform.h>
    6.11 -int acpi_notify_hypervisor_state(u8 sleep_state,
    6.12 -	u32 pm1a_cnt, u32 pm1b_cnt)
    6.13 -{
    6.14 -	struct xen_platform_op op = {
    6.15 -		.cmd = XENPF_enter_acpi_sleep,
    6.16 -		.interface_version = XENPF_INTERFACE_VERSION,
    6.17 -		.u = {
    6.18 -			.enter_acpi_sleep = {
    6.19 -				.pm1a_cnt_val = (u16)pm1a_cnt,
    6.20 -				.pm1b_cnt_val = (u16)pm1b_cnt,
    6.21 -				.sleep_state = sleep_state,
    6.22 -			},
    6.23 -		},
    6.24 -	};
    6.25 -
    6.26 -	return HYPERVISOR_platform_op(&op);
    6.27 -}
    6.28  #endif				/* CONFIG_ACPI_PV_SLEEP */
    6.29  
    6.30  #endif				/*CONFIG_ACPI_SLEEP */
     7.1 --- a/drivers/acpi/hardware/hwsleep.c	Mon Apr 14 13:29:37 2008 -0600
     7.2 +++ b/drivers/acpi/hardware/hwsleep.c	Tue Apr 15 11:10:27 2008 -0600
     7.3 @@ -227,7 +227,11 @@ acpi_status asmlinkage acpi_enter_sleep_
     7.4  	u32 PM1Bcontrol;
     7.5  	struct acpi_bit_register_info *sleep_type_reg_info;
     7.6  	struct acpi_bit_register_info *sleep_enable_reg_info;
     7.7 +#if !(defined(CONFIG_XEN) && defined(CONFIG_X86))
     7.8  	u32 in_value;
     7.9 +#else
    7.10 +	int err;
    7.11 +#endif
    7.12  	acpi_status status;
    7.13  
    7.14  	ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
    7.15 @@ -327,7 +331,7 @@ acpi_status asmlinkage acpi_enter_sleep_
    7.16  
    7.17  	ACPI_FLUSH_CPU_CACHE();
    7.18  
    7.19 -#ifndef CONFIG_ACPI_PV_SLEEP
    7.20 +#if !(defined(CONFIG_XEN) && defined(CONFIG_X86))
    7.21  	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
    7.22  					ACPI_REGISTER_PM1A_CONTROL,
    7.23  					PM1Acontrol);
    7.24 @@ -377,17 +381,18 @@ acpi_status asmlinkage acpi_enter_sleep_
    7.25  		/* Spin until we wake */
    7.26  
    7.27  	} while (!in_value);
    7.28 -
    7.29 -	return_ACPI_STATUS(AE_OK);
    7.30  #else
    7.31  	/* PV ACPI just need check hypercall return value */
    7.32 -	status = acpi_notify_hypervisor_state(sleep_state,
    7.33 +	err = acpi_notify_hypervisor_state(sleep_state,
    7.34  			PM1Acontrol, PM1Bcontrol);
    7.35 -	if (ACPI_FAILURE(status))
    7.36 -		return_ACPI_STATUS(status);
    7.37 -	else
    7.38 -		return_ACPI_STATUS(AE_OK);
    7.39 +	if (err) {
    7.40 +		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
    7.41 +				  "Hypervisor failure [%d]\n", err));
    7.42 +		return_ACPI_STATUS(AE_ERROR);
    7.43 +	}
    7.44  #endif
    7.45 +
    7.46 +	return_ACPI_STATUS(AE_OK);
    7.47  }
    7.48  
    7.49  ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
     8.1 --- a/drivers/char/mem.c	Mon Apr 14 13:29:37 2008 -0600
     8.2 +++ b/drivers/char/mem.c	Tue Apr 15 11:10:27 2008 -0600
     8.3 @@ -264,6 +264,9 @@ static int mmap_mem(struct file * file, 
     8.4  static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
     8.5  {
     8.6  	unsigned long pfn;
     8.7 +#ifdef CONFIG_XEN
     8.8 +	unsigned long i, count;
     8.9 +#endif
    8.10  
    8.11  	/* Turn a kernel-virtual address into a physical page frame */
    8.12  	pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT;
    8.13 @@ -278,6 +281,13 @@ static int mmap_kmem(struct file * file,
    8.14  	if (!pfn_valid(pfn))
    8.15  		return -EIO;
    8.16  
    8.17 +#ifdef CONFIG_XEN
    8.18 +	count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
    8.19 +	for (i = 0; i < count; i++)
    8.20 +		if ((pfn + i) != mfn_to_local_pfn(pfn_to_mfn(pfn + i)))
    8.21 +			return -EIO;
    8.22 +#endif
    8.23 +
    8.24  	vma->vm_pgoff = pfn;
    8.25  	return mmap_mem(file, vma);
    8.26  }
     9.1 --- a/drivers/pci/quirks.c	Mon Apr 14 13:29:37 2008 -0600
     9.2 +++ b/drivers/pci/quirks.c	Tue Apr 15 11:10:27 2008 -0600
     9.3 @@ -1528,10 +1528,11 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_N
     9.4  
     9.5  static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
     9.6  {
     9.7 -	u16 command;
     9.8 +	u16 command, pmcsr;
     9.9  	u32 bar;
    9.10  	u8 __iomem *csr;
    9.11  	u8 cmd_hi;
    9.12 +	int pm;
    9.13  
    9.14  	switch (dev->device) {
    9.15  	/* PCI IDs taken from drivers/net/e100.c */
    9.16 @@ -1566,6 +1567,17 @@ static void __devinit quirk_e100_interru
    9.17  	if (!(command & PCI_COMMAND_MEMORY) || !bar)
    9.18  		return;
    9.19  
    9.20 +        /*
    9.21 +         * Check that the device is in the D0 power state. If it's not,
    9.22 +         * there is no point to look any further.
    9.23 +         */
    9.24 +        pm = pci_find_capability(dev, PCI_CAP_ID_PM);
    9.25 +        if (pm) {
    9.26 +                pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
    9.27 +                if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
    9.28 +                        return;
    9.29 +        }
    9.30 +
    9.31  	csr = ioremap(bar, 8);
    9.32  	if (!csr) {
    9.33  		printk(KERN_WARNING "PCI: Can't map %s e100 registers\n",
    10.1 --- a/drivers/xen/balloon/balloon.c	Mon Apr 14 13:29:37 2008 -0600
    10.2 +++ b/drivers/xen/balloon/balloon.c	Tue Apr 15 11:10:27 2008 -0600
    10.3 @@ -194,6 +194,41 @@ static unsigned long current_target(void
    10.4  	return target;
    10.5  }
    10.6  
    10.7 +static unsigned long minimum_target(void)
    10.8 +{
    10.9 +#ifndef CONFIG_XEN
   10.10 +	return 0;
   10.11 +#else
   10.12 +	unsigned long min_pages, curr_pages = current_target();
   10.13 +
   10.14 +#define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
   10.15 +	/* Simple continuous piecewiese linear function:
   10.16 +	 *  max MiB -> min MiB	gradient
   10.17 +	 *       0	   0
   10.18 +	 *      16	  16
   10.19 +	 *      32	  24
   10.20 +	 *     128	  72	(1/2)
   10.21 +	 *     512 	 168	(1/4)
   10.22 +	 *    2048	 360	(1/8)
   10.23 +	 *    8192	 552	(1/32)
   10.24 +	 *   32768	1320
   10.25 +	 *  131072	4392
   10.26 +	 */
   10.27 +	if (max_pfn < MB2PAGES(128))
   10.28 +		min_pages = MB2PAGES(8) + (max_pfn >> 1);
   10.29 +	else if (max_pfn < MB2PAGES(512))
   10.30 +		min_pages = MB2PAGES(40) + (max_pfn >> 2);
   10.31 +	else if (max_pfn < MB2PAGES(2048))
   10.32 +		min_pages = MB2PAGES(104) + (max_pfn >> 3);
   10.33 +	else
   10.34 +		min_pages = MB2PAGES(296) + (max_pfn >> 5);
   10.35 +#undef MB2PAGES
   10.36 +
   10.37 +	/* Don't enforce growth */
   10.38 +	return min(min_pages, curr_pages);
   10.39 +#endif
   10.40 +}
   10.41 +
   10.42  static int increase_reservation(unsigned long nr_pages)
   10.43  {
   10.44  	unsigned long  pfn, i, flags;
   10.45 @@ -384,7 +419,7 @@ void balloon_set_new_target(unsigned lon
   10.46  {
   10.47  	/* No need for lock. Not read-modify-write updates. */
   10.48  	bs.hard_limit   = ~0UL;
   10.49 -	bs.target_pages = target;
   10.50 +	bs.target_pages = max(target, minimum_target());
   10.51  	schedule_work(&balloon_worker);
   10.52  }
   10.53  
    11.1 --- a/drivers/xen/blkback/common.h	Mon Apr 14 13:29:37 2008 -0600
    11.2 +++ b/drivers/xen/blkback/common.h	Tue Apr 15 11:10:27 2008 -0600
    11.3 @@ -110,7 +110,7 @@ int blkif_map(blkif_t *blkif, unsigned l
    11.4  
    11.5  /* Create a vbd. */
    11.6  int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, unsigned major,
    11.7 -	       unsigned minor, int readonly);
    11.8 +	       unsigned minor, int readonly, int cdrom);
    11.9  void vbd_free(struct vbd *vbd);
   11.10  
   11.11  unsigned long long vbd_size(struct vbd *vbd);
    12.1 --- a/drivers/xen/blkback/vbd.c	Mon Apr 14 13:29:37 2008 -0600
    12.2 +++ b/drivers/xen/blkback/vbd.c	Tue Apr 15 11:10:27 2008 -0600
    12.3 @@ -51,7 +51,7 @@ unsigned long vbd_secsize(struct vbd *vb
    12.4  }
    12.5  
    12.6  int vbd_create(blkif_t *blkif, blkif_vdev_t handle, unsigned major,
    12.7 -	       unsigned minor, int readonly)
    12.8 +	       unsigned minor, int readonly, int cdrom)
    12.9  {
   12.10  	struct vbd *vbd;
   12.11  	struct block_device *bdev;
   12.12 @@ -81,7 +81,7 @@ int vbd_create(blkif_t *blkif, blkif_vde
   12.13  		return -ENOENT;
   12.14  	}
   12.15  
   12.16 -	if (vbd->bdev->bd_disk->flags & GENHD_FL_CD)
   12.17 +	if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
   12.18  		vbd->type |= VDISK_CDROM;
   12.19  	if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE)
   12.20  		vbd->type |= VDISK_REMOVABLE;
    13.1 --- a/drivers/xen/blkback/xenbus.c	Mon Apr 14 13:29:37 2008 -0600
    13.2 +++ b/drivers/xen/blkback/xenbus.c	Tue Apr 15 11:10:27 2008 -0600
    13.3 @@ -270,6 +270,8 @@ static void backend_changed(struct xenbu
    13.4  	struct backend_info *be
    13.5  		= container_of(watch, struct backend_info, backend_watch);
    13.6  	struct xenbus_device *dev = be->dev;
    13.7 +	int cdrom = 0;
    13.8 +	char *device_type;
    13.9  
   13.10  	DPRINTK("");
   13.11  
   13.12 @@ -303,6 +305,12 @@ static void backend_changed(struct xenbu
   13.13  		return;
   13.14  	}
   13.15  
   13.16 +	device_type = xenbus_read(XBT_NIL, dev->otherend, "device-type", NULL);
   13.17 +	if (!IS_ERR(device_type)) {
   13.18 +		cdrom = strcmp(device_type, "cdrom") == 0;
   13.19 +		kfree(device_type);
   13.20 +	}
   13.21 +
   13.22  	if (be->major == 0 && be->minor == 0) {
   13.23  		/* Front end dir is a number, which is used as the handle. */
   13.24  
   13.25 @@ -313,7 +321,7 @@ static void backend_changed(struct xenbu
   13.26  		be->minor = minor;
   13.27  
   13.28  		err = vbd_create(be->blkif, handle, major, minor,
   13.29 -				 (NULL == strchr(be->mode, 'w')));
   13.30 +				 (NULL == strchr(be->mode, 'w')), cdrom);
   13.31  		if (err) {
   13.32  			be->major = be->minor = 0;
   13.33  			xenbus_dev_fatal(dev, err, "creating vbd structure");
    14.1 --- a/drivers/xen/blktap/blktap.c	Mon Apr 14 13:29:37 2008 -0600
    14.2 +++ b/drivers/xen/blktap/blktap.c	Tue Apr 15 11:10:27 2008 -0600
    14.3 @@ -684,7 +684,7 @@ static int blktap_mmap(struct file *filp
    14.4  
    14.5  	/* Mark this VM as containing foreign pages, and set up mappings. */
    14.6  	map = kzalloc(((vma->vm_end - vma->vm_start) >> PAGE_SHIFT)
    14.7 -		      * sizeof(struct page_struct*),
    14.8 +		      * sizeof(struct page *),
    14.9  		      GFP_KERNEL);
   14.10  	if (map == NULL) {
   14.11  		WPRINTK("Couldn't alloc VM_FOREIGN map.\n");
    15.1 --- a/drivers/xen/evtchn/evtchn.c	Mon Apr 14 13:29:37 2008 -0600
    15.2 +++ b/drivers/xen/evtchn/evtchn.c	Tue Apr 15 11:10:27 2008 -0600
    15.3 @@ -349,6 +349,7 @@ static long evtchn_ioctl(struct file *fi
    15.4  
    15.5  		port_user[unbind.port] = NULL;
    15.6  		mask_evtchn(unbind.port);
    15.7 +		rebind_evtchn_to_cpu(unbind.port, 0);
    15.8  
    15.9  		spin_unlock_irq(&port_user_lock);
   15.10  
   15.11 @@ -458,6 +459,7 @@ static int evtchn_release(struct inode *
   15.12  
   15.13  		port_user[i] = NULL;
   15.14  		mask_evtchn(i);
   15.15 +		rebind_evtchn_to_cpu(i, 0);
   15.16  
   15.17  		close.port = i;
   15.18  		ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
    16.1 --- a/drivers/xen/gntdev/gntdev.c	Mon Apr 14 13:29:37 2008 -0600
    16.2 +++ b/drivers/xen/gntdev/gntdev.c	Tue Apr 15 11:10:27 2008 -0600
    16.3 @@ -555,7 +555,7 @@ static int gntdev_mmap (struct file *fli
    16.4      
    16.5  	/* The VM area contains pages from another VM. */
    16.6  	vma->vm_flags |= VM_FOREIGN;
    16.7 -	vma->vm_private_data = kzalloc(size * sizeof(struct page_struct *), 
    16.8 +	vma->vm_private_data = kzalloc(size * sizeof(struct page *),
    16.9  				       GFP_KERNEL);
   16.10  	if (vma->vm_private_data == NULL) {
   16.11  		printk(KERN_ERR "Couldn't allocate mapping structure for VM "
    17.1 --- a/drivers/xen/netfront/netfront.c	Mon Apr 14 13:29:37 2008 -0600
    17.2 +++ b/drivers/xen/netfront/netfront.c	Tue Apr 15 11:10:27 2008 -0600
    17.3 @@ -366,10 +366,14 @@ static int talk_to_backend(struct xenbus
    17.4  	struct xenbus_transaction xbt;
    17.5  	int err;
    17.6  
    17.7 -	err = xen_net_read_mac(dev, info->mac);
    17.8 -	if (err) {
    17.9 -		xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
   17.10 -		goto out;
   17.11 +	/* Read mac only in the first setup. */
   17.12 +	if (!is_valid_ether_addr(info->mac)) {
   17.13 +		err = xen_net_read_mac(dev, info->mac);
   17.14 +		if (err) {
   17.15 +			xenbus_dev_fatal(dev, err, "parsing %s/mac",
   17.16 +					 dev->nodename);
   17.17 +			goto out;
   17.18 +		}
   17.19  	}
   17.20  
   17.21  	/* Create shared ring, alloc event channel. */
   17.22 @@ -1027,6 +1031,7 @@ static int network_start_xmit(struct sk_
   17.23  
   17.24  	np->stats.tx_bytes += skb->len;
   17.25  	np->stats.tx_packets++;
   17.26 +	dev->trans_start = jiffies;
   17.27  
   17.28  	/* Note: It is not safe to access skb after network_tx_buf_gc()! */
   17.29  	network_tx_buf_gc(dev);
   17.30 @@ -1059,6 +1064,7 @@ static irqreturn_t netif_int(int irq, vo
   17.31  			netfront_accelerator_call_stop_napi_irq(np, dev);
   17.32  
   17.33  			netif_rx_schedule(dev);
   17.34 +			dev->last_rx = jiffies;
   17.35  		}
   17.36  	}
   17.37  
   17.38 @@ -1688,6 +1694,23 @@ static struct net_device_stats *network_
   17.39  	return &np->stats;
   17.40  }
   17.41  
   17.42 +static int xennet_set_mac_address(struct net_device *dev, void *p)
   17.43 +{
   17.44 +	struct netfront_info *np = netdev_priv(dev);
   17.45 +	struct sockaddr *addr = p;
   17.46 +
   17.47 +	if (netif_running(dev))
   17.48 +		return -EBUSY;
   17.49 +
   17.50 +	if (!is_valid_ether_addr(addr->sa_data))
   17.51 +		return -EADDRNOTAVAIL;
   17.52 +
   17.53 +	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
   17.54 +	memcpy(np->mac, addr->sa_data, ETH_ALEN);
   17.55 +
   17.56 +	return 0;
   17.57 +}
   17.58 +
   17.59  static int xennet_change_mtu(struct net_device *dev, int mtu)
   17.60  {
   17.61  	int max = xennet_can_sg(dev) ? 65535 - ETH_HLEN : ETH_DATA_LEN;
   17.62 @@ -2075,6 +2098,7 @@ static struct net_device * __devinit cre
   17.63  	netdev->poll            = netif_poll;
   17.64  	netdev->set_multicast_list = network_set_multicast_list;
   17.65  	netdev->uninit          = netif_uninit;
   17.66 +	netdev->set_mac_address	= xennet_set_mac_address;
   17.67  	netdev->change_mtu	= xennet_change_mtu;
   17.68  	netdev->weight          = 64;
   17.69  	netdev->features        = NETIF_F_IP_CSUM;
   17.70 @@ -2189,9 +2213,6 @@ static int __init netif_init(void)
   17.71  		MODPARM_rx_flip = 1; /* Default is to flip. */
   17.72  #endif
   17.73  
   17.74 -	if (is_initial_xendomain())
   17.75 -		return 0;
   17.76 -
   17.77  	netif_init_accel();
   17.78  
   17.79  	IPRINTK("Initialising virtual ethernet driver.\n");
   17.80 @@ -2207,9 +2228,6 @@ module_init(netif_init);
   17.81  
   17.82  static void __exit netif_exit(void)
   17.83  {
   17.84 -	if (is_initial_xendomain())
   17.85 -		return;
   17.86 -
   17.87  #ifdef CONFIG_INET
   17.88  	unregister_inetaddr_notifier(&notifier_inetdev);
   17.89  #endif
    18.1 --- a/drivers/xen/xenbus/xenbus_probe.c	Mon Apr 14 13:29:37 2008 -0600
    18.2 +++ b/drivers/xen/xenbus/xenbus_probe.c	Tue Apr 15 11:10:27 2008 -0600
    18.3 @@ -347,6 +347,9 @@ static void xenbus_dev_shutdown(struct d
    18.4  
    18.5  	DPRINTK("%s", dev->nodename);
    18.6  
    18.7 +	if (is_initial_xendomain())
    18.8 +		return;
    18.9 +
   18.10  	get_device(&dev->dev);
   18.11  	if (dev->state != XenbusStateConnected) {
   18.12  		printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__,
    19.1 --- a/fs/binfmt_elf.c	Mon Apr 14 13:29:37 2008 -0600
    19.2 +++ b/fs/binfmt_elf.c	Tue Apr 15 11:10:27 2008 -0600
    19.3 @@ -1170,6 +1170,10 @@ static int dump_seek(struct file *file, 
    19.4   */
    19.5  static int maydump(struct vm_area_struct *vma)
    19.6  {
    19.7 +	/* The vma can be set up to tell us the answer directly.  */
    19.8 +	if (vma->vm_flags & VM_ALWAYSDUMP)
    19.9 +		return 1;
   19.10 +
   19.11  	/* Do not dump I/O mapped devices or special mappings */
   19.12  	if (vma->vm_flags & (VM_IO | VM_RESERVED))
   19.13  		return 0;
    20.1 --- a/fs/compat_ioctl.c	Mon Apr 14 13:29:37 2008 -0600
    20.2 +++ b/fs/compat_ioctl.c	Tue Apr 15 11:10:27 2008 -0600
    20.3 @@ -124,10 +124,12 @@
    20.4  #include <linux/dvb/video.h>
    20.5  #include <linux/lp.h>
    20.6  
    20.7 +#ifdef CONFIG_XEN
    20.8  #include <xen/interface/xen.h>
    20.9  #include <xen/public/evtchn.h>
   20.10  #include <xen/public/privcmd.h>
   20.11  #include <xen/compat_ioctl.h>
   20.12 +#endif
   20.13  
   20.14  /* Aiee. Someone does not find a difference between int and long */
   20.15  #define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
    21.1 --- a/include/asm-i386/acpi.h	Mon Apr 14 13:29:37 2008 -0600
    21.2 +++ b/include/asm-i386/acpi.h	Tue Apr 15 11:10:27 2008 -0600
    21.3 @@ -31,6 +31,9 @@
    21.4  #include <acpi/pdc_intel.h>
    21.5  
    21.6  #include <asm/system.h>		/* defines cmpxchg */
    21.7 +#ifdef CONFIG_XEN
    21.8 +#include <xen/interface/platform.h>
    21.9 +#endif
   21.10  
   21.11  #define COMPILER_DEPENDENT_INT64   long long
   21.12  #define COMPILER_DEPENDENT_UINT64  unsigned long long
   21.13 @@ -156,6 +159,27 @@ static inline void acpi_disable_pci(void
   21.14  }
   21.15  extern int acpi_irq_balance_set(char *str);
   21.16  
   21.17 +#ifdef CONFIG_XEN
   21.18 +static inline int acpi_notify_hypervisor_state(u8 sleep_state,
   21.19 +					       u32 pm1a_cnt_val,
   21.20 +					       u32 pm1b_cnt_val)
   21.21 +{
   21.22 +	struct xen_platform_op op = {
   21.23 +		.cmd = XENPF_enter_acpi_sleep,
   21.24 +		.interface_version = XENPF_INTERFACE_VERSION,
   21.25 +		.u = {
   21.26 +			.enter_acpi_sleep = {
   21.27 +				.pm1a_cnt_val = pm1a_cnt_val,
   21.28 +				.pm1b_cnt_val = pm1b_cnt_val,
   21.29 +				.sleep_state = sleep_state,
   21.30 +			},
   21.31 +		},
   21.32 +	};
   21.33 +
   21.34 +	return HYPERVISOR_platform_op(&op);
   21.35 +}
   21.36 +#endif /* CONFIG_XEN */
   21.37 +
   21.38  #else	/* !CONFIG_ACPI */
   21.39  
   21.40  #define acpi_lapic 0
   21.41 @@ -177,10 +201,6 @@ extern unsigned long acpi_wakeup_address
   21.42  /* early initialization routine */
   21.43  extern void acpi_reserve_bootmem(void);
   21.44  
   21.45 -#ifdef CONFIG_ACPI_PV_SLEEP
   21.46 -extern int acpi_notify_hypervisor_state(u8 sleep_state,
   21.47 -	u32 pm1a_cnt, u32 pm1b_cnt);
   21.48 -#endif /* CONFIG_ACPI_PV_SLEEP */
   21.49  #endif /*CONFIG_ACPI_SLEEP*/
   21.50  
   21.51  extern u8 x86_acpiid_to_apicid[];
    22.1 --- a/include/asm-i386/elf.h	Mon Apr 14 13:29:37 2008 -0600
    22.2 +++ b/include/asm-i386/elf.h	Tue Apr 15 11:10:27 2008 -0600
    22.3 @@ -169,50 +169,6 @@ do if (vdso_enabled) {						\
    22.4  		NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE);	\
    22.5  } while (0)
    22.6  
    22.7 -/*
    22.8 - * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
    22.9 - * extra segments containing the vsyscall DSO contents.  Dumping its
   22.10 - * contents makes post-mortem fully interpretable later without matching up
   22.11 - * the same kernel and hardware config to see what PC values meant.
   22.12 - * Dumping its extra ELF program headers includes all the other information
   22.13 - * a debugger needs to easily find how the vsyscall DSO was being used.
   22.14 - */
   22.15 -#define ELF_CORE_EXTRA_PHDRS		(VDSO_HIGH_EHDR->e_phnum)
   22.16 -#define ELF_CORE_WRITE_EXTRA_PHDRS					      \
   22.17 -do {									      \
   22.18 -	const struct elf_phdr *const vsyscall_phdrs =			      \
   22.19 -		(const struct elf_phdr *) (VDSO_HIGH_BASE		      \
   22.20 -					   + VDSO_HIGH_EHDR->e_phoff);    \
   22.21 -	int i;								      \
   22.22 -	Elf32_Off ofs = 0;						      \
   22.23 -	for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {		      \
   22.24 -		struct elf_phdr phdr = vsyscall_phdrs[i];		      \
   22.25 -		if (phdr.p_type == PT_LOAD) {				      \
   22.26 -			BUG_ON(ofs != 0);				      \
   22.27 -			ofs = phdr.p_offset = offset;			      \
   22.28 -			phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);	      \
   22.29 -			phdr.p_filesz = phdr.p_memsz;			      \
   22.30 -			offset += phdr.p_filesz;			      \
   22.31 -		}							      \
   22.32 -		else							      \
   22.33 -			phdr.p_offset += ofs;				      \
   22.34 -		phdr.p_paddr = 0; /* match other core phdrs */		      \
   22.35 -		DUMP_WRITE(&phdr, sizeof(phdr));			      \
   22.36 -	}								      \
   22.37 -} while (0)
   22.38 -#define ELF_CORE_WRITE_EXTRA_DATA					      \
   22.39 -do {									      \
   22.40 -	const struct elf_phdr *const vsyscall_phdrs =			      \
   22.41 -		(const struct elf_phdr *) (VDSO_HIGH_BASE		      \
   22.42 -					   + VDSO_HIGH_EHDR->e_phoff);    \
   22.43 -	int i;								      \
   22.44 -	for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {		      \
   22.45 -		if (vsyscall_phdrs[i].p_type == PT_LOAD)		      \
   22.46 -			DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,	      \
   22.47 -				   PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));    \
   22.48 -	}								      \
   22.49 -} while (0)
   22.50 -
   22.51  #endif
   22.52  
   22.53  #endif
    23.1 --- a/include/asm-i386/mach-xen/asm/pgtable.h	Mon Apr 14 13:29:37 2008 -0600
    23.2 +++ b/include/asm-i386/mach-xen/asm/pgtable.h	Tue Apr 15 11:10:27 2008 -0600
    23.3 @@ -105,7 +105,7 @@ void paging_init(void);
    23.4  #define _PAGE_BIT_DIRTY		6
    23.5  #define _PAGE_BIT_PSE		7	/* 4 MB (or 2MB) page, Pentium+, if present.. */
    23.6  #define _PAGE_BIT_GLOBAL	8	/* Global TLB entry PPro+ */
    23.7 -#define _PAGE_BIT_UNUSED1	9	/* available for programmer */
    23.8 +/*#define _PAGE_BIT_UNUSED1	9*/	/* available for programmer */
    23.9  #define _PAGE_BIT_UNUSED2	10
   23.10  #define _PAGE_BIT_UNUSED3	11
   23.11  #define _PAGE_BIT_NX		63
   23.12 @@ -119,7 +119,7 @@ void paging_init(void);
   23.13  #define _PAGE_DIRTY	0x040
   23.14  #define _PAGE_PSE	0x080	/* 4 MB (or 2MB) page, Pentium+, if present.. */
   23.15  #define _PAGE_GLOBAL	0x100	/* Global TLB entry PPro+ */
   23.16 -#define _PAGE_UNUSED1	0x200	/* available for programmer */
   23.17 +/*#define _PAGE_UNUSED1	0x200*/	/* available for programmer */
   23.18  #define _PAGE_UNUSED2	0x400
   23.19  #define _PAGE_UNUSED3	0x800
   23.20  
    24.1 --- a/include/asm-x86_64/acpi.h	Mon Apr 14 13:29:37 2008 -0600
    24.2 +++ b/include/asm-x86_64/acpi.h	Tue Apr 15 11:10:27 2008 -0600
    24.3 @@ -28,6 +28,9 @@
    24.4  
    24.5  #ifdef __KERNEL__
    24.6  
    24.7 +#ifdef CONFIG_XEN
    24.8 +#include <xen/interface/platform.h>
    24.9 +#endif
   24.10  #include <acpi/pdc_intel.h>
   24.11  
   24.12  #define COMPILER_DEPENDENT_INT64   long long
   24.13 @@ -129,6 +132,27 @@ static inline void acpi_disable_pci(void
   24.14  }
   24.15  extern int acpi_irq_balance_set(char *str);
   24.16  
   24.17 +#ifdef CONFIG_XEN
   24.18 +static inline int acpi_notify_hypervisor_state(u8 sleep_state,
   24.19 +					       u32 pm1a_cnt_val,
   24.20 +					       u32 pm1b_cnt_val)
   24.21 +{
   24.22 +	struct xen_platform_op op = {
   24.23 +		.cmd = XENPF_enter_acpi_sleep,
   24.24 +		.interface_version = XENPF_INTERFACE_VERSION,
   24.25 +		.u = {
   24.26 +			.enter_acpi_sleep = {
   24.27 +				.pm1a_cnt_val = pm1a_cnt_val,
   24.28 +				.pm1b_cnt_val = pm1b_cnt_val,
   24.29 +				.sleep_state = sleep_state,
   24.30 +			},
   24.31 +		},
   24.32 +	};
   24.33 +
   24.34 +	return HYPERVISOR_platform_op(&op);
   24.35 +}
   24.36 +#endif /* CONFIG_XEN */
   24.37 +
   24.38  #else	/* !CONFIG_ACPI */
   24.39  
   24.40  #define acpi_lapic 0
   24.41 @@ -152,11 +176,6 @@ extern unsigned long acpi_wakeup_address
   24.42  
   24.43  /* early initialization routine */
   24.44  extern void acpi_reserve_bootmem(void);
   24.45 -
   24.46 -#ifdef CONFIG_ACPI_PV_SLEEP
   24.47 -extern int acpi_notify_hypervisor_state(u8 sleep_state,
   24.48 -	u32 pm1a_cnt, u32 pm1b_cnt);
   24.49 -#endif /* CONFIG_ACPI_PV_SLEEP */
   24.50  #endif /*CONFIG_ACPI_SLEEP*/
   24.51  
   24.52  #define boot_cpu_physical_apicid boot_cpu_id
    25.1 --- a/include/linux/mm.h	Mon Apr 14 13:29:37 2008 -0600
    25.2 +++ b/include/linux/mm.h	Tue Apr 15 11:10:27 2008 -0600
    25.3 @@ -167,6 +167,7 @@ extern unsigned int kobjsize(const void 
    25.4  #ifdef CONFIG_XEN
    25.5  #define VM_FOREIGN	0x04000000	/* Has pages belonging to another VM */
    25.6  #endif
    25.7 +#define VM_ALWAYSDUMP	0x08000000	/* Always include in core dumps */
    25.8  
    25.9  #ifndef VM_STACK_DEFAULT_FLAGS		/* arch can override this */
   25.10  #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS