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] linux/x86: fix powering off certain m

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86: fix powering off certain machines
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 08 Apr 2008 02:02:07 -0700
Delivery-date: Tue, 08 Apr 2008 02:07:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207312068 -3600
# Node ID 0d6c9c975eaee85e35d4007b1b84cafbfbb24378
# Parent  51f1b31888b8173dc9a94e46280f83c9011c4f51
linux/x86: fix powering off certain machines

Dell's Precision490, for example, fails to properly power off without
going through the full sequence of operations in the hypervisor. Hence
acpi_notify_hypervisor_state() must be defined, and used for entry to
S5, regardless of CONFIG_ACPI_PV_SLEEP configuration.

Also fix a compiler warning and the improper use of a hypervisor
return value as ACPI status.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 arch/i386/kernel/acpi/sleep-xen.c   |   21 ---------------------
 arch/x86_64/kernel/acpi/sleep-xen.c |   23 -----------------------
 drivers/acpi/hardware/hwsleep.c     |   21 +++++++++++++--------
 include/asm-i386/acpi.h             |   28 ++++++++++++++++++++++++----
 include/asm-x86_64/acpi.h           |   29 ++++++++++++++++++++++++-----
 5 files changed, 61 insertions(+), 61 deletions(-)

diff -r 51f1b31888b8 -r 0d6c9c975eae arch/i386/kernel/acpi/sleep-xen.c
--- a/arch/i386/kernel/acpi/sleep-xen.c Fri Apr 04 13:21:29 2008 +0100
+++ b/arch/i386/kernel/acpi/sleep-xen.c Fri Apr 04 13:27:48 2008 +0100
@@ -110,25 +110,4 @@ static int __init acpisleep_dmi_init(voi
 }
 
 core_initcall(acpisleep_dmi_init);
-
-#else /* CONFIG_ACPI_PV_SLEEP */
-#include <asm/hypervisor.h>
-#include <xen/interface/platform.h>
-int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt)
-{
-       struct xen_platform_op op = {
-               .cmd = XENPF_enter_acpi_sleep,
-               .interface_version = XENPF_INTERFACE_VERSION,
-               .u = {
-                       .enter_acpi_sleep = {
-                               .pm1a_cnt_val = (u16)pm1a_cnt,
-                               .pm1b_cnt_val = (u16)pm1b_cnt,
-                               .sleep_state = sleep_state,
-                       },
-               },
-       };
-
-       return HYPERVISOR_platform_op(&op);
-}
 #endif /* CONFIG_ACPI_PV_SLEEP */
diff -r 51f1b31888b8 -r 0d6c9c975eae arch/x86_64/kernel/acpi/sleep-xen.c
--- a/arch/x86_64/kernel/acpi/sleep-xen.c       Fri Apr 04 13:21:29 2008 +0100
+++ b/arch/x86_64/kernel/acpi/sleep-xen.c       Fri Apr 04 13:27:48 2008 +0100
@@ -137,29 +137,6 @@ static int __init acpi_sleep_setup(char 
 }
 
 __setup("acpi_sleep=", acpi_sleep_setup);
-
-#else /* CONFIG_ACPI_PV_SLEEP */
-#include <asm/hypervisor.h>
-#include <xen/interface/platform.h>
-int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt)
-{
-       struct xen_platform_op op = {
-               .cmd = XENPF_enter_acpi_sleep,
-               .interface_version = XENPF_INTERFACE_VERSION,
-               .u = {
-                       .enter_acpi_sleep = {
-                               .pm1a_cnt_val = (u16)pm1a_cnt,
-                               .pm1b_cnt_val = (u16)pm1b_cnt,
-                               .sleep_state = sleep_state,
-                       },
-               },
-       };
-
-       return HYPERVISOR_platform_op(&op);
-}
-#endif                         /* CONFIG_ACPI_PV_SLEEP */
-
 #endif                         /*CONFIG_ACPI_SLEEP */
 
 void acpi_pci_link_exit(void)
diff -r 51f1b31888b8 -r 0d6c9c975eae drivers/acpi/hardware/hwsleep.c
--- a/drivers/acpi/hardware/hwsleep.c   Fri Apr 04 13:21:29 2008 +0100
+++ b/drivers/acpi/hardware/hwsleep.c   Fri Apr 04 13:27:48 2008 +0100
@@ -227,7 +227,11 @@ acpi_status asmlinkage acpi_enter_sleep_
        u32 PM1Bcontrol;
        struct acpi_bit_register_info *sleep_type_reg_info;
        struct acpi_bit_register_info *sleep_enable_reg_info;
+#ifndef CONFIG_XEN
        u32 in_value;
+#else
+       int err;
+#endif
        acpi_status status;
 
        ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
@@ -327,7 +331,7 @@ acpi_status asmlinkage acpi_enter_sleep_
 
        ACPI_FLUSH_CPU_CACHE();
 
-#ifndef CONFIG_ACPI_PV_SLEEP
+#ifndef CONFIG_XEN
        status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
                                        ACPI_REGISTER_PM1A_CONTROL,
                                        PM1Acontrol);
@@ -377,17 +381,18 @@ acpi_status asmlinkage acpi_enter_sleep_
                /* Spin until we wake */
 
        } while (!in_value);
-
-       return_ACPI_STATUS(AE_OK);
 #else
        /* PV ACPI just need check hypercall return value */
-       status = acpi_notify_hypervisor_state(sleep_state,
+       err = acpi_notify_hypervisor_state(sleep_state,
                        PM1Acontrol, PM1Bcontrol);
-       if (ACPI_FAILURE(status))
-               return_ACPI_STATUS(status);
-       else
-               return_ACPI_STATUS(AE_OK);
+       if (err) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Hypervisor failure [%d]\n", err));
+               return_ACPI_STATUS(AE_ERROR);
+       }
 #endif
+
+       return_ACPI_STATUS(AE_OK);
 }
 
 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
diff -r 51f1b31888b8 -r 0d6c9c975eae include/asm-i386/acpi.h
--- a/include/asm-i386/acpi.h   Fri Apr 04 13:21:29 2008 +0100
+++ b/include/asm-i386/acpi.h   Fri Apr 04 13:27:48 2008 +0100
@@ -31,6 +31,9 @@
 #include <acpi/pdc_intel.h>
 
 #include <asm/system.h>                /* defines cmpxchg */
+#ifdef CONFIG_XEN
+#include <xen/interface/platform.h>
+#endif
 
 #define COMPILER_DEPENDENT_INT64   long long
 #define COMPILER_DEPENDENT_UINT64  unsigned long long
@@ -156,6 +159,27 @@ static inline void acpi_disable_pci(void
 }
 extern int acpi_irq_balance_set(char *str);
 
+#ifdef CONFIG_XEN
+static inline int acpi_notify_hypervisor_state(u8 sleep_state,
+                                              u32 pm1a_cnt_val,
+                                              u32 pm1b_cnt_val)
+{
+       struct xen_platform_op op = {
+               .cmd = XENPF_enter_acpi_sleep,
+               .interface_version = XENPF_INTERFACE_VERSION,
+               .u = {
+                       .enter_acpi_sleep = {
+                               .pm1a_cnt_val = pm1a_cnt_val,
+                               .pm1b_cnt_val = pm1b_cnt_val,
+                               .sleep_state = sleep_state,
+                       },
+               },
+       };
+
+       return HYPERVISOR_platform_op(&op);
+}
+#endif /* CONFIG_XEN */
+
 #else  /* !CONFIG_ACPI */
 
 #define acpi_lapic 0
@@ -177,10 +201,6 @@ extern unsigned long acpi_wakeup_address
 /* early initialization routine */
 extern void acpi_reserve_bootmem(void);
 
-#ifdef CONFIG_ACPI_PV_SLEEP
-extern int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt);
-#endif /* CONFIG_ACPI_PV_SLEEP */
 #endif /*CONFIG_ACPI_SLEEP*/
 
 extern u8 x86_acpiid_to_apicid[];
diff -r 51f1b31888b8 -r 0d6c9c975eae include/asm-x86_64/acpi.h
--- a/include/asm-x86_64/acpi.h Fri Apr 04 13:21:29 2008 +0100
+++ b/include/asm-x86_64/acpi.h Fri Apr 04 13:27:48 2008 +0100
@@ -28,6 +28,9 @@
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_XEN
+#include <xen/interface/platform.h>
+#endif
 #include <acpi/pdc_intel.h>
 
 #define COMPILER_DEPENDENT_INT64   long long
@@ -129,6 +132,27 @@ static inline void acpi_disable_pci(void
 }
 extern int acpi_irq_balance_set(char *str);
 
+#ifdef CONFIG_XEN
+static inline int acpi_notify_hypervisor_state(u8 sleep_state,
+                                              u32 pm1a_cnt_val,
+                                              u32 pm1b_cnt_val)
+{
+       struct xen_platform_op op = {
+               .cmd = XENPF_enter_acpi_sleep,
+               .interface_version = XENPF_INTERFACE_VERSION,
+               .u = {
+                       .enter_acpi_sleep = {
+                               .pm1a_cnt_val = pm1a_cnt_val,
+                               .pm1b_cnt_val = pm1b_cnt_val,
+                               .sleep_state = sleep_state,
+                       },
+               },
+       };
+
+       return HYPERVISOR_platform_op(&op);
+}
+#endif /* CONFIG_XEN */
+
 #else  /* !CONFIG_ACPI */
 
 #define acpi_lapic 0
@@ -152,11 +176,6 @@ extern unsigned long acpi_wakeup_address
 
 /* early initialization routine */
 extern void acpi_reserve_bootmem(void);
-
-#ifdef CONFIG_ACPI_PV_SLEEP
-extern int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt);
-#endif /* CONFIG_ACPI_PV_SLEEP */
 #endif /*CONFIG_ACPI_SLEEP*/
 
 #define boot_cpu_physical_apicid boot_cpu_id

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] linux/x86: fix powering off certain machines, Xen patchbot-linux-2.6.18-xen <=