Usermode driver expect vulkan device id info from kernel.
Add new KGSL_PROP_VK_DEVICE_ID property support to provide
vk-device-id information.
Change-Id: Ib4f6872fcd3a956caeaad6e7c9f534d7c8e87305
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Instead of coordinating between a worker when dispatching commands and
abusing a mutex lock for synchronization, it's faster to keep a single
kthread dispatching commands whenever needed. This reduces GPU
processing latency.
[@0ctobot: Adapted for msm-4.9, this reverts commit:
2eb74d7 ("msm: kgsl: Defer issue commands to worker thread")]
Change-Id: I5d3fd2dde07ff641feaf4fdc93e5d2b423bcb23d
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This results in no change in structure size on 64-bit machines as it
fits in the padding between the gfp_t and the void *. 32-bit machines
will grow the structure from 8 to 12 bytes. Almost all radix trees are
protected with (at least) a spinlock, so as they are converted from
radix trees to xarrays, the data structures will shrink again.
Initialising the spinlock requires a name for the benefit of lockdep, so
RADIX_TREE_INIT() now needs to know the name of the radix tree it's
initialising, and so do IDR_INIT() and IDA_INIT().
Also add the xa_lock() and xa_unlock() family of wrappers to make it
easier to use the lock. If we could rely on -fplan9-extensions in the
compiler, we could avoid all of this syntactic sugar, but that wasn't
added until gcc 4.6.
Link: http://lkml.kernel.org/r/20180313132639.17387-8-willy@infradead.org
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[@RealJohnGalt: adapt to 4.14]
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
Adds a new CFS thread for freeing GPU memory. Improves performance
when tearing down processes (eg, via LMK) and not blocking currently
running UI from submitting work to the GPU.
Test: boots, works
Bug: 137140296
Bug: 137927078
Change-Id: I47b42691862b01501a77bce0965d8be7538c1d26
Signed-off-by: Tim Murray <timmurray@google.com>
Signed-off-by: Sean Callanan <spyffe@google.com>
Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
Waking the GPU upon touch wastes power when the screen is being touched
in a way that does not induce animation or any actual need for GPU usage.
Instead of preemptively waking the GPU on touch input, wake it up upon
receiving a IOCTL_KGSL_GPU_COMMAND ioctl since it is a sign that the GPU
will soon be needed.
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
There is a possibility of sharing process_private between two unrelated
processes due to PID wrapping. In kgsl_process_private_new(), instead
of checking numeric TGID, compare the unique pid pointer of the current
process with that of the existing processes in kgsl process list to
allow sharing of process_private data judiciously. Also, in all required
functions get TGID/PID of a process from its struct pid.
Change-Id: I0e3d5d79275cdb3f3c304fb36322ad56b0d0b227
Signed-off-by: Archana Sriram <apsrir@codeaurora.org>
There is a chance of messing up per process stats if something
like a free and allocation happen at the same time for memory
belonging to the same process. Similarly mapsize of memdesc can
also go bad because of concurrent access. So make per process
stats and mapsize of memdesc atomic. Also use scnprintf()
instead of snprintf().
Change-Id: I5da1cf368d523768d0b267b314394612934a620d
Signed-off-by: Puranam V G Tejaswi <pvgtejas@codeaurora.org>
Check the return value of kgsl_pwrctrl_change_state()
when requested state is suspend. This call can fail
and we encounter adverse effects, if we proceed without
checking if the call succeeded. For instance, in case of
_preemption_store(), it is fatal to change ringbuffer,
when state change to suspend fails. Also add a helper
function that changes a given flag safely, only after
successful state change to suspend.
Change-Id: I8a929cc201d127baeaabed194655ac73a8032b2f
Signed-off-by: Puranam V G Tejaswi <pvgtejas@codeaurora.org>
Secure memory cannot be preserved during hibernation.
This change is to first check and fail the hibernation
if there is secure context. Then hyp assign kgsl internal
secure buffer to HLOS during hibernation.
Change-Id: I8879294ed357ef09201bd430bdbece84de324fa9
Signed-off-by: Thomas (Wonyoung) Yun <wyun@codeaurora.org>
Unload zap shader during device hibernation and reload it
during resume otherwise scm calls during post hibernation
GPU initialization will fail as there is possibility that
TZ driver is not aware of the hibernation.
Change-Id: I1f62fb97cbc8e6c3e3536d4d5260a543ca15b685
Signed-off-by: Suprith Malligere Shankaregowda <supgow@codeaurora.org>
Signed-off-by: Thomas Yun <wyun@codeaurora.org>
Add per-context properties to count the number of faults
for each context. This will help out to identify faulting
context really faulted on its own command or not.
Change-Id: Ifd74e32f1f95a345645c10c01c33c5ef14bdcbcd
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Update the vm_stat counter NR_UNRECLAIMABLE_PAGES to
account for the total memory allocated. Update the vm_stat
counter NR_INDIRECTLY_RECLAIMABLE_BYTES to account for the
memory held in pools. Update the rss_stat counter
MM_UNRECLAIMABLE to account for the memory allocated and
memory imported per process.
Change-Id: I302834502c21376136d7b5081024812b0cecd150
Signed-off-by: Puranam V G Tejaswi <pvgtejas@codeaurora.org>
In functions like gpumem_alloc_entry(), per process
stats are updated after kgsl_mem_entry_attach_process()
returns success. But in case of failure, per process
stats are decremented, though they are not incremented.
Fix this by isolating stat updation from
kgsl_mem_entry_detach_process(). Also take into account
the memory from sparse allocations.
Change-Id: I6e2bc1880bdda15aa75d546d0dc3d34c63cd7dba
Signed-off-by: Puranam V G Tejaswi <pvgtejas@codeaurora.org>
Use "gmu_core_gpmu_isenabled" check for all GPMU related
functionality instead of "gmu_core_isenabled" as later will
return true even when ADRENO_GPMU feature flag is not defined.
Change-Id: Ic577052d8c1cc52965e07c557b178fec444c3613
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Added sysfs entries to show kgsl memory usage statistics.
gpumem_mapped: kgsl memory mapped in the process address space.
gpumem_unmapped: kgsl allocated memory but not mapped in process.
imported_mem: graphics memory not allocated by the kgsl.
Below is the sysfs path for new entries:
/sys/class/kgsl/kgsl/proc/<pid>/
Change-Id: I08c2014d28dc0ca1e2b54ebf966d00143b303b54
Signed-off-by: Amit Kushwaha <kushwaha@codeaurora.org>
Signed-off-by: Archana Sriram <apsrir@codeaurora.org>
Log context type in case of GPU page faults or GPU faults.
Also add Vulkan context type to distinguish it from GL.
Change-Id: I7b93bf645b80abe82f2d6aa379296b2fffceb684
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
GPU state especially command processor state is important
to debug GMU fault. If GPU is powered ON, dump both GMU
and GPU state for GMU faults to make sure all required
state needed for debug is captured.
Change-Id: I71b359cd944a12cb19c419bca0254fd2fa468328
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Move some gmu functions to gmu_core so that
those can reusable without reimplementing on
other kind of gmu.
Change-Id: Ie083bd541f716eabf56da8cef4e7606a2595d482
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Add software path to bump the l3 frequency using a
performance hint from user space in I/O coherence cases.
Change-Id: I559fecf0dbbf79ebe3972db2a65bde6b69063fc9
Signed-off-by: Urvashi Agrawal <urvaagra@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
We need a list of perfcounters for each kgsl file descriptor, in
order to gracefully release any perfcounter allocated using that fd
in the event that the process dies unexpectedly or doesn't release
the perfcounters properly. This prevents possible leakage of
perfcounters referenced by a process.
Change-Id: Ib443282f26a0cbdad656fa0f82fb62c6de871fb0
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
A6xx GPUs have different variants of GMU. Abstract
out current GMU implementation under GMU core,
so that it’s easy to add new code for different
GMU variants.
Change-Id: I0dae15bc6905b869c34bbbdebc0b5e9e2f7ff25b
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Read and increment context count atomic variable under a lock
to avoid race condition between read and increment. This is
necessary to make sure no process goes beyond the specified
context limit.
Change-Id: I483e2ac169beaff49e19b8ef1b46541f6eb740b0
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Increment GPU halt variable after successful transition
to SUSPEND state to halt dispatcher. This is necessary to
make sure that any pending dispatcher threads don't go
ahead and try to wake up GPU in SUSPEND state.
Change-Id: I806884306549afbef0dfa92ea14903cc7a47d347
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Add a setting and a corresponding sysfs node that
controls whether new snapshots overwrite old
snapshots in case they are unrecoverable. This
prioritization of unrecoverable snapshots already
exists, but we want the option to turn it off.
By default, keep this option on.
Change-Id: Ia7dfa5f0f4bbb45fcd72fe769adb366f00b0fcbc
Signed-off-by: Kyle Piefer <kpiefer@codeaurora.org>
Signed-off-by: Urvashi Agrawal <urvaagra@codeaurora.org>
Snapshot of the Qualcomm Adreno GPU driver (KGSL) as of msm-4.9
commit e023d014d2039d59d0999e73984ccf0cc6e60bc7 (msm: pcie:
fix PCIe L0s and L1 ASPM support).
Fixed compile errors,checkpatch issues and API changes:
* Rename function _copy_from_user() to kgsl_copy_from_user()
* Fixup vm_fault API
* Rename fence API to dma_fence API
* Stop using scm_call()
* Fixup header includes
* Fix IDR API usage
* Fix __mutex_owner usage
Change-Id: Ib35ff402b3b0a14a94bc2568b34be6364ef2e882
Signed-off-by: Urvashi Agrawal <urvaagra@codeaurora.org>