WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2008 05:51:07 -0700
Delivery-date: Mon, 11 Aug 2008 05:57:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
# Date 1218077890 -32400
# Node ID 324a5c041301d42b662e20f6175cba6c9b26f262
# Parent  678ad99920c897f247c37d3de14827c547e664c5
# Parent  2866e6af503ea0b33e1c1fb2340ab8ed81925e97
merge with linux-2.6.18-xen.hg
---
 arch/i386/Kconfig                             |    1 
 arch/i386/kernel/acpi/Makefile                |    2 
 arch/i386/kernel/acpi/processor_extcntl_xen.c |   20 ++------
 arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c   |   11 ----
 arch/i386/kernel/cpu/cpufreq/powernow-k8.c    |   10 ----
 arch/i386/kernel/setup-xen.c                  |    7 ++
 arch/i386/kernel/setup.c                      |    7 ++
 arch/x86_64/kernel/acpi/Makefile              |    5 +-
 arch/x86_64/kernel/process-xen.c              |    6 --
 arch/x86_64/kernel/setup-xen.c                |    4 +
 arch/x86_64/kernel/setup.c                    |    4 +
 arch/x86_64/mm/init-xen.c                     |    8 +++
 drivers/acpi/Kconfig                          |    1 
 drivers/acpi/Makefile                         |    2 
 drivers/acpi/processor_core.c                 |   33 ++-----------
 drivers/acpi/processor_extcntl.c              |   37 ++-------------
 drivers/acpi/processor_idle.c                 |   29 -----------
 drivers/acpi/processor_perflib.c              |   30 +++++++-----
 drivers/cpufreq/Kconfig                       |    1 
 drivers/pci/msi-xen.c                         |   25 ++++------
 drivers/pci/msi.h                             |    5 --
 drivers/xen/blkfront/blkfront.c               |    9 +++
 drivers/xen/blkfront/block.h                  |   15 ++++++
 drivers/xen/blkfront/vbd.c                    |   45 ++++++++++++++++++
 drivers/xen/core/machine_reboot.c             |    9 +--
 drivers/xen/core/pci.c                        |    6 +-
 drivers/xen/core/reboot.c                     |   63 ++++++++++++++++++--------
 drivers/xen/netfront/accel.c                  |    5 +-
 drivers/xen/pciback/pci_stub.c                |    6 --
 drivers/xen/scsiback/emulate.c                |   23 +++++++--
 include/acpi/processor.h                      |   35 ++++++++------
 include/linux/pci.h                           |    8 +++
 include/xen/interface/xen.h                   |    1 
 33 files changed, 256 insertions(+), 217 deletions(-)

diff -r 678ad99920c8 -r 324a5c041301 arch/i386/Kconfig
--- a/arch/i386/Kconfig Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/i386/Kconfig Thu Aug 07 11:58:10 2008 +0900
@@ -107,6 +107,7 @@ config X86_XEN
 config X86_XEN
        bool "Xen-compatible"
        select XEN
+       select X86_PAE
        select X86_UP_APIC if !SMP && XEN_PRIVILEGED_GUEST
        select X86_UP_IOAPIC if !SMP && XEN_PRIVILEGED_GUEST
        select SWIOTLB
diff -r 678ad99920c8 -r 324a5c041301 arch/i386/kernel/acpi/Makefile
--- a/arch/i386/kernel/acpi/Makefile    Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/i386/kernel/acpi/Makefile    Thu Aug 07 11:58:10 2008 +0900
@@ -4,7 +4,9 @@ obj-$(CONFIG_ACPI_SLEEP)        += sleep.o wake
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y                          += cstate.o processor.o
+ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),)
 obj-$(CONFIG_XEN)              += processor_extcntl_xen.o
+endif
 endif
 
 disabled-obj-$(CONFIG_XEN)     := cstate.o wakeup.o
diff -r 678ad99920c8 -r 324a5c041301 
arch/i386/kernel/acpi/processor_extcntl_xen.c
--- a/arch/i386/kernel/acpi/processor_extcntl_xen.c     Tue Aug 05 12:19:38 
2008 +0900
+++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c     Thu Aug 07 11:58:10 
2008 +0900
@@ -33,14 +33,6 @@
 #include <asm/hypercall.h>
 
 static int xen_processor_pmbits;
-static int __init set_xen_processor_pmbits(char *str)
-{
-       get_option(&str, &xen_processor_pmbits);
-
-       return 1;
-}
-__setup("xen_processor_pmbits=", set_xen_processor_pmbits);
-EXPORT_SYMBOL(xen_processor_pmbits);
 
 static int xen_cx_notifier(struct acpi_processor *pr, int action)
 {
@@ -221,8 +213,10 @@ static struct processor_extcntl_ops xen_
        .hotplug                = xen_hotplug_notifier,
 };
 
-static int __cpuinit xen_init_processor_extcntl(void)
-{
+void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **ops)
+{
+       xen_processor_pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8;
+
        if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX)
                xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
        if (xen_processor_pmbits & XEN_PROCESSOR_PM_PX)
@@ -230,6 +224,6 @@ static int __cpuinit xen_init_processor_
        if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX)
                xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier;
 
-       return processor_register_extcntl(&xen_extcntl_ops);
-}
-core_initcall(xen_init_processor_extcntl);
+       *ops = &xen_extcntl_ops;
+}
+EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
diff -r 678ad99920c8 -r 324a5c041301 arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c       Tue Aug 05 12:19:38 
2008 +0900
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c       Thu Aug 07 11:58:10 
2008 +0900
@@ -568,17 +568,6 @@ acpi_cpufreq_init (void)
 {
        dprintk("acpi_cpufreq_init\n");
 
-#ifdef CONFIG_XEN
-       /*
-        * This effectively blocks in-kernel cpufreq driver to interfere
-        * external control logic
-        */
-       if (processor_pmperf_external()) {
-               printk("CPUFREQ is controllerd externally...exit then!\n");
-               return -1;
-       }
-#endif /* CONFIG_XEN */
-
        acpi_cpufreq_early_init_acpi();
 
        return cpufreq_register_driver(&acpi_cpufreq_driver);
diff -r 678ad99920c8 -r 324a5c041301 arch/i386/kernel/cpu/cpufreq/powernow-k8.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c        Tue Aug 05 12:19:38 
2008 +0900
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c        Thu Aug 07 11:58:10 
2008 +0900
@@ -1312,16 +1312,6 @@ static int __cpuinit powernowk8_init(voi
 {
        unsigned int i, supported_cpus = 0;
 
-#ifdef CONFIG_XEN
-        /*
-         * This effectively blocks in-kernel cpufreq driver to interfere
-         * external control logic
-         */
-        if (processor_pmperf_external()) {
-                return -ENODEV;
-        }
-#endif /* CONFIG_XEN */
-
        for_each_online_cpu(i) {
                if (check_supported_cpu(i))
                        supported_cpus++;
diff -r 678ad99920c8 -r 324a5c041301 arch/i386/kernel/setup-xen.c
--- a/arch/i386/kernel/setup-xen.c      Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/i386/kernel/setup-xen.c      Thu Aug 07 11:58:10 2008 +0900
@@ -283,7 +283,12 @@ static struct resource standard_io_resou
 }, {
        .name   = "keyboard",
        .start  = 0x0060,
-       .end    = 0x006f,
+       .end    = 0x0060,
+       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
+}, {
+       .name   = "keyboard",
+       .start  = 0x0064,
+       .end    = 0x0064,
        .flags  = IORESOURCE_BUSY | IORESOURCE_IO
 }, {
        .name   = "dma page reg",
diff -r 678ad99920c8 -r 324a5c041301 arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c  Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/i386/kernel/setup.c  Thu Aug 07 11:58:10 2008 +0900
@@ -261,7 +261,12 @@ static struct resource standard_io_resou
 }, {
        .name   = "keyboard",
        .start  = 0x0060,
-       .end    = 0x006f,
+       .end    = 0x0060,
+       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
+}, {
+       .name   = "keyboard",
+       .start  = 0x0064,
+       .end    = 0x0064,
        .flags  = IORESOURCE_BUSY | IORESOURCE_IO
 }, {
        .name   = "dma page reg",
diff -r 678ad99920c8 -r 324a5c041301 arch/x86_64/kernel/acpi/Makefile
--- a/arch/x86_64/kernel/acpi/Makefile  Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/x86_64/kernel/acpi/Makefile  Thu Aug 07 11:58:10 2008 +0900
@@ -6,8 +6,9 @@ obj-y                   += processor.o
 obj-y                  += processor.o
 processor-y            := ../../../i386/kernel/acpi/processor.o 
../../../i386/kernel/acpi/cstate.o
 processor-$(CONFIG_XEN)        := ../../../i386/kernel/acpi/processor.o
+ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),)
+processor-$(CONFIG_XEN)        += 
../../../i386/kernel/acpi/processor_extcntl_xen.o
+endif
 endif
 
-obj-$(CONFIG_XEN)      += processor_extcnt_xen.o
-processor_extcnt_xen-$(CONFIG_XEN) := 
../../../i386/kernel/acpi/processor_extcntl_xen.o
 disabled-obj-$(CONFIG_XEN) := wakeup.o
diff -r 678ad99920c8 -r 324a5c041301 arch/x86_64/kernel/process-xen.c
--- a/arch/x86_64/kernel/process-xen.c  Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/x86_64/kernel/process-xen.c  Thu Aug 07 11:58:10 2008 +0900
@@ -846,9 +846,3 @@ unsigned long arch_align_stack(unsigned 
                sp -= get_random_int() % 8192;
        return sp & ~0xf;
 }
-
-#ifndef CONFIG_SMP
-void _restore_vcpu(void)
-{
-}
-#endif
diff -r 678ad99920c8 -r 324a5c041301 arch/x86_64/kernel/setup-xen.c
--- a/arch/x86_64/kernel/setup-xen.c    Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/x86_64/kernel/setup-xen.c    Thu Aug 07 11:58:10 2008 +0900
@@ -169,7 +169,9 @@ struct resource standard_io_resources[] 
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
        { .name = "timer1", .start = 0x50, .end = 0x53,
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
-       { .name = "keyboard", .start = 0x60, .end = 0x6f,
+       { .name = "keyboard", .start = 0x60, .end = 0x60,
+               .flags = IORESOURCE_BUSY | IORESOURCE_IO },
+       { .name = "keyboard", .start = 0x64, .end = 0x64,
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
        { .name = "dma page reg", .start = 0x80, .end = 0x8f,
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
diff -r 678ad99920c8 -r 324a5c041301 arch/x86_64/kernel/setup.c
--- a/arch/x86_64/kernel/setup.c        Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/x86_64/kernel/setup.c        Thu Aug 07 11:58:10 2008 +0900
@@ -122,7 +122,9 @@ struct resource standard_io_resources[] 
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
        { .name = "timer1", .start = 0x50, .end = 0x53,
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
-       { .name = "keyboard", .start = 0x60, .end = 0x6f,
+       { .name = "keyboard", .start = 0x60, .end = 0x60,
+               .flags = IORESOURCE_BUSY | IORESOURCE_IO },
+       { .name = "keyboard", .start = 0x64, .end = 0x64,
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
        { .name = "dma page reg", .start = 0x80, .end = 0x8f,
                .flags = IORESOURCE_BUSY | IORESOURCE_IO },
diff -r 678ad99920c8 -r 324a5c041301 arch/x86_64/mm/init-xen.c
--- a/arch/x86_64/mm/init-xen.c Tue Aug 05 12:19:38 2008 +0900
+++ b/arch/x86_64/mm/init-xen.c Thu Aug 07 11:58:10 2008 +0900
@@ -325,6 +325,14 @@ static __init void set_pte_phys_ma(unsig
        new_pte = pfn_pte_ma(phys >> PAGE_SHIFT, prot);
 
        pte = pte_offset_kernel(pmd, vaddr);
+       if (!pte_none(*pte) &&
+#ifdef CONFIG_ACPI
+           /* __acpi_map_table() fails to properly call clear_fixmap() */
+           (vaddr < __fix_to_virt(FIX_ACPI_END) ||
+            vaddr > __fix_to_virt(FIX_ACPI_BEGIN)) &&
+#endif
+           __pte_val(*pte) != (__pte_val(new_pte) & __supported_pte_mask))
+               pte_ERROR(*pte);
        set_pte(pte, new_pte);
 
        /*
diff -r 678ad99920c8 -r 324a5c041301 drivers/acpi/Kconfig
--- a/drivers/acpi/Kconfig      Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/acpi/Kconfig      Thu Aug 07 11:58:10 2008 +0900
@@ -371,7 +371,6 @@ config PROCESSOR_EXTERNAL_CONTROL
 config PROCESSOR_EXTERNAL_CONTROL
        bool
        depends on X86 && XEN
-       select ACPI_PROCESSOR
        default y
 endif  # ACPI
 
diff -r 678ad99920c8 -r 324a5c041301 drivers/acpi/Makefile
--- a/drivers/acpi/Makefile     Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/acpi/Makefile     Thu Aug 07 11:58:10 2008 +0900
@@ -35,7 +35,7 @@ processor-objs        += processor_perflib.o
 processor-objs += processor_perflib.o                  
 endif
 ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
-processor-objs += processor_extcntl.o
+processor-objs += processor_perflib.o processor_extcntl.o
 endif
 
 obj-y                          += sleep/
diff -r 678ad99920c8 -r 324a5c041301 drivers/acpi/processor_core.c
--- a/drivers/acpi/processor_core.c     Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/acpi/processor_core.c     Thu Aug 07 11:58:10 2008 +0900
@@ -474,14 +474,9 @@ static int acpi_processor_get_info(struc
         *  they are physically not present.
         */
        if (cpu_index == -1) {
-#ifdef CONFIG_XEN
                if (ACPI_FAILURE
                    (acpi_processor_hotadd_init(pr->handle, &pr->id)) &&
                    !processor_cntl_external()) {
-#else
-               if (ACPI_FAILURE
-                   (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
-#endif /* CONFIG_XEN */
                        printk(KERN_ERR PREFIX
                                    "Getting cpuindex for acpiid 0x%x\n",
                                    pr->acpi_id);
@@ -514,20 +509,14 @@ static int acpi_processor_get_info(struc
                request_region(pr->throttling.address, 6, "ACPI CPU throttle");
        }
 
-#ifdef CONFIG_CPU_FREQ
        acpi_processor_ppc_has_changed(pr);
-#endif
        acpi_processor_get_throttling_info(pr);
        acpi_processor_get_limit_info(pr);
 
        return 0;
 }
 
-#ifdef CONFIG_XEN
 static void *processor_device_array[NR_ACPI_CPUS];
-#else
-static void *processor_device_array[NR_CPUS];
-#endif /* CONFIG_XEN */
 
 static int acpi_processor_start(struct acpi_device *device)
 {
@@ -535,26 +524,19 @@ static int acpi_processor_start(struct a
        acpi_status status = AE_OK;
        struct acpi_processor *pr;
 
+       processor_extcntl_init();
 
        pr = acpi_driver_data(device);
 
        result = acpi_processor_get_info(pr);
-#ifdef CONFIG_XEN
        if (result || 
            ((pr->id == -1) && !processor_cntl_external())) {
-#else
-       if (result) {
-#endif /* CONFIG_XEN */
                /* Processor is physically not present */
                return 0;
        }
 
-#ifdef CONFIG_XEN
        BUG_ON(!processor_cntl_external() &&
               ((pr->id >= NR_CPUS) || (pr->id < 0)));
-#else
-       BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
-#endif /* CONFIG_XEN */
 
        /*
         * Buggy BIOS check
@@ -562,6 +544,7 @@ static int acpi_processor_start(struct a
         * Don't trust it blindly
         */
 #ifdef CONFIG_XEN
+       BUG_ON(pr->acpi_id >= NR_ACPI_CPUS);
        if (processor_device_array[pr->acpi_id] != NULL &&
            processor_device_array[pr->acpi_id] != (void *)device) {
 #else
@@ -595,9 +578,9 @@ static int acpi_processor_start(struct a
 
        acpi_processor_power_init(pr, device);
 
-#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
-       processor_extcntl_init(pr);
-#endif
+       result = processor_extcntl_prepare(pr);
+       if (result)
+               goto end;
 
        if (pr->flags.throttling) {
                printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -751,11 +734,9 @@ int acpi_processor_device_add(acpi_handl
        if (!pr)
                return -ENODEV;
 
-#ifdef CONFIG_XEN
        if (processor_cntl_external())
                processor_notify_external(pr,
                        PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
-#endif /* CONFIG_XEN */
 
        if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
                kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
@@ -795,11 +776,9 @@ acpi_processor_hotplug_notify(acpi_handl
                        break;
                }
 
-#ifdef CONFIG_XEN
                if (processor_cntl_external())
                        processor_notify_external(pr,
                                        PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
-#endif /* CONFIG_XEN */
 
                if (pr->id >= 0 && (pr->id < NR_CPUS)) {
                        kobject_uevent(&device->kobj, KOBJ_OFFLINE);
@@ -838,11 +817,9 @@ acpi_processor_hotplug_notify(acpi_handl
 #endif /* CONFIG_XEN */
                        kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 
-#ifdef CONFIG_XEN
                if (processor_cntl_external())
                        processor_notify_external(pr, PROCESSOR_HOTPLUG,
                                                        HOTPLUG_TYPE_REMOVE);
-#endif /* CONFIG_XEN */
 
                break;
        default:
diff -r 678ad99920c8 -r 324a5c041301 drivers/acpi/processor_extcntl.c
--- a/drivers/acpi/processor_extcntl.c  Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/acpi/processor_extcntl.c  Thu Aug 07 11:58:10 2008 +0900
@@ -36,7 +36,7 @@ static int processor_extcntl_get_perform
  * External processor control logic may register with its own set of
  * ops to get ACPI related notification. One example is like VMM.
  */
-struct processor_extcntl_ops *processor_extcntl_ops;
+const struct processor_extcntl_ops *processor_extcntl_ops;
 EXPORT_SYMBOL(processor_extcntl_ops);
 
 static int processor_notify_smm(void)
@@ -112,30 +112,11 @@ int processor_notify_external(struct acp
  * state which is also necessarily controlled by VMM. But for other
  * control bits like performance/throttle states, VMM may choose to
  * control or not upon its own policy.
- *
- * Such ownership is unlikely to be switched in the fly, and thus
- * not sure unregister interface is required or not. Being same reason,
- * lock is not forced now.
- */
-int processor_register_extcntl(struct processor_extcntl_ops *ops)
-{
-       if (!ops)
-               return -EINVAL;
-
-       if (processor_extcntl_ops &&
-               (processor_extcntl_ops != ops))
-               return -EBUSY;
-
-       processor_extcntl_ops = ops;
-       return 0;
-}
-
-int processor_unregister_extcntl(struct processor_extcntl_ops *ops)
-{
-       if (processor_extcntl_ops == ops)
-               processor_extcntl_ops = NULL;
-
-       return 0;
+ */
+void processor_extcntl_init(void)
+{
+       if (!processor_extcntl_ops)
+               arch_acpi_processor_init_extcntl(&processor_extcntl_ops);
 }
 
 /*
@@ -145,7 +126,7 @@ int processor_unregister_extcntl(struct 
  * and performance state. Those information may be not available
  * if splitting from dom0 control logic like cpufreq driver.
  */
-int processor_extcntl_init(struct acpi_processor *pr)
+int processor_extcntl_prepare(struct acpi_processor *pr)
 {
        /* parse cstate dependency information */
        if (processor_pm_external())
@@ -187,7 +168,6 @@ static int processor_extcntl_parse_csd(s
  * logic. So we have to collect raw performance information here 
  * when ACPI processor object is found and started.
  */
-#ifdef CONFIG_CPU_FREQ
 static int processor_extcntl_get_performance(struct acpi_processor *pr)
 {
        int ret;
@@ -244,6 +224,3 @@ err_out:
        kfree(perf);
        return ret;
 }
-#else
-static int processor_extcntl_get_performance(struct acpi_processor *pr) { 
return 0; }
-#endif
diff -r 678ad99920c8 -r 324a5c041301 drivers/acpi/processor_idle.c
--- a/drivers/acpi/processor_idle.c     Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/acpi/processor_idle.c     Thu Aug 07 11:58:10 2008 +0900
@@ -714,17 +714,12 @@ static int acpi_processor_get_power_info
                    (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))
                        continue;
 
-#ifdef CONFIG_XEN
                if (!processor_pm_external())
                        cx.address = (reg->space_id ==
                                      ACPI_ADR_SPACE_FIXED_HARDWARE) ?
                                      0 : reg->address;
                else
                        cx.address = reg->address;
-#else
-               cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?
-                   0 : reg->address;
-#endif /* CONFIG_XEN */
 
                /* There should be an easy way to extract an integer... */
                obj = (union acpi_object *)&(element->package.elements[1]);
@@ -733,17 +728,11 @@ static int acpi_processor_get_power_info
 
                cx.type = obj->integer.value;
 
-#ifdef CONFIG_XEN
                /* Following check doesn't apply to external control case */
-               if (!processor_pm_external())
-                       if ((cx.type != ACPI_STATE_C1) &&
-                           (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
-                               continue;
-#else
-               if ((cx.type != ACPI_STATE_C1) &&
+               if (!processor_pm_external() &&
+                   (cx.type != ACPI_STATE_C1) &&
                    (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
                        continue;
-#endif /* CONFIG_XEN */
 
                if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3))
                        continue;
@@ -1008,24 +997,16 @@ int acpi_processor_cst_has_changed(struc
                return -ENODEV;
 
        /* Fall back to the default idle loop */
-#ifdef CONFIG_XEN
        if (!processor_pm_external())
                pm_idle = pm_idle_save;
-#else
-       pm_idle = pm_idle_save;
-#endif /* CONFIG_XEN */
        synchronize_sched();    /* Relies on interrupts forcing exit from idle. 
*/
 
        pr->flags.power = 0;
        result = acpi_processor_get_power_info(pr);
-#ifdef CONFIG_XEN
        if (processor_pm_external())
                processor_notify_external(pr,
                        PROCESSOR_PM_CHANGE, PM_TYPE_IDLE);
        else if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
-#else
-       if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
-#endif /* CONFIG_XEN */
                pm_idle = acpi_processor_idle;
 
        return result;
@@ -1157,11 +1138,7 @@ int acpi_processor_power_init(struct acp
                                       pr->power.states[i].type);
                printk(")\n");
 
-#ifdef CONFIG_XEN
                if (!processor_pm_external() && (pr->id == 0)) {
-#else
-               if (pr->id == 0) {
-#endif /* CONFIG_XEN */
                        pm_idle_save = pm_idle;
                        pm_idle = acpi_processor_idle;
                }
@@ -1180,11 +1157,9 @@ int acpi_processor_power_init(struct acp
 
        pr->flags.power_setup_done = 1;
 
-#ifdef CONFIG_XEN
        if (processor_pm_external())
                processor_notify_external(pr,
                        PROCESSOR_PM_INIT, PM_TYPE_IDLE);
-#endif /* CONFIG_XEN */
        return 0;
 }
 
diff -r 678ad99920c8 -r 324a5c041301 drivers/acpi/processor_perflib.c
--- a/drivers/acpi/processor_perflib.c  Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/acpi/processor_perflib.c  Thu Aug 07 11:58:10 2008 +0900
@@ -66,6 +66,7 @@ static DEFINE_MUTEX(performance_mutex);
 
 static int acpi_processor_ppc_status = 0;
 
+#ifdef CONFIG_CPU_FREQ
 static int acpi_processor_ppc_notifier(struct notifier_block *nb,
                                       unsigned long event, void *data)
 {
@@ -102,6 +103,7 @@ static struct notifier_block acpi_ppc_no
 static struct notifier_block acpi_ppc_notifier_block = {
        .notifier_call = acpi_processor_ppc_notifier,
 };
+#endif /* CONFIG_CPU_FREQ */
 
 static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
 {
@@ -136,15 +138,16 @@ int acpi_processor_ppc_has_changed(struc
        int ret = acpi_processor_get_platform_limit(pr);
        if (ret < 0)
                return (ret);
-#ifdef CONFIG_XEN
-       else if (processor_pmperf_external())
+       else
+#ifdef CONFIG_CPU_FREQ
+               return cpufreq_update_policy(pr->id);
+#elif CONFIG_PROCESSOR_EXTERNAL_CONTROL
                return processor_notify_external(pr,
                                PROCESSOR_PM_CHANGE, PM_TYPE_PERF);
-#endif /* CONFIG_XEN */
-       else
-               return cpufreq_update_policy(pr->id);
-}
-
+#endif
+}
+
+#ifdef CONFIG_CPU_FREQ
 void acpi_processor_ppc_init(void)
 {
        if (!cpufreq_register_notifier
@@ -163,6 +166,7 @@ void acpi_processor_ppc_exit(void)
 
        acpi_processor_ppc_status &= ~PPC_REGISTERED;
 }
+#endif /* CONFIG_CPU_FREQ */
 
 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
 {
@@ -305,10 +309,9 @@ static int acpi_processor_get_performanc
 }
 
 #ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
-static int acpi_processor_get_performance_info(struct acpi_processor *pr)
-#else
+static
+#endif
 int acpi_processor_get_performance_info(struct acpi_processor *pr)
-#endif
 {
        int result = 0;
        acpi_status status = AE_OK;
@@ -340,6 +343,7 @@ int acpi_processor_get_performance_info(
        return 0;
 }
 
+#ifdef CONFIG_CPU_FREQ
 int acpi_processor_notify_smm(struct module *calling_module)
 {
        acpi_status status;
@@ -407,6 +411,7 @@ int acpi_processor_notify_smm(struct mod
 }
 
 EXPORT_SYMBOL(acpi_processor_notify_smm);
+#endif /* CONFIG_CPU_FREQ */
 
 #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
 /* /proc/acpi/processor/../performance interface (DEPRECATED) */
@@ -548,10 +553,9 @@ static void acpi_cpufreq_remove_file(str
 #endif                         /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
 
 #ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
-static int acpi_processor_get_psd(struct acpi_processor        *pr)
-#else
+static
+#endif
 int acpi_processor_get_psd(struct acpi_processor *pr)
-#endif
 {
        int result = 0;
        acpi_status status = AE_OK;
diff -r 678ad99920c8 -r 324a5c041301 drivers/cpufreq/Kconfig
--- a/drivers/cpufreq/Kconfig   Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/cpufreq/Kconfig   Thu Aug 07 11:58:10 2008 +0900
@@ -1,5 +1,6 @@ config CPU_FREQ
 config CPU_FREQ
        bool "CPU Frequency scaling"
+       depends on !PROCESSOR_EXTERNAL_CONTROL
        help
          CPU Frequency scaling allows you to change the clock speed of 
          CPUs on the fly. This is a nice method to save power, because 
diff -r 678ad99920c8 -r 324a5c041301 drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c     Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/pci/msi-xen.c     Thu Aug 07 11:58:10 2008 +0900
@@ -116,7 +116,7 @@ static void detach_pirq_entry(int entry_
 /*
  * pciback will provide device's owner
  */
-int (*get_owner)(struct pci_dev *dev);
+static int (*get_owner)(struct pci_dev *dev);
 
 int register_msi_get_owner(int (*func)(struct pci_dev *dev))
 {
@@ -130,33 +130,32 @@ int register_msi_get_owner(int (*func)(s
 
 int unregister_msi_get_owner(int (*func)(struct pci_dev *dev))
 {
-       if (get_owner == func)
-               get_owner = NULL;
+       if (get_owner != func)
+               return -EINVAL;
+       get_owner = NULL;
        return 0;
 }
 
 static int msi_get_dev_owner(struct pci_dev *dev)
 {
-       int owner = DOMID_SELF;
+       int owner;
 
        BUG_ON(!is_initial_xendomain());
-       if (get_owner && (owner = get_owner(dev)) >=0 ) {
+       if (get_owner && (owner = get_owner(dev)) >= 0) {
                printk(KERN_INFO "get owner for dev %x get %x \n",
-                                   dev->devfn, owner);
+                      dev->devfn, owner);
                return owner;
        }
-       else
-               return DOMID_SELF;
+
+       return DOMID_SELF;
 }
 
 static int msi_unmap_pirq(struct pci_dev *dev, int pirq)
 {
        struct physdev_unmap_pirq unmap;
        int rc;
-       domid_t domid = DOMID_SELF;
-
-       domid = msi_get_dev_owner(dev);
-       unmap.domid = domid;
+
+       unmap.domid = msi_get_dev_owner(dev);
        unmap.pirq = pirq;
 
        if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap)))
@@ -164,7 +163,7 @@ static int msi_unmap_pirq(struct pci_dev
 
        if (rc < 0)
                return rc;
-    return 0;
+       return 0;
 }
 
 /*
diff -r 678ad99920c8 -r 324a5c041301 drivers/pci/msi.h
--- a/drivers/pci/msi.h Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/pci/msi.h Thu Aug 07 11:58:10 2008 +0900
@@ -84,11 +84,6 @@ extern void (*interrupt[NR_IRQS])(void);
 extern void (*interrupt[NR_IRQS])(void);
 extern int pci_vector_resources(int last, int nr_released);
 
-#ifdef CONFIG_XEN
-extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
-extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
-#endif
-
 /*
  * MSI-X Address Register
  */
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c   Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/blkfront/blkfront.c   Thu Aug 07 11:58:10 2008 +0900
@@ -352,6 +352,13 @@ static void connect(struct blkfront_info
                return;
        }
 
+       err = xlvbd_sysfs_addif(info);
+       if (err) {
+               xenbus_dev_fatal(info->xbdev, err, "xlvbd_sysfs_addif at %s",
+                                info->xbdev->otherend);
+               return;
+       }
+
        (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
        /* Kick pending requests. */
@@ -390,6 +397,8 @@ static void blkfront_closing(struct xenb
 
        /* Flush gnttab callback work. Must be done with no locks held. */
        flush_scheduled_work();
+
+       xlvbd_sysfs_delif(info);
 
        xlvbd_del(info);
 
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/blkfront/block.h
--- a/drivers/xen/blkfront/block.h      Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/blkfront/block.h      Thu Aug 07 11:58:10 2008 +0900
@@ -140,4 +140,19 @@ void xlvbd_del(struct blkfront_info *inf
 void xlvbd_del(struct blkfront_info *info);
 int xlvbd_barrier(struct blkfront_info *info);
 
+#ifdef CONFIG_SYSFS
+int xlvbd_sysfs_addif(struct blkfront_info *info);
+void xlvbd_sysfs_delif(struct blkfront_info *info);
+#else
+static inline int xlvbd_sysfs_addif(struct blkfront_info *info)
+{
+       return 0;
+}
+
+static inline void xlvbd_sysfs_delif(struct blkfront_info *info)
+{
+       ;
+}
+#endif
+
 #endif /* __XEN_DRIVERS_BLOCK_H__ */
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/blkfront/vbd.c
--- a/drivers/xen/blkfront/vbd.c        Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/blkfront/vbd.c        Thu Aug 07 11:58:10 2008 +0900
@@ -413,3 +413,48 @@ xlvbd_barrier(struct blkfront_info *info
        return -ENOSYS;
 }
 #endif
+
+#ifdef CONFIG_SYSFS
+static ssize_t show_media(struct device *dev,
+                                 struct device_attribute *attr, char *buf)
+{
+       struct xenbus_device *xendev = to_xenbus_device(dev);
+       struct blkfront_info *info = xendev->dev.driver_data;
+
+       if (info->gd->flags & GENHD_FL_CD)
+               return sprintf(buf, "cdrom\n");
+       return sprintf(buf, "disk\n");
+}
+
+static struct device_attribute xlvbd_attrs[] = {
+       __ATTR(media, S_IRUGO, show_media, NULL),
+};
+
+int xlvbd_sysfs_addif(struct blkfront_info *info)
+{
+       int i;
+       int error = 0;
+
+       for (i = 0; i < ARRAY_SIZE(xlvbd_attrs); i++) {
+               error = device_create_file(info->gd->driverfs_dev,
+                               &xlvbd_attrs[i]);
+               if (error)
+                       goto fail;
+       }
+       return 0;
+
+fail:
+       while (--i >= 0)
+               device_remove_file(info->gd->driverfs_dev, &xlvbd_attrs[i]);
+       return error;
+}
+
+void xlvbd_sysfs_delif(struct blkfront_info *info)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(xlvbd_attrs); i++)
+               device_remove_file(info->gd->driverfs_dev, &xlvbd_attrs[i]);
+}
+
+#endif /* CONFIG_SYSFS */
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/core/machine_reboot.c
--- a/drivers/xen/core/machine_reboot.c Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/core/machine_reboot.c Thu Aug 07 11:58:10 2008 +0900
@@ -26,8 +26,6 @@ void (*pm_power_off)(void);
 void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
-int setup_suspend_evtchn(void);
-
 void machine_emergency_restart(void)
 {
        /* We really want to get pending console data out before we die. */
@@ -133,7 +131,7 @@ static void post_suspend(int suspend_can
 
 struct suspend {
        int fast_suspend;
-       void (*resume_notifier)(void);
+       void (*resume_notifier)(int);
 };
 
 static int take_machine_down(void *_suspend)
@@ -175,7 +173,7 @@ static int take_machine_down(void *_susp
         */
        suspend_cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
 
-       suspend->resume_notifier();
+       suspend->resume_notifier(suspend_cancelled);
        post_suspend(suspend_cancelled);
        gnttab_resume();
        if (!suspend_cancelled) {
@@ -204,7 +202,7 @@ static int take_machine_down(void *_susp
        return suspend_cancelled;
 }
 
-int __xen_suspend(int fast_suspend, void (*resume_notifier)(void))
+int __xen_suspend(int fast_suspend, void (*resume_notifier)(int))
 {
        int err, suspend_cancelled;
        struct suspend suspend;
@@ -243,7 +241,6 @@ int __xen_suspend(int fast_suspend, void
        if (!suspend_cancelled) {
                xencons_resume();
                xenbus_resume();
-               setup_suspend_evtchn();
        } else {
                xenbus_suspend_cancel();
        }
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/core/pci.c
--- a/drivers/xen/core/pci.c    Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/core/pci.c    Thu Aug 07 11:58:10 2008 +0900
@@ -24,7 +24,8 @@ static int pci_bus_probe_wrapper(struct 
 
        r = pci_bus_probe(dev);
        if (r)
-               HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
+               WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
+                                             &manage_pci));
 
        return r;
 }
@@ -40,7 +41,8 @@ static int pci_bus_remove_wrapper(struct
        r = pci_bus_remove(dev);
        /* dev and pci_dev are no longer valid!! */
 
-       HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
+       WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
+               &manage_pci));
        return r;
 }
 
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/core/reboot.c
--- a/drivers/xen/core/reboot.c Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/core/reboot.c Thu Aug 07 11:58:10 2008 +0900
@@ -27,13 +27,18 @@ MODULE_LICENSE("Dual BSD/GPL");
 /* Ignore multiple shutdown requests. */
 static int shutting_down = SHUTDOWN_INVALID;
 
+/* Was last suspend request cancelled? */
+static int suspend_cancelled;
+
 /* Can we leave APs online when we suspend? */
 static int fast_suspend;
 
 static void __shutdown_handler(void *unused);
 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
 
-int __xen_suspend(int fast_suspend, void (*resume_notifier)(void));
+static int setup_suspend_evtchn(void);
+
+int __xen_suspend(int fast_suspend, void (*resume_notifier)(int));
 
 static int shutdown_process(void *__unused)
 {
@@ -62,10 +67,11 @@ static int shutdown_process(void *__unus
        return 0;
 }
 
-static void xen_resume_notifier(void)
+static void xen_resume_notifier(int _suspend_cancelled)
 {
        int old_state = xchg(&shutting_down, SHUTDOWN_RESUMING);
        BUG_ON(old_state != SHUTDOWN_SUSPEND);
+       suspend_cancelled = _suspend_cancelled;
 }
 
 static int xen_suspend(void *__unused)
@@ -85,6 +91,8 @@ static int xen_suspend(void *__unused)
                        printk(KERN_ERR "Xen suspend failed (%d)\n", err);
                        goto fail;
                }
+               if (!suspend_cancelled)
+                       setup_suspend_evtchn();
                old_state = cmpxchg(
                        &shutting_down, SHUTDOWN_RESUMING, SHUTDOWN_INVALID);
        } while (old_state == SHUTDOWN_SUSPEND);
@@ -108,6 +116,31 @@ static int xen_suspend(void *__unused)
        return 0;
 }
 
+static void switch_shutdown_state(int new_state)
+{
+       int prev_state, old_state = SHUTDOWN_INVALID;
+
+       /* We only drive shutdown_state into an active state. */
+       if (new_state == SHUTDOWN_INVALID)
+               return;
+
+       do {
+               /* We drop this transition if already in an active state. */
+               if ((old_state != SHUTDOWN_INVALID) &&
+                   (old_state != SHUTDOWN_RESUMING))
+                       return;
+               /* Attempt to transition. */
+               prev_state = old_state;
+               old_state = cmpxchg(&shutting_down, old_state, new_state);
+       } while (old_state != prev_state);
+
+       /* Either we kick off the work, or we leave it to xen_suspend(). */
+       if (old_state == SHUTDOWN_INVALID)
+               schedule_work(&shutdown_work);
+       else
+               BUG_ON(old_state != SHUTDOWN_RESUMING);
+}
+
 static void __shutdown_handler(void *unused)
 {
        int err;
@@ -129,7 +162,7 @@ static void shutdown_handler(struct xenb
        extern void ctrl_alt_del(void);
        char *str;
        struct xenbus_transaction xbt;
-       int err, old_state, new_state = SHUTDOWN_INVALID;
+       int err, new_state = SHUTDOWN_INVALID;
 
        if ((shutting_down != SHUTDOWN_INVALID) &&
            (shutting_down != SHUTDOWN_RESUMING))
@@ -166,13 +199,7 @@ static void shutdown_handler(struct xenb
        else
                printk("Ignoring shutdown request: %s\n", str);
 
-       if (new_state != SHUTDOWN_INVALID) {
-               old_state = xchg(&shutting_down, new_state);
-               if (old_state == SHUTDOWN_INVALID)
-                       schedule_work(&shutdown_work);
-               else
-                       BUG_ON(old_state != SHUTDOWN_RESUMING);
-       }
+       switch_shutdown_state(new_state);
 
        kfree(str);
 }
@@ -220,26 +247,24 @@ static struct xenbus_watch sysrq_watch =
 
 static irqreturn_t suspend_int(int irq, void* dev_id, struct pt_regs *ptregs)
 {
-       shutting_down = SHUTDOWN_SUSPEND;
-       schedule_work(&shutdown_work);
-
+       switch_shutdown_state(SHUTDOWN_SUSPEND);
        return IRQ_HANDLED;
 }
 
-int setup_suspend_evtchn(void)
-{
-       static int irq = -1;
+static int setup_suspend_evtchn(void)
+{
+       static int irq;
        int port;
-       char portstr[5]; /* 1024 max */
+       char portstr[16];
 
        if (irq > 0)
                unbind_from_irqhandler(irq, NULL);
 
        irq = bind_listening_port_to_irqhandler(0, suspend_int, 0, "suspend",
                                                NULL);
-       if (irq <= 0) {
+       if (irq <= 0)
                return -1;
-       }
+
        port = irq_to_evtchn_port(irq);
        printk(KERN_INFO "suspend: event channel %d\n", port);
        sprintf(portstr, "%d", port);
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/netfront/accel.c
--- a/drivers/xen/netfront/accel.c      Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/netfront/accel.c      Thu Aug 07 11:58:10 2008 +0900
@@ -709,8 +709,9 @@ int netfront_accelerator_suspend_cancel(
         * accelerator, so no need to call accelerator_probe_new_vif()
         * directly here
         */
-       netfront_accelerator_add_watch(np);
-       return 0;
+       if (dev->state == XenbusStateConnected)
+               netfront_accelerator_add_watch(np);
+       return 0;
 }
  
  
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/pciback/pci_stub.c
--- a/drivers/xen/pciback/pci_stub.c    Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/pciback/pci_stub.c    Thu Aug 07 11:58:10 2008 +0900
@@ -832,9 +832,7 @@ static void pcistub_exit(void)
        driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
 
        pci_unregister_driver(&pciback_pci_driver);
-#ifdef CONFIG_PCI_MSI
-       unregister_msi_get_owner(pciback_get_owner);
-#endif
+       WARN_ON(unregister_msi_get_owner(pciback_get_owner));
 }
 
 static int __init pcistub_init(void)
@@ -892,10 +890,8 @@ static int __init pcistub_init(void)
                err = driver_create_file(&pciback_pci_driver.driver,
                                         &driver_attr_permissive);
 
-#ifdef CONFIG_PCI_MSI
        if (!err)
                err = register_msi_get_owner(pciback_get_owner);
-#endif
        if (err)
                pcistub_exit();
 
diff -r 678ad99920c8 -r 324a5c041301 drivers/xen/scsiback/emulate.c
--- a/drivers/xen/scsiback/emulate.c    Tue Aug 05 12:19:38 2008 +0900
+++ b/drivers/xen/scsiback/emulate.c    Thu Aug 07 11:58:10 2008 +0900
@@ -73,8 +73,6 @@
 #define VSCSI_MAX_SCSI_OP_CODE         256
 static unsigned char bitmap[VSCSI_MAX_SCSI_OP_CODE];
 
-/* REPORT LUNS Header*/
-#define VSCSI_REPORT_LUNS_HEADER       8
 
 
 /*
@@ -200,6 +198,11 @@ static int __nr_luns_under_host(struct v
 
        return (lun_cnt);
 }
+
+
+/* REPORT LUNS Define*/
+#define VSCSI_REPORT_LUNS_HEADER       8
+#define VSCSI_REPORT_LUNS_RETRY                3
 
 /* quoted scsi_debug.c/resp_report_luns() */
 static void __report_luns(pending_req_t *pending_req, void *data)
@@ -215,6 +218,7 @@ static void __report_luns(pending_req_t 
        unsigned int alloc_luns = 0;
        unsigned int req_bufflen = 0;
        unsigned int actual_len = 0;
+       unsigned int retry_cnt = 0;
        int select_report = (int)cmd[2];
        int i, lun_cnt = 0, lun, upper, err = 0;
        
@@ -231,7 +235,7 @@ static void __report_luns(pending_req_t 
        alloc_luns = __nr_luns_under_host(info);
        alloc_len  = sizeof(struct scsi_lun) * alloc_luns
                                + VSCSI_REPORT_LUNS_HEADER;
-
+retry:
        if ((buff = kmalloc(alloc_len, GFP_KERNEL)) == NULL) {
                printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__);
                goto fail;
@@ -246,8 +250,19 @@ static void __report_luns(pending_req_t 
                    (entry->v.tgt == target)) {
                        
                        /* check overflow */
-                       if (lun_cnt >= alloc_luns)
+                       if (lun_cnt >= alloc_luns) {
+                               spin_unlock_irqrestore(&info->v2p_lock,
+                                                       flags);
+
+                               if (retry_cnt < VSCSI_REPORT_LUNS_RETRY) {
+                                       retry_cnt++;
+                                       if (buff)
+                                               kfree(buff);
+                                       goto retry;
+                               }
+
                                goto fail;
+                       }
 
                        lun = entry->v.lun;
                        upper = (lun >> 8) & 0x3f;
diff -r 678ad99920c8 -r 324a5c041301 include/acpi/processor.h
--- a/include/acpi/processor.h  Tue Aug 05 12:19:38 2008 +0900
+++ b/include/acpi/processor.h  Thu Aug 07 11:58:10 2008 +0900
@@ -22,7 +22,9 @@
 #define ACPI_PSD_REV0_ENTRIES          5
 
 #ifdef CONFIG_XEN
-#define NR_ACPI_CPUS                   256
+#define NR_ACPI_CPUS                   (NR_CPUS < 256 ? 256 : NR_CPUS)
+#else
+#define NR_ACPI_CPUS                   NR_CPUS
 #endif /* CONFIG_XEN */
 
 /*
@@ -252,6 +254,9 @@ static inline void acpi_processor_ppc_ex
 {
        return;
 }
+#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
+int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
+#else
 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
 {
        static unsigned int printout = 1;
@@ -264,6 +269,7 @@ static inline int acpi_processor_ppc_has
        }
        return 0;
 }
+#endif                         /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */
 #endif                         /* CONFIG_CPU_FREQ */
 
 /* in processor_throttling.c */
@@ -296,7 +302,6 @@ static inline void acpi_thermal_cpufreq_
 }
 #endif
 
-#ifdef CONFIG_XEN
 /* 
  * Following are interfaces geared to external processor PM control
  * logic like a VMM
@@ -306,7 +311,7 @@ static inline void acpi_thermal_cpufreq_
 #define PROCESSOR_PM_CHANGE    2
 #define PROCESSOR_HOTPLUG      3
 
-/* Objects for the PM envents */
+/* Objects for the PM events */
 #define PM_TYPE_IDLE           0
 #define PM_TYPE_PERF           1
 #define PM_TYPE_THR            2
@@ -323,7 +328,7 @@ struct processor_extcntl_ops {
        /* Notify physical processor status to external control logic */
        int (*hotplug)(struct acpi_processor *pr, int event);
 };
-extern struct processor_extcntl_ops *processor_extcntl_ops;
+extern const struct processor_extcntl_ops *processor_extcntl_ops;
 
 static inline int processor_cntl_external(void)
 {
@@ -350,11 +355,11 @@ static inline int processor_pmthr_extern
 
 extern int processor_notify_external(struct acpi_processor *pr,
                        int event, int type);
-extern int processor_register_extcntl(struct processor_extcntl_ops *ops);
-extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops);
-extern int processor_extcntl_init(struct acpi_processor *pr);
+extern void processor_extcntl_init(void);
+extern int processor_extcntl_prepare(struct acpi_processor *pr);
 extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
 extern int acpi_processor_get_psd(struct acpi_processor *pr);
+void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **);
 #else
 static inline int processor_cntl_external(void) {return 0;}
 static inline int processor_pm_external(void) {return 0;}
@@ -363,13 +368,13 @@ static inline int processor_notify_exter
 static inline int processor_notify_external(struct acpi_processor *pr,
                        int event, int type)
 {
-       return -EINVAL;
-}
-static inline int processor_extcntl_init(struct acpi_processor *pr)
-{
-       return -EINVAL;
+       return 0;
+}
+static inline void processor_extcntl_init(void) {}
+static inline int processor_extcntl_prepare(struct acpi_processor *pr)
+{
+       return 0;
 }
 #endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */
-#endif /* CONFIG_XEN */
-
-#endif
+
+#endif
diff -r 678ad99920c8 -r 324a5c041301 include/linux/pci.h
--- a/include/linux/pci.h       Tue Aug 05 12:19:38 2008 +0900
+++ b/include/linux/pci.h       Thu Aug 07 11:58:10 2008 +0900
@@ -599,6 +599,10 @@ static inline int pci_enable_msix(struct
        struct msix_entry *entries, int nvec) {return -1;}
 static inline void pci_disable_msix(struct pci_dev *dev) {}
 static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
+#ifdef CONFIG_XEN
+#define register_msi_get_owner(func) 0
+#define unregister_msi_get_owner(func) 0
+#endif
 #else
 extern void pci_scan_msi_device(struct pci_dev *dev);
 extern int pci_enable_msi(struct pci_dev *dev);
@@ -607,6 +611,10 @@ extern int pci_enable_msix(struct pci_de
        struct msix_entry *entries, int nvec);
 extern void pci_disable_msix(struct pci_dev *dev);
 extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
+#ifdef CONFIG_XEN
+extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
+extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
+#endif
 #endif
 
 extern void pci_block_user_cfg_access(struct pci_dev *dev);
diff -r 678ad99920c8 -r 324a5c041301 include/xen/interface/xen.h
--- a/include/xen/interface/xen.h       Tue Aug 05 12:19:38 2008 +0900
+++ b/include/xen/interface/xen.h       Thu Aug 07 11:58:10 2008 +0900
@@ -554,6 +554,7 @@ typedef struct start_info start_info_t;
 /* These flags are passed in the 'flags' field of start_info_t. */
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
+#define SIF_PM_MASK       (0xFF<<8) /* reserve 1 byte for xen-pm options */
 
 typedef struct dom0_vga_console_info {
     uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>