summaryrefslogtreecommitdiff
path: root/drivers/gpu/msm/kgsl_sharedmem.c (follow)
Commit message (Collapse)AuthorAge
* Merge remote-tracking branch 'msm8998/lineage-20' into lineage-20Raghuram Subramani2024-10-17
| | | | Change-Id: I126075a330f305c85f8fe1b8c9d408f368be95d1
* msm: kgsl: Protect the memdesc->gpuaddr in SVM use casesJordan Crouse2021-01-07
| | | | | | | | | | | When SVM is being used there can only be one GPU address assigned to the memory descriptor. Don't allow the GPU address to be changed after it has been negotiated the first time by a process. Change-Id: Ic0dedbad2a1b3ccdc2c1598a6c501b2be288d64e Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Harshitha Sai Neelati <hsaine@codeaurora.org> Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
* msm: kgsl: Stop using memdesc->usermemJordan Crouse2021-01-07
| | | | | | | | | | | | | It shouldn't be illegal for memory descriptors to have multiple virtual memory mappings under certain circumstances. If that is the case tracking a single usermem address for each memdesc no longer makes much sense. Get rid of the memdesc->usermem member and use an atomic counter to track mappings instead. Change-Id: Ic0dedbad31bafcd1019ccc8e68657cb7e3c72727 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Harshitha Sai Neelati <hsaine@codeaurora.org> Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
* msm: kgsl: Compare pid pointer instead of TGID for a new processArchana Sriram2020-11-10
| | | | | | | | | | | | | 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> Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
* msm: kgsl: Fix the process sysfs refcountingLynus Vaz2017-11-30
| | | | | | | | | | The kobject used for the process's sysfs node did not provide a release function, so it did not correctly implement the refcounting. Add a release callback so that we keep the process structure valid as long as the kobject is alive. Change-Id: I6db54092ed29ecd4d2f157188a4f1a5fc70f1edf Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
* msm: kgsl: Print Vulkan memory types as wellYoung Hwan Kwak2017-11-02
| | | | | | | | | Vulkan memory types are added into UMD. Print Vulkan memory type as an int value. CRs-Fixed: 2119633 Change-Id: Idf5d58a6a02dbef6ef8cf6663e7819d221bf3e11 Signed-off-by: Young Hwan Kwak <ykwak@codeaurora.org>
* msm: kgsl: Return supported page size based on available memory poolsDeepak Kumar2017-09-01
| | | | | | | | | | 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>
* msm: kgsl: Limit the frequency of logging on memory allocation failureDeepak Kumar2017-06-30
| | | | | | | | | 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>
* msm: kgsl: Use per page cache operation instead of bulk cache operationDeepak Kumar2017-05-26
| | | | | | | | | | | | | | For any cache operation, the current code tries to map all pages to the kernel using vmap in case sg table is not available and then performs the requested cache operation. If vmap fails because of memory crunch ioctl just returns failure. This change avoids using vmap and performs per page cache operation even when sg table is not available. This is done to avoid failures because of vmap especially on 32 bit systems. Change-Id: I123b46e6a55a62cbf934ab6a2a49dcd1f0d4c7d4 Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
* msm: kgsl: Perform cache operation with kernel addressHareesh Gundu2017-04-26
| | | | | | | | | Kernel should never access untrusted pointers directly. If the address is not mapped to kernel, map to kernel address space and perform cache related operation. Change-Id: I433befcde620e51b8ec17954ddb710f6084e0592 Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
* msm: kgsl: Get pages from the system incase mempool is not configuredHareesh Gundu2016-12-14
| | | | | | | | | Allow driver to get pages from the system incase mempool configuration is not defined from the device tree. This will fix kgsl driver probe failure for without gpu mempool configuration devices. Change-Id: I3142a5d2e13ed40f643c91594fd868c37620ce54 Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
* Merge "msm: kgsl: Fix pagetable member of struct kgsl_memdesc"Linux Build Service Account2016-11-18
|\
| * msm: kgsl: Fix pagetable member of struct kgsl_memdescJordan Crouse2016-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | memdesc->pagetable is supposed to help ensure that memory gets unmapped before it is freed, but the pagetable member is being populated at create time not when the buffer gets mapped. This forces the developer to ensure that the same pagetable is used for both the create and map step. Instead, assign the pagetable member when it is first used (to get a GPU address) and put it away when the GPU address is released. Change-Id: Ic0dedbad372fd9029b932dd99633a650049751ed Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* | msm: kgsl: Fix overflow in sharedmem cache range operation functionSudeep Yedalapure2016-11-04
|/ | | | | | | | | | There could be possibility of integer overflow on adding size with maximum offset bytes and result in a value smaller than maximum memdesc size. CRs-Fixed: 1082914 Change-Id: Ie66b3a8ca2ca418a4a52f65987266b8d580c121f Signed-off-by: Sudeep Yedalapure <sudeepy@codeaurora.org>
* msm: kgsl: Do not free gpuaddr range if unmap failsHarshdeep Dhatt2016-09-29
| | | | | | | | | | | | | | | Currently, we free up the gpuaddr range whether unmap succeeds or fails. If it fails and we free up the gpuaddr range, there is a possibility that a later allocation will overlap with this range. Mapping this new range leads to a BUG_ON() in the iommu driver which thinks that we are overwriting an existing mapping. To avoid this, we never free the failing gpuaddr range, effectively removing it from being re-used for any future mappings. CRs-Fixed: 1072834 Change-Id: I57dfd6abe6c928dbe4df1bcc682d4093040ccb9f Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
* Merge "msm: kgsl: Make VBIF register dump more generic"Linux Build Service Account2016-08-07
|\
| * msm: kgsl: Add array of page pointers to memdescHarshdeep Dhatt2016-08-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done to improve the kgsl vmfault routine. Currently, it traverses the sglist to find the faulted page, which takes linear time. By having an array of all the page pointers, this operation will be completed in constant time. Also, allocate sgt only for mapping this memory to the GPU. Since this optimization is not needed for secure/global or imported memory, we will not keep this array but keep the sgt instead. CRs-Fixed: 1006012 Change-Id: I221fce9082da0bdd59842455221b896a33a6ce42 Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
* | msm: kgsl: Allocate global buffers through paged memoryHarshdeep Dhatt2016-07-26
|/ | | | | | | | | | The global buffers are allocated through cma, which can be very limited on some targets. Add a flag to allocate a global buffer through our page allocator. CRs-Fixed: 1024295 Change-Id: Ie796b03ce152774535f593acdf00e900109d303a Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
* msm: kgsl: Add 1M and 8K pools to the allocatorShrenuj Bansal2016-05-11
| | | | | | | | | | | | | | | | This change includes the below: - Add 1M and 8k pools and structure the allocator to use all pools from the largest page to the smallest - Reserve a set number of pages for each of these pools at init time - When allocating, use the reserved pools and then fall back to allocating from system memory using only 8k and 4k pages - Remove maximums on the pool sizes - Zero the memory when we create the pool initially and add pages back to the pool on free CRs-Fixed: 995735 Change-Id: I9440bad62d3e13b434902f167c9d23467b1c4235 Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
* msm: kgsl: Fix overflow in sharedmem read/write functionsSunil Khatri2016-05-05
| | | | | | | | | | There could be possibility of integer overflow on adding sizeof(uint32_t) with uint64_t maximum offset bytes and result in a value smaller than uint64_t maximum memdesc size. CRs-Fixed: 988861 Change-Id: Ifc3ec45297c2a29ad6f7d70dd0bd59238ac8cc3d Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
* msm: kgsl: Use a page pool to reduce allocation timeDeepak Kumar2016-05-05
| | | | | | | | | | | Use a mempool to reduce the allocation time. When memory allocated from pages is freed, put it in a page pool. At allocation time, try to allocate from the page pool before getting pages from the system. Make sure that the pool does not grow too big by enforcing a maximum limit. Change-Id: Icac7fb4355ee1fd07e7127ea5c2721665e279272 Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
* msm: kgsl: Refactor MMU/IOMMU supportJordan Crouse2016-03-23
| | | | | | | | | | | | | | | | | | | | | The current MMU code assumes a binary state - either there is a IOMMU or there isn't. This precludes other memory models and makes for a lot of inherent IOMMU knowledge in the generic MMU code and the rest of the driver. Reorganize and cleanup the MMU and IOMMU code: * Add a Kconfig boolean dependent on ARM and/or MSM SMMU support. * Make "nommu" mode an actual MMU subtype and figure out available MMU subtypes at probe time. * Move IOMMU device tree parsing to the IOMMU code. * Move the MMU subtype private structures into struct kgsl_mmu. * Move adreno_iommu specific functions out of other generic adreno code. * Move A4XX specific preemption code out of the ringbuffer code. CRs-Fixed: 970264 Change-Id: Ic0dedbad1293a1d129b7c4ed1105d684ca84d97f Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* msm: kgsl: Add accounting for memory mapped in userspaceHarshdeep Dhatt2016-03-23
| | | | | | | | | | | For proper memory accounting, a key metric is to know how much memory kgsl allocated for a process and how much of it the process is actually using. This is done by keeping track of memory in our vmfault routines. This information is provided via the process mem file. Change-Id: I7e3371a708ea5fdade3840b2384b3bc4012ad004 Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
* msm: kgsl: Remove tracking virtual map sizesCarter Cooper2016-03-23
| | | | | | | | | mmapsize is no longer important to the memory descriptor and the APIs that would use it never materialized. It currently just tracks the size of the memdesc and is no longer needed. Change-Id: I8fa1001c2f89f23034029de7de6ab77532bf45fa Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
* msm: kgsl: Rework page allocation sizesCarter Cooper2016-03-23
| | | | | | | | Alignment checks only need to be done once and can be moved down to the lower layers. Change-Id: Ia4683cf9db08506db810e80854c006d94dc80310 Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
* msm: kgsl: Update various exernal APIs for the 4.4 kernelJordan Crouse2016-03-22
| | | | | | | | | | | | | | | Make several changes to build the GPU driver for 4.4: - Rename CONFIG_MSM to CONFIG_QCOM where applicable - Add msm_kgsl.h to the Kbuild exports - Remove linux/coresight_of.h (as it has been merged into coresight.h) and remove the .owner member of the coresight_desc struct. - Use the new location for the sync.h file (in staging) - Remove an unused sync function - Move oneshot_sync.h inside of #ifdef wrappers Signed-off-by: Jordan Crouse <jcrouse@codeauorora.org>
* msm: kgsl: Add Qualcomm GPU driverJordan Crouse2016-03-22
Snapshot of the Qualcom Adreno GPU driver (KGSL) as of msm-3.18 commit commit e70ad0cd5efd ("Promotion of kernel.lnx.3.18-151201."). Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>