msm: mdss: Enable solid fill on pipe

Add support to enable solid fill on pipe with an option to
configure fill-color by userspace. This support does not confine
to background pipe and can be used to enable solid fill on any source
surface processing pipes irrespective of the z-order.
This support can be used in requirements involving constant
color layers.

Change-Id: Iae3c2968ca2f2f1be161e9c2f857641ffbb859e5
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Use MDP_SOLID_FILL to enable color on pipe

To enable constant color on a pipe, set MDP_SOLID_FILL in pipe
flag. This will do a solid fill on the pipe with the color
specified in bg_color.

CRs-Fixed:592032
Change-Id: I3201e2fa657a6fc6d0e7f51f8585366afc3d29a3
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: msm_bus: send correct value to bw division function

While calculating bw for existing client request
sometimes it can go to negative if client unregisters
or send request with lesser ab/ib values. Bus driver
will divide bandwidth if interleaving enabled.

Added a macro wrapper to handle negative bw values
since the division utility function can't handle
negative values

CRs-Fixed: 521940
Change-Id: Ic3a216b8efb535593fe02ad3228d71808d2e0f98
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
msm: iomap: Remove unused APCS_GCC entries

Remove the static I/O map entries for the APCS_GCC register
set on targets that do not use it.

Change-Id: Id62cc9ef47acd15ceb46d8a52c0063817a2f3049
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: iommu: Check for NULL genpools during domain teardown

During domain creation, some of the genpools will be set to NULL if
there is not enough memory for creation. Check for these NULL
genpools during domain destruction to avoid NULL dereferences.

Change-Id: I60238c138b809ef5c13383f5b1752ab6c799707d
CRs-Fixed: 573612
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: cachedump: Add cache maintenance for calls into TZ

The scm_call API is no longer providing implicit cache maintenance for
shared buffers. Add cache flushing for buffers heading towards TZ and
cache invalidation for buffers coming from TZ.

Change-Id: Iaafdc10ee49b43f462ba00dd751861a3b285a067
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: use dma_alloc_coherent for L1/L2 cache dump buffers

Currently buffers for L1 and L2 cache dump are allocated using
allocate_contiguous_ebi_nomap() api. On devices with more than
2GB of memory, debug image crashes since these buffers end up
being allocated above 2GB address space which the debug image
currently does not support.Hence, use the dma api so as to
have these buffers be allocated below 2GB address space.

CRs-Fixed: 515701
Change-Id: Iaf862753e63fd9f42256c820b3e3ba08b6894bf3
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
msm: qmi: Fix access-after-free condition

In case, the sending of a message from handle_resume_tx fails, the
transaction is freed and the failure info is printed in the kernel log
which results in an access-after-free condition.

Free the txn after printing the error message.

CRs-Fixed: 525365
Change-Id: I111634948fa2e8a9737b77a658283ae6d1562531
Signed-off-by: Zaheerulla Meer <zmeer@codeaurora.org>
msm: pil: Proxy unvote after pil_shutdown() when using IRQs

Subsystems might use an IRQ for removal of proxy votes via the
power/clock ready interrupt. So, if a peripheral shutdown is triggered
before the power/clock ready interrupt is received, remove the proxy
votes and bypass the unvoting in the power/clock ready interrupt handler.
Conversely, if the power/clock interrupt is received before shutdown is
triggered, bypass the unvoting during pil shutdown.

Also, remove the hack to proxy unvote directly from the pil-q6v5-mss
driver.

Change-Id: I254ab5a1595ceb27a2cfcac99c4c1d2f2443b7c7
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Factor out PIL code into a separate library.

pil-q6v5-mss.c contains code for both the PIL and subsystem
implementations. Factor out the PIL specific code into a
pil-msa.c library so it can be reused by other subsystems
which use the same/similar self-authentication mechanisms.

Change-Id: I7e27eafbd2c89c2747482f1162e7b28d9e5f7bca
Acked-by: Jennifer Zenner <jzenner@qti.qualcomm.com>
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Perform proxy voting/unvoting at mba bootup

Currently, both mba and q6 devices perform voting and unvoting during
bootup via pil. This is done because earlier the clock ready interrupt was
not provided by the modem booting up. But now that we have the clock ready
interrupt being sent by the modem, we can make the proxy votes for the PBL
while booting up. Later when the modem has finished booting up it would
send the clock ready interrupt and at that time we would remove the proxy
votes made for the PBL. So remove the PBL proxy votes after receiving the
clock ready interrupt from the modem.

Also, having IRQF_SHARED in the proxy unvote IRQ registration is
unnecessary because the the power/clock ready interrupt is not shared
among subsystems. So remove that as well.

Change-Id: Ie6ec27f6842c42c4240a9f09f8f49a190ab3c2f9
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: scm-pas: Remove cpu_is_* checks

The soc type check is included in scm_pas_init in order to assign
different source port IDs to the bus bandwidth voting vectors.
The check is removed by making scm_pas_init a function to which
the source port ID is passed in as a parameter. This change assumes
that the destination port remains the same across all SOCs. The
scm_pas_init function is invoked from individual pil drivers.

Change-Id: I7472d07ae560a16d2fd03b184e340e56a62985d2
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
msm: pil-q6v5-mss: Do not generate redundant smem ramdump

When the device crashes, smem ramdump is already generated by the smem
driver. Therefore, the smem ramdump generated by pil-q6v5-mss is redundant
and the code responsible for it can be taken out.

CRs-fixed: 485208
Change-Id: I8b67ff9f54663b68268b7b87e9cb1f3930219afa
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil-q6v5-mss: Initialize the stop ack completion variable

In case of targets that don't use the PIL framework to boot the modem,
the stop_ack completion variable might remain in uninitialized state as
the initialization is currently being done only within PIL callbacks.
So, fix this my initializing the completion variable outside of PIL
by callbacks.

Change-Id: I204b0fbf461b1e1f1d4576dc43e33c7442eaf0e0
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: subsystem_restart: Move device tree parsing code into the framework

Every driver has to repeat the code for parsing device tree nodes for the
SMP2P gpios. So, move this parsing code into the framework level to avoid
this duplication of code.

Change-Id: Ie27a5f37ce2b9718a5cc0ccf11c7abda1c6cb1df
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: pil: Move device tree parsing code into the framework

Every driver has to repeat the code for parsing device tree nodes for the
proxy unvote IRQ. So, move this parsing code into the framework level to
avoid this duplication of code.

Change-Id: I8739af63f6f3bc95aaded74d60359256e5bd7a66
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: scm: Flush the command buffer only instead of the entire cache

scm_call flushes the entire cache before calling into the
secure world. This is both a performance penalty as well
as insufficient on SMP systems where the CPUs possess a
write-back L1 cache. Flush only the command and reponse
buffers instead, moving the responsibility of flushing any
other cached buffer (being passed to the secure world) to
callers.

Change-Id: Ic5dabf04a51aa2b190a841445e86d1c3f330f27c
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: scm: Add scm_call_noalloc and helper macros

Currently, scm_call internally calls kmalloc() to allocate a command
buffer structure. This prevents scm_call from working before kmalloc
structures are initialized or during atomic contexts. Allow clients
to pass in a pre-allocated buffer for scm_call to be used for internal
structures.

Change-Id: Id09500c8c696298228aefdcc2a61953e654677c9
CRs-Fixed: 498392
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: scm: Add logging of actual return code from scm call

When an error occurs during an scm call the error returned is
remapped so we lose the original error code. This means that
when an error occurs we have no idea what actually failed within
the secure environment.

Add a logging statement that will log the actual error code from
scm call allowing us to easier determine what caused the error
to occur.

Change-Id: I8439cf53e324fee136b78c1f9e55c4f3d54679eb
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: peripheral-loader: Fix double irq enable

Check device tree for the proxy_unvote gpio only if the pil_desc
defines the proxy_unvote op.

This fixes an issue where the proxy_unvote irq was erroneously
enabled twice by two pil_desc, resulting in a kernel warning.

Change-Id: I07b4377c59a2908caea00b184cc0ef6adfd8f1fb
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>