The list_for_each macro was not used correctly, where the intermediate
variable would be LIST_POISON, resulting in a untrusted pointer
dereference. Switch to using list_for_each_entry_safe to for safe
removal of a list entry.
Bug: 72956998
Change-Id: I0e0fd5dd9f251b5093d6e9d6335387512ec59249
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJVv5fSAAoJEDjbvchgkmk+cCEP/08rxgFQc0/T4NHeojs8WJHm
lJKa+EqW9zEPiuCQ9b+MpXHHnvvwCLQ/aSW0f4kg6795jXW9xmea0iUDiGHV8sck
3M6Mg4rnrpOxfDUQYf6n1ajOGCtyCunjbekSD+qt5+gyjmj7Zn1xU+1iuyvaFouY
mnEH5VdBpOLkYLLH5mz996yFi95cSUrXUDNWEybUG0ce+T5rAPmwrzoqs6VAQ+8f
sPHYtWCY1Rdnww203L02Ske57GXk/yikEbEqTruVjg4i43XANfMUOYPZ6gfQV12J
Rzfb54XhXkMfgH5BYirKcAy3h/CMqw0AlxRWazyrJGshSIlw4Ftznrr1q9ba2720
4haXDmc5apJ0FG1Xl63+zhpQvJgKPAJ/BrFUqM7nQC4+IkcWNGfslygJCUcnoizT
SlmohUSYyeFZtqKtr5uO7FIVP6M73g7ZBDGOgWjWXTuFlqVCEM+14Tn/2acIBuBU
R5/c+ZNEjm/XQXHdHJIPNztG+hDxhHTrCtG8MwVabC+/2IjMyzJZFctEErKC7jI4
+n4TG2SfU06ypVHFRmhCc7xRrC29W0GYQ2nMgWVslL2E2cT3ttZeQA0osOT7vvtO
CgNZFub/bWXvhh9yeKeWr2tRijCcnjH4tK0Tf9SuY+JYz3lIkQb9MdaScuZKxl2g
mwDqJkXxXNwaNI6KeL09
=OvlT
-----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEJDfLduVEy2qz2d/TmXOSYMtstxYFAlpqbtgACgkQmXOSYMts
txZsgQ/6AsdHDYDrjM4MPw0EGej1oLq3QlYuCfRSFhtPYVPimDZJ7uc+8s5Cx143
M1ifgn9ZFXhteg0sMnwbV410CXaqc/4WZWnj0yMpTsP/SoMWPs/3gJhc+9wYnFvD
nP95ykDsH/vXlMyLjreQTZaRRhUWhMjJ8zTkzC+HaPw71B6k+KKBDEwdkxgu8u7p
TihWxAjqKULv41on088TdzX33lBsFD57z9JASjC27gxtlxBdYZsU3ZR1LiYHrXSb
Mc9CiETcj7reBQZzLo+IkLQK5S3WxMo/wMAUGh+20i4iEn07HGymsSgg1YsjtJ/a
aSmnqwPnGdcipM+RY0G4pGV4bit6OUp5La32rXnFGpp7JTYebp3C5f2NJGs/I7HY
KVwhmbS9lfHA8fpS6IG/WF/by9DsR/VTenBkCX3sQ3fggnkmIDceVv+TdnaITik0
/edZYK3vhENXfzeP1ZzpxE5husF9s63RwoStMvrEJot406KN72EBkrXcr0r2Jx/t
gzq+HSua929RjwE6MNMRMXPgGZA0if7JoWMXnBVHfWDFzvjgq68nI406imPN4ENM
kPJhclaHI+sgedO3PXlmnVSa44re37PQlUlQkmGGJjIRjWeI/GOC78+StDvRiJnn
4rj30RgwOJPvYTCpFPCjwNlkBlBPw79XiHaqIR5uU7uMCqhZ4E4=
=xdrR
-----END PGP SIGNATURE-----
Merge 3.10.85 into android-msm-bullhead-3.10-oreo-m5
Changes in 3.10.85: (90 commits)
ipr: Increase default adapter init stage change timeout
Disable write buffering on Toshiba ToPIC95
ALSA: hda - Add headset support to Acer Aspire V5
ALSA: hda - Fix the dock headphone output on Fujitsu Lifebook E780
ARC: add compiler barrier to LLSC based cmpxchg
arm64: Do not attempt to use init_mm in reset_context()
arm64: mm: Fix freeing of the wrong memmap entries with !SPARSEMEM_VMEMMAP
arm64: vdso: work-around broken ELF toolchains in Makefile
cpuidle / menu: Return (-1) if there are no suitable states
regmap: Fix regmap_bulk_read in BE mode
regulator: core: fix constraints output buffer
spi: pl022: Specify 'num-cs' property as required in devicetree binding
mtd: fix: avoid race condition when accessing mtd->usecount
mtd: dc21285: use raw spinlock functions for nw_gpio_lock
pinctrl: mvebu: armada-370: fix spi0 pin description
pinctrl: mvebu: armada-xp: remove non-existing NAND pins
pinctrl: mvebu: armada-xp: remove non-existing VDD cpu_pd functions
pinctrl: mvebu: armada-xp: fix functions of MPP48
Bluetooth: btusb: Fix memory leak in Intel setup routine
ath9k: fix DMA stop sequence for AR9003+
staging: rtl8712: prevent buffer overrun in recvbuf2recvframe
ext4: fix race between truncate and __ext4_journalled_writepage()
ext4: call sync_blockdev() before invalidate_bdev() in put_super()
ext4: don't retry file block mapping on bigalloc fs with non-extent file
ext4: fix reservation release on invalidatepage for delalloc fs
ext4: be more strict when migrating to non-extent based file
ext4: correctly migrate a file with a hole at the beginning
ext4: replace open coded nofail allocation in ext4_free_blocks()
jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail()
jbd2: fix ocfs2 corrupt when updating journal superblock fails
i2c: at91: fix a race condition when using the DMA controller
iio: DAC: ad5624r_spi: fix bit shift of output data value
af9013: Don't accept invalid bandwidth
s5h1420: fix a buffer overflow when checking userspace params
cx24116: fix a buffer overflow when checking userspace params
ASoC: wm8737: Fixup setting VMID Impedance control register
ASoC: wm8955: Fix setting wrong register for WM8955_K_8_0_MASK bits
ASoC: wm8903: Fix define for WM8903_VMID_RES_250K
ASoC: wm8960: the enum of "DAC Polarity" should be wm8960_enum[1]
libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for HP 250GB SATA disk VB0250EAVER
libata: increase the timeout when setting transfer mode
usb: dwc3: gadget: return error if command sent to DGCMD register fails
usb: dwc3: gadget: return error if command sent to DEPCMD register fails
usb: dwc3: Reset the transfer resource index on SET_INTERFACE
USB: devio: fix a condition in async_completed()
USB: cp210x: add ID for Aruba Networks controllers
USB: option: add 2020:4000 ID
usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function
dm btree remove: fix bug in redistribute3
dm btree: silence lockdep lock inversion in dm_btree_del()
mmc: block: Add missing mmc_blk_put() in power_ro_lock_show()
drm/qxl: Do not cause spice-server to clean our objects
drm/radeon: take the mode_config mutex when dealing with hpds (v2)
drm/radeon: Don't flush the GART TLB if rdev->gart.ptr == NULL
drm: add a check for x/y in drm_mode_setcrtc
xfs: fix remote symlinks on V5/CRC filesystems
vTPM: set virtual device before passing to ibmvtpm_reset_crq
libata: add ATA_HORKAGE_NOTRIM
libata: force disable trim for SuperSSpeed S238
tracing/filter: Do not WARN on operand count going below zero
tracing/filter: Do not allow infix to exceed end of string
tracing: Have branch tracer use recursive field of task struct
dmaengine: mv_xor: bug fix for racing condition in descriptors cleanup
hwmon: (mcp3021) Fix broken output scaling
md: fix a build warning
Btrfs: use kmem_cache_free when freeing entry in inode cache
fuse: initialize fc->release before calling it
crush: fix a bug in tree bucket decode
ACPICA: Tables: Fix an issue that FACS initialization is performed twice
iscsi-target: Convert iscsi_thread_set usage to kthread.h
iser-target: Fix possible deadlock in RDMA_CM connection error
iser-target: release stale iser connections
mmc: card: Fixup request missing in mmc_blk_issue_rw_rq
__bitmap_parselist: fix bug in empty string handling
mac80211: prevent possible crypto tx tailroom corruption
USB: usbfs: allow URBs to be reaped after disconnection
watchdog: omap: assert the counter being stopped before reprogramming
NFS: Fix size of NFSACL SETACL operations
fixing infinite OPEN loop in 4.0 stateid recovery
nfs: increase size of EXCHANGE_ID name string buffer
SUNRPC: Fix a memory leak in the backchannel code
9p: forgetting to cancel request on interrupted zero-copy RPC
9p: don't leave a half-initialized inode sitting around
rbd: use GFP_NOIO in rbd_obj_request_create()
agp/intel: Fix typo in needs_ilk_vtd_wa()
hpfs: hpfs_error: Remove static buffer, use vsprintf extension %pV instead
Fix firmware loader uevent buffer NULL pointer dereference
qla2xxx: Mark port lost when we receive an RSCN for it.
MIPS: KVM: Do not sign extend on unsigned MMIO load
Linux 3.10.85
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Conflicts:
drivers/usb/dwc3/gadget.c
commit 3836785a1bdcd6706c68ad46bf53adc0b057b310 upstream.
If there is a PM QoS latency limit and all of the sufficiently shallow
C-states are disabled, the cpuidle menu governor returns 0 which on
some systems is CPUIDLE_DRIVER_STATE_START and shouldn't be returned
if that C-state has been disabled.
Fix the issue by modifying the menu governor to return (-1) in such
situations.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[shilpab: Backport to 3.10.y
- adjust context
- add a check if 'next_state' is less than 0 in 'cpuidle_idle_call()',
this ensures that we exit 'cpuidle_idle_call()' if governor->select()
returns negative value]
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The lpm cpuidle driver does all its idle state calculations
in the driver, as opposed to in the governor. To avoid pointless
work, add a null cpuidle governor that returns fixed idle
state to move to, the result of which can be ignored.
Change-Id: I7e29513126e91023af13794792235bc4b5500d06
Signed-off-by: Riley Andrews <riandrews@google.com>
Free the allocated memory for level_name to avoid the
memory leak in regsiter_cpu_lpm_stats().
Change-Id: I24f0feff2e05963986eaaf54610a8a5ed079b692
Signed-off-by: Mohammed Khajapasha <mkhaja@codeaurora.org>
Cluster pm notifications without level information increases difficulty
and complexity for the registered drivers to figure out when the last
coherency level is going into power collapse.
Send notifications with level information that allows the registered
drivers to easily determine the cluster level that is going in/out of
power collapse.
There is an issue with this implementation. GIC driver saves and
restores the distributed registers as part of cluster notifications. On
newer platforms there are multiple cluster levels are defined (e.g l2,
cci etc). These cluster level notofications can happen independently.
On MSM platforms GIC is still active while the cluster sleeps in idle,
causing the GIC state to be overwritten with an incorrect previous state
of the interrupts. This leads to a system hang. Do not save and restore
on any L2 and higher cache coherency level sleep entry and exit.
Change-Id: I31918d6383f19e80fe3b064cfaf0b55e16b97eb6
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Add new module lpm-workarounds to support workarounds for
low power modes driver. Add workaround support for unvote
CX turbo vote during exit of rpm assisted power collapse.
On some targets rpm bumps up the CX to turbo while
coming out of power collapse, to reduce the power impact
of this the workaround is necessary.
Change-Id: I11b6e96f02dd3a0dec189ee568a1f7baa3e8894a
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
Cluster lpm's last executed level info needs to be initialized at probe.
This data when left uninitialized would result in the top level cluster
having an incorrect, lpm state, view of a child cluster. This incorrect
view could result in one of the following race conditions. CCI could be
programmed to enter a low power mode even though one of the cores is
online. RPM SPM interrupt may be masked by a core that is not the last
core in the system.
Change-Id: I663da7e9b5972ed572546c0d87ce8851ecf8e56b
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
struct lpm_cluster_level's mode is an array of enum representing
SPM low power modes. The current code compares the values in it
with enum msm_pm_sleep_mode which represents cpu sleep modes.
Fix this by comparing mode with SPM low power modes.
Change-Id: I49ae054298f4f8f71a4a4476c541db3ec69935d0
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
CCI auto hardware clock gating is exercised independent of CCI
SPM. To support auto hardware clock gating, disable CCI SPM when
clock gating lpm level is chosen.
Change-Id: Iec20be34708c85161675c977153ef7198d926346
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
On targets that support auto clock gating, spm needs to be disabled
for the hardware to do auto clock gating. If auto clock gating is not
supported or not used, spm needs to be left enabled when programmed
for clock gating.
Add driver support to keep the spm enabled, and, if qchannel interface
is present then add driver support to enable spm legacy mode. This
would keep the spm enabled for clock gating. Use the dt flag
qcom,use-spm-clock-gating to determine if spm needs to be used for
clock gating.
Also, fix lpm-levels driver to support clock gating and auto clock gating
modes.
Change-Id: I4c796d7e063633e41910e780ee2a05e5205db0bd
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Issue:
System hangs as soon as USB is unplugged from the device.
Cpu pm notifications are to be sent only in the power collapse path,
but it is sent when cpu enters any low power modes. This results in
undesired and unexpected behavior.
Send cpu pm notifications only for power collapse and idle path.
Change-Id: I779152cd05c65b116e9ac88856de729c1212fe16
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
CCI auto hardware clock gating is exercised independent of CCI
SPM. To support auto hardware clock gating, disable CCI SPM when
clock gating lpm level is chosen.
Change-Id: Ice9cfdb9277e8604b9ac02541907caa6d30e160a
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Currently, all the event timers are associated to CPU0. These event
timers are not bind to any of the IRQs and always handled(hrtimer)
by CPU0. This event timers framework make sure event timers are
bound to clients IRQs and when the IRQ affinity has changed event
timer framework will make sure to move associated event timer to
a new CPU based on IRQ affinity.
CRs-fixed: 719258
Change-Id: Idbce3d5195655f558f74c208216f75515d235b8e
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Similar to cpu pm notifications, send cluster notifications whenever a
cluster goes into low power mode. Ensure that cpu pm notifications are
sent out for the all the cpus on the power domain before cluster
notification is sent out.
CRs-fixed: 751893
Change-Id: Ib098d41c4ec750c7af8142bb99977d9b417bf2f0
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
The next event value could be NULL if there is no event
queued. Add a NULL check to avoid wrong calculation of
next wakeup time.
Change-Id: I1ddd8db1803c8f88e99c050e8e40fb6cb5326bda
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
LPM modes can fail if there is a pending IPI interrupt at GIC CPU
interface. On some usecases frequent failure of LPM modes can
cause power and performance degradation. Hence, prevent cluster
low power modes when there is a pending IPI on cluster CPUs.
Change-Id: Id8a0ac24e4867ef824e0a6f11d989f1e1a2b0e93
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
CPU's lpm level kobjects are dynamically allocated based on the
number of CPU's in that cluster. The kobject's are then indexed
using the cpu number. This results in the driver writing to and
using memory not allocated to it. Fix this by using an index
starting from zero to index into the allocated kobject array.
CRs-fixed: 739886
Change-Id: I033590c89ad800087007ed6ba60fe558c2221767
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
SAW2 3.0 supports RPM handshake using SAW2_SPM_CTL register for the
sleep command in the SPM sequence. This allows a single power collapse
sequence for both cases when we don't want to notify RPM on apps power
down and when we want to.
This implementation is the same across all IPs in the apps processor
subsystem, but only a few SAW modules are allowed to notify RPM and
handshake with RPM when executing the 0x03 sleep command. Disallow and
check incorrect call on SPM, based on the flag provided in the device
tree.
Based on this flag in DT, set the SLP_CMD_MODE bit in SPM_CTL
register. Fail to set the low power mode if we are trying to send
rpm notification for a mode that does not support rpm notification.
Change-Id: I5527bd8da62673d68867842dbd80000d67965e6a
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
An SPM is able to support Clock Gating along with the other low power
modes. Add support for parsing clock gating lpm mode in the lpm driver.
Change-Id: Idac6f7d415cfbe9490aef5c7933d72626e15acae
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Currently the cpuidle driver considers the mode selected by menu
governor for trace events. lpm_levels recalculates the cpu and system
modes within the enter_sleep function and overwrites the menu governor
mode selection with its decision. Due to this other modules that are
dependent on these tracepoints collect incorrect low power mode
information.
Move the tracepoint within lpm_levels such that the mode selected within
lpm-levels is correctly reported and traced.
Change-Id: I9059a107da21ceebe11ae83427d36a28cf3f1a8e
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
System level power collapse should only be configured from the last core
entering power collapse. Incorrect input parameters, when configuring
system level cluster power collapse, would result in the system having an
inconsistent view of the lpm status of one or more cores in a cluster.
This race condition would allow multiple cores to program the system level
cluster to enter power collapse. As part of configuring the system level
cluster to enter power collapse several operations are performed. Due to
the race condition these operations can end up being executed on a core
that is not the last core in the cluster. This duplicate execution could
result in a system state that is critical and nonrecoverable.
When configuring system level cluster power collapse, use a child mask that
identifies the current low power mode status of the children, to make sure
that the system level cluster power collapse is only configured by the last
child entering power collapse.
The check to see if the core that is attempting to configure system level
cluster for power collapse is indeed the last core, is a critical section.
Protect this check inside a spinlock.
CRs-fixed: 714779
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Change-Id: Ic44f1e12253ae508aa3a5d4962f77b1408b860f8
The pm_qos framework passes down a mask of cpus for which the qos has
changed. cpuidle driver uses this info to wakeup only those cpus for the
new qos to take effect. This would prevent waking up cpus for which the qos
values remains unchanged.
Change-Id: Ibb79937674a8f16920c6b8f224a21d2f72a0f9ce
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
The scheduler currently receives the low power mode level that a CPU
is about to enter whereby 0 indicates the shallowest sleep state and
higher numbers indicate deeper sleep states. The scheduler, however,
operates on the notion of C-states whereby 0 indicates an active state
and a higher numbers indicate different sleep states. Due to this
mismatch the scheduler is unable to distinguish between an active CPU
and a CPU in the shallowest sleep state. Fix this by translating the
low power mode level to the appropriate C-state before communicating
it to the scheduler.
Change-Id: I60d985626cb799d436172c00861f05538c2b382a
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
If CPU hotplug is initiated before probe, the L2 of the cluster is not
configured for any low power mode and is not flushed. This results in data
incoherencies in ramdumps in particular, if the system crashed after.
To ensure that L2 is flushed, flush L2 during hotplug until lpm-levels
module is probed
CRs-fixed: 715757
Change-Id: I0fb203da68e78d4f0c4acf96db9e5863268d1f52
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
trace_cpu_idle_rcuidle() can end up waking ksoftirqd under certain
conditions. Since there is no check for need_resched() following
this wake up, the cpu ends up going into an idle state despite there
being a runnable task on that runqueue. Furthermore, since the
resched flag is set, any sucessive waking up tasks on the idle cpu
will not result in an IPI being sent to that cpu. Consequently tasks
on that runqueue will starve until the cpu exits idle by itself. Fix
this problem by adding a need_resched() check after the idle entry
trace event.
A side effect of this change is that the idle trace entry and exit
event may be recorded for an extremely short duration even though
the cpu does not actually enter idle.
Change-Id: I370c39a1e39ecd829e44ac783b4888a00ab05eae
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
When selecting a cluster level, if a level can result in sleep set
transition and there are pending rpm acks, then ignore that level in the
search for the best cluster level.
CRs-fixed: 705303
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Change-Id: I915297b0b74c013bdeb69026e69204e7c6dc39b1
The coresight save/restore functions needs to be called when the L2 of the
respective clusters are placed in power collapse/GDHS. On a multi-cluster
system, keeping track of this using a static variable could result in
incorrect save/restore of CTI registers. Fix by using a variable
associated with a cluster.
Change-Id: Ib4ba5790af2a9e3bc245f1ef5010930b5cf4921c
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Cpu node name is printed in error case when its matching
node is not found. If cpu_node is NULL we must avoid its
dereference. Move the print statement so that it is not
accessed when cpu node variable is NULL.
Change-Id: I373d668403c61e9fce76d1d5b4d0f225fa277d16
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
Scheduler needs to distinguish cpus that are in different C-states.
Having information on C-states, especially the cost of exiting a
particular state will help the scheduler make better task placement
decisions.
This patch extends the msm power management driver to provide required
information to the scheduler.
Change-Id: I569d5f8b3e18b0444e5517be500e82bf27d3d22f
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
When sending sleep-set requests send up 24 requests before reading any
acks. The RX FIFO can hold 24 acks. Increase the threshold to the
max number of acks the FIFO can hold, so as to delay the process of
emptying the FIFO.
Also check and return an err on timeout and propagate that error up the
call chain.
Change-Id: Ic774fad65fbaa1906fcc7c51ab0d8b3766b8a987
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Only cluster_enter events log for default levels causes
inconsistency. Log them only if the any low power mode is selected.
CRs-fixed: 692014
Change-Id: I5c549c1f9139d67a73e288a0393a19e52e9d2412
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>