14 Jan, 2011

2 commits

  • * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (59 commits)
    ACPI / PM: Fix build problems for !CONFIG_ACPI related to NVS rework
    ACPI: fix resource check message
    ACPI / Battery: Update information on info notification and resume
    ACPI: Drop device flag wake_capable
    ACPI: Always check if _PRW is present before trying to evaluate it
    ACPI / PM: Check status of power resources under mutexes
    ACPI / PM: Rename acpi_power_off_device()
    ACPI / PM: Drop acpi_power_nocheck
    ACPI / PM: Drop acpi_bus_get_power()
    Platform / x86: Make fujitsu_laptop use acpi_bus_update_power()
    ACPI / Fan: Rework the handling of power resources
    ACPI / PM: Register power resource devices as soon as they are needed
    ACPI / PM: Register acpi_power_driver early
    ACPI / PM: Add function for updating device power state consistently
    ACPI / PM: Add function for device power state initialization
    ACPI / PM: Introduce __acpi_bus_get_power()
    ACPI / PM: Introduce function for refcounting device power resources
    ACPI / PM: Add functions for manipulating lists of power resources
    ACPI / PM: Prevent acpi_power_get_inferred_state() from making changes
    ACPICA: Update version to 20101209
    ...

    Linus Torvalds
     
  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    Documentation/trace/events.txt: Remove obsolete sched_signal_send.
    writeback: fix global_dirty_limits comment runtime -> real-time
    ppc: fix comment typo singal -> signal
    drivers: fix comment typo diable -> disable.
    m68k: fix comment typo diable -> disable.
    wireless: comment typo fix diable -> disable.
    media: comment typo fix diable -> disable.
    remove doc for obsolete dynamic-printk kernel-parameter
    remove extraneous 'is' from Documentation/iostats.txt
    Fix spelling milisec -> ms in snd_ps3 module parameter description
    Fix spelling mistakes in comments
    Revert conflicting V4L changes
    i7core_edac: fix typos in comments
    mm/rmap.c: fix comment
    sound, ca0106: Fix assignment to 'channel'.
    hrtimer: fix a typo in comment
    init/Kconfig: fix typo
    anon_inodes: fix wrong function name in comment
    fix comment typos concerning "consistent"
    poll: fix a typo in comment
    ...

    Fix up trivial conflicts in:
    - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
    - fs/ext4/ext4.h

    Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.

    Linus Torvalds
     

07 Jan, 2011

2 commits


24 Dec, 2010

1 commit


16 Nov, 2010

2 commits

  • While at it, fix two checkpatch errors.
    Several non-const struct instances constified by this patch were added after
    the introduction of platform_suspend_ops in checkpatch.pl's list of "should
    be const" structs (79404849e90a41ea2109bd0e2f7c7164b0c4ce73).

    Patch against mainline.
    Inspired by hunks of the grsecurity patch, updated for newer kernels.

    Signed-off-by: Lionel Debroux
    Acked-by: Ingo Molnar
    Signed-off-by: Jiri Kosina

    Lionel Debroux
     
  • Patch against mainline.

    Changes since v1: added one hunk; no longer adding "const" qualifier to
    pointers in platform_hibernation_ops after seeing
    b4144e4f6e3b448d322095ca08af393682a69e33.

    Signed-off-by: Jiri Kosina

    Lionel Debroux
     

17 Oct, 2010

2 commits

  • If there is a wakeup event during the freezing of tasks, suspend or
    hibernation will fail anyway. Since try_to_freeze_tasks() can take
    up to 20 seconds to complete or fail, aborting it as soon as a wakeup
    event is detected improves the worst case wakeup latency.

    Based on a patch from Arve Hjønnevåg.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek

    Rafael J. Wysocki
     
  • Introduce struct wakeup_source for representing system wakeup sources
    within the kernel and for collecting statistics related to them.
    Make the recently introduced helper functions pm_wakeup_event(),
    pm_stay_awake() and pm_relax() use struct wakeup_source objects
    internally, so that wakeup statistics associated with wakeup devices
    can be collected and reported in a consistent way (the definition of
    pm_relax() is changed, which is harmless, because this function is
    not called directly by anyone yet). Introduce new wakeup-related
    sysfs device attributes in /sys/devices/.../power for reporting the
    device wakeup statistics.

    Change the global wakeup events counters event_count and
    events_in_progress into atomic variables, so that it is not necessary
    to acquire a global spinlock in pm_wakeup_event(), pm_stay_awake()
    and pm_relax(), which should allow us to avoid lock contention in
    these functions on SMP systems with many wakeup devices.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

19 Jul, 2010

2 commits

  • The ACPI suspend code calls suspend_nvs_free() at a wrong place,
    which may lead to a memory leak if there's an error executing
    acpi_pm_prepare(), because acpi_pm_finish() will not be called in
    that case. However, the root cause of this problem is the
    apparently confusing ordering of calls in suspend error paths that
    needs to be fixed.

    In addition to that, fix a typo in a label name in suspend.c.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Len Brown

    Rafael J. Wysocki
     
  • One of the arguments during the suspend blockers discussion was that
    the mainline kernel didn't contain any mechanisms making it possible
    to avoid races between wakeup and system suspend.

    Generally, there are two problems in that area. First, if a wakeup
    event occurs exactly when /sys/power/state is being written to, it
    may be delivered to user space right before the freezer kicks in, so
    the user space consumer of the event may not be able to process it
    before the system is suspended. Second, if a wakeup event occurs
    after user space has been frozen, it is not generally guaranteed that
    the ongoing transition of the system into a sleep state will be
    aborted.

    To address these issues introduce a new global sysfs attribute,
    /sys/power/wakeup_count, associated with a running counter of wakeup
    events and three helper functions, pm_stay_awake(), pm_relax(), and
    pm_wakeup_event(), that may be used by kernel subsystems to control
    the behavior of this attribute and to request the PM core to abort
    system transitions into a sleep state already in progress.

    The /sys/power/wakeup_count file may be read from or written to by
    user space. Reads will always succeed (unless interrupted by a
    signal) and return the current value of the wakeup events counter.
    Writes, however, will only succeed if the written number is equal to
    the current value of the wakeup events counter. If a write is
    successful, it will cause the kernel to save the current value of the
    wakeup events counter and to abort the subsequent system transition
    into a sleep state if any wakeup events are reported after the write
    has returned.

    [The assumption is that before writing to /sys/power/state user space
    will first read from /sys/power/wakeup_count. Next, user space
    consumers of wakeup events will have a chance to acknowledge or
    veto the upcoming system transition to a sleep state. Finally, if
    the transition is allowed to proceed, /sys/power/wakeup_count will
    be written to and if that succeeds, /sys/power/state will be written
    to as well. Still, if any wakeup events are reported to the PM core
    by kernel subsystems after that point, the transition will be
    aborted.]

    Additionally, put a wakeup events counter into struct dev_pm_info and
    make these per-device wakeup event counters available via sysfs,
    so that it's possible to check the activity of various wakeup event
    sources within the kernel.

    To illustrate how subsystems can use pm_wakeup_event(), make the
    low-level PCI runtime PM wakeup-handling code use it.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Jesse Barnes
    Acked-by: Greg Kroah-Hartman
    Acked-by: markgross
    Reviewed-by: Alan Stern

    Rafael J. Wysocki
     

10 Jun, 2010

1 commit


18 Nov, 2009

1 commit

  • Allow memory hotplug and hibernation in the same kernel

    Memory hotplug and hibernation were exclusive in Kconfig. This is
    obviously a problem for distribution kernels who want to support both in
    the same image.

    After some discussions with Rafael and others the only problem is with
    parallel memory hotadd or removal while a hibernation operation is in
    process. It was also working for s390 before.

    This patch removes the Kconfig level exclusion, and simply makes the
    memory add / remove functions grab the pm_mutex to exclude against
    hibernation.

    Fixes a regression - old kernels didn't exclude memory hotadd and
    hibernation.

    Signed-off-by: Andi Kleen
    Cc: Gerald Schaefer
    Cc: KOSAKI Motohiro
    Cc: Yasunori Goto
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     

13 Jun, 2009

1 commit

  • The *_nvs_* routines in swsusp.c make use of the io*map()
    functions, which are only provided for HAS_IOMEM, thus
    breaking compilation if HAS_IOMEM is not set. Fix this
    by moving the *_nvs_* routines into hibernate_nvs.c, which
    is only compiled if HAS_IOMEM is set.

    [rjw: Change the name of the new file to hibernate_nvs.c, add the
    license line to the header comment.]

    Signed-off-by: Cornelia Huck
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki

    Cornelia Huck
     

20 Apr, 2009

1 commit

  • Commit 900af0d973856d6feb6fc088c2d0d3fde57707d3 (PM: Change suspend
    code ordering) changed the ordering of suspend code in such a way
    that the platform .prepare() callback is now executed after the
    device drivers' late suspend callbacks have run. Unfortunately, this
    turns out to break ARM platforms that need to talk via I2C to power
    control devices during the .prepare() callback.

    For this reason introduce two new platform suspend callbacks,
    .prepare_late() and .wake(), that will be called just prior to
    disabling non-boot CPUs and right after bringing them back on line,
    respectively, and use them instead of .prepare() and .finish() for
    ACPI suspend. Make the PM core execute the .prepare() and .finish()
    platform suspend callbacks where they were executed previously (that
    is, right after calling the regular suspend methods provided by
    device drivers and right before executing their regular resume
    methods, respectively).

    It is not necessary to make analogous changes to the hibernation
    code and data structures at the moment, because they are only used
    by ACPI platforms.

    Signed-off-by: Rafael J. Wysocki
    Reported-by: Russell King
    Acked-by: Len Brown

    Rafael J. Wysocki
     

01 Apr, 2009

1 commit

  • Make the following header file changes:

    - remove arch ifdefs and asm/suspend.h from linux/suspend.h
    - add asm/suspend.h to disk.c (for arch_prepare_suspend())
    - add linux/io.h to swsusp.c (for ioremap())
    - x86 32/64 bit compile fixes

    Signed-off-by: Magnus Damm
    Cc: Paul Mundt
    Acked-by: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Magnus Damm
     

27 Jan, 2009

1 commit

  • Introduce boolean function system_entering_hibernation() returning
    'true' during the last phase of hibernation, in which devices are
    being put into low power states and the sleep state (for example,
    ACPI S4) is finally entered.

    Some device drivers need such a function to check if the system is
    in the final phase of hibernation. In particular, some SATA drivers
    are going to use it for blacklisting systems in which the disks
    should not be spun down during the last phase of hibernation (the
    BIOS will do that anyway).

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jeff Garzik

    Rafael J. Wysocki
     

19 Dec, 2008

1 commit

  • According to the ACPI Specification 3.0b, Section 15.3.2,
    "OSPM will call the _PTS control method some time before entering a
    sleeping state, to allow the platform's AML code to update this
    memory image before entering the sleeping state. After the system
    awakes from an S4 state, OSPM will restore this memory area and call
    the _WAK control method to enable the BIOS to reclaim its memory
    image." For this reason, implement a mechanism allowing us to save
    the NVS memory during hibernation and to restore it during the
    subsequent resume.

    Based on a patch by Zhang Rui.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Nigel Cunningham
    Cc: Zhang Rui
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

15 Aug, 2008

1 commit

  • WARNING: vmlinux.o(.text+0xe684): Section mismatch in reference from the function register_nosave_region() to the function .init.text:__register_nosave_region()
    The function register_nosave_region() references
    the function __init __register_nosave_region().
    This is often because register_nosave_region lacks a __init
    annotation or the annotation of __register_nosave_region is wrong.

    register_nosave_region calls __init function and is called only from
    __init functions

    Signed-off-by: Marcin Slusarz
    Acked-by: Rafael J. Wysocki
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     

27 Jul, 2008

1 commit

  • This patch implements devices state save/restore before after kexec.

    This patch together with features in kexec_jump patch can be used for
    following:

    - A simple hibernation implementation without ACPI support. You can kexec a
    hibernating kernel, save the memory image of original system and shutdown
    the system. When resuming, you restore the memory image of original system
    via ordinary kexec load then jump back.

    - Kernel/system debug through making system snapshot. You can make system
    snapshot, jump back, do some thing and make another system snapshot.

    - Cooperative multi-kernel/system. With kexec jump, you can switch between
    several kernels/systems quickly without boot process except the first time.
    This appears like swap a whole kernel/system out/in.

    - A general method to call program in physical mode (paging turning
    off). This can be used to invoke BIOS code under Linux.

    The following user-space tools can be used with kexec jump:

    - kexec-tools needs to be patched to support kexec jump. The patches
    and the precompiled kexec can be download from the following URL:
    source: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-src_git_kh10.tar.bz2
    patches: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-patches_git_kh10.tar.bz2
    binary: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec_git_kh10

    - makedumpfile with patches are used as memory image saving tool, it
    can exclude free pages from original kernel memory image file. The
    patches and the precompiled makedumpfile can be download from the
    following URL:
    source: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile-src_cvs_kh10.tar.bz2
    patches: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile-patches_cvs_kh10.tar.bz2
    binary: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile_cvs_kh10

    - An initramfs image can be used as the root file system of kexeced
    kernel. An initramfs image built with "BuildRoot" can be downloaded
    from the following URL:
    initramfs image: http://khibernation.sourceforge.net/download/release_v10/initramfs/rootfs_cvs_kh10.gz
    All user space tools above are included in the initramfs image.

    Usage example of simple hibernation:

    1. Compile and install patched kernel with following options selected:

    CONFIG_X86_32=y
    CONFIG_RELOCATABLE=y
    CONFIG_KEXEC=y
    CONFIG_CRASH_DUMP=y
    CONFIG_PM=y
    CONFIG_HIBERNATION=y
    CONFIG_KEXEC_JUMP=y

    2. Build an initramfs image contains kexec-tool and makedumpfile, or
    download the pre-built initramfs image, called rootfs.gz in
    following text.

    3. Prepare a partition to save memory image of original kernel, called
    hibernating partition in following text.

    4. Boot kernel compiled in step 1 (kernel A).

    5. In the kernel A, load kernel compiled in step 1 (kernel B) with
    /sbin/kexec. The shell command line can be as follow:

    /sbin/kexec --load-preserve-context /boot/bzImage --mem-min=0x100000
    --mem-max=0xffffff --initrd=rootfs.gz

    6. Boot the kernel B with following shell command line:

    /sbin/kexec -e

    7. The kernel B will boot as normal kexec. In kernel B the memory
    image of kernel A can be saved into hibernating partition as
    follow:

    jump_back_entry=`cat /proc/cmdline | tr ' ' '\n' | grep kexec_jump_back_entry | cut -d '='`
    echo $jump_back_entry > kexec_jump_back_entry
    cp /proc/vmcore dump.elf

    Then you can shutdown the machine as normal.

    8. Boot kernel compiled in step 1 (kernel C). Use the rootfs.gz as
    root file system.

    9. In kernel C, load the memory image of kernel A as follow:

    /sbin/kexec -l --args-none --entry=`cat kexec_jump_back_entry` dump.elf

    10. Jump back to the kernel A as follow:

    /sbin/kexec -e

    Then, kernel A is resumed.

    Implementation point:

    To support jumping between two kernels, before jumping to (executing)
    the new kernel and jumping back to the original kernel, the devices
    are put into quiescent state, and the state of devices and CPU is
    saved. After jumping back from kexeced kernel and jumping to the new
    kernel, the state of devices and CPU are restored accordingly. The
    devices/CPU state save/restore code of software suspend is called to
    implement corresponding function.

    Known issues:

    - Because the segment number supported by sys_kexec_load is limited,
    hibernation image with many segments may not be load. This is
    planned to be eliminated by adding a new flag to sys_kexec_load to
    make a image can be loaded with multiple sys_kexec_load invoking.

    Now, only the i386 architecture is supported.

    Signed-off-by: Huang Ying
    Acked-by: Vivek Goyal
    Cc: "Eric W. Biederman"
    Cc: Pavel Machek
    Cc: Nigel Cunningham
    Cc: "Rafael J. Wysocki"
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     

13 Jun, 2008

1 commit

  • ACPI PM: Add possibility to change suspend sequence

    There are some systems out there that don't work correctly with
    our current suspend/hibernation code ordering. Provide a workaround
    for these systems allowing them to pass 'acpi_sleep=old_ordering' in
    the kernel command line so that it will use the pre-ACPI 2.0 ("old")
    suspend code ordering.

    Unfortunately, this requires us to add a platform hook to the
    resuming of devices for recovering the platform in case one of the
    device drivers' .suspend() routines returns error code. Namely,
    ACPI 1.0 specifies that _PTS should be called before suspending
    devices, but _WAK still should be called before resuming them in
    order to undo the changes made by _PTS. However, if there is an
    error during suspending devices, they are automatically resumed
    without returning control to the PM core, so the _WAK has to be
    called from within device_resume() in that cases.

    The patch also reorders and refactors the ACPI suspend/hibernation
    code to avoid duplication as far as reasonably possible.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

28 Apr, 2008

1 commit

  • Prior to suspend, we allocate and switch to a new VT; after suspend, we switch
    back to the original VT. This can be slow, and is completely unnecessary if
    the framebuffer we're using can restore video properly.

    This adds a hook that allows drivers to select whether or not to do this vt
    switch, and changes the gxfb driver to call this hook. It also adds a module
    param to gxfb to allow controlling of the vt switch (defaulting to no switch).

    (Note: I'm not convinced that console_sem is the best way to protect this, but
    we should probably have some form of locking..)

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Andres Salomon
    Cc: Jordan Crouse
    Cc: "Antonino A. Daplas"
    Cc: Pavel Machek
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andres Salomon
     

06 Feb, 2008

1 commit

  • - Add comments explaing how drain_pages() works.

    - Eliminate useless functions

    - Rename drain_all_local_pages to drain_all_pages(). It does drain
    all pages not only those of the local processor.

    - Eliminate useless interrupt off / on sequences. drain_pages()
    disables interrupts on its own. The execution thread is
    pinned to processor by the caller. So there is no need to
    disable interrupts.

    - Put drain_all_pages() declaration in gfp.h and remove the
    declarations from suspend.h and from mm/memory_hotplug.c

    - Make software suspend call drain_all_pages(). The draining
    of processor local pages is may not the right approach if
    software suspend wants to support SMP. If they call drain_all_pages
    then we can make drain_pages() static.

    [akpm@linux-foundation.org: fix build]
    Signed-off-by: Christoph Lameter
    Acked-by: Mel Gorman
    Cc: "Rafael J. Wysocki"
    Cc: Daniel Walker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

02 Feb, 2008

3 commits

  • Introduce global hibernation callback .end() and rename global
    hibernation callback .start() to .begin(), in analogy with the
    recent modifications of the global suspend callbacks.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • On ACPI systems the target state set by acpi_pm_set_target() is
    reset by acpi_pm_finish(), but that need not be called if the
    suspend fails.  All platforms that use the .set_target() global
    suspend callback are affected by analogous issues.

    For this reason, we need an additional global suspend callback that
    will reset the target state regardless of whether or not the suspend
    is successful.  Also, it is reasonable to rename the .set_target()
    callback, since it will be used for a different purpose on ACPI
    systems (due to ACPI 1.0x code ordering requirements).

    Introduce the global suspend callback .end() to be executed at the
    end of the suspend sequence and rename the .set_target() global
    suspend callback to .begin().

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • This patch (as1008b) converts the PM notifier routines from inline
    calls to out-of-line code. It also prevents pm_chain_head from
    being created when CONFIG_PM_SLEEP isn't enabled, and EXPORTs the
    notifier registration and unregistration routines.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Alan Stern
     

30 Jan, 2008

1 commit

  • .. allowing to remove their declarations from a global include file
    (the symbols don't exist for anything but x86).

    Likewise for 64-bits' fix_processor_context(), just that that one was
    properly declared in an arch-specific header.

    Signed-off-by: Jan Beulich
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Jan Beulich
     

19 Oct, 2007

7 commits

  • The following scenario leads to total confusion of the platform firmware on
    some boxes (eg. HPC nx6325):
    * Hibernate with ACPI enabled
    * Resume passing "acpi=off" to the boot kernel

    To prevent this from happening it's necessary to check if ACPI is enabled (and
    enable it if that's not the case) _right_ _after_ control has been transfered
    from the boot kernel to the image kernel, before device_power_up() is called
    (ie. with interrupts disabled).  Enabling ACPI after calling
    device_power_up() turns out to be insufficient.

    For this reason, introduce new hibernation callback ->leave() that will be
    executed before device_power_up() by the restored image kernel.  To make it
    work, it also is necessary to move swsusp_suspend() from swsusp.c to disk.c
    (it's name is changed to "create_image", which is more up to the point).

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Rename 'struct hibernation_ops' to 'struct platform_hibernation_ops' in
    analogy with 'struct platform_suspend_ops'.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Len Brown
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • During hibernation we also need to tell the ACPI core that we're going to put
    the system into the S4 sleep state. For this reason, an additional method in
    'struct hibernation_ops' is needed, playing the role of set_target() in
    'struct platform_suspend_operations'. Moreover, the role of the .prepare()
    method is now different, so it's better to introduce another method, that in
    general may be different from .prepare(), that will be used to prepare the
    platform for creating the hibernation image (.prepare() is used anyway to
    notify the platform that we're going to enter the low power state after the
    image has been saved).

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • The variable suspend_ops representing the set of global platform-specific
    suspend-related operations, used by the PM core, need not be exported outside
    of kernel/power/main.c .  Make it static.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • There is no reason why the .prepare() and .finish() methods in 'struct
    platform_suspend_ops' should take any arguments, since architectures don't use
    these methods' argument in any practically meaningful way (ie. either the
    target system sleep state is conveyed to the platform by .set_target(), or
    there is only one suspend state supported and it is indicated to the PM core
    by .valid(), or .prepare() and .finish() aren't defined at all).  There also
    is no reason why .finish() should return any result.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Len Brown
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • The name of 'struct pm_ops' suggests that it is related to the power
    management in general, but in fact it is only related to suspend.  Moreover,
    its name should indicate what this structure is used for, so it seems
    reasonable to change it to 'struct platform_suspend_ops'.  In that case, the
    name of the global variable of this type used by the PM core and the names of
    related functions should be changed accordingly.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Len Brown
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Move the definition of 'struct pm_ops' and related functions from
    to .

    There are, at least, the following reasons to do that:
    * 'struct pm_ops' is specifically related to suspend and not to the power
    management in general.
    * As long as 'struct pm_ops' is defined in , any modification of it
    causes the entire kernel to be recompiled, which is unnecessary and annoying.
    * Some suspend-related features are already defined in , so it
    is logical to move the definition of 'struct pm_ops' into there.
    * 'struct hibernation_ops', being the hibernation-related counterpart of
    'struct pm_ops', is defined in .

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Len Brown
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

30 Jul, 2007

2 commits

  • Introduce CONFIG_SUSPEND representing the ability to enter system sleep
    states, such as the ACPI S3 state, and allow the user to choose SUSPEND
    and HIBERNATION independently of each other.

    Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has
    been chosen and the kernel is intended for SMP systems.

    Also, introduce CONFIG_PM_SLEEP which is automatically selected if
    CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the
    code needed for both suspend and hibernation.

    The top-level power management headers and the ACPI code related to
    suspend and hibernation are modified to use the new definitions (the
    changes in drivers/acpi/sleep/main.c are, mostly, moving code to reduce
    the number of ifdefs).

    There are many other files in which CONFIG_PM can be replaced with
    CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
    the future.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid
    confusion (among other things, with CONFIG_SUSPEND introduced in the
    next patch).

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

27 Jul, 2007

1 commit

  • A dummy inline function of register_nosave_region_late was accidentally
    removed by the recent PM patch that introduced suspend notifiers.
    This elimination causes the following compiler error on PPC machines.

    CC arch/powerpc/sysdev/dart_iommu.o
    arch/powerpc/sysdev/dart_iommu.c: In function 'iommu_init_late_dart':
    arch/powerpc/sysdev/dart_iommu.c:376: error: implicit declaration of function
    'register_nosave_region_late'
    make[1]: *** [arch/powerpc/sysdev/dart_iommu.o] Error 1
    make: *** [arch/powerpc/sysdev] Error 2

    This patch fixes the problem.

    Signed-off-by: Ryusuke Konishi
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

20 Jul, 2007

2 commits

  • Make it possible to register hibernation and suspend notifiers, so that
    subsystems can perform hibernation-related or suspend-related operations that
    should not be carried out by device drivers' .suspend() and .resume()
    routines.

    [akpm@linux-foundation.org: build fixes]
    [akpm@linux-foundation.org: cleanups]
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • At least on some machines it is necessary to prepare the ACPI firmware for the
    restoration of the system memory state from the hibernation image if the
    "platform" mode of hibernation has been used. Namely, in that cases we need
    to disable the GPEs before replacing the "boot" kernel with the "frozen"
    kernel (cf. http://bugzilla.kernel.org/show_bug.cgi?id=7887). After the
    restore they will be re-enabled by hibernation_ops->finish(), but if the
    restore fails, they have to be re-enabled by the restore code explicitly.

    For this purpose we can introduce two additional hibernation operations,
    called pre_restore() and restore_cleanup() and call them from the restore code
    path. Still, they should be called if the "platform" mode of hibernation has
    been used, so we need to pass the information about the hibernation mode from
    the "frozen" kernel to the "boot" kernel in the image header.

    Apparently, we can't drop the disabling of GPEs before the restore because of
    Bug #7887 .  We also can't do it unconditionally, because the GPEs wouldn't
    have been enabled after a successful restore if the suspend had been done in
    the 'shutdown' or 'reboot' mode.

    In principle we could (and probably should) unconditionally disable the GPEs
    before each snapshot creation *and* before the restore, but then we'd have to
    unconditionally enable them after the snapshot creation as well as after the
    restore (or restore failure)   Still, for this purpose we'd need to modify
    acpi_enter_sleep_state_prep() and acpi_leave_sleep_state() and we'd have to
    introduce some mechanism synchronizing the disablind/enabling of the GPEs with
    the device drivers' .suspend()/.resume() routines and with
    disable_/enable_nonboot_cpus().  However, this would have affected the
    suspend (ie. s2ram) code as well as the hibernation, which I'd like to avoid
    in this patch series.

    Signed-off-by: Rafael J. Wysocki
    Cc: Nigel Cunningham
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

10 May, 2007

1 commit

  • * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
    [POWERPC] Further fixes for the removal of 4level-fixup hack from ppc32
    [POWERPC] EEH: log all PCI-X and PCI-E AER registers
    [POWERPC] EEH: capture and log pci state on error
    [POWERPC] EEH: Split up long error msg
    [POWERPC] EEH: log error only after driver notification.
    [POWERPC] fsl_soc: Make mac_addr const in fs_enet_of_init().
    [POWERPC] Don't use SLAB/SLUB for PTE pages
    [POWERPC] Spufs support for 64K LS mappings on 4K kernels
    [POWERPC] Add ability to 4K kernel to hash in 64K pages
    [POWERPC] Introduce address space "slices"
    [POWERPC] Small fixes & cleanups in segment page size demotion
    [POWERPC] iSeries: Make HVC_ISERIES the default
    [POWERPC] iSeries: suppress build warning in lparmap.c
    [POWERPC] Mark pages that don't exist as nosave
    [POWERPC] swsusp: Introduce register_nosave_region_late

    Linus Torvalds