Commit graph

444 commits

Author SHA1 Message Date
Hareesh Gundu
273f50746c msm: kgsl: Do not allocate scratch memory for A3xx
A3xx device gets the ring buffer read pointer directly
from the GPU registers. So don’t allocate scratch memory
which can’t be used for A3xx GPU devices.

Change-Id: I95016dfc169b9fee74e978f5560592740f34515e
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-09-08 02:02:40 -07:00
Hareesh Gundu
40e0712361 msm: kgsl: Fix gpu fault issue while enabling stall on page fault
Stall on page fault feature is supported on A5XX and later GPUs.
Enabling this feature on unsupported GPUs causes GPU faults.
So don't insert GPU stall related commands in ringbuffer if
not supported. But allow user to capture the GPU snapshot on
GPU page fault.

Change-Id: Ied26a5b4f44c1877b289a0ff5c0a6d47901e453d
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-09-08 14:08:57 +05:30
Venkateswara Rao Tadikonda
a33cdc7723 msm: kgsl: Limit the kgsl log frequency in kgsl_get_unmapped_area()
Reduce the frequency of kgsl logging when kgsl driver failed to get
memory mapping for requested memory.

Change-Id: If1a8832a9aa0396e3c990916deec7949697be12d
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
2017-09-07 21:04:46 +05:30
Sunil Khatri
8b6bbeab08 msm: kgsl: Protect the bind object against bad dereference
Sparse bind object are unbinded with bind id. This
can be exploited by any malicious application calling
unbind with same bind id again and again.

This can lead to a race condition between two threads
where one free the bind object and second thread uses
same object leading to bad dereference.

Change-Id: I542a008fc647489560667fb5016453a0c3448f7a
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
2017-09-07 05:18:38 -07:00
Deepak Kumar
a68123258a msm: kgsl: Return supported page size based on available memory pools
In case memory pools are supported return the page size as
supported only if corresponding memory pool is available.
This will increase the usage of memory pool and will reduce the
overall allocation time.

Change-Id: Iea84a4259b38fe9cb546419dfcbaf0a9666e7ca9
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2017-09-01 06:00:48 -07:00
Hareesh Gundu
99bada4303 msm: kgsl: Add debug log in adreno_of_get_pwrlevels()
Add debug log to dump the GPU speed bin value incase probe
fails due to efused bin value mismatch with speed bin value.

Change-Id: I329523f8dbb82272418981a54a1c2e6cf5e90b85
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-08-25 21:15:17 +05:30
Linux Build Service Account
fd17ef2bca Merge "msm: kgsl: Add disable-wake-on-touch devicetree property" into msm-4.4 2017-08-20 01:17:16 -07:00
Abhilash Kumar
a9d6b142e1 msm: kgsl: Correctly update fence_name for larger timestamp
Since 'timestamp' is of unsigned int type, for larger timestamp
the format specifier %d can show negative values. Fix this by
using %u format specifier for timestamp.

Change-Id: I621dfd4843099cb27436006500fe3342d1d5ddf4
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
2017-08-09 02:17:09 -07:00
Hareesh Gundu
8d2505b7de msm: kgsl: Add disable-wake-on-touch devicetree property
Add a devicetree "disable-wake-on-touch" property support
to disable GPU wake up on touch input events. This will
help save power in case of unintended taps and swipes,
for example, when the screen is wet.

Change-Id: I35768dc78c473272472aaf9c0e09e66d75817b2c
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-08-08 18:57:26 +05:30
Linux Build Service Account
865caab613 Merge "msm: kgsl: Disable VPC all flat shading optimization for A5XX" 2017-08-07 04:11:10 -07:00
Linux Build Service Account
ee6cbb5f25 Merge "msm: kgsl: Protect the event->handle with spinlock" 2017-08-07 04:11:09 -07:00
Abhilash Kumar
fde778c14a msm: kgsl: Fix integer overflow in _load_gpmu_firmware
There is a possibility of integer overflow in the arithmetic
calculation for cmd_size. Fix this by adding checks for such
arithmetic.

Change-Id: I2298a32f8ba3411decb29f55bb7b55e2214de35a
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
2017-08-04 04:33:52 -07:00
Linux Build Service Account
d4a6462641 Merge "msm: kgsl: Add a trace event for the GPU clock" 2017-08-03 20:51:29 -07:00
Linux Build Service Account
e5d965417f Merge "msm: kgsl: Set the abnormal power perf counter value to zero" 2017-08-03 20:51:26 -07:00
Abhilash Kumar
696ce310cf msm: kgsl: Set the abnormal power perf counter value to zero
During preemption microcode does save restore for all perf
counters. If we read the power counters at preemption boundary
we might get abnormal value from the perf counter. This will
result in showing incorrect GPU busy percentage. Fix this by
setting the abnormal power perf counter value with zero.

Change-Id: I96ba367ceeeb92d6adb507d0d917113297b4b58d
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
2017-08-03 11:22:12 -07:00
Linux Build Service Account
b26562a8d3 Merge "msm: kgsl: Disallow L2PC during wake up from SLUMBER" 2017-08-03 10:07:54 -07:00
Sunil Khatri
637bd2a4d1 msm: kgsl: Protect the event->handle with spinlock
event->handle pointer can be used after free due to
the race condition between kgsl_sync_callback and
kgsl_sync_fence_async_cancel.

Protect the event->handle with a spinlock to
avoid concurrent access issues.

Change-Id: I3719e401af9ece82ac68b72f2aef784c7fdc1104
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
2017-08-03 00:08:03 -07:00
Jonathan Wicks
e18cd5657a msm: kgsl: Add a trace event for the GPU clock
If requested, trace the GPU time to ensure
a useful mapping regardless of the chosen
trace clock.

Change-Id: I76a893975de9a278c8178f935991191354f29e2f
Signed-off-by: Jonathan Wicks <jwicks@codeaurora.org>
2017-08-02 11:13:31 -06:00
Linux Build Service Account
acacfdf4a9 Merge "msm: kgsl: Do not memset pages to zero while adding to pool" 2017-08-01 20:49:10 -07:00
Linux Build Service Account
e944accf8c Merge "msm: kgsl: Fix leak when preemption init fails" 2017-07-31 23:43:59 -07:00
Gaurav Sonwani
f135a770a6 msm: kgsl: Disallow L2PC during wake up from SLUMBER
Add a PM QOS request to disallow L2PC during wake up
from SLUMBER state. This is required to improve queue
to submit time for first set of GPU commands which results
in GPU wake up.

Change-Id: Iad1a6dfdf9e1fe034eef4fae526138d724bdd3eb
Signed-off-by: Gaurav Sonwani <gsonwani@codeaurora.org>
2017-07-31 21:41:29 -07:00
Linux Build Service Account
e81d17ff12 Merge "msm: kgsl: Fix the syncpoint_fence trace" 2017-07-28 08:21:41 -07:00
Hareesh Gundu
a02500b8b3 msm: kgsl: Disable VPC all flat shading optimization for A5XX
Set ALLFLATOPTDIS bit in A5XX_VPC_DBG_ECO_CNTL register to
disable VPC all flat shading optimization. ALLFLATOPTDIS is
a hardware chicken bit value needs to be set one, to avoid
UI rendering corruption.

Change-Id: I39b5ad098daacbb1c3b0fc93963d82d477f70cc1
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-07-27 18:11:04 +05:30
Prakash Kamliya
e3e2458d64 msm: kgsl: Fix leak when preemption init fails
For any reason if preemption initialization fails,
we do not free allocated memory for preemption.
Free allocated memory when it fails.

Change-Id: Ie931766f1ec1de7f3a0522054fc1fcb7b9426be6
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
2017-07-24 23:30:30 -07:00
Sunil Khatri
5b1f525950 msm: kgsl: Fix the syncpoint_fence trace
We should have a corresponding syncpoint_fence trace
for every syncpoint_fence_expire trace. In case the
fence is already signaled then make sure to have
syncpoint_fence trace before syncpoint_fence_expire
trace.

Also take an extra refcount for fence which will make
sure that the fence pointer is valid in the trace even
if the fence is signaled.

Change-Id: I2fd8f91c800f89a4a64813a6908eaa0445cf548b
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
2017-07-24 15:36:48 +05:30
Abhilash Kumar
9b0026e54f msm: kgsl: Update total time at right place for accurate GPU busy
For calculation of busy time and total time, KGSL relies on perf
counters and CPU clock. These can be a bit out of sync and may
give GPU busy greater than 100 percent. Updating time at the right
place will give more accurate total time and will avoid crossing
100% in GPU busy calculation.

Change-Id: I3cc702492325b9dc44ea2b705e4d9014d95abd33
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
2017-07-21 10:49:25 +05:30
Venkateswara Rao Tadikonda
468fc93432 msm: kgsl: Change pwrlevels array index type to unsigned int
Change the array index 'i' of pwrlevels[] to unsigned int, which can't be
decremented beyond zero.

Change-Id: I9b646fccf03437f6facf0d5938f097916d13d2f2
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
2017-07-14 11:24:53 +05:30
Linux Build Service Account
27ee915218 Merge "msm: kgsl: Use vma_area_struct with proper locks" 2017-07-12 12:47:36 -07:00
Linux Build Service Account
6b67ad013a Merge "msm: kgsl: Fix a dead loop issue while changing gpu frequency" 2017-07-06 23:41:16 -07:00
Linux Build Service Account
abfdf9aa5a Merge "msm: kgsl: Make sure regulators are ON before GPU clocks are forced on" 2017-07-06 23:41:15 -07:00
Sunil Khatri
f0b50a87b4 msm: kgsl: Use vma_area_struct with proper locks
Make sure to use proper locks when using the
vma_struct_area. This will avoid the race condition
in a scenario where one thread gets a vma_struct_area
and other thread is unmapping the vma from the process.

Change-Id: I6c7837d1a8dd24fc6955ab5be8b1917a42f2cb53
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
2017-07-06 15:09:35 +05:30
Linux Build Service Account
e28c151ad1 Merge "msm: kgsl: Add A5XX RBBM registers to pre-crash dumper list" 2017-07-05 18:20:19 -07:00
Venkateswara Rao Tadikonda
aac10e39c7 msm: kgsl: Fix a dead loop issue while changing gpu frequency
There is a dead loop in kgsl_devfreq_target(), while governor request
to change GPU frequency. In governor 'userspace' mode, If the requested
frequency (set_freq) is more than the configured frequency and max_freq
is also set to more than the configured frequency, then there is a dead
loop while changing target frequency.

Dead loop occurs due to comparing signed integer with unsigned integer.
So, type casting unsigned integer to signed integer will terminate the
loop when loop variable is less than zero.

Change-Id: Ic82b7477d50d1abcd348b011f64246066887922c
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
2017-07-05 18:50:15 +05:30
Hareesh Gundu
3b265177fc msm: kgsl: Add a NULL check for limit pointer
KGSL power limit pointer can be error or NULL. Add a NULL
check for limit pointer to avoid NULL pointer dereference.

Change-Id: I4aacaddd1cd9b34f1befc21807eb7ab577f0a7f1
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-07-04 14:34:10 +05:30
Linux Build Service Account
bc399a65c4 Merge "msm: kgsl: Limit the frequency of logging on memory allocation failure" 2017-07-02 16:11:43 -07:00
Linux Build Service Account
b0bcf92508 Merge "msm: kgsl: Directly return page size of the supported pool" 2017-07-02 16:11:40 -07:00
Deepak Kumar
40b830cd5e msm: kgsl: Do not memset pages to zero while adding to pool
Doing a memset to zero while adding a page to pool is not
efficient as the page added to the pool can be returned to
system in case shrinker kicks in. In this scenario, time spent
in zeroing the page is a waste.

Instead of zeroing the page while adding it to pool zero the
page when it is taken from the pool. This helps in reducing
the time taken to free big chunk of memory. Also, allocation
time shouldn't be a problem as zeroing of page anyways happens
during allocation in case it is allocated from system.

Change-Id: I41ab2cb88fb4fd9854d2cc9a45bb60fc7013286a
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2017-06-30 20:44:10 +05:30
Deepak Kumar
d9eb3ce9a8 msm: kgsl: Limit the frequency of logging on memory allocation failure
Excessive logging due to several successive memory allocation failure
may cause a watchdog bite. Hence, this change adds ratelimit to logging
on memory allocation failure.

Change-Id: I8e5d78918a32c48ef7fa587f3dc63cbd1f065d5f
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2017-06-30 20:39:29 +05:30
Rajesh Kemisetti
a92d182205 msm: kgsl: Make sure regulators are ON before GPU clocks are forced on
The debug option to always ON the GPU clocks does not check the regulator
state. If the user tries to set this option while GPU is in Slumber state
then enabling clocks will fail.

Make sure we enable the GPU regulators before enabling its clocks.

Change-Id: Id77773224c674fe2e1b6179a039750b24e5e5f87
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2017-06-30 18:55:28 +05:30
Rajesh Kemisetti
bf556bf53d msm: kgsl: Add A5XX RBBM registers to pre-crash dumper list
Add all A5XX RBBM status registers to pre-crash dumper
registers list so that snapshot captures the accurate
state of the individual blocks.

Change-Id: I774b84f3cb69b7b0aa119e87229d9ec9c96bbbb4
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2017-06-28 19:22:43 +05:30
Linux Build Service Account
db478ca29d Merge "Revert "msm: kgsl: Offload mementry destroy work to separate thread"" 2017-06-22 14:00:22 -07:00
Hareesh Gundu
e98fd46014 Revert "msm: kgsl: Offload mementry destroy work to separate thread"
This reverts commit 281fcb5e18.

To address the issue with the OOMkiller causing to kill the
foreground application.

Change-Id: Ie4c078d706fdf1c13ad45840f72b414ddc37c1d0
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
2017-06-22 14:29:10 +05:30
Tim Murray
7412403004 msm: kgsl: convert some workqueues to use kthreads.
adreno_dispatch_work and _kgsl_event_worker are both low-latency
low-runtime functions that are in the critical path of GPU
rendering. Moving them out of workqueues and into a dedicated FIFO
kthread avoids significant jitter.

bug 30342017

Git-commit: 1a7a93bd33f48a369de29f6f2b56251127bf6ab4
Git-repo: https://android.googlesource.com/kernel/msm

Change-Id: I83562f488c34c2ab001c8ea79e7f09b633c658bd
Signed-off-by: Tim Murray <timmurray@google.com>
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
2017-06-21 22:56:18 -07:00
Deepak Kumar
e8adb4c2b8 msm: kgsl: Directly return page size of the supported pool
In current code, if a request comes to allocate a page of a size
for which pool is not supported EAGAIN is returned with a page
size of PAGE_SIZE << --order. This is not efficient as it results
in multiple retries in case pool of size = PAGE_SIZE << --order is
also not supported.

Instead of retrying with lower order page in a sequential manner
this change directly returns the page size of the pool that is
supported.

Change-Id: Ib82ae5be7e4109fdc0a3d72bcbcd4b47cfb2e266
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2017-06-21 14:35:26 +05:30
Linux Build Service Account
f0d37d522b Merge "Revert "msm: kgsl: Update QoS settings for A508 VBIF as recommended"" 2017-06-19 16:41:57 -07:00
Linux Build Service Account
7223e29df4 Merge "msm: kgsl: Reset busy data after soft reset" 2017-06-19 16:41:56 -07:00
Abhilash Kumar
28339f3b38 msm: kgsl: Reset busy data after soft reset
GPU perfcounters gets reset after a soft reset. Currently
GPU busy stats is using previous values after a soft reset.
This might lead to invalid GPU busy calculations. Start GPU
stats from the scratch after a soft reset to get valid GPU
busy calculations.

Change-Id: Ia38c18ad59f438d724ff4710ee2b350853b3810d
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
2017-06-15 23:35:06 -07:00
Linux Build Service Account
c0301d4240 Merge "msm: kgsl: Defer issue commands to worker thread" 2017-06-15 22:59:05 -07:00
Hareesh Gundu
71c3b2e17c msm: kgsl: Defer issue commands to worker thread
Currently submit ioctl getting blocked till the commands
gets added to ringbuffer incase inflight count is less
than context burst count. If the submit command happens
in GPU slumber state, it will add the GPU wakeup time to
submit IOCTL. This will add latency in preparing next frame
in CPU side. Defer commands submission to dispatcher worker,
if the GPU is in slumber state.

CRs-Fixed: 2055107
Change-Id: I099ba721e02bbcd8ccadb1bc518c7c1ef4fb7e21
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-06-13 12:03:27 +05:30
Hareesh Gundu
cd94470626 msm: kgsl: Log clk set, enable and prepare failure
Handle the clk API return value so that it’s easy
to catch un clocked GPU register access.

Change-Id: I5a1a9a6cbd673394f126bb17b849393268a22b1b
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2017-06-09 13:34:56 +05:30