mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
* remotes/origin/tmp-ad490df: ANDROID: binder: Remove obsolete proc waitqueue. f2fs: updates on 4.15-rc1 ANDROID: arch_topology: fix build for !CONFIG_CPU_FREQ ANDROID: ARM64: Tweak defconfig Android EAS features ANDROID: ARM64: Tweak defconfig for EAS platforms ANDROID: DEBUG: accumulate debug output and dump all at the end of energy_diff ANDROID: sched/fair: prevent meaningless active migration ANDROID: sched/fair: Fall back to slow path wakeup placement if needed ANDROID: DEBUG: Temporarily disable lockdep asserting on update_task_ravg ANDROID: sched: Introduce Window Assisted Load Tracking (WALT) ANDROID: Add find_best_target to minimise energy calculation overhead ANDROID: Combined EAS Load Balance Tweaks ANDROID: sched/fair: re-factor energy_diff to use a single (extensible) energy_env ANDROID: sched/fair: consider task utilization in group_norm/max_util() ANDROID: refactor select_task_rq_fair et al to be cleaner ANDROID: sched: fair: Bypass energy-aware wakeup for prefer-idle tasks ANDROID: sched: Move energy-aware decision into a helper function ANDROID: sched/fair: Try to estimate possible idle states. ANDROID: trace/sched: Add tracepoint for sched_overutilized events ANDROID: sched: fair/tune: Add schedtune with cgroups interface ANDROID: sched: EAS: take cstate into account when selecting idle core ANDROID: sched: Unconditionally honor sync flag for energy-aware wakeups ANDROID: sched: Add KConfig option to set ENERGY_AWARE sched feature on ANDROID: cpufreq: schedutil: add up/down frequency transition rate limits ANDROID: sched: Add per-cpu max capacity to sched_group_capacity ANDROID: sched: cpufreq: use PELT rt_rq as estimate of required RT CPU capacity ANDROID: trace/sched: add tracepoint for rt_rq PELT signal FROMLIST: sched/rt: add utilization tracking FROMLIST: sched/fair: Use wake_q length as a hint for wake_wide FROMLIST: sched/fair: Update blocked load from newly idle balance FROMLIST: sched: force update of blocked load of idle cpus UPSTREAM: sched/fair: Sync task util before slow-path wakeup UPSTREAM: sched/fair: Fix usage of find_idlest_group() when the local group is idlest UPSTREAM: sched/fair: Fix usage of find_idlest_group() when no groups are allowed UPSTREAM: sched/fair: Fix find_idlest_group() when local group is not allowed UPSTREAM: sched/fair: Remove unnecessary comparison with -1 UPSTREAM: sched/fair: Move select_task_rq_fair() slow-path into its own function UPSTREAM: sched/fair: Force balancing on NOHZ balance if local group has capacity ANDROID: sched/events: Introduce task_group load tracking trace event ANDROID: sched/events: Introduce sched_entity load tracking trace event ANDROID: sched/events: Introduce cfs_rq load tracking trace event ANDROID: sched/autogroup: Define autogroup_path() for !CONFIG_SCHED_DEBUG ANDROID: sched/debug: Add energy procfs interface ANDROID: arm: Support for extracting EAS energy costs from DT ANDROID: arm64: Support for extracting EAS energy costs from DT ANDROID: arm: Add Energy Model to dtb for TC2 ANDROID: hisilicon: Add energy model data to hisilicon 6220 dtb ANDROID: arm64: Add Energy Model to dtb for Juno-r0 and Juno-r2 ANDROID: Documentation: DT bindings for energy model cost data required by EAS ANDROID: arm64, dts: add hikey cpu capacity-dmips-mhz information ANDROID: drivers base/arch_topology: Detect SD_SHARE_CAP_STATES flag ANDROID: drivers base/arch_topology: enforce SCHED_CAPACITY_SCALE as highest CPU capacity ANDROID: drivers base/arch_topology: fold two pr_debug()'s into one ANDROID: sched: Per-Sched-domain over utilization ANDROID: sched: Disable energy-unfriendly nohz kicks ANDROID: sched: Consider a not over-utilized energy-aware system as balanced ANDROID: sched/fair: Energy-aware wake-up task placement ANDROID: sched: Add over-utilization/tipping point indicator ANDROID: sched/fair: Add energy_diff dead-zone margin ANDROID: sched: Determine the current sched_group idle-state ANDROID: sched, cpuidle: Track cpuidle state index in the scheduler ANDROID: sched: Estimate energy impact of scheduling decisions ANDROID: sched: Extend sched_group_energy to test load-balancing decisions ANDROID: initramfs: call free_initrd() when skipping init FROMLIST: net: xfrm: allow clearing socket xfrm policies. FROMLIST: binder: fix proc->files use-after-free UPSTREAM: arm64: vdso: fix clock_getres for 4GiB-aligned res UPSTREAM: security: bpf: replace include of linux/bpf.h with forward declarations BACKPORT: selinux: bpf: Add addtional check for bpf object file receive UPSTREAM: selinux: bpf: Add selinux check for eBPF syscall operations BACKPORT: security: bpf: Add LSM hooks for bpf object related syscall BACKPORT: bpf: Add file mode configuration into bpf maps UPSTREAM: arm64: Avoid aligning normal memory pointers in __memcpy_{to,from}io UPSTREAM: android: binder: Change binder_shrinker to static UPSTREAM: f2fs: expose some sectors to user in inline data or dentry case UPSTREAM: tracing: Add support for preempt and irq enable/disable events UPSTREAM: tracing: Prepare to add preempt and irq trace events BACKPORT: android: binder: Remove unused vma argument ANDROID: Revert "arm64: move ELF_ET_DYN_BASE to 4GB / 4MB" ANDROID: Revert "arm: move ELF_ET_DYN_BASE to 4MB" ANDROID: memory_state_time: fix undefined behavior with missing DT properties ANDROID: memory_state_time: Implement memory_state_time, used by qcom,cpubw ANDROID: uid_sys_stats: log task io with a debug flag ANDROID: uid_sys_stats: check previous uid_entry before call find_or_register_uid ANDROID: uid_sys_stats: Kconfig: add depends for UID_SYS_STATS ANDROID: uid_sys_stats: defer io stats calulation for dead tasks ANDROID: uid_sys_stats: fix access of task_uid(task) ANDROID: uid_sys_stats: reduce update_io_stats overhead ANDROID: uid_sys_stats: change to use rt_mutex ANDROID: uid_sys_stats: account for fsync syscalls ANDROID: uid_sys_stats: fix negative write bytes. ANDROID: uid_sys_stats: allow writing same state ANDROID: uid_sys_stats: rename uid_cputime.c to uid_sys_stats.c ANDROID: uid_cputime: add per-uid IO usage accounting ANDROID: uid_cputime: Check for the range while removing range of UIDs. ANDROID: uid_cputime: Iterates over all the threads instead of processes. ANDROID: uid_cputime: fix cputime overflow ANDROID: uid_cputime: Adds accounting for the cputimes per uid. CHROMIUM: usb: gadget: f_accessory: add .raw_request callback CHROMIUM: usb: gadget: f_audio_source: add .free_func callback ANDROID: usb: gadget: f_midi: set fi->f to NULL when free f_midi function ANDROID: usb: gadget: f_midi: create F_midi device ANDROID: usb: gadget: f_accessory: assign no-op request complete callbacks ANDROID: usb: gadget: f_accessory: Fix for UsbAccessory clean unbind. ANDROID: usb: gadget: f_accessory: fix false disconnect due to a signal sent to the reading process ANDROID: usb: gadget: f_accessory: Move gadget functions code ANDROID: usb: gadget: f_accessory: Migrate to USB_FUNCTION API ANDROID: usb: gadget: f_audio_source: disable the CPU C-states upon playback ANDROID: usb: gadget: f_audio_source: Move gadget functions code ANDROID: usb: gadget: f_audio_source: Move to USB_FUNCTION API ANDROID: usb: gadget: composite: Do not disconnect unregistered dev ANDROID: usb: gadget: configfs: fix null ptr in android_disconnect ANDROID: usb: gadget: configfs: Add device attribute to determine gadget state ANDROID: usb: gadget: configfs: Add "state" attribute to android_device ANDROID: usb: gadget: configfs: Add function devices to the parent ANDROID: usb: gadget: configfs: Add Uevent to notify userspace ANDROID: usb: gadget: configfs: Add usb_function ptr to fi struct ANDROID: usb: gadget: f_audio_source: Fixed USB Audio Class Interface Descriptor ANDROID: usb: gadget: f_audio_source: change max ISO packet size ANDROID: usb: gadget: f_audio_source: New gadget driver for audio output ANDROID: usb: gadget: f_accessory: check for accessory device before disconnecting HIDs ANDROID: usb: gadget: f_accessory: Enabled Zero Length Packet (ZLP) for acc_write ANDROID: usb: gadget: f_accessory: move userspace interface to uapi ANDROID: usb: gadget: f_accessory: Add support for HID input devices ANDROID: usb: gadget: f_accessory: Add ACCESSORY_SET_AUDIO_MODE control request and ioctl ANDROID: usb: gadget: f_accessory: Add Android Accessory function ANDROID: usb: phy: Dual role sysfs class definition ANDROID: usb: otg-wakelock: Remove wakelock.h dependencies ANDROID: usb: otg-wakelock: Temporarily grab wakelock on charger and disconnect events ANDROID: usb: otg-wakelock: Take wakelock when VBUS present ANDROID: trace: net: use %pK for kernel pointers ANDROID: trace: power: add trace_clock_set_parent ANDROID: trace: cpufreq: Add tracing for min/max cpufreq ANDROID: trace: gpu: add gpu trace events ANDROID: trace: sched: add sched blocked tracepoint which dumps out context of sleep. ANDROID: trace: add non-hierarchical function_graph option ANDROID: security,perf: Allow further restriction of perf_event_open ANDROID: rtc-palmas: correct for bcd year ANDROID: power: wakeup: align wakeup_sources format ANDROID: power: wakeup: Add the guard condition for len in pm_get_active_wakeup_sources ANDROID: power: wakeup: Add last wake up source logging for suspend abort reason. ANDROID: power: wakeup_reason: fix suspend time reporting ANDROID: power: wakeup_reason: Report suspend times from last_suspend_time ANDROID: power: wakeup_reason: Add check_wakeup_reason() to verify wakeup source irq ANDROID: power: wakeup_reason: Adds functionality to log the last suspend abort reason. ANDROID: power: wakeup_reason: Avoids bogus error messages for the suspend aborts. ANDROID: power: wakeup_reason: Add guard condition for maximum wakeup reasons ANDROID: power: wakeup_reason: add an API to log wakeup reasons ANDROID: power: power_supply: Add property CHARGE_COUNTER_EXT and 64-bit precision properties ANDROID: power: power_supply: add POWER_SUPPLY_PROP_CHARGE_ENABLED ANDROID: power: power_supply: add POWER_SUPPLY_PROP_USB_OTG ANDROID: power: power_supply: Add custom property for USB High Current mode ANDROID: arm64: copy CONFIG_CMDLINE_EXTEND from ARM ANDROID: of: Support CONFIG_CMDLINE_EXTEND config option ANDROID: NFC: st21nfca: Fix memory OOB and leak issues in connectivity events handler ANDROID: NFC: Fix possible memory corruption when handling SHDLC I-Frame commands ANDROID: nfc: fdp: Fix possible buffer overflow in WCS4000 NFC driver ANDROID: NFC: st21nfca: Fix out of bounds kernel access when handling ATR_REQ ANDROID: netfilter: xt_IDLETIMER: Use fullsock when querying uid ANDROID: netfilter: xt_IDLETIMER: Fix use after free condition during work ANDROID: netfilter: xt_IDLETIMER: Adds the uid field in the msg ANDROID: netfilter: xt_IDLETIMER: time-stamp and suspend/resume handling. ANDROID: netfilter: xt_IDLETIMER: Add new netlink msg type ANDROID: netfilter: xt_qtaguid: Use sk_uid to replace uid get from socket file ANDROID: netfilter: xt_qtaguid: fix handling for cases where tunnels are used. ANDROID: netfilter: xt_qtaguid: handle properly request sockets ANDROID: netfilter: xt_qtaguid: Add untag hacks to inet_release function ANDROID: netfilter: xt_qtaguid: don't check if embedded arrays are NULL ANDROID: netfilter: xt_qtaguid: fix the deadlock when enable DDEBUG ANDROID: netfilter: xt_qtaguid: Don't show empty tag stats for unprivileged uids ANDROID: netfilter: xt_qtaguid: Fix panic caused by processing non-full socket. ANDROID: netfilter: xt_qtaguid: Fix panic caused by synack processing ANDROID: netfilter: xt_qtaguid: fix a race condition in if_tag_stat_update ANDROID: netfilter: xt_qtaguid: xt_socket: build fixes ANDROID: netfilter: xt_socket/nf_socket: fix refcount underflow and crash ANDROID: netfilter: xt_qtaguid: Use sk_callback_lock read locks before reading sk->sk_socket ANDROID: netfilter: xt_qtaguid/xt_socket: Build fixups ANDROID: netfilter: xt_qtaguid: Fix boot panic ANDROID: netfilter: xt_qtaguid: fix bad tcp_time_wait sock handling ANDROID: netfilter: xt_qtaguid: 3.10 fixes ANDROID: netfilter: xt_qtaguid: rate limit some of the printks ANDROID: netfilter: xt_qtaguid: Allow tracking loopback ANDROID: netfilter: xt_qtaguid: extend iface stat to report protocols ANDROID: netfilter: xt_qtaguid: remove AID_* dependency for access control ANDROID: netfilter: xt_qtaguid: Don't BUG_ON if create_if_tag_stat fails ANDROID: netfilter: xt_qtaguid: fix error exit that would keep a spinlock. ANDROID: netfilter: xt_qtaguid: report only uid tags to non-privileged processes ANDROID: netfilter: xt_qtaguid: start tracking iface rx/tx at low level ANDROID: netfilter: xt_qtaguid: fix ipv6 protocol lookup ANDROID: netfilter: xt_qtaguid: add qtaguid matching module ANDROID: netfilter: xt_quota2: fixup the quota2, and enable. ANDROID: netfilter: xt_quota2: adding the original quota2 from xtables-addons ANDROID: net: xfrm: check dir value of xfrm_userpolicy_id ANDROID: net: xfrm: make PF_KEY SHA256 use RFC-compliant truncation. ANDROID: net: wireless: wlcore: Disable filtering in AP role ANDROID: net: wireless: Decrease scan entry expiration to avoid stall results ANDROID: net: rfkill: Introduce CONFIG_RFKILL_PM and use instead of CONFIG_PM to power down ANDROID: net: ipv6: autoconf routes into per-device tables ANDROID: net: ipv6: fix crash caused by ipv6_find_hdr() ANDROID: net: ipv4: tcp: add a sysctl to config the tcp_default_init_rwnd ANDROID: net: ipv4: sysfs_net_ipv4: Add sysfs-based knobs for controlling TCP window size ANDROID: net: ip-sysctl: Document tcp_fwmark_accept ANDROID: net: paranoid: commoncap: Begin to warn users of implicit PARANOID_NETWORK capability grants ANDROID: net: paranoid: security: Add proper checks for Android specific capability checks ANDROID: net: paranoid: Only NET_ADMIN is allowed to fully control TUN interfaces. ANDROID: net: paranoid: Replace AID_NET_RAW checks with capable(CAP_NET_RAW). ANDROID: net: paranoid: security: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable(). ANDROID: net: Paranoid network. ANDROID: mmc: core: export emmc revision ANDROID: mmc: core: move to a SCHED_FIFO thread ANDROID: mmc: core: Add "ignore mmc pm notify" functionality ANDROID: mmc: sdio: Add concept of an 'embedded' SDIO device. ANDROID: mmc: sd: Add retries in re-detection ANDROID: mmc: sd: When resuming, try a little harder to init the card ANDROID: mmc: sd: Add new CONFIG_MMC_PARANOID_SD_INIT for enabling retries during SD detection ANDROID: mm: add a field to store names for private anonymous memory ANDROID: HACK: arm64: use -mno-implicit-float instead of -mgeneral-regs-only ANDROID: Kbuild, LLVMLinux: allow overriding clang target triple CHROMIUM: arm64: Disable asm-operand-width warning for clang CHROMIUM: kbuild: clang: Disable the 'duplicate-decl-specifier' warning ANDROID: kbuild: Makefile.clean: make Kbuild and Makefile optional ANDROID: kbuild: make it possible to specify the module output dir ANDROID: input: goldfish_events: no extra EV_SYN; register goldfish ANDROID: input: keychord: Fix for a memory leak in keychord. ANDROID: input: keychord: Fix races in keychord_write. ANDROID: input: keychord: Fix a slab out-of-bounds read. ANDROID: input: keychord: log when keychord triggered ANDROID: input: keyreset: switch to orderly_reboot ANDROID: input: keyreset: Made keyreset more robust ANDROID: input: keyreset: Changed keyreset to act as a wrapper for keycombo. ANDROID: input: keycombo: add keycombo, a general key combo driver. ANDROID: input: keychord: Add keychord driver ANDROID: input: keyreset: Add keyreset driver. ANDROID: input: gpio_matrix: Remove wakelock.h dependencies ANDROID: input: gpio_input: convert from wakelocks to wakeup sources ANDROID: input: gpio_event: remove early suspend ANDROID: input: Generic GPIO Input devices ANDROID: initramfs: Add skip_initramfs command line option ANDROID: build: add build server configs for goldfish ANDROID: goldfish: add ranchu defconfigs ANDROID: goldfish_sync_timeline: Rename fence to dma_fence ANDROID: goldfish_sync: 32 max cmds to save stack ANDROID: goldfish_sync: Fix sync_file_obj is NULL but dereferenced problem ANDROID: goldfish_sync: Isolate single module to fix compilation ANDROID: goldfish_sync: upgrade to new fence sync api ANDROID: goldfish_sync: Add goldfish sync driver ANDROID: goldfish_audio: Clear audio read buffer status after each read ANDROID: goldfish_audio: Enable ACPI-based enumeration for goldfish audio ANDROID: goldfishfb: Set pixclock = 0 ANDROID: goldfishfb: Enable ACPI-based enumeration for goldfish framebuffer ANDROID: goldfishfb: add devicetree bindings ANDROID: fs: Fix for in kernel emergency remount when loop mounts are used ANDROID: fs: Refactor FS readpage/write tracepoints. ANDROID: fs: FS tracepoints to track IO. ANDROID: fs: sched: add a counter to track fsync ANDROID: fs: epoll: use freezable blocking call ANDROID: fs: ext4: Add support for FIDTRIM, a best-effort ioctl for deep discard trim ANDROID: fs: fuse: Freeze client on suspend when request sent to userspace ANDROID: fs: pstore: ram: Add ramoops_console_write_buf api ANDROID: fs: block_dump: Don't display inode changes if block_dump < 2 ANDROID: dm: verity: add minimum prefetch size ANDROID: dm: android-verity: mark dev as rw for linear target ANDROID: dm: android-verity: allow disable dm-verity for Treble VTS ANDROID: dm: android-verity: fix table_make_digest() error handling ANDROID: dm: android-verity: rebase for 4.9 ANDROID: dm: android-verity: Remove fec_header location constraint ANDROID: dm: android-verity: adopt changes made to dm callbacks ANDROID: dm: android-verity: pack the fec_header structure ANDROID: dm: android-verity: Verify header before fetching table ANDROID: dm: android-verity: allow adb disable-verity only in userdebug ANDROID: dm: android-verity: mount as linear target if eng build ANDROID: dm: android-verity: use default verity public key ANDROID: dm: android-verity: fix signature verification flag ANDROID: dm: android-verity: use name_to_dev_t ANDROID: dm: android-verity: Mounting root as linear device when verity disabled ANDROID: dm: android-verity: Add android verity target ANDROID: dm: do_mounts_dm: Update init/do_mounts_dm.c to the latest ChromiumOS version. ANDROID: dm: do_mounts_dm: fix dm_substitute_devices() ANDROID: dm: do_mounts_dm: Rebase on top of 4.9 CHROMIUM: dm: boot time specification of dm= ANDROID: dm: verity-fec: add sysfs attribute fec/corrected CHROMIUM: dma-buf: dma-fence: fix warning when releasing active sync point CHROMIUM: cgroups: relax permissions on moving tasks between cgroups ANDROID: cpuset: Make cpusets restore on hotplug ANDROID: cpu: send KOBJ_ONLINE event when enabling cpus ANDROID: cpuidle: governor: menu: don't use loadavg ANDROID: binder: clarify deferred thread work. ANDROID: binder: show high watermark of alloc->pages. ANDROID: binder: Add thread->process_todo flag. ANDROID: binder: fix node sched policy calculation ANDROID: binder: init desired_prio.sched_policy before use it ANDROID: binder: fix transaction leak. ANDROID: binder: Add tracing for binder priority inheritance. ANDROID: binder: don't check prio permissions on restore. ANDROID: binder: add RT inheritance flag to node. ANDROID: binder: improve priority inheritance. ANDROID: binder: add min sched_policy to node. ANDROID: binder: add support for RT prio inheritance. ANDROID: ashmem: Shrink directly through shmem_fallocate ANDROID: ashmem: Add shmem_set_file to mm/shmem.c ANDROID: fiq_debugger: Remove wakelock.h dependencies ANDROID: fiq_debugger: Add fiq_debugger.disable option ANDROID: fiq_debugger: Add option to apply uart overlay by FIQ_DEBUGGER_UART_OVERLAY ANDROID: fiq_debugger: Add fiq_watchdog_triggered api ANDROID: fiq_debugger: Call fiq_debugger_printf through a function pointer from cpu specific code ANDROID: fiq_debugger: add ARM64 support ANDROID: fiq_debugger: split arm support into fiq_debugger_arm.c ANDROID: fiq_debugger: use pt_regs for registers ANDROID: fiq_debugger: allow compiling without CONFIG_FIQ_GLUE ANDROID: fiq_debugger: rename debug->fiq_debugger ANDROID: fiq_debugger: move into drivers/staging/android/fiq_debugger/ ANDROID: kdb: support new lines without carriage returns ANDROID: ARM: fiq_debugger: Update tty code for 3.9 ANDROID: ARM: fiq_debugger: lock between tty and console writes ANDROID: ARM: fiq_debugger: add process context reboot command ANDROID: ARM: fiq_debugger: fix multiple consoles and make it a preferred console ANDROID: ARM: kgdb: ignore breakpoint instructions from user mode ANDROID: ARM: fiq_debugger: add support for kgdb ANDROID: ARM: fiq_debugger: add debug_putc ANDROID: ARM: fiq_debugger: add support for reboot commands ANDROID: ARM: fiq_debugger: Add generic fiq serial debugger ANDROID: ARM: fiq_glue: Add custom fiq return handler api. ANDROID: ARM: fiq_glue: Add fiq_glue ANDROID: arm64: pass return address to dma_common_contiguous_remap ANDROID: arm64: check for upper PAGE_SHIFT bits in pfn_valid() ANDROID: arm: mm: Optionally flush entire dcache from v6_dma_flush_range ANDROID: arm: decompressor: Flush tlb before swiching domain 0 to client mode ANDROID: arm: fault: assume no context when IRQs are disabled during data abort. ANDROID: arm: add option to flush console before reboot ANDROID: arm64: process: dump memory around registers when displaying regs ANDROID: arm: process: Add display of memory around registers when displaying regs. ANDROID: arm64: Allow to choose appended kernel image ANDROID: arm64: add option to build Image-dtb ANDROID: arm64: add option to build Image.gz/dtb combo ANDROID: arm: convert build of appended dtb zImage to list of dtbs ANDROID: arm: add config option to build zImage/dtb combo ANDROID: arm: Fix dtb list when DTB_IMAGE_NAMES is empty ANDROID: arch: force -fno-pic ANDROID: add script to fetch android kernel config fragments ANDROID: sched: Calculate energy consumption of sched_group ANDROID: sched: Highest energy aware balancing sched_domain level pointer ANDROID: sched: Relocated cpu_util() and change return type ANDROID: sched: EAS & 'single cpu per cluster'/cpu hotplug interoperability ANDROID: sched: Introduce SD_SHARE_CAP_STATES sched_domain flag ANDROID: sched: Initialize energy data structures ANDROID: sched: Introduce energy data structures ANDROID: sched: Make energy awareness a sched feature ANDROID: sched: Documentation for scheduler energy cost model ANDROID: arm64: Enable dynamic sched_domain flag setting ANDROID: arm: Enable dynamic sched_domain flag setting ANDROID: drivers/base/arch_topology: Dynamic sched_domain flag detection ANDROID: sched/fair: Avoid unnecessary balancing of asymmetric capacity groups ANDROID: sched: Consider misfit tasks when load-balancing ANDROID: sched: Add group_misfit_task load-balance type ANDROID: arm64: wire cpu-invariant accounting support up to the task scheduler ANDROID: arm64: wire frequency-invariant accounting support up to the task scheduler ANDROID: arm: wire cpu-invariant accounting support up to the task scheduler ANDROID: arm: wire frequency-invariant accounting support up to the task scheduler ANDROID: drivers base/arch_topology: allow inlining cpu-invariant accounting support ANDROID: drivers base/arch_topology: provide frequency-invariant accounting support ANDROID: cpufreq: dt: invoke frequency-invariance setter function ANDROID: cpufreq: arm_big_little: invoke frequency-invariance setter function ANDROID: cpufreq: provide default frequency-invariance setter function ANDROID: drivers base/arch_topology: free cpumask cpus_to_visit ANDROID: sched: Enable idle balance to pull single task towards cpu with higher capacity ANDROID: sched: Prevent unnecessary active balance of single task in sched group Conflicts: Documentation/admin-guide/kernel-parameters.txt Makefile arch/arm/configs/ranchu_defconfig arch/arm64/Kconfig arch/arm64/Makefile arch/arm64/boot/Makefile arch/arm64/configs/ranchu64_defconfig arch/arm64/kernel/io.c arch/arm64/kernel/process.c arch/arm64/mm/dma-mapping.c arch/x86/configs/i386_ranchu_defconfig arch/x86/configs/x86_64_ranchu_defconfig drivers/android/binder.c drivers/dma-buf/sw_sync.c drivers/md/Kconfig drivers/md/dm-android-verity.c drivers/md/dm-android-verity.h drivers/md/dm-linear.c drivers/mmc/core/Kconfig drivers/mmc/core/mmc.c drivers/power/supply/power_supply_sysfs.c drivers/staging/android/fiq_debugger/fiq_debugger.c drivers/staging/android/fiq_debugger/fiq_debugger_arm64.c drivers/usb/gadget/Kconfig drivers/usb/gadget/function/Makefile include/linux/power_supply.h init/initramfs.c kernel/power/suspend.c kernel/sched/sched.h net/netfilter/xt_qtaguid.c arch/arm/kernel/topology.c arch/arm64/boot/dts/hisilicon/hi6220.dtsi arch/arm64/kernel/topology.c drivers/base/arch_topology.c kernel/sched/fair.c kernel/sched/features.h kernel/sched/sched.h kernel/sched/topology.c Change-Id: Ib242448f01dae40bff6a4da72aa4619c44663e76 Signed-off-by: Runmin Wang <runminw@codeaurora.org>
649 lines
16 KiB
C
649 lines
16 KiB
C
/*
|
|
* kernel/power/suspend.c - Suspend to RAM and standby functionality.
|
|
*
|
|
* Copyright (c) 2003 Patrick Mochel
|
|
* Copyright (c) 2003 Open Source Development Lab
|
|
* Copyright (c) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
|
|
*
|
|
* This file is released under the GPLv2.
|
|
*/
|
|
|
|
#define pr_fmt(fmt) "PM: " fmt
|
|
|
|
#include <linux/string.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/init.h>
|
|
#include <linux/console.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/cpuidle.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/gfp.h>
|
|
#include <linux/io.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/list.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/export.h>
|
|
#include <linux/suspend.h>
|
|
#include <linux/syscore_ops.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/rtc.h>
|
|
#include <trace/events/power.h>
|
|
#include <linux/compiler.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/wakeup_reason.h>
|
|
|
|
#include "power.h"
|
|
|
|
const char * const pm_labels[] = {
|
|
[PM_SUSPEND_TO_IDLE] = "freeze",
|
|
[PM_SUSPEND_STANDBY] = "standby",
|
|
[PM_SUSPEND_MEM] = "mem",
|
|
};
|
|
const char *pm_states[PM_SUSPEND_MAX];
|
|
static const char * const mem_sleep_labels[] = {
|
|
[PM_SUSPEND_TO_IDLE] = "s2idle",
|
|
[PM_SUSPEND_STANDBY] = "shallow",
|
|
[PM_SUSPEND_MEM] = "deep",
|
|
};
|
|
const char *mem_sleep_states[PM_SUSPEND_MAX];
|
|
|
|
suspend_state_t mem_sleep_current = PM_SUSPEND_TO_IDLE;
|
|
suspend_state_t mem_sleep_default = PM_SUSPEND_MAX;
|
|
suspend_state_t pm_suspend_target_state;
|
|
EXPORT_SYMBOL_GPL(pm_suspend_target_state);
|
|
|
|
unsigned int pm_suspend_global_flags;
|
|
EXPORT_SYMBOL_GPL(pm_suspend_global_flags);
|
|
|
|
static const struct platform_suspend_ops *suspend_ops;
|
|
static const struct platform_s2idle_ops *s2idle_ops;
|
|
static DECLARE_WAIT_QUEUE_HEAD(s2idle_wait_head);
|
|
|
|
enum s2idle_states __read_mostly s2idle_state;
|
|
static DEFINE_SPINLOCK(s2idle_lock);
|
|
|
|
void s2idle_set_ops(const struct platform_s2idle_ops *ops)
|
|
{
|
|
lock_system_sleep();
|
|
s2idle_ops = ops;
|
|
unlock_system_sleep();
|
|
}
|
|
|
|
static void s2idle_begin(void)
|
|
{
|
|
s2idle_state = S2IDLE_STATE_NONE;
|
|
}
|
|
|
|
static void s2idle_enter(void)
|
|
{
|
|
trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE, true);
|
|
|
|
spin_lock_irq(&s2idle_lock);
|
|
if (pm_wakeup_pending())
|
|
goto out;
|
|
|
|
s2idle_state = S2IDLE_STATE_ENTER;
|
|
spin_unlock_irq(&s2idle_lock);
|
|
|
|
get_online_cpus();
|
|
cpuidle_resume();
|
|
|
|
/* Push all the CPUs into the idle loop. */
|
|
wake_up_all_idle_cpus();
|
|
/* Make the current CPU wait so it can enter the idle loop too. */
|
|
wait_event(s2idle_wait_head,
|
|
s2idle_state == S2IDLE_STATE_WAKE);
|
|
|
|
cpuidle_pause();
|
|
put_online_cpus();
|
|
|
|
spin_lock_irq(&s2idle_lock);
|
|
|
|
out:
|
|
s2idle_state = S2IDLE_STATE_NONE;
|
|
spin_unlock_irq(&s2idle_lock);
|
|
|
|
trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE, false);
|
|
}
|
|
|
|
static void s2idle_loop(void)
|
|
{
|
|
pm_pr_dbg("suspend-to-idle\n");
|
|
|
|
for (;;) {
|
|
int error;
|
|
|
|
dpm_noirq_begin();
|
|
|
|
/*
|
|
* Suspend-to-idle equals
|
|
* frozen processes + suspended devices + idle processors.
|
|
* Thus s2idle_enter() should be called right after
|
|
* all devices have been suspended.
|
|
*
|
|
* Wakeups during the noirq suspend of devices may be spurious,
|
|
* so prevent them from terminating the loop right away.
|
|
*/
|
|
error = dpm_noirq_suspend_devices(PMSG_SUSPEND);
|
|
if (!error)
|
|
s2idle_enter();
|
|
else if (error == -EBUSY && pm_wakeup_pending())
|
|
error = 0;
|
|
|
|
if (!error && s2idle_ops && s2idle_ops->wake)
|
|
s2idle_ops->wake();
|
|
|
|
dpm_noirq_resume_devices(PMSG_RESUME);
|
|
|
|
dpm_noirq_end();
|
|
|
|
if (error)
|
|
break;
|
|
|
|
if (s2idle_ops && s2idle_ops->sync)
|
|
s2idle_ops->sync();
|
|
|
|
if (pm_wakeup_pending())
|
|
break;
|
|
|
|
pm_wakeup_clear(false);
|
|
}
|
|
|
|
pm_pr_dbg("resume from suspend-to-idle\n");
|
|
}
|
|
|
|
void s2idle_wake(void)
|
|
{
|
|
unsigned long flags;
|
|
|
|
spin_lock_irqsave(&s2idle_lock, flags);
|
|
if (s2idle_state > S2IDLE_STATE_NONE) {
|
|
s2idle_state = S2IDLE_STATE_WAKE;
|
|
wake_up(&s2idle_wait_head);
|
|
}
|
|
spin_unlock_irqrestore(&s2idle_lock, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(s2idle_wake);
|
|
|
|
static bool valid_state(suspend_state_t state)
|
|
{
|
|
/*
|
|
* PM_SUSPEND_STANDBY and PM_SUSPEND_MEM states need low level
|
|
* support and need to be valid to the low level
|
|
* implementation, no valid callback implies that none are valid.
|
|
*/
|
|
return suspend_ops && suspend_ops->valid && suspend_ops->valid(state);
|
|
}
|
|
|
|
void __init pm_states_init(void)
|
|
{
|
|
/* "mem" and "freeze" are always present in /sys/power/state. */
|
|
pm_states[PM_SUSPEND_MEM] = pm_labels[PM_SUSPEND_MEM];
|
|
pm_states[PM_SUSPEND_TO_IDLE] = pm_labels[PM_SUSPEND_TO_IDLE];
|
|
/*
|
|
* Suspend-to-idle should be supported even without any suspend_ops,
|
|
* initialize mem_sleep_states[] accordingly here.
|
|
*/
|
|
mem_sleep_states[PM_SUSPEND_TO_IDLE] = mem_sleep_labels[PM_SUSPEND_TO_IDLE];
|
|
}
|
|
|
|
static int __init mem_sleep_default_setup(char *str)
|
|
{
|
|
suspend_state_t state;
|
|
|
|
for (state = PM_SUSPEND_TO_IDLE; state <= PM_SUSPEND_MEM; state++)
|
|
if (mem_sleep_labels[state] &&
|
|
!strcmp(str, mem_sleep_labels[state])) {
|
|
mem_sleep_default = state;
|
|
break;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
__setup("mem_sleep_default=", mem_sleep_default_setup);
|
|
|
|
/**
|
|
* suspend_set_ops - Set the global suspend method table.
|
|
* @ops: Suspend operations to use.
|
|
*/
|
|
void suspend_set_ops(const struct platform_suspend_ops *ops)
|
|
{
|
|
lock_system_sleep();
|
|
|
|
suspend_ops = ops;
|
|
|
|
if (valid_state(PM_SUSPEND_STANDBY)) {
|
|
mem_sleep_states[PM_SUSPEND_STANDBY] = mem_sleep_labels[PM_SUSPEND_STANDBY];
|
|
pm_states[PM_SUSPEND_STANDBY] = pm_labels[PM_SUSPEND_STANDBY];
|
|
if (mem_sleep_default == PM_SUSPEND_STANDBY)
|
|
mem_sleep_current = PM_SUSPEND_STANDBY;
|
|
}
|
|
if (valid_state(PM_SUSPEND_MEM)) {
|
|
mem_sleep_states[PM_SUSPEND_MEM] = mem_sleep_labels[PM_SUSPEND_MEM];
|
|
if (mem_sleep_default >= PM_SUSPEND_MEM)
|
|
mem_sleep_current = PM_SUSPEND_MEM;
|
|
}
|
|
|
|
unlock_system_sleep();
|
|
}
|
|
EXPORT_SYMBOL_GPL(suspend_set_ops);
|
|
|
|
/**
|
|
* suspend_valid_only_mem - Generic memory-only valid callback.
|
|
*
|
|
* Platform drivers that implement mem suspend only and only need to check for
|
|
* that in their .valid() callback can use this instead of rolling their own
|
|
* .valid() callback.
|
|
*/
|
|
int suspend_valid_only_mem(suspend_state_t state)
|
|
{
|
|
return state == PM_SUSPEND_MEM;
|
|
}
|
|
EXPORT_SYMBOL_GPL(suspend_valid_only_mem);
|
|
|
|
static bool sleep_state_supported(suspend_state_t state)
|
|
{
|
|
return state == PM_SUSPEND_TO_IDLE || (suspend_ops && suspend_ops->enter);
|
|
}
|
|
|
|
static int platform_suspend_prepare(suspend_state_t state)
|
|
{
|
|
return state != PM_SUSPEND_TO_IDLE && suspend_ops->prepare ?
|
|
suspend_ops->prepare() : 0;
|
|
}
|
|
|
|
static int platform_suspend_prepare_late(suspend_state_t state)
|
|
{
|
|
return state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->prepare ?
|
|
s2idle_ops->prepare() : 0;
|
|
}
|
|
|
|
static int platform_suspend_prepare_noirq(suspend_state_t state)
|
|
{
|
|
return state != PM_SUSPEND_TO_IDLE && suspend_ops->prepare_late ?
|
|
suspend_ops->prepare_late() : 0;
|
|
}
|
|
|
|
static void platform_resume_noirq(suspend_state_t state)
|
|
{
|
|
if (state != PM_SUSPEND_TO_IDLE && suspend_ops->wake)
|
|
suspend_ops->wake();
|
|
}
|
|
|
|
static void platform_resume_early(suspend_state_t state)
|
|
{
|
|
if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->restore)
|
|
s2idle_ops->restore();
|
|
}
|
|
|
|
static void platform_resume_finish(suspend_state_t state)
|
|
{
|
|
if (state != PM_SUSPEND_TO_IDLE && suspend_ops->finish)
|
|
suspend_ops->finish();
|
|
}
|
|
|
|
static int platform_suspend_begin(suspend_state_t state)
|
|
{
|
|
if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->begin)
|
|
return s2idle_ops->begin();
|
|
else if (suspend_ops && suspend_ops->begin)
|
|
return suspend_ops->begin(state);
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
static void platform_resume_end(suspend_state_t state)
|
|
{
|
|
if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->end)
|
|
s2idle_ops->end();
|
|
else if (suspend_ops && suspend_ops->end)
|
|
suspend_ops->end();
|
|
}
|
|
|
|
static void platform_recover(suspend_state_t state)
|
|
{
|
|
if (state != PM_SUSPEND_TO_IDLE && suspend_ops->recover)
|
|
suspend_ops->recover();
|
|
}
|
|
|
|
static bool platform_suspend_again(suspend_state_t state)
|
|
{
|
|
return state != PM_SUSPEND_TO_IDLE && suspend_ops->suspend_again ?
|
|
suspend_ops->suspend_again() : false;
|
|
}
|
|
|
|
#ifdef CONFIG_PM_DEBUG
|
|
static unsigned int pm_test_delay = 5;
|
|
module_param(pm_test_delay, uint, 0644);
|
|
MODULE_PARM_DESC(pm_test_delay,
|
|
"Number of seconds to wait before resuming from suspend test");
|
|
#endif
|
|
|
|
static int suspend_test(int level)
|
|
{
|
|
#ifdef CONFIG_PM_DEBUG
|
|
if (pm_test_level == level) {
|
|
pr_info("suspend debug: Waiting for %d second(s).\n",
|
|
pm_test_delay);
|
|
mdelay(pm_test_delay * 1000);
|
|
return 1;
|
|
}
|
|
#endif /* !CONFIG_PM_DEBUG */
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* suspend_prepare - Prepare for entering system sleep state.
|
|
*
|
|
* Common code run for every system sleep state that can be entered (except for
|
|
* hibernation). Run suspend notifiers, allocate the "suspend" console and
|
|
* freeze processes.
|
|
*/
|
|
static int suspend_prepare(suspend_state_t state)
|
|
{
|
|
int error, nr_calls = 0;
|
|
|
|
if (!sleep_state_supported(state))
|
|
return -EPERM;
|
|
|
|
pm_prepare_console();
|
|
|
|
error = __pm_notifier_call_chain(PM_SUSPEND_PREPARE, -1, &nr_calls);
|
|
if (error) {
|
|
nr_calls--;
|
|
goto Finish;
|
|
}
|
|
|
|
trace_suspend_resume(TPS("freeze_processes"), 0, true);
|
|
error = suspend_freeze_processes();
|
|
trace_suspend_resume(TPS("freeze_processes"), 0, false);
|
|
if (!error)
|
|
return 0;
|
|
|
|
suspend_stats.failed_freeze++;
|
|
dpm_save_failed_step(SUSPEND_FREEZE);
|
|
Finish:
|
|
__pm_notifier_call_chain(PM_POST_SUSPEND, nr_calls, NULL);
|
|
pm_restore_console();
|
|
return error;
|
|
}
|
|
|
|
/* default implementation */
|
|
void __weak arch_suspend_disable_irqs(void)
|
|
{
|
|
local_irq_disable();
|
|
}
|
|
|
|
/* default implementation */
|
|
void __weak arch_suspend_enable_irqs(void)
|
|
{
|
|
local_irq_enable();
|
|
}
|
|
|
|
/**
|
|
* suspend_enter - Make the system enter the given sleep state.
|
|
* @state: System sleep state to enter.
|
|
* @wakeup: Returns information that the sleep state should not be re-entered.
|
|
*
|
|
* This function should be called after devices have been suspended.
|
|
*/
|
|
static int suspend_enter(suspend_state_t state, bool *wakeup)
|
|
{
|
|
char suspend_abort[MAX_SUSPEND_ABORT_LEN];
|
|
int error, last_dev;
|
|
|
|
error = platform_suspend_prepare(state);
|
|
if (error)
|
|
goto Platform_finish;
|
|
|
|
error = dpm_suspend_late(PMSG_SUSPEND);
|
|
if (error) {
|
|
last_dev = suspend_stats.last_failed_dev + REC_FAILED_NUM - 1;
|
|
last_dev %= REC_FAILED_NUM;
|
|
pr_err("late suspend of devices failed\n");
|
|
log_suspend_abort_reason("%s device failed to power down",
|
|
suspend_stats.failed_devs[last_dev]);
|
|
goto Platform_finish;
|
|
}
|
|
error = platform_suspend_prepare_late(state);
|
|
if (error)
|
|
goto Devices_early_resume;
|
|
|
|
if (state == PM_SUSPEND_TO_IDLE && pm_test_level != TEST_PLATFORM) {
|
|
s2idle_loop();
|
|
goto Platform_early_resume;
|
|
}
|
|
|
|
error = dpm_suspend_noirq(PMSG_SUSPEND);
|
|
if (error) {
|
|
last_dev = suspend_stats.last_failed_dev + REC_FAILED_NUM - 1;
|
|
last_dev %= REC_FAILED_NUM;
|
|
pr_err("noirq suspend of devices failed\n");
|
|
log_suspend_abort_reason("noirq suspend of %s device failed",
|
|
suspend_stats.failed_devs[last_dev]);
|
|
goto Platform_early_resume;
|
|
}
|
|
error = platform_suspend_prepare_noirq(state);
|
|
if (error)
|
|
goto Platform_wake;
|
|
|
|
if (suspend_test(TEST_PLATFORM))
|
|
goto Platform_wake;
|
|
|
|
error = disable_nonboot_cpus();
|
|
if (error || suspend_test(TEST_CPUS)) {
|
|
log_suspend_abort_reason("Disabling non-boot cpus failed");
|
|
goto Enable_cpus;
|
|
}
|
|
|
|
arch_suspend_disable_irqs();
|
|
BUG_ON(!irqs_disabled());
|
|
|
|
error = syscore_suspend();
|
|
if (!error) {
|
|
*wakeup = pm_wakeup_pending();
|
|
if (!(suspend_test(TEST_CORE) || *wakeup)) {
|
|
trace_suspend_resume(TPS("machine_suspend"),
|
|
state, true);
|
|
error = suspend_ops->enter(state);
|
|
trace_suspend_resume(TPS("machine_suspend"),
|
|
state, false);
|
|
} else if (*wakeup) {
|
|
pm_get_active_wakeup_sources(suspend_abort,
|
|
MAX_SUSPEND_ABORT_LEN);
|
|
log_suspend_abort_reason(suspend_abort);
|
|
error = -EBUSY;
|
|
}
|
|
syscore_resume();
|
|
}
|
|
|
|
arch_suspend_enable_irqs();
|
|
BUG_ON(irqs_disabled());
|
|
|
|
Enable_cpus:
|
|
enable_nonboot_cpus();
|
|
|
|
Platform_wake:
|
|
platform_resume_noirq(state);
|
|
dpm_resume_noirq(PMSG_RESUME);
|
|
|
|
Platform_early_resume:
|
|
platform_resume_early(state);
|
|
|
|
Devices_early_resume:
|
|
dpm_resume_early(PMSG_RESUME);
|
|
|
|
Platform_finish:
|
|
platform_resume_finish(state);
|
|
return error;
|
|
}
|
|
|
|
/**
|
|
* suspend_devices_and_enter - Suspend devices and enter system sleep state.
|
|
* @state: System sleep state to enter.
|
|
*/
|
|
int suspend_devices_and_enter(suspend_state_t state)
|
|
{
|
|
int error;
|
|
bool wakeup = false;
|
|
|
|
if (!sleep_state_supported(state))
|
|
return -ENOSYS;
|
|
|
|
pm_suspend_target_state = state;
|
|
|
|
error = platform_suspend_begin(state);
|
|
if (error)
|
|
goto Close;
|
|
|
|
suspend_console();
|
|
suspend_test_start();
|
|
error = dpm_suspend_start(PMSG_SUSPEND);
|
|
if (error) {
|
|
pr_err("Some devices failed to suspend, or early wake event detected\n");
|
|
log_suspend_abort_reason("Some devices failed to suspend, or early wake event detected");
|
|
goto Recover_platform;
|
|
}
|
|
suspend_test_finish("suspend devices");
|
|
if (suspend_test(TEST_DEVICES))
|
|
goto Recover_platform;
|
|
|
|
do {
|
|
error = suspend_enter(state, &wakeup);
|
|
} while (!error && !wakeup && platform_suspend_again(state));
|
|
|
|
Resume_devices:
|
|
suspend_test_start();
|
|
dpm_resume_end(PMSG_RESUME);
|
|
suspend_test_finish("resume devices");
|
|
trace_suspend_resume(TPS("resume_console"), state, true);
|
|
resume_console();
|
|
trace_suspend_resume(TPS("resume_console"), state, false);
|
|
|
|
Close:
|
|
platform_resume_end(state);
|
|
pm_suspend_target_state = PM_SUSPEND_ON;
|
|
return error;
|
|
|
|
Recover_platform:
|
|
platform_recover(state);
|
|
goto Resume_devices;
|
|
}
|
|
|
|
/**
|
|
* suspend_finish - Clean up before finishing the suspend sequence.
|
|
*
|
|
* Call platform code to clean up, restart processes, and free the console that
|
|
* we've allocated. This routine is not called for hibernation.
|
|
*/
|
|
static void suspend_finish(void)
|
|
{
|
|
suspend_thaw_processes();
|
|
pm_notifier_call_chain(PM_POST_SUSPEND);
|
|
pm_restore_console();
|
|
}
|
|
|
|
/**
|
|
* enter_state - Do common work needed to enter system sleep state.
|
|
* @state: System sleep state to enter.
|
|
*
|
|
* Make sure that no one else is trying to put the system into a sleep state.
|
|
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
|
|
* system enter the given sleep state and clean up after wakeup.
|
|
*/
|
|
static int enter_state(suspend_state_t state)
|
|
{
|
|
int error;
|
|
|
|
trace_suspend_resume(TPS("suspend_enter"), state, true);
|
|
if (state == PM_SUSPEND_TO_IDLE) {
|
|
#ifdef CONFIG_PM_DEBUG
|
|
if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
|
|
pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n");
|
|
return -EAGAIN;
|
|
}
|
|
#endif
|
|
} else if (!valid_state(state)) {
|
|
return -EINVAL;
|
|
}
|
|
if (!mutex_trylock(&pm_mutex))
|
|
return -EBUSY;
|
|
|
|
if (state == PM_SUSPEND_TO_IDLE)
|
|
s2idle_begin();
|
|
|
|
#ifndef CONFIG_SUSPEND_SKIP_SYNC
|
|
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
|
|
pr_info("Syncing filesystems ... ");
|
|
sys_sync();
|
|
pr_cont("done.\n");
|
|
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
|
|
#endif
|
|
|
|
pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
|
|
pm_suspend_clear_flags();
|
|
error = suspend_prepare(state);
|
|
if (error)
|
|
goto Unlock;
|
|
|
|
if (suspend_test(TEST_FREEZER))
|
|
goto Finish;
|
|
|
|
trace_suspend_resume(TPS("suspend_enter"), state, false);
|
|
pm_pr_dbg("Suspending system (%s)\n", mem_sleep_labels[state]);
|
|
pm_restrict_gfp_mask();
|
|
error = suspend_devices_and_enter(state);
|
|
pm_restore_gfp_mask();
|
|
|
|
Finish:
|
|
events_check_enabled = false;
|
|
pm_pr_dbg("Finishing wakeup.\n");
|
|
suspend_finish();
|
|
Unlock:
|
|
mutex_unlock(&pm_mutex);
|
|
return error;
|
|
}
|
|
|
|
static void pm_suspend_marker(char *annotation)
|
|
{
|
|
struct timespec ts;
|
|
struct rtc_time tm;
|
|
|
|
getnstimeofday(&ts);
|
|
rtc_time_to_tm(ts.tv_sec, &tm);
|
|
pr_info("PM: suspend %s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n",
|
|
annotation, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
|
tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec);
|
|
}
|
|
|
|
/**
|
|
* pm_suspend - Externally visible function for suspending the system.
|
|
* @state: System sleep state to enter.
|
|
*
|
|
* Check if the value of @state represents one of the supported states,
|
|
* execute enter_state() and update system suspend statistics.
|
|
*/
|
|
int pm_suspend(suspend_state_t state)
|
|
{
|
|
int error;
|
|
|
|
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
|
|
return -EINVAL;
|
|
|
|
pm_suspend_marker("entry");
|
|
pr_info("suspend entry (%s)\n", mem_sleep_labels[state]);
|
|
error = enter_state(state);
|
|
if (error) {
|
|
suspend_stats.fail++;
|
|
dpm_save_failed_errno(error);
|
|
} else {
|
|
suspend_stats.success++;
|
|
}
|
|
pm_suspend_marker("exit");
|
|
pr_info("suspend exit\n");
|
|
return error;
|
|
}
|
|
EXPORT_SYMBOL(pm_suspend);
|