Revert "Revert "arm: mm: Add VM_ARM_EMPTY_MAPPING flag to mark the PMD gaps""

This reverts commit 9834b4d5207ee13536bc41f3a9d98702c0cd9c7a.
Revert "ARM: 7527/1: uaccess: explicitly check __user pointer when !CPU_USE_DOMAINS"

This reverts commit 8cc876def310b034ab0e0775a14d1a49472d7f5f.
Merge "ion: Update ION_SECURE and ION_FORCE_CONTIGUOUS flags"
Merge "gpu: ion: enable the kmalloc heap"
power: pm8921-bms: fix SOC jumps while entering suspend/resume

The last_soc is being set to -EINVAL when entering suspend. This
causes SOC to jump while coming out of resume.

Instead remember
If we are reporting for the first time after suspend.
The calculated_soc at the time we went to suspend.

Soc should not increase because we cannot suspend while
charging. If the calculated_soc has increased continue reporting
the lower last_soc.

If the calculated soc has dropped check if it has dropped since
suspend. If so decrease the reported soc by the amount it dropped
since suspend.

If the calculated soc has dropped but it has increased since suspend
continue to report the last_soc.

Change-Id: I9040feceaa3e829d11bec0b21e61951f2ed1180b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: pm8921-bms: Cancel/schedule work across suspend/resume

Clean up the work before going into suspend to avoid any
race during resume.

While at it, fix the timing comparison during resume
and use the de-referenced chip pointer.

Change-Id: I9e6dbe49e6ad5ebf1cdf9a3cd0ec7f57aa6495c6
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
power: pm8921-bms: Fine tune SOC reporting during suspend/resume

Report SOC based on the time for which the system was suspended.

Remember -
1. If we recalculated the SOC in resume
2. The last_soc before going into suspend

Two cases arise - if we had a short suspend or if the suspend
was significant to case a drop in SOC. For the former do not
report a change in SOC and for the latter, report the
newly calculated_soc. In either of the cases, soc should not
increase because we cannot suspend while charging.

There is a possibility that the report_soc may be called
before BMS resume (update_power_supply), causing the driver
to report the old SOC. Handle this case by setting state
variables before recalculating the soc in resume.

CRs-Fixed: 482611
Change-Id: Ic21a24a1126800011f5e7e4531c1953436812811
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Revert "Revert "ARM: 7527/1: uaccess: explicitly check __user pointer when !CPU_USE_DOMAINS""

The security extension aka trustzone firmware had a bug in the old verizon release which is like the engineering release which causes reboot when a media is playing. I think qcom media goes into secure mode for security reason. verizon users need to update their freaking stuff before they complain something is broken.

Fuck verizon for making this a pain in the ass.

This reverts commit 38e1f74e6898f795b9943d7599fc5c96c13da7a0

Change-Id: If0df40b403546f53cf41642f406fe15cccda149e
msm: camera: Enable pixel line buffer for ispif.

Enable pixel line buffer for ispif to handle fast incoming
data. This provides cusion to dowmstream components such as vfe
and helps in preventing UB buffer overflows.

Change-Id: I0c2a0f8241e08d6cf39732db4ee05b34975b1557
Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
board-8930: Request the correct ab/ib values for camera.

Various camera usecases show up bus overflows under
regression. Request right ab/ib values to ensure
camera has required bandwidth.

Increased ab, ib values for 8960 pro to run mmfab
at turbo

Change-Id: I1477fae2f0f6081e943d97ee0ffe9d17198a9b7e
Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
msm: camera: Disable software override for axi wm priority.

Remove the software override for write master priority because
hardware assigns priority to write masters based on data rate.

Change-Id: If16b54f05d41a2d78606ae21983aa3248eb2b1a3
Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
msm_serial_hs: Fix synchronization between ADM and UART Cores

With current UART Core programming sequence, it is seen that ADM
and UART Core are going out of sync in few usecases with regression.
It is fixed by using Force RxStale feature of UART Core from
set_termios() and sending discard flush to ADM which would terminate
currently queued UART RX CMD to ADM. Add termios_in_progress check
to make decision about what kind flush to send on receiving RxStale
interrupt. It makes set_termios() more reboust and also keeps ADM
and UART Core in-sync.

Add dma_in_flight to keep check of UART Rx CMD status and BUG_ON if
UART driver is trying to queue one more UART RX CMD to ADM as UART
driver re-uses same UART RX CMD.

This change also adds check of currently set uartclk rate and next
required uartclk rate for new baud rate. If both are same it would
not call clk_set_rate() to set same uartclk rate again.

UART baud rate change request (i.e. executing set_termios()) can come
asynchronously and time to program ADM hardware with queued CMD by ADM
driver is non-deterministic. It is required by UART driver to confirm
that queued RX CMD is programmed with ADM hardware before going with
requested baud rate change operation. Hence this change wait in
set_termios() for ADM driver to program queued RX CMD before going ahead
with baud rate. Otherwise ADM may encounter data bus error with UART RX
channel which is unrecoverable.

Change-Id: I678e91420b33a49ce8b6a5a29c6309f9ff6f5c4a
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm: vidc: Fix compilation errors

This change removes the compilation error in kernel
if ddl logs are enabled.

CRs-Fixed: 483776
Change-Id: Iffc37fcdd4e5ce7ddcd8560d432af5c3f3e6c433
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
msm_serial_hs: Disable UART RxStale before Force RxStale in set_termios

There is possible race for handling normal RxStale event and Force
Rxstale event with UART Core, when Force RxStale is issued from
set_termios(). Hence on baud rate change request disable RxStale event
mechanism, and invoke Force RxStale. With RxStale event mechanism
disabled, Force RxStale still generates interrupt.

Fix possible race condition if before completion of previous UART RX CMD
flush, set_termios() request is received. With this case it is quite
possible that rx_tlet() queues one UART RX CMD with ADM driver and also
set_termios() queues one more UART RX CMD which would results with
queueing same UART RX CMD twice with ADM driver. With this device would
crash as the ADM driver will not be able to de-reference the second UART
RX CMD work. Hence add check in set_termios with rx.flush value as
FLUSH_DATA_READY which confirms that flush is initiated but it is not
completed and wait for rx.flush to become FLUSH_NONE which would happen
only once flush is completed and new UART RX CMD is being queued with ADM
driver.

Reduce waiting time for discard flush completion as it is already waited
for queued UART Rx CMD to be programmed with ADM hardware. Hence change
wait time out from 300 jiffies to 50 mseconds.

Add an API to get important UART core registers values which can be called
from error condition. Use the same when discard flush timeout happens with
set_termios(), when rx.dma_in_flight is not set with set_termios() and when
multiple UART RX CMD queueing condition is seen in msm_hs_start_rx_locked()
API.

CRs-Fixed: 486260
Change-Id: I9fd17e453fad619609e76e8b3a72a4f47210cff9
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm_serial_hs: Improve UART Shutdown path

For uart port close operation, serial core calls msm_hs_stop_rx_locked()
which sends discard flush request to ADM driver after changing rx.flush
state machine from FLUSH_NONE to FLUSH_STOP value. Next serial core
calls msm_hs_shutdown()and it waits for discard flush completion with
rx.flush state machine to be set as FLUSH_SHUTDOWN to complete uart
port close operation. With this approach, transfer termination is not
known by UART Core which may still allow UART core to make CRCI request
with ADM Core if new data is being received from remote uart. Hence
invoke Force RxStale from msm_hs_stop_rx_locked() which informs UART
core to terminate current Rx transfer and do not make any new CRCI
request with ADM core for any new incoming data. On receiving RxStale
interrupt, it sends discard flush request to ADM driver to terminate
transfer with ADM hardware.

This new programming sequence is required to get both UART and ADM
hardwares in-sync for termination of transfer.

CRs-Fixed: 475230
Change-Id: I802a456294d4fd2fa51a5f4e918a4f4f22bc5ee3
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm: vidc: Do not reset VCD_FRAME_FLAG_DATACORRUPT flag for VC1

- To propagate VCD_FRAME_FLAG_DATACORRUPT flag to IL client, dont reset.

Change-Id: I68bf4c953c02a2a4327fe6e875863853cb4e0bf8
CRs-Fixed: 472798
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Merge "msm_serial_hs: Fix synchronization between ADM and UART Cores"
Merge "msm_serial_hs: Disable UART RxStale before Force RxStale in set_termios"
Merge "msm_serial_hs: Improve UART Shutdown path"