ia64/linux-2.6.18-xen.hg

changeset 632:324a5c041301

merge with linux-2.6.18-xen.hg
author Isaku Yamahata <yamahata@valinux.co.jp>
date Thu Aug 07 11:58:10 2008 +0900 (2008-08-07)
parents 678ad99920c8 2866e6af503e
children a18df47f671b
files
line diff
     1.1 --- a/arch/i386/Kconfig	Tue Aug 05 12:19:38 2008 +0900
     1.2 +++ b/arch/i386/Kconfig	Thu Aug 07 11:58:10 2008 +0900
     1.3 @@ -107,6 +107,7 @@ config X86_PC
     1.4  config X86_XEN
     1.5  	bool "Xen-compatible"
     1.6  	select XEN
     1.7 +	select X86_PAE
     1.8  	select X86_UP_APIC if !SMP && XEN_PRIVILEGED_GUEST
     1.9  	select X86_UP_IOAPIC if !SMP && XEN_PRIVILEGED_GUEST
    1.10  	select SWIOTLB
     2.1 --- a/arch/i386/kernel/acpi/Makefile	Tue Aug 05 12:19:38 2008 +0900
     2.2 +++ b/arch/i386/kernel/acpi/Makefile	Thu Aug 07 11:58:10 2008 +0900
     2.3 @@ -4,7 +4,9 @@ obj-$(CONFIG_ACPI_SLEEP)	+= sleep.o wake
     2.4  
     2.5  ifneq ($(CONFIG_ACPI_PROCESSOR),)
     2.6  obj-y				+= cstate.o processor.o
     2.7 +ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),)
     2.8  obj-$(CONFIG_XEN)		+= processor_extcntl_xen.o
     2.9  endif
    2.10 +endif
    2.11  
    2.12  disabled-obj-$(CONFIG_XEN)	:= cstate.o wakeup.o
     3.1 --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c	Tue Aug 05 12:19:38 2008 +0900
     3.2 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c	Thu Aug 07 11:58:10 2008 +0900
     3.3 @@ -33,14 +33,6 @@
     3.4  #include <asm/hypercall.h>
     3.5  
     3.6  static int xen_processor_pmbits;
     3.7 -static int __init set_xen_processor_pmbits(char *str)
     3.8 -{
     3.9 -	get_option(&str, &xen_processor_pmbits);
    3.10 -
    3.11 -	return 1;
    3.12 -}
    3.13 -__setup("xen_processor_pmbits=", set_xen_processor_pmbits);
    3.14 -EXPORT_SYMBOL(xen_processor_pmbits);
    3.15  
    3.16  static int xen_cx_notifier(struct acpi_processor *pr, int action)
    3.17  {
    3.18 @@ -221,8 +213,10 @@ static struct processor_extcntl_ops xen_
    3.19  	.hotplug		= xen_hotplug_notifier,
    3.20  };
    3.21  
    3.22 -static int __cpuinit xen_init_processor_extcntl(void)
    3.23 +void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **ops)
    3.24  {
    3.25 +	xen_processor_pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8;
    3.26 +
    3.27  	if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX)
    3.28  		xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
    3.29  	if (xen_processor_pmbits & XEN_PROCESSOR_PM_PX)
    3.30 @@ -230,6 +224,6 @@ static int __cpuinit xen_init_processor_
    3.31  	if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX)
    3.32  		xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier;
    3.33  
    3.34 -	return processor_register_extcntl(&xen_extcntl_ops);
    3.35 +	*ops = &xen_extcntl_ops;
    3.36  }
    3.37 -core_initcall(xen_init_processor_extcntl);
    3.38 +EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
     4.1 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Tue Aug 05 12:19:38 2008 +0900
     4.2 +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Thu Aug 07 11:58:10 2008 +0900
     4.3 @@ -568,17 +568,6 @@ acpi_cpufreq_init (void)
     4.4  {
     4.5  	dprintk("acpi_cpufreq_init\n");
     4.6  
     4.7 -#ifdef CONFIG_XEN
     4.8 -	/*
     4.9 -	 * This effectively blocks in-kernel cpufreq driver to interfere
    4.10 -	 * external control logic
    4.11 -	 */
    4.12 -	if (processor_pmperf_external()) {
    4.13 -		printk("CPUFREQ is controllerd externally...exit then!\n");
    4.14 -		return -1;
    4.15 -	}
    4.16 -#endif /* CONFIG_XEN */
    4.17 -
    4.18  	acpi_cpufreq_early_init_acpi();
    4.19  
    4.20  	return cpufreq_register_driver(&acpi_cpufreq_driver);
     5.1 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	Tue Aug 05 12:19:38 2008 +0900
     5.2 +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	Thu Aug 07 11:58:10 2008 +0900
     5.3 @@ -1312,16 +1312,6 @@ static int __cpuinit powernowk8_init(voi
     5.4  {
     5.5  	unsigned int i, supported_cpus = 0;
     5.6  
     5.7 -#ifdef CONFIG_XEN
     5.8 -        /*
     5.9 -         * This effectively blocks in-kernel cpufreq driver to interfere
    5.10 -         * external control logic
    5.11 -         */
    5.12 -        if (processor_pmperf_external()) {
    5.13 -                return -ENODEV;
    5.14 -        }
    5.15 -#endif /* CONFIG_XEN */
    5.16 -
    5.17  	for_each_online_cpu(i) {
    5.18  		if (check_supported_cpu(i))
    5.19  			supported_cpus++;
     6.1 --- a/arch/i386/kernel/setup-xen.c	Tue Aug 05 12:19:38 2008 +0900
     6.2 +++ b/arch/i386/kernel/setup-xen.c	Thu Aug 07 11:58:10 2008 +0900
     6.3 @@ -283,7 +283,12 @@ static struct resource standard_io_resou
     6.4  }, {
     6.5  	.name	= "keyboard",
     6.6  	.start	= 0x0060,
     6.7 -	.end	= 0x006f,
     6.8 +	.end	= 0x0060,
     6.9 +	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
    6.10 +}, {
    6.11 +	.name	= "keyboard",
    6.12 +	.start	= 0x0064,
    6.13 +	.end	= 0x0064,
    6.14  	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
    6.15  }, {
    6.16  	.name	= "dma page reg",
     7.1 --- a/arch/i386/kernel/setup.c	Tue Aug 05 12:19:38 2008 +0900
     7.2 +++ b/arch/i386/kernel/setup.c	Thu Aug 07 11:58:10 2008 +0900
     7.3 @@ -261,7 +261,12 @@ static struct resource standard_io_resou
     7.4  }, {
     7.5  	.name	= "keyboard",
     7.6  	.start	= 0x0060,
     7.7 -	.end	= 0x006f,
     7.8 +	.end	= 0x0060,
     7.9 +	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
    7.10 +}, {
    7.11 +	.name	= "keyboard",
    7.12 +	.start	= 0x0064,
    7.13 +	.end	= 0x0064,
    7.14  	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
    7.15  }, {
    7.16  	.name	= "dma page reg",
     8.1 --- a/arch/x86_64/kernel/acpi/Makefile	Tue Aug 05 12:19:38 2008 +0900
     8.2 +++ b/arch/x86_64/kernel/acpi/Makefile	Thu Aug 07 11:58:10 2008 +0900
     8.3 @@ -6,8 +6,9 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),)
     8.4  obj-y			+= processor.o
     8.5  processor-y		:= ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o
     8.6  processor-$(CONFIG_XEN)	:= ../../../i386/kernel/acpi/processor.o
     8.7 +ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),)
     8.8 +processor-$(CONFIG_XEN)	+= ../../../i386/kernel/acpi/processor_extcntl_xen.o
     8.9 +endif
    8.10  endif
    8.11  
    8.12 -obj-$(CONFIG_XEN)	+= processor_extcnt_xen.o
    8.13 -processor_extcnt_xen-$(CONFIG_XEN) := ../../../i386/kernel/acpi/processor_extcntl_xen.o
    8.14  disabled-obj-$(CONFIG_XEN) := wakeup.o
     9.1 --- a/arch/x86_64/kernel/process-xen.c	Tue Aug 05 12:19:38 2008 +0900
     9.2 +++ b/arch/x86_64/kernel/process-xen.c	Thu Aug 07 11:58:10 2008 +0900
     9.3 @@ -846,9 +846,3 @@ unsigned long arch_align_stack(unsigned 
     9.4  		sp -= get_random_int() % 8192;
     9.5  	return sp & ~0xf;
     9.6  }
     9.7 -
     9.8 -#ifndef CONFIG_SMP
     9.9 -void _restore_vcpu(void)
    9.10 -{
    9.11 -}
    9.12 -#endif
    10.1 --- a/arch/x86_64/kernel/setup-xen.c	Tue Aug 05 12:19:38 2008 +0900
    10.2 +++ b/arch/x86_64/kernel/setup-xen.c	Thu Aug 07 11:58:10 2008 +0900
    10.3 @@ -169,7 +169,9 @@ struct resource standard_io_resources[] 
    10.4  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
    10.5  	{ .name = "timer1", .start = 0x50, .end = 0x53,
    10.6  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
    10.7 -	{ .name = "keyboard", .start = 0x60, .end = 0x6f,
    10.8 +	{ .name = "keyboard", .start = 0x60, .end = 0x60,
    10.9 +		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
   10.10 +	{ .name = "keyboard", .start = 0x64, .end = 0x64,
   10.11  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
   10.12  	{ .name = "dma page reg", .start = 0x80, .end = 0x8f,
   10.13  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
    11.1 --- a/arch/x86_64/kernel/setup.c	Tue Aug 05 12:19:38 2008 +0900
    11.2 +++ b/arch/x86_64/kernel/setup.c	Thu Aug 07 11:58:10 2008 +0900
    11.3 @@ -122,7 +122,9 @@ struct resource standard_io_resources[] 
    11.4  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
    11.5  	{ .name = "timer1", .start = 0x50, .end = 0x53,
    11.6  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
    11.7 -	{ .name = "keyboard", .start = 0x60, .end = 0x6f,
    11.8 +	{ .name = "keyboard", .start = 0x60, .end = 0x60,
    11.9 +		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
   11.10 +	{ .name = "keyboard", .start = 0x64, .end = 0x64,
   11.11  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
   11.12  	{ .name = "dma page reg", .start = 0x80, .end = 0x8f,
   11.13  		.flags = IORESOURCE_BUSY | IORESOURCE_IO },
    12.1 --- a/arch/x86_64/mm/init-xen.c	Tue Aug 05 12:19:38 2008 +0900
    12.2 +++ b/arch/x86_64/mm/init-xen.c	Thu Aug 07 11:58:10 2008 +0900
    12.3 @@ -325,6 +325,14 @@ static __init void set_pte_phys_ma(unsig
    12.4  	new_pte = pfn_pte_ma(phys >> PAGE_SHIFT, prot);
    12.5  
    12.6  	pte = pte_offset_kernel(pmd, vaddr);
    12.7 +	if (!pte_none(*pte) &&
    12.8 +#ifdef CONFIG_ACPI
    12.9 +	    /* __acpi_map_table() fails to properly call clear_fixmap() */
   12.10 +	    (vaddr < __fix_to_virt(FIX_ACPI_END) ||
   12.11 +	     vaddr > __fix_to_virt(FIX_ACPI_BEGIN)) &&
   12.12 +#endif
   12.13 +	    __pte_val(*pte) != (__pte_val(new_pte) & __supported_pte_mask))
   12.14 +		pte_ERROR(*pte);
   12.15  	set_pte(pte, new_pte);
   12.16  
   12.17  	/*
    13.1 --- a/drivers/acpi/Kconfig	Tue Aug 05 12:19:38 2008 +0900
    13.2 +++ b/drivers/acpi/Kconfig	Thu Aug 07 11:58:10 2008 +0900
    13.3 @@ -371,7 +371,6 @@ config ACPI_PV_SLEEP
    13.4  config PROCESSOR_EXTERNAL_CONTROL
    13.5  	bool
    13.6  	depends on X86 && XEN
    13.7 -	select ACPI_PROCESSOR
    13.8  	default y
    13.9  endif	# ACPI
   13.10  
    14.1 --- a/drivers/acpi/Makefile	Tue Aug 05 12:19:38 2008 +0900
    14.2 +++ b/drivers/acpi/Makefile	Thu Aug 07 11:58:10 2008 +0900
    14.3 @@ -35,7 +35,7 @@ ifdef CONFIG_CPU_FREQ
    14.4  processor-objs	+= processor_perflib.o			
    14.5  endif
    14.6  ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
    14.7 -processor-objs	+= processor_extcntl.o
    14.8 +processor-objs	+= processor_perflib.o processor_extcntl.o
    14.9  endif
   14.10  
   14.11  obj-y				+= sleep/
    15.1 --- a/drivers/acpi/processor_core.c	Tue Aug 05 12:19:38 2008 +0900
    15.2 +++ b/drivers/acpi/processor_core.c	Thu Aug 07 11:58:10 2008 +0900
    15.3 @@ -474,14 +474,9 @@ static int acpi_processor_get_info(struc
    15.4  	 *  they are physically not present.
    15.5  	 */
    15.6  	if (cpu_index == -1) {
    15.7 -#ifdef CONFIG_XEN
    15.8  		if (ACPI_FAILURE
    15.9  		    (acpi_processor_hotadd_init(pr->handle, &pr->id)) &&
   15.10  		    !processor_cntl_external()) {
   15.11 -#else
   15.12 -		if (ACPI_FAILURE
   15.13 -		    (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
   15.14 -#endif /* CONFIG_XEN */
   15.15  			printk(KERN_ERR PREFIX
   15.16  				    "Getting cpuindex for acpiid 0x%x\n",
   15.17  				    pr->acpi_id);
   15.18 @@ -514,20 +509,14 @@ static int acpi_processor_get_info(struc
   15.19  		request_region(pr->throttling.address, 6, "ACPI CPU throttle");
   15.20  	}
   15.21  
   15.22 -#ifdef CONFIG_CPU_FREQ
   15.23  	acpi_processor_ppc_has_changed(pr);
   15.24 -#endif
   15.25  	acpi_processor_get_throttling_info(pr);
   15.26  	acpi_processor_get_limit_info(pr);
   15.27  
   15.28  	return 0;
   15.29  }
   15.30  
   15.31 -#ifdef CONFIG_XEN
   15.32  static void *processor_device_array[NR_ACPI_CPUS];
   15.33 -#else
   15.34 -static void *processor_device_array[NR_CPUS];
   15.35 -#endif /* CONFIG_XEN */
   15.36  
   15.37  static int acpi_processor_start(struct acpi_device *device)
   15.38  {
   15.39 @@ -535,26 +524,19 @@ static int acpi_processor_start(struct a
   15.40  	acpi_status status = AE_OK;
   15.41  	struct acpi_processor *pr;
   15.42  
   15.43 +	processor_extcntl_init();
   15.44  
   15.45  	pr = acpi_driver_data(device);
   15.46  
   15.47  	result = acpi_processor_get_info(pr);
   15.48 -#ifdef CONFIG_XEN
   15.49  	if (result || 
   15.50  	    ((pr->id == -1) && !processor_cntl_external())) {
   15.51 -#else
   15.52 -	if (result) {
   15.53 -#endif /* CONFIG_XEN */
   15.54  		/* Processor is physically not present */
   15.55  		return 0;
   15.56  	}
   15.57  
   15.58 -#ifdef CONFIG_XEN
   15.59  	BUG_ON(!processor_cntl_external() &&
   15.60  	       ((pr->id >= NR_CPUS) || (pr->id < 0)));
   15.61 -#else
   15.62 -	BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
   15.63 -#endif /* CONFIG_XEN */
   15.64  
   15.65  	/*
   15.66  	 * Buggy BIOS check
   15.67 @@ -562,6 +544,7 @@ static int acpi_processor_start(struct a
   15.68  	 * Don't trust it blindly
   15.69  	 */
   15.70  #ifdef CONFIG_XEN
   15.71 +	BUG_ON(pr->acpi_id >= NR_ACPI_CPUS);
   15.72  	if (processor_device_array[pr->acpi_id] != NULL &&
   15.73  	    processor_device_array[pr->acpi_id] != (void *)device) {
   15.74  #else
   15.75 @@ -595,9 +578,9 @@ static int acpi_processor_start(struct a
   15.76  
   15.77  	acpi_processor_power_init(pr, device);
   15.78  
   15.79 -#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
   15.80 -	processor_extcntl_init(pr);
   15.81 -#endif
   15.82 +	result = processor_extcntl_prepare(pr);
   15.83 +	if (result)
   15.84 +		goto end;
   15.85  
   15.86  	if (pr->flags.throttling) {
   15.87  		printk(KERN_INFO PREFIX "%s [%s] (supports",
   15.88 @@ -751,11 +734,9 @@ int acpi_processor_device_add(acpi_handl
   15.89  	if (!pr)
   15.90  		return -ENODEV;
   15.91  
   15.92 -#ifdef CONFIG_XEN
   15.93  	if (processor_cntl_external())
   15.94  		processor_notify_external(pr,
   15.95  			PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
   15.96 -#endif /* CONFIG_XEN */
   15.97  
   15.98  	if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
   15.99  		kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
  15.100 @@ -795,11 +776,9 @@ acpi_processor_hotplug_notify(acpi_handl
  15.101  			break;
  15.102  		}
  15.103  
  15.104 -#ifdef CONFIG_XEN
  15.105  		if (processor_cntl_external())
  15.106  			processor_notify_external(pr,
  15.107  					PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
  15.108 -#endif /* CONFIG_XEN */
  15.109  
  15.110  		if (pr->id >= 0 && (pr->id < NR_CPUS)) {
  15.111  			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
  15.112 @@ -838,11 +817,9 @@ acpi_processor_hotplug_notify(acpi_handl
  15.113  #endif /* CONFIG_XEN */
  15.114  			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
  15.115  
  15.116 -#ifdef CONFIG_XEN
  15.117  		if (processor_cntl_external())
  15.118  			processor_notify_external(pr, PROCESSOR_HOTPLUG,
  15.119  							HOTPLUG_TYPE_REMOVE);
  15.120 -#endif /* CONFIG_XEN */
  15.121  
  15.122  		break;
  15.123  	default:
    16.1 --- a/drivers/acpi/processor_extcntl.c	Tue Aug 05 12:19:38 2008 +0900
    16.2 +++ b/drivers/acpi/processor_extcntl.c	Thu Aug 07 11:58:10 2008 +0900
    16.3 @@ -36,7 +36,7 @@ static int processor_extcntl_get_perform
    16.4   * External processor control logic may register with its own set of
    16.5   * ops to get ACPI related notification. One example is like VMM.
    16.6   */
    16.7 -struct processor_extcntl_ops *processor_extcntl_ops;
    16.8 +const struct processor_extcntl_ops *processor_extcntl_ops;
    16.9  EXPORT_SYMBOL(processor_extcntl_ops);
   16.10  
   16.11  static int processor_notify_smm(void)
   16.12 @@ -112,30 +112,11 @@ int processor_notify_external(struct acp
   16.13   * state which is also necessarily controlled by VMM. But for other
   16.14   * control bits like performance/throttle states, VMM may choose to
   16.15   * control or not upon its own policy.
   16.16 - *
   16.17 - * Such ownership is unlikely to be switched in the fly, and thus
   16.18 - * not sure unregister interface is required or not. Being same reason,
   16.19 - * lock is not forced now.
   16.20   */
   16.21 -int processor_register_extcntl(struct processor_extcntl_ops *ops)
   16.22 +void processor_extcntl_init(void)
   16.23  {
   16.24 -	if (!ops)
   16.25 -		return -EINVAL;
   16.26 -
   16.27 -	if (processor_extcntl_ops &&
   16.28 -		(processor_extcntl_ops != ops))
   16.29 -		return -EBUSY;
   16.30 -
   16.31 -	processor_extcntl_ops = ops;
   16.32 -	return 0;
   16.33 -}
   16.34 -
   16.35 -int processor_unregister_extcntl(struct processor_extcntl_ops *ops)
   16.36 -{
   16.37 -	if (processor_extcntl_ops == ops)
   16.38 -		processor_extcntl_ops = NULL;
   16.39 -
   16.40 -	return 0;
   16.41 +	if (!processor_extcntl_ops)
   16.42 +		arch_acpi_processor_init_extcntl(&processor_extcntl_ops);
   16.43  }
   16.44  
   16.45  /*
   16.46 @@ -145,7 +126,7 @@ int processor_unregister_extcntl(struct 
   16.47   * and performance state. Those information may be not available
   16.48   * if splitting from dom0 control logic like cpufreq driver.
   16.49   */
   16.50 -int processor_extcntl_init(struct acpi_processor *pr)
   16.51 +int processor_extcntl_prepare(struct acpi_processor *pr)
   16.52  {
   16.53  	/* parse cstate dependency information */
   16.54  	if (processor_pm_external())
   16.55 @@ -187,7 +168,6 @@ static int processor_extcntl_parse_csd(s
   16.56   * logic. So we have to collect raw performance information here 
   16.57   * when ACPI processor object is found and started.
   16.58   */
   16.59 -#ifdef CONFIG_CPU_FREQ
   16.60  static int processor_extcntl_get_performance(struct acpi_processor *pr)
   16.61  {
   16.62  	int ret;
   16.63 @@ -244,6 +224,3 @@ err_out:
   16.64  	kfree(perf);
   16.65  	return ret;
   16.66  }
   16.67 -#else
   16.68 -static int processor_extcntl_get_performance(struct acpi_processor *pr) { return 0; }
   16.69 -#endif
    17.1 --- a/drivers/acpi/processor_idle.c	Tue Aug 05 12:19:38 2008 +0900
    17.2 +++ b/drivers/acpi/processor_idle.c	Thu Aug 07 11:58:10 2008 +0900
    17.3 @@ -714,17 +714,12 @@ static int acpi_processor_get_power_info
    17.4  		    (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))
    17.5  			continue;
    17.6  
    17.7 -#ifdef CONFIG_XEN
    17.8  		if (!processor_pm_external())
    17.9  			cx.address = (reg->space_id ==
   17.10  				      ACPI_ADR_SPACE_FIXED_HARDWARE) ?
   17.11  		    		      0 : reg->address;
   17.12  		else
   17.13  			cx.address = reg->address;
   17.14 -#else
   17.15 -		cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?
   17.16 -		    0 : reg->address;
   17.17 -#endif /* CONFIG_XEN */
   17.18  
   17.19  		/* There should be an easy way to extract an integer... */
   17.20  		obj = (union acpi_object *)&(element->package.elements[1]);
   17.21 @@ -733,17 +728,11 @@ static int acpi_processor_get_power_info
   17.22  
   17.23  		cx.type = obj->integer.value;
   17.24  
   17.25 -#ifdef CONFIG_XEN
   17.26  		/* Following check doesn't apply to external control case */
   17.27 -		if (!processor_pm_external())
   17.28 -			if ((cx.type != ACPI_STATE_C1) &&
   17.29 -			    (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
   17.30 -				continue;
   17.31 -#else
   17.32 -		if ((cx.type != ACPI_STATE_C1) &&
   17.33 +		if (!processor_pm_external() &&
   17.34 +		    (cx.type != ACPI_STATE_C1) &&
   17.35  		    (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
   17.36  			continue;
   17.37 -#endif /* CONFIG_XEN */
   17.38  
   17.39  		if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3))
   17.40  			continue;
   17.41 @@ -1008,24 +997,16 @@ int acpi_processor_cst_has_changed(struc
   17.42  		return -ENODEV;
   17.43  
   17.44  	/* Fall back to the default idle loop */
   17.45 -#ifdef CONFIG_XEN
   17.46  	if (!processor_pm_external())
   17.47  		pm_idle = pm_idle_save;
   17.48 -#else
   17.49 -	pm_idle = pm_idle_save;
   17.50 -#endif /* CONFIG_XEN */
   17.51  	synchronize_sched();	/* Relies on interrupts forcing exit from idle. */
   17.52  
   17.53  	pr->flags.power = 0;
   17.54  	result = acpi_processor_get_power_info(pr);
   17.55 -#ifdef CONFIG_XEN
   17.56  	if (processor_pm_external())
   17.57  		processor_notify_external(pr,
   17.58  			PROCESSOR_PM_CHANGE, PM_TYPE_IDLE);
   17.59  	else if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
   17.60 -#else
   17.61 -	if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
   17.62 -#endif /* CONFIG_XEN */
   17.63  		pm_idle = acpi_processor_idle;
   17.64  
   17.65  	return result;
   17.66 @@ -1157,11 +1138,7 @@ int acpi_processor_power_init(struct acp
   17.67  				       pr->power.states[i].type);
   17.68  		printk(")\n");
   17.69  
   17.70 -#ifdef CONFIG_XEN
   17.71  		if (!processor_pm_external() && (pr->id == 0)) {
   17.72 -#else
   17.73 -		if (pr->id == 0) {
   17.74 -#endif /* CONFIG_XEN */
   17.75  			pm_idle_save = pm_idle;
   17.76  			pm_idle = acpi_processor_idle;
   17.77  		}
   17.78 @@ -1180,11 +1157,9 @@ int acpi_processor_power_init(struct acp
   17.79  
   17.80  	pr->flags.power_setup_done = 1;
   17.81  
   17.82 -#ifdef CONFIG_XEN
   17.83  	if (processor_pm_external())
   17.84  		processor_notify_external(pr,
   17.85  			PROCESSOR_PM_INIT, PM_TYPE_IDLE);
   17.86 -#endif /* CONFIG_XEN */
   17.87  	return 0;
   17.88  }
   17.89  
    18.1 --- a/drivers/acpi/processor_perflib.c	Tue Aug 05 12:19:38 2008 +0900
    18.2 +++ b/drivers/acpi/processor_perflib.c	Thu Aug 07 11:58:10 2008 +0900
    18.3 @@ -66,6 +66,7 @@ static DEFINE_MUTEX(performance_mutex);
    18.4  
    18.5  static int acpi_processor_ppc_status = 0;
    18.6  
    18.7 +#ifdef CONFIG_CPU_FREQ
    18.8  static int acpi_processor_ppc_notifier(struct notifier_block *nb,
    18.9  				       unsigned long event, void *data)
   18.10  {
   18.11 @@ -102,6 +103,7 @@ static int acpi_processor_ppc_notifier(s
   18.12  static struct notifier_block acpi_ppc_notifier_block = {
   18.13  	.notifier_call = acpi_processor_ppc_notifier,
   18.14  };
   18.15 +#endif	/* CONFIG_CPU_FREQ */
   18.16  
   18.17  static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
   18.18  {
   18.19 @@ -136,15 +138,16 @@ int acpi_processor_ppc_has_changed(struc
   18.20  	int ret = acpi_processor_get_platform_limit(pr);
   18.21  	if (ret < 0)
   18.22  		return (ret);
   18.23 -#ifdef CONFIG_XEN
   18.24 -	else if (processor_pmperf_external())
   18.25 +	else
   18.26 +#ifdef CONFIG_CPU_FREQ
   18.27 +		return cpufreq_update_policy(pr->id);
   18.28 +#elif CONFIG_PROCESSOR_EXTERNAL_CONTROL
   18.29  		return processor_notify_external(pr,
   18.30  				PROCESSOR_PM_CHANGE, PM_TYPE_PERF);
   18.31 -#endif /* CONFIG_XEN */
   18.32 -	else
   18.33 -		return cpufreq_update_policy(pr->id);
   18.34 +#endif
   18.35  }
   18.36  
   18.37 +#ifdef CONFIG_CPU_FREQ
   18.38  void acpi_processor_ppc_init(void)
   18.39  {
   18.40  	if (!cpufreq_register_notifier
   18.41 @@ -163,6 +166,7 @@ void acpi_processor_ppc_exit(void)
   18.42  
   18.43  	acpi_processor_ppc_status &= ~PPC_REGISTERED;
   18.44  }
   18.45 +#endif	/* CONFIG_CPU_FREQ */
   18.46  
   18.47  static int acpi_processor_get_performance_control(struct acpi_processor *pr)
   18.48  {
   18.49 @@ -305,10 +309,9 @@ static int acpi_processor_get_performanc
   18.50  }
   18.51  
   18.52  #ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
   18.53 -static int acpi_processor_get_performance_info(struct acpi_processor *pr)
   18.54 -#else
   18.55 +static
   18.56 +#endif
   18.57  int acpi_processor_get_performance_info(struct acpi_processor *pr)
   18.58 -#endif
   18.59  {
   18.60  	int result = 0;
   18.61  	acpi_status status = AE_OK;
   18.62 @@ -340,6 +343,7 @@ int acpi_processor_get_performance_info(
   18.63  	return 0;
   18.64  }
   18.65  
   18.66 +#ifdef CONFIG_CPU_FREQ
   18.67  int acpi_processor_notify_smm(struct module *calling_module)
   18.68  {
   18.69  	acpi_status status;
   18.70 @@ -407,6 +411,7 @@ int acpi_processor_notify_smm(struct mod
   18.71  }
   18.72  
   18.73  EXPORT_SYMBOL(acpi_processor_notify_smm);
   18.74 +#endif	/* CONFIG_CPU_FREQ */
   18.75  
   18.76  #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
   18.77  /* /proc/acpi/processor/../performance interface (DEPRECATED) */
   18.78 @@ -548,10 +553,9 @@ static void acpi_cpufreq_remove_file(str
   18.79  #endif				/* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
   18.80  
   18.81  #ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
   18.82 -static int acpi_processor_get_psd(struct acpi_processor	*pr)
   18.83 -#else
   18.84 +static
   18.85 +#endif
   18.86  int acpi_processor_get_psd(struct acpi_processor *pr)
   18.87 -#endif
   18.88  {
   18.89  	int result = 0;
   18.90  	acpi_status status = AE_OK;
    19.1 --- a/drivers/cpufreq/Kconfig	Tue Aug 05 12:19:38 2008 +0900
    19.2 +++ b/drivers/cpufreq/Kconfig	Thu Aug 07 11:58:10 2008 +0900
    19.3 @@ -1,5 +1,6 @@
    19.4  config CPU_FREQ
    19.5  	bool "CPU Frequency scaling"
    19.6 +	depends on !PROCESSOR_EXTERNAL_CONTROL
    19.7  	help
    19.8  	  CPU Frequency scaling allows you to change the clock speed of 
    19.9  	  CPUs on the fly. This is a nice method to save power, because 
    20.1 --- a/drivers/pci/msi-xen.c	Tue Aug 05 12:19:38 2008 +0900
    20.2 +++ b/drivers/pci/msi-xen.c	Thu Aug 07 11:58:10 2008 +0900
    20.3 @@ -116,7 +116,7 @@ static void detach_pirq_entry(int entry_
    20.4  /*
    20.5   * pciback will provide device's owner
    20.6   */
    20.7 -int (*get_owner)(struct pci_dev *dev);
    20.8 +static int (*get_owner)(struct pci_dev *dev);
    20.9  
   20.10  int register_msi_get_owner(int (*func)(struct pci_dev *dev))
   20.11  {
   20.12 @@ -130,33 +130,32 @@ int register_msi_get_owner(int (*func)(s
   20.13  
   20.14  int unregister_msi_get_owner(int (*func)(struct pci_dev *dev))
   20.15  {
   20.16 -	if (get_owner == func)
   20.17 -		get_owner = NULL;
   20.18 +	if (get_owner != func)
   20.19 +		return -EINVAL;
   20.20 +	get_owner = NULL;
   20.21  	return 0;
   20.22  }
   20.23  
   20.24  static int msi_get_dev_owner(struct pci_dev *dev)
   20.25  {
   20.26 -	int owner = DOMID_SELF;
   20.27 +	int owner;
   20.28  
   20.29  	BUG_ON(!is_initial_xendomain());
   20.30 -	if (get_owner && (owner = get_owner(dev)) >=0 ) {
   20.31 +	if (get_owner && (owner = get_owner(dev)) >= 0) {
   20.32  		printk(KERN_INFO "get owner for dev %x get %x \n",
   20.33 -				    dev->devfn, owner);
   20.34 +		       dev->devfn, owner);
   20.35  		return owner;
   20.36  	}
   20.37 -	else
   20.38 -		return DOMID_SELF;
   20.39 +
   20.40 +	return DOMID_SELF;
   20.41  }
   20.42  
   20.43  static int msi_unmap_pirq(struct pci_dev *dev, int pirq)
   20.44  {
   20.45  	struct physdev_unmap_pirq unmap;
   20.46  	int rc;
   20.47 -	domid_t domid = DOMID_SELF;
   20.48  
   20.49 -	domid = msi_get_dev_owner(dev);
   20.50 -	unmap.domid = domid;
   20.51 +	unmap.domid = msi_get_dev_owner(dev);
   20.52  	unmap.pirq = pirq;
   20.53  
   20.54  	if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap)))
   20.55 @@ -164,7 +163,7 @@ static int msi_unmap_pirq(struct pci_dev
   20.56  
   20.57  	if (rc < 0)
   20.58  		return rc;
   20.59 -    return 0;
   20.60 +	return 0;
   20.61  }
   20.62  
   20.63  /*
    21.1 --- a/drivers/pci/msi.h	Tue Aug 05 12:19:38 2008 +0900
    21.2 +++ b/drivers/pci/msi.h	Thu Aug 07 11:58:10 2008 +0900
    21.3 @@ -84,11 +84,6 @@ extern int vector_irq[NR_VECTORS];
    21.4  extern void (*interrupt[NR_IRQS])(void);
    21.5  extern int pci_vector_resources(int last, int nr_released);
    21.6  
    21.7 -#ifdef CONFIG_XEN
    21.8 -extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
    21.9 -extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
   21.10 -#endif
   21.11 -
   21.12  /*
   21.13   * MSI-X Address Register
   21.14   */
    22.1 --- a/drivers/xen/blkfront/blkfront.c	Tue Aug 05 12:19:38 2008 +0900
    22.2 +++ b/drivers/xen/blkfront/blkfront.c	Thu Aug 07 11:58:10 2008 +0900
    22.3 @@ -352,6 +352,13 @@ static void connect(struct blkfront_info
    22.4  		return;
    22.5  	}
    22.6  
    22.7 +	err = xlvbd_sysfs_addif(info);
    22.8 +	if (err) {
    22.9 +		xenbus_dev_fatal(info->xbdev, err, "xlvbd_sysfs_addif at %s",
   22.10 +				 info->xbdev->otherend);
   22.11 +		return;
   22.12 +	}
   22.13 +
   22.14  	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
   22.15  
   22.16  	/* Kick pending requests. */
   22.17 @@ -391,6 +398,8 @@ static void blkfront_closing(struct xenb
   22.18  	/* Flush gnttab callback work. Must be done with no locks held. */
   22.19  	flush_scheduled_work();
   22.20  
   22.21 +	xlvbd_sysfs_delif(info);
   22.22 +
   22.23  	xlvbd_del(info);
   22.24  
   22.25   out:
    23.1 --- a/drivers/xen/blkfront/block.h	Tue Aug 05 12:19:38 2008 +0900
    23.2 +++ b/drivers/xen/blkfront/block.h	Thu Aug 07 11:58:10 2008 +0900
    23.3 @@ -140,4 +140,19 @@ int xlvbd_add(blkif_sector_t capacity, i
    23.4  void xlvbd_del(struct blkfront_info *info);
    23.5  int xlvbd_barrier(struct blkfront_info *info);
    23.6  
    23.7 +#ifdef CONFIG_SYSFS
    23.8 +int xlvbd_sysfs_addif(struct blkfront_info *info);
    23.9 +void xlvbd_sysfs_delif(struct blkfront_info *info);
   23.10 +#else
   23.11 +static inline int xlvbd_sysfs_addif(struct blkfront_info *info)
   23.12 +{
   23.13 +	return 0;
   23.14 +}
   23.15 +
   23.16 +static inline void xlvbd_sysfs_delif(struct blkfront_info *info)
   23.17 +{
   23.18 +	;
   23.19 +}
   23.20 +#endif
   23.21 +
   23.22  #endif /* __XEN_DRIVERS_BLOCK_H__ */
    24.1 --- a/drivers/xen/blkfront/vbd.c	Tue Aug 05 12:19:38 2008 +0900
    24.2 +++ b/drivers/xen/blkfront/vbd.c	Thu Aug 07 11:58:10 2008 +0900
    24.3 @@ -413,3 +413,48 @@ xlvbd_barrier(struct blkfront_info *info
    24.4  	return -ENOSYS;
    24.5  }
    24.6  #endif
    24.7 +
    24.8 +#ifdef CONFIG_SYSFS
    24.9 +static ssize_t show_media(struct device *dev,
   24.10 +		                  struct device_attribute *attr, char *buf)
   24.11 +{
   24.12 +	struct xenbus_device *xendev = to_xenbus_device(dev);
   24.13 +	struct blkfront_info *info = xendev->dev.driver_data;
   24.14 +
   24.15 +	if (info->gd->flags & GENHD_FL_CD)
   24.16 +		return sprintf(buf, "cdrom\n");
   24.17 +	return sprintf(buf, "disk\n");
   24.18 +}
   24.19 +
   24.20 +static struct device_attribute xlvbd_attrs[] = {
   24.21 +	__ATTR(media, S_IRUGO, show_media, NULL),
   24.22 +};
   24.23 +
   24.24 +int xlvbd_sysfs_addif(struct blkfront_info *info)
   24.25 +{
   24.26 +	int i;
   24.27 +	int error = 0;
   24.28 +
   24.29 +	for (i = 0; i < ARRAY_SIZE(xlvbd_attrs); i++) {
   24.30 +		error = device_create_file(info->gd->driverfs_dev,
   24.31 +				&xlvbd_attrs[i]);
   24.32 +		if (error)
   24.33 +			goto fail;
   24.34 +	}
   24.35 +	return 0;
   24.36 +
   24.37 +fail:
   24.38 +	while (--i >= 0)
   24.39 +		device_remove_file(info->gd->driverfs_dev, &xlvbd_attrs[i]);
   24.40 +	return error;
   24.41 +}
   24.42 +
   24.43 +void xlvbd_sysfs_delif(struct blkfront_info *info)
   24.44 +{
   24.45 +	int i;
   24.46 +
   24.47 +	for (i = 0; i < ARRAY_SIZE(xlvbd_attrs); i++)
   24.48 +		device_remove_file(info->gd->driverfs_dev, &xlvbd_attrs[i]);
   24.49 +}
   24.50 +
   24.51 +#endif /* CONFIG_SYSFS */
    25.1 --- a/drivers/xen/core/machine_reboot.c	Tue Aug 05 12:19:38 2008 +0900
    25.2 +++ b/drivers/xen/core/machine_reboot.c	Thu Aug 07 11:58:10 2008 +0900
    25.3 @@ -26,8 +26,6 @@
    25.4  void (*pm_power_off)(void);
    25.5  EXPORT_SYMBOL(pm_power_off);
    25.6  
    25.7 -int setup_suspend_evtchn(void);
    25.8 -
    25.9  void machine_emergency_restart(void)
   25.10  {
   25.11  	/* We really want to get pending console data out before we die. */
   25.12 @@ -133,7 +131,7 @@ static void post_suspend(int suspend_can
   25.13  
   25.14  struct suspend {
   25.15  	int fast_suspend;
   25.16 -	void (*resume_notifier)(void);
   25.17 +	void (*resume_notifier)(int);
   25.18  };
   25.19  
   25.20  static int take_machine_down(void *_suspend)
   25.21 @@ -175,7 +173,7 @@ static int take_machine_down(void *_susp
   25.22  	 */
   25.23  	suspend_cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
   25.24  
   25.25 -	suspend->resume_notifier();
   25.26 +	suspend->resume_notifier(suspend_cancelled);
   25.27  	post_suspend(suspend_cancelled);
   25.28  	gnttab_resume();
   25.29  	if (!suspend_cancelled) {
   25.30 @@ -204,7 +202,7 @@ static int take_machine_down(void *_susp
   25.31  	return suspend_cancelled;
   25.32  }
   25.33  
   25.34 -int __xen_suspend(int fast_suspend, void (*resume_notifier)(void))
   25.35 +int __xen_suspend(int fast_suspend, void (*resume_notifier)(int))
   25.36  {
   25.37  	int err, suspend_cancelled;
   25.38  	struct suspend suspend;
   25.39 @@ -243,7 +241,6 @@ int __xen_suspend(int fast_suspend, void
   25.40  	if (!suspend_cancelled) {
   25.41  		xencons_resume();
   25.42  		xenbus_resume();
   25.43 -		setup_suspend_evtchn();
   25.44  	} else {
   25.45  		xenbus_suspend_cancel();
   25.46  	}
    26.1 --- a/drivers/xen/core/pci.c	Tue Aug 05 12:19:38 2008 +0900
    26.2 +++ b/drivers/xen/core/pci.c	Thu Aug 07 11:58:10 2008 +0900
    26.3 @@ -24,7 +24,8 @@ static int pci_bus_probe_wrapper(struct 
    26.4  
    26.5  	r = pci_bus_probe(dev);
    26.6  	if (r)
    26.7 -		HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
    26.8 +		WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
    26.9 +					      &manage_pci));
   26.10  
   26.11  	return r;
   26.12  }
   26.13 @@ -40,7 +41,8 @@ static int pci_bus_remove_wrapper(struct
   26.14  	r = pci_bus_remove(dev);
   26.15  	/* dev and pci_dev are no longer valid!! */
   26.16  
   26.17 -	HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
   26.18 +	WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
   26.19 +		&manage_pci));
   26.20  	return r;
   26.21  }
   26.22  
    27.1 --- a/drivers/xen/core/reboot.c	Tue Aug 05 12:19:38 2008 +0900
    27.2 +++ b/drivers/xen/core/reboot.c	Thu Aug 07 11:58:10 2008 +0900
    27.3 @@ -27,13 +27,18 @@ MODULE_LICENSE("Dual BSD/GPL");
    27.4  /* Ignore multiple shutdown requests. */
    27.5  static int shutting_down = SHUTDOWN_INVALID;
    27.6  
    27.7 +/* Was last suspend request cancelled? */
    27.8 +static int suspend_cancelled;
    27.9 +
   27.10  /* Can we leave APs online when we suspend? */
   27.11  static int fast_suspend;
   27.12  
   27.13  static void __shutdown_handler(void *unused);
   27.14  static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
   27.15  
   27.16 -int __xen_suspend(int fast_suspend, void (*resume_notifier)(void));
   27.17 +static int setup_suspend_evtchn(void);
   27.18 +
   27.19 +int __xen_suspend(int fast_suspend, void (*resume_notifier)(int));
   27.20  
   27.21  static int shutdown_process(void *__unused)
   27.22  {
   27.23 @@ -62,10 +67,11 @@ static int shutdown_process(void *__unus
   27.24  	return 0;
   27.25  }
   27.26  
   27.27 -static void xen_resume_notifier(void)
   27.28 +static void xen_resume_notifier(int _suspend_cancelled)
   27.29  {
   27.30  	int old_state = xchg(&shutting_down, SHUTDOWN_RESUMING);
   27.31  	BUG_ON(old_state != SHUTDOWN_SUSPEND);
   27.32 +	suspend_cancelled = _suspend_cancelled;
   27.33  }
   27.34  
   27.35  static int xen_suspend(void *__unused)
   27.36 @@ -85,6 +91,8 @@ static int xen_suspend(void *__unused)
   27.37  			printk(KERN_ERR "Xen suspend failed (%d)\n", err);
   27.38  			goto fail;
   27.39  		}
   27.40 +		if (!suspend_cancelled)
   27.41 +			setup_suspend_evtchn();
   27.42  		old_state = cmpxchg(
   27.43  			&shutting_down, SHUTDOWN_RESUMING, SHUTDOWN_INVALID);
   27.44  	} while (old_state == SHUTDOWN_SUSPEND);
   27.45 @@ -108,6 +116,31 @@ static int xen_suspend(void *__unused)
   27.46  	return 0;
   27.47  }
   27.48  
   27.49 +static void switch_shutdown_state(int new_state)
   27.50 +{
   27.51 +	int prev_state, old_state = SHUTDOWN_INVALID;
   27.52 +
   27.53 +	/* We only drive shutdown_state into an active state. */
   27.54 +	if (new_state == SHUTDOWN_INVALID)
   27.55 +		return;
   27.56 +
   27.57 +	do {
   27.58 +		/* We drop this transition if already in an active state. */
   27.59 +		if ((old_state != SHUTDOWN_INVALID) &&
   27.60 +		    (old_state != SHUTDOWN_RESUMING))
   27.61 +			return;
   27.62 +		/* Attempt to transition. */
   27.63 +		prev_state = old_state;
   27.64 +		old_state = cmpxchg(&shutting_down, old_state, new_state);
   27.65 +	} while (old_state != prev_state);
   27.66 +
   27.67 +	/* Either we kick off the work, or we leave it to xen_suspend(). */
   27.68 +	if (old_state == SHUTDOWN_INVALID)
   27.69 +		schedule_work(&shutdown_work);
   27.70 +	else
   27.71 +		BUG_ON(old_state != SHUTDOWN_RESUMING);
   27.72 +}
   27.73 +
   27.74  static void __shutdown_handler(void *unused)
   27.75  {
   27.76  	int err;
   27.77 @@ -129,7 +162,7 @@ static void shutdown_handler(struct xenb
   27.78  	extern void ctrl_alt_del(void);
   27.79  	char *str;
   27.80  	struct xenbus_transaction xbt;
   27.81 -	int err, old_state, new_state = SHUTDOWN_INVALID;
   27.82 +	int err, new_state = SHUTDOWN_INVALID;
   27.83  
   27.84  	if ((shutting_down != SHUTDOWN_INVALID) &&
   27.85  	    (shutting_down != SHUTDOWN_RESUMING))
   27.86 @@ -166,13 +199,7 @@ static void shutdown_handler(struct xenb
   27.87  	else
   27.88  		printk("Ignoring shutdown request: %s\n", str);
   27.89  
   27.90 -	if (new_state != SHUTDOWN_INVALID) {
   27.91 -		old_state = xchg(&shutting_down, new_state);
   27.92 -		if (old_state == SHUTDOWN_INVALID)
   27.93 -			schedule_work(&shutdown_work);
   27.94 -		else
   27.95 -			BUG_ON(old_state != SHUTDOWN_RESUMING);
   27.96 -	}
   27.97 +	switch_shutdown_state(new_state);
   27.98  
   27.99  	kfree(str);
  27.100  }
  27.101 @@ -220,26 +247,24 @@ static struct xenbus_watch sysrq_watch =
  27.102  
  27.103  static irqreturn_t suspend_int(int irq, void* dev_id, struct pt_regs *ptregs)
  27.104  {
  27.105 -	shutting_down = SHUTDOWN_SUSPEND;
  27.106 -	schedule_work(&shutdown_work);
  27.107 -
  27.108 +	switch_shutdown_state(SHUTDOWN_SUSPEND);
  27.109  	return IRQ_HANDLED;
  27.110  }
  27.111  
  27.112 -int setup_suspend_evtchn(void)
  27.113 +static int setup_suspend_evtchn(void)
  27.114  {
  27.115 -	static int irq = -1;
  27.116 +	static int irq;
  27.117  	int port;
  27.118 -	char portstr[5]; /* 1024 max */
  27.119 +	char portstr[16];
  27.120  
  27.121  	if (irq > 0)
  27.122  		unbind_from_irqhandler(irq, NULL);
  27.123  
  27.124  	irq = bind_listening_port_to_irqhandler(0, suspend_int, 0, "suspend",
  27.125  						NULL);
  27.126 -	if (irq <= 0) {
  27.127 +	if (irq <= 0)
  27.128  		return -1;
  27.129 -	}
  27.130 +
  27.131  	port = irq_to_evtchn_port(irq);
  27.132  	printk(KERN_INFO "suspend: event channel %d\n", port);
  27.133  	sprintf(portstr, "%d", port);
    28.1 --- a/drivers/xen/netfront/accel.c	Tue Aug 05 12:19:38 2008 +0900
    28.2 +++ b/drivers/xen/netfront/accel.c	Thu Aug 07 11:58:10 2008 +0900
    28.3 @@ -709,8 +709,9 @@ int netfront_accelerator_suspend_cancel(
    28.4  	 * accelerator, so no need to call accelerator_probe_new_vif()
    28.5  	 * directly here
    28.6  	 */
    28.7 -	netfront_accelerator_add_watch(np);
    28.8 - 	return 0;
    28.9 +	if (dev->state == XenbusStateConnected)
   28.10 +		netfront_accelerator_add_watch(np);
   28.11 +	return 0;
   28.12  }
   28.13   
   28.14   
    29.1 --- a/drivers/xen/pciback/pci_stub.c	Tue Aug 05 12:19:38 2008 +0900
    29.2 +++ b/drivers/xen/pciback/pci_stub.c	Thu Aug 07 11:58:10 2008 +0900
    29.3 @@ -832,9 +832,7 @@ static void pcistub_exit(void)
    29.4  	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
    29.5  
    29.6  	pci_unregister_driver(&pciback_pci_driver);
    29.7 -#ifdef CONFIG_PCI_MSI
    29.8 -	unregister_msi_get_owner(pciback_get_owner);
    29.9 -#endif
   29.10 +	WARN_ON(unregister_msi_get_owner(pciback_get_owner));
   29.11  }
   29.12  
   29.13  static int __init pcistub_init(void)
   29.14 @@ -892,10 +890,8 @@ static int __init pcistub_init(void)
   29.15  		err = driver_create_file(&pciback_pci_driver.driver,
   29.16  					 &driver_attr_permissive);
   29.17  
   29.18 -#ifdef CONFIG_PCI_MSI
   29.19  	if (!err)
   29.20  		err = register_msi_get_owner(pciback_get_owner);
   29.21 -#endif
   29.22  	if (err)
   29.23  		pcistub_exit();
   29.24  
    30.1 --- a/drivers/xen/scsiback/emulate.c	Tue Aug 05 12:19:38 2008 +0900
    30.2 +++ b/drivers/xen/scsiback/emulate.c	Thu Aug 07 11:58:10 2008 +0900
    30.3 @@ -73,8 +73,6 @@
    30.4  #define VSCSI_MAX_SCSI_OP_CODE		256
    30.5  static unsigned char bitmap[VSCSI_MAX_SCSI_OP_CODE];
    30.6  
    30.7 -/* REPORT LUNS Header*/
    30.8 -#define VSCSI_REPORT_LUNS_HEADER	8
    30.9  
   30.10  
   30.11  /*
   30.12 @@ -201,6 +199,11 @@ static int __nr_luns_under_host(struct v
   30.13  	return (lun_cnt);
   30.14  }
   30.15  
   30.16 +
   30.17 +/* REPORT LUNS Define*/
   30.18 +#define VSCSI_REPORT_LUNS_HEADER	8
   30.19 +#define VSCSI_REPORT_LUNS_RETRY		3
   30.20 +
   30.21  /* quoted scsi_debug.c/resp_report_luns() */
   30.22  static void __report_luns(pending_req_t *pending_req, void *data)
   30.23  {
   30.24 @@ -215,6 +218,7 @@ static void __report_luns(pending_req_t 
   30.25  	unsigned int alloc_luns = 0;
   30.26  	unsigned int req_bufflen = 0;
   30.27  	unsigned int actual_len = 0;
   30.28 +	unsigned int retry_cnt = 0;
   30.29  	int select_report = (int)cmd[2];
   30.30  	int i, lun_cnt = 0, lun, upper, err = 0;
   30.31  	
   30.32 @@ -231,7 +235,7 @@ static void __report_luns(pending_req_t 
   30.33  	alloc_luns = __nr_luns_under_host(info);
   30.34  	alloc_len  = sizeof(struct scsi_lun) * alloc_luns
   30.35  				+ VSCSI_REPORT_LUNS_HEADER;
   30.36 -
   30.37 +retry:
   30.38  	if ((buff = kmalloc(alloc_len, GFP_KERNEL)) == NULL) {
   30.39  		printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__);
   30.40  		goto fail;
   30.41 @@ -246,8 +250,19 @@ static void __report_luns(pending_req_t 
   30.42  		    (entry->v.tgt == target)) {
   30.43  			
   30.44  			/* check overflow */
   30.45 -			if (lun_cnt >= alloc_luns)
   30.46 +			if (lun_cnt >= alloc_luns) {
   30.47 +				spin_unlock_irqrestore(&info->v2p_lock,
   30.48 +							flags);
   30.49 +
   30.50 +				if (retry_cnt < VSCSI_REPORT_LUNS_RETRY) {
   30.51 +					retry_cnt++;
   30.52 +					if (buff)
   30.53 +						kfree(buff);
   30.54 +					goto retry;
   30.55 +				}
   30.56 +
   30.57  				goto fail;
   30.58 +			}
   30.59  
   30.60  			lun = entry->v.lun;
   30.61  			upper = (lun >> 8) & 0x3f;
    31.1 --- a/include/acpi/processor.h	Tue Aug 05 12:19:38 2008 +0900
    31.2 +++ b/include/acpi/processor.h	Thu Aug 07 11:58:10 2008 +0900
    31.3 @@ -22,7 +22,9 @@
    31.4  #define ACPI_PSD_REV0_ENTRIES		5
    31.5  
    31.6  #ifdef CONFIG_XEN
    31.7 -#define NR_ACPI_CPUS			256
    31.8 +#define NR_ACPI_CPUS			(NR_CPUS < 256 ? 256 : NR_CPUS)
    31.9 +#else
   31.10 +#define NR_ACPI_CPUS			NR_CPUS
   31.11  #endif /* CONFIG_XEN */
   31.12  
   31.13  /*
   31.14 @@ -252,6 +254,9 @@ static inline void acpi_processor_ppc_ex
   31.15  {
   31.16  	return;
   31.17  }
   31.18 +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
   31.19 +int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
   31.20 +#else
   31.21  static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
   31.22  {
   31.23  	static unsigned int printout = 1;
   31.24 @@ -264,6 +269,7 @@ static inline int acpi_processor_ppc_has
   31.25  	}
   31.26  	return 0;
   31.27  }
   31.28 +#endif				/* CONFIG_PROCESSOR_EXTERNAL_CONTROL */
   31.29  #endif				/* CONFIG_CPU_FREQ */
   31.30  
   31.31  /* in processor_throttling.c */
   31.32 @@ -296,7 +302,6 @@ static inline void acpi_thermal_cpufreq_
   31.33  }
   31.34  #endif
   31.35  
   31.36 -#ifdef CONFIG_XEN
   31.37  /* 
   31.38   * Following are interfaces geared to external processor PM control
   31.39   * logic like a VMM
   31.40 @@ -306,7 +311,7 @@ static inline void acpi_thermal_cpufreq_
   31.41  #define PROCESSOR_PM_CHANGE	2
   31.42  #define PROCESSOR_HOTPLUG	3
   31.43  
   31.44 -/* Objects for the PM envents */
   31.45 +/* Objects for the PM events */
   31.46  #define PM_TYPE_IDLE		0
   31.47  #define PM_TYPE_PERF		1
   31.48  #define PM_TYPE_THR		2
   31.49 @@ -323,7 +328,7 @@ struct processor_extcntl_ops {
   31.50  	/* Notify physical processor status to external control logic */
   31.51  	int (*hotplug)(struct acpi_processor *pr, int event);
   31.52  };
   31.53 -extern struct processor_extcntl_ops *processor_extcntl_ops;
   31.54 +extern const struct processor_extcntl_ops *processor_extcntl_ops;
   31.55  
   31.56  static inline int processor_cntl_external(void)
   31.57  {
   31.58 @@ -350,11 +355,11 @@ static inline int processor_pmthr_extern
   31.59  
   31.60  extern int processor_notify_external(struct acpi_processor *pr,
   31.61  			int event, int type);
   31.62 -extern int processor_register_extcntl(struct processor_extcntl_ops *ops);
   31.63 -extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops);
   31.64 -extern int processor_extcntl_init(struct acpi_processor *pr);
   31.65 +extern void processor_extcntl_init(void);
   31.66 +extern int processor_extcntl_prepare(struct acpi_processor *pr);
   31.67  extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
   31.68  extern int acpi_processor_get_psd(struct acpi_processor *pr);
   31.69 +void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **);
   31.70  #else
   31.71  static inline int processor_cntl_external(void) {return 0;}
   31.72  static inline int processor_pm_external(void) {return 0;}
   31.73 @@ -363,13 +368,13 @@ static inline int processor_pmthr_extern
   31.74  static inline int processor_notify_external(struct acpi_processor *pr,
   31.75  			int event, int type)
   31.76  {
   31.77 -	return -EINVAL;
   31.78 +	return 0;
   31.79  }
   31.80 -static inline int processor_extcntl_init(struct acpi_processor *pr)
   31.81 +static inline void processor_extcntl_init(void) {}
   31.82 +static inline int processor_extcntl_prepare(struct acpi_processor *pr)
   31.83  {
   31.84 -	return -EINVAL;
   31.85 +	return 0;
   31.86  }
   31.87  #endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */
   31.88 -#endif /* CONFIG_XEN */
   31.89  
   31.90  #endif
    32.1 --- a/include/linux/pci.h	Tue Aug 05 12:19:38 2008 +0900
    32.2 +++ b/include/linux/pci.h	Thu Aug 07 11:58:10 2008 +0900
    32.3 @@ -599,6 +599,10 @@ static inline int pci_enable_msix(struct
    32.4  	struct msix_entry *entries, int nvec) {return -1;}
    32.5  static inline void pci_disable_msix(struct pci_dev *dev) {}
    32.6  static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
    32.7 +#ifdef CONFIG_XEN
    32.8 +#define register_msi_get_owner(func) 0
    32.9 +#define unregister_msi_get_owner(func) 0
   32.10 +#endif
   32.11  #else
   32.12  extern void pci_scan_msi_device(struct pci_dev *dev);
   32.13  extern int pci_enable_msi(struct pci_dev *dev);
   32.14 @@ -607,6 +611,10 @@ extern int pci_enable_msix(struct pci_de
   32.15  	struct msix_entry *entries, int nvec);
   32.16  extern void pci_disable_msix(struct pci_dev *dev);
   32.17  extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
   32.18 +#ifdef CONFIG_XEN
   32.19 +extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
   32.20 +extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
   32.21 +#endif
   32.22  #endif
   32.23  
   32.24  extern void pci_block_user_cfg_access(struct pci_dev *dev);
    33.1 --- a/include/xen/interface/xen.h	Tue Aug 05 12:19:38 2008 +0900
    33.2 +++ b/include/xen/interface/xen.h	Thu Aug 07 11:58:10 2008 +0900
    33.3 @@ -554,6 +554,7 @@ typedef struct start_info start_info_t;
    33.4  /* These flags are passed in the 'flags' field of start_info_t. */
    33.5  #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
    33.6  #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
    33.7 +#define SIF_PM_MASK       (0xFF<<8) /* reserve 1 byte for xen-pm options */
    33.8  
    33.9  typedef struct dom0_vga_console_info {
   33.10      uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */