In the confusion of adding the perfcounter API the timestamp query
was broken. Convert the query over to the perfcounter API to avoid
confusion.
Change-Id: Ic0dedbad590489a643e8aa6d678bf19f732c06dd
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
The next_fence array is left over from when we started storing
per-ring information.
Change-Id: Ic0dedbada687f899eca1017ecfd77fbd2aa8e114
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
hangcheck_fence was missed when all the ring specific members were
moved out of the gpu struct.
Change-Id: Ic0dedbad00a86d6657bc2a3e0e5bbdc5eae21ae6
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
adreno_last_fence is no longer very useful since we have a handy
per-ring pointer directly to the values we need.
Change-Id: Ic0dedbadfb195551afcd016651776965da32fb2d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
When we first did preemption the priority was set at submission
time. In order to be properly backwards compatible we made ring id 0
the lowest priority ring so that when a legacy app made a submission
it didn't get itself onto the highest priority ring by accident.
Now that we set the priority with submitqueues this is no longer
a concern and ordering priorities this way goes against long
standing convention in similar GPU drivers.
Declare a flag day and invert the priority algorithm so that
priority '0' is the highest priority and it descends from there.
The lowest prority ring is 'number of rings - 1' where the number
of active rings can be acquired through a parameter query of
MSM_PARAM_NR_RINGS.
This change also ensures that the legacy submitqueue id '0' will
use the next-to-lowest ring buffer by default for legacy
submissions.
Change-Id: Ic0dedbadeea522e4f07babc4395cbf5fb7143fe3
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
In order to manage ringbuffer priority to its fullest userspace
should know how many ringbuffers it has to work with. Add a
parameter to return the number of active rings.
Change-Id: Ic0dedbada6010dd5122e8409141fd23b414d73e4
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Remove the queued time from the profile struct and turn the submit time
into a proper timespec (tv_sec + tv_nsec). This should sync up better
with what userspace is used to seeing.
Change-Id: Ic0dedbad0621fa248e6cffde2d1ee3f9b609e19d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Record the GPU always on timer value at the start and end of a
submission on the ringbuffer. Since the timer runs at a constant
19.2 Mhz this is a handy way of tracking how long each
submission takes.
The timer values are recorded in the memptrs. Each ringbuffer is
given a circular list of 128 entries to store the event ticks;
this should be enough to avoid running out of room even when the
ring is completely full of submissions.
Add trace events for the user to track when submissions are
queued, submitted to the ringbuffer and retired. The submitted
trace point shows the GPU ticks and the current kernel time at
submit time (as read by the CPU) and the retired trace event shows
the GPU ticks at submission start/end as read by the GPU. Taken
together these two events can provide a pretty close match between
the current GPU time and the kernel time which is handy for tracing
tools that try to match up the various kernel events with one
another.
Change-Id: Ic0dedbadbcf89f032890820785b9fb49a6362b01
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Originally queue_delayed_work() used to negative error codes or 0 and 1
on success depending if the work was queued or not. It caused a lot of
bugs where people treated all non-zero returns as failures so we changed
it to return bool instead in d4283e9378 ('workqueue: make queueing
functions return bool'). Now it never returns failure.
Checking for negative values causes a static checker warning since it is
impossible based on the bool type.
Change-Id: I49c875e09534795a8d5176773eb497f5404fcbe3
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
While trying to write dsi commands from userspace, the user buffer
is copied using simple_write_to_buffer. If the number of bytes in
the user buffer is less than the destination buffer, the length was
set to the destination buffer length. Subsequently the buffer could
be read from userspace to dump a lot of uninitialized kernel heap
data. Update the destination buffer with the correct size of bytes
copied from the user buffer.
Change-Id: Ib28f3698655d25ad8103fc02199a1d214092e232
Signed-off-by: Ashish Garg <ashigarg@codeaurora.org>
A negative sleep time could be interpreted as a large positive sleep
time when its casted to a unsigned type. This could result in CPU sleeping
for a longer than expected duration resulting in missed interrupts.
Change-Id: I472f355c8ba392ab46d53fceddb448f7e35c178e
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
Signed-off-by: Naresh Malladi <namall@codeaurora.org>
Initializing metadata buffer to zero before reusing the buffer
for next invoke.
Change-Id: Iaab3478732b83427a475e95afa0e031cb76f60d9
Acked-by: Viswanatham Paduchuri <vpaduchu@qti.qualcomm.com>
Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
This is required to add a PM QOS request to disallow L2PC on masked CPUS.
It improves queue to submit time for first set of GPU commands
which results in GPU wake up.
Change-Id: If7e0925ec76065158188671f1d11a0de5e9900aa
Signed-off-by: Gaurav Sonwani <gsonwani@codeaurora.org>
Removed a local variable in mmc_start_req() which was used to store the
error encountered while starting a new data request. If an error is
encountered while starting a new request, the error
information is stored in the mrq. The error information stored in the
mrq is during error handling. So removing the unused variable.
Change-Id: Ifeedc91433230d5156d286bd332a85fb221188ac
Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
In case the DPCD read transaction continuously times out, it is
likely that the sink is not responding or the DP cable/dongle is
faulty and hence no response is seen. In such cases, avoid
reporting the DP connect event to userspace.
Change-Id: Ie07de464f63dc3b18c875a061a18ad00e4c99e85
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Audio codec interrupt line is connected to pin61 of MPM. Map
interrupt 209 to MPM pin61 to wakeup APSS from TCXO mode.
CRs-Fixed: 2040808
Change-Id: I74cfc871b6e99c62dda30033e6dabb5fe5d19705
Signed-off-by: Nagaradhesh Yeleswarapu <nagaradh@qti.qualcomm.com>
Fix ordering of link creation between node->prev and prev->next in
osq_lock(). A case in which the status of optimistic spin queue is
CPU6->CPU2 in which CPU6 has acquired the lock. At this point if CPU0
comes in to acquire osq_lock, it will update the tail count. After tail
count update if CPU2 starts to unqueue itself from optimistic spin queue,
it will find updated tail count with CPU0 and update CPU2 node->next to
NULL in osq_wait_next(). If reordering of following stores happen then
prev->next where prev being CPU2 would be updated to point to CPU0 node:
node->prev = prev;
WRITE_ONCE(prev->next, node);
At this point if next instruction
WRITE_ONCE(next->prev, prev);
in CPU2 path is committed before the update of CPU0 node->prev = prev then
CPU0 node->prev will point to CPU6 node. At this point if CPU0 path's
node->prev = prev is committed resulting in change of CPU0 prev back to
CPU2 node. CPU2 node->next is NULL currently, so if CPU0 gets into unqueue
path of osq_lock it will keep spinning in infinite loop as condition
prev->next == node will never be true.
Change-Id: I48d847096daf3c228de90ae1cd2a6415b7bde65a
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
The legacy detection workaround change restricts DCP to 1.5A draw,
regardless of legacy/non-legacy type. This was to prevent a legacy
(non-compliant) cable, incorrectly detected as non-legacy cable from
drawing more than 1.5A.
The issue with legacy bit is that hardware could end up reporting
non-legacy for a legacy cable (not the other way round). We want to
ensure that for non-compliant legacy cable SDP/CDP current limits
are honoured and that for a Rp = 10k legacy cable VBUS shouldn't go
higher than 5V.
This cap of 1.5A on DCP is not necessary. Moreover AICL will limit the
current if needed.
To realize this force the Rp based current whenever DCP or float
is seen via the LEGACY_UNKNOWN_VOTER. LEGACY_UNKNOWN_VOTER is not
removed unless a confirmed hvdcp or pd is seen.
Change-Id: I89505e9db4f045aaf71ab0ee534de783ea4d2df3
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
MHI change requires all work to be finished before returning from
the ERROR, SHUTDOWN and DISABLE callbacks. Call mhi xprt enable and
disable functions directly instead of deferring the work. Remove
calls to mhi_close_channel to prevent calling MHI after the disable
callback.
CRs-Fixed: 1095436
Change-Id: I37910cfd3b51693b1f3bc84815d95595602690e8
Signed-off-by: Chris Lew <clew@codeaurora.org>
The MHI driver is changing their APIs to use the device
node during registration. This change accommodates the
API changes and callback state changes.
CRs-Fixed: 1095436
Change-Id: I1899d97d676c28b89bb5f85c1a92732f6cfec904
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>