block: Adding ROW scheduling algorithm

This patch adds the implementation of a new scheduling algorithm - ROW.
The policy of this algorithm is to prioritize READ requests over WRITE
as much as possible without starving the WRITE requests.
The requests are kept in queues according to their priority. The dispatch
is done in a Round Robin manner with a different slice for each queue.
READ request queues get bigger dispatch quantum than the write requests.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Reduce swappiness to 40

reduce page swap

Signed-off-by: Harsh Bhanvadia <harsh.slade@gmail.com>
Increase readahead to 512kb
Use ROW scheduler as default
mako: msm: Fix correct topology for qseecom bus scaling.

Conflicts:
	arch/arm/mach-msm/lge/mako/board-mako.c
qseecom: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

Change-Id: If78e8a3aa66209b93449569cc9bd670b8d21008c
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
qseecom:  Fix failure to release qseecom handle

qseecom_release() returns a failure, if it is unable to find
app_id of zero, associated with the handle in the app list.

There exists scenarios where the handle may not have the
app_id initialized and remain to be 0.  In these scenarios,
once the uninitialized zero app_id is not found in the list,
it returns a failure.

Fix to this is look for non-zero valid app_id in the app_list when
releasing the handle.

Change-Id: If0bf918a6397d8d5f925abde895b096dab76a9bb
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
msm: boards: Enable Krait Retention.

Add SPM sequences to do Krait retention for 8960,8930
and 8064. Also added a new rpmrs level containing the
latencies and power measurements for this new low power
state.

CRs-Fixed: 369864
Change-Id: Ib30a9a978cf38b35037810a4001c9277837acd4c
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
qseecom:Fix race condition while voting for clocks

In the current functionality, if DFAB clock is already on and a
request is made to turn on SFPB clock, the DFAB clock is turned
off and SFPB clock is turned on and vice-versa.

The above situation can lead to unexpected errors. The current fix
makes sure that clocks that are on are not voted to be off without
explicit request.

Change-Id: I6c3230e23b105c049cdb0aace579b8a176328c84
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
msm: dcvs: change tz buffer to 32KB

Only around 32K of buffer is required for normal operation.
Request the scm buffer of 32kb from the contiguous area.

Change-Id: If79471c6e0cfe80b1796a14d83ea10eb6b919e40
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/msm_dcvs.c
msm: pm: Support for Krait Retention

Introduce a new low power state for Krait, retention.
This state will lower the voltage to the Krait core to
retention voltage in addition to clock gating. This state
will be in between WFI and Standalone power collapse in
terms of time overhead and power savings.

Change-Id: I6b1f0a0d2e4954a705a047fd4a07f4dd1fb3518a
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
msm: pm-8x60: Fix bug where device enter low power mode

An incorrect ordering in the check of allowed modes, results in
standalone power collapse not getting selected when the secondary
cores are online.

Change-Id: Idc7177b78bd0ce7563cc27afbf6c12d3bc1f9f9a
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
msm: pm: Add support for retention on each core

Allow each core on 8974 to enter retention and retain
the state of the CPU. On 8960 as hardware restriction does
not permit all cores to enter retention at the same time,
allow only core 0 to enter retention when all other cores
are offline to maintain backward compatibility.

Change-Id: I6690e901afc9fa3a27010c264fa3acc9a0722c1a
Signed-off-by: Priyanka Mathur <pmathur@codeaurora.org>
msm: usb_bam : Add support for CI2.0 HSUSB BAM

Add support for both HSUSB and SSUSB BAM devices using device
tree. User can select required BAM device using below commands:
->To select SSUSB BAM:
	echo ssusb > /sys/bus/platform/devices/usb_bam/enable
->To select HSUSB BAM:
	echo hsusb > /sys/bus/platform/devices/usb_bam/enable

On some targets there is no SPS dedicated pipe memory for USB
BAM, hence, allow user to specify the type of memory used by
the BAM devices, which can be one of the type:
-SPS's dedidated pipe memory (DEFAULT), or
-USB Core's dedicated internal memory, or
-System memory that should be allocated by this driver

Change-Id: I5e5421c45fa611bc1ab2cdc81813c77d1329a8af
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
msm: usb_bam: Use USB3 private memory for CI2.0 USB BAM FIFOs

Some peripheral BAMs e.g. QDSS cannot access DDR or any other
system memory but they can access USB3 private memory. Hence,
add support for using USB3 private memory with CI2.0 USB BAM.

This requires specifying BAM FIFOs' starting address and length
in USB private memory and configuring QSCRACTH RAM1 register
to let USB3 core know about the part of internal memory getting
used as BAM FIFO and it shouldn't try to access that. Also
turn ON clocks are required to access the memory as part of
cable connect and turn OFF on cable disconnect.

Change-Id: Iaa0ba67cd54aa3eaae784d0be3f16f67974083e1
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
msm: usb_bam: Request SPS to ignore ACK from USB core for PIPE RESET

USB 2.0 core doesn't support RESET ACK signal to BAM performing
pipe reset. Hence, request SPS to disable this otherwise USB BAM
reports errror during connect.

Change-Id: I54374a194faf2f886b07cd4aa9eae17f8e19ca52
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
msm: usb_bam: Fix NULL pointer dereferences

usb_bam_connect() might still be called even if the usb_bam
platform device does not exist. Make sure to check that usb_bam_pdev
is not NULL before attempting to initialize the SPS pipes. Also
clean up other pdev instances in the dev_attr functions.

Change-Id: I0702f6b18eeb67783e9e84d502d64b1042c36c96
Signed-off-by: Jack Pham <jackp@codeaurora.org>
msm: ipa: add Driver for the IPA core

The IPA (Internet Protocol Accelerator) driver provides an API for
interacting with the IPA HW.
Kernel and user-space processes can call the IPA driver
to configure IPA.
Kernel processes can also use IPA driver as a data
transport for traffic to/from apps including exception traffic.
Exception traffic is any traffic that cannot be handled by IPA HW
or is specially marked through SW configuration.
Such traffic will always be sent to apps for further processing.

Change-Id: Ia940176536079a7cf7a78f49b5ea82288a0638d4
Signed-off-by: Talel Atias <tatias@codeaurora.org>
usb: usb_bam: Add support to USB-IPA BAM2BAM connection

Add support to the USB BAM driver in USB-IPA connections.
IPA (IP Accelerator) is a new HW block which implements data packet
protocol processing functions.

Change-Id: I3e782951ba7c9307c4e67f6ad44213ec7debf8ed
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
msm: ipa: IPA Driver stub functions addition

Adding stub functions for the IPA driver.
These stubs will be used by platforms which
disable the IPA Driver.

Change-Id: I73a902f1b77ae6ab090358265abfc337c1bad93c
Signed-off-by: Talel Atias <tatias@codeaurora.org>