summaryrefslogtreecommitdiff
path: root/drivers/gpu/msm/kgsl_iommu.c (follow)
Commit message (Collapse)AuthorAge
* Merge remote-tracking branch 'msm8998/lineage-20' into lineage-20Raghuram Subramani2024-10-17
| | | | Change-Id: I126075a330f305c85f8fe1b8c9d408f368be95d1
* Merge tag 'LA.UM.8.4.c25-06600-8x98.0' of ↵Michael Bestas2022-11-05
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.codelinaro.org/clo/la/kernel/msm-4.4 into android13-4.4-msm8998 "LA.UM.8.4.c25-06600-8x98.0" * tag 'LA.UM.8.4.c25-06600-8x98.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.4: diag: Prevent out of bound write while sending dci pkt to remote diag: Ensure dci entry is valid before sending the packet ion: Fix integer overflow in msm_ion_custom_ioctl diag: Use valid data_source for a valid token msm: kgsl: Remove 'fd' dependency to get dma_buf handle msm: kgsl: Fix gpuaddr_in_range() to check upper bound msm: adsprpc: Handle UAF in fastrpc debugfs read msm: kgsl: Add a sysfs node to control performance counter reads msm: kgsl: Perform cache flush on the pages obtained using get_user_pages() soc: qcom: hab: Add sanity check for payload_count msm: kgsl: Fix out of bound write in adreno_profile_submit_time futex: Fix inode life-time issue futex: Handle faults correctly for PI futexes futex: Simplify fixup_pi_state_owner() futex: Use pi_state_update_owner() in put_pi_state() rtmutex: Remove unused argument from rt_mutex_proxy_unlock() futex: Provide and use pi_state_update_owner() futex: Replace pointless printk in fixup_owner() futex: Avoid violating the 10th rule of futex futex: Rework inconsistent rt_mutex/futex_q state futex: Remove rt_mutex_deadlock_account_*() futex,rt_mutex: Provide futex specific rt_mutex API msm: adsprpc: Handle UAF in process shell memory Disable TRACER Check to improve Camera Performance msm: kgsl: Deregister gpu address on memdesc_sg_virt failure crypto: Fix possible stack out-of-bound error msm: kgsl: Correct the refcount on current process PID. msm: kgsl: Compare pid pointer instead of TGID for a new process qcom,max-freq-level change for trial msm: kgsl: Protect the memdesc->gpuaddr in SVM use cases. msm: kgsl: Stop using memdesc->usermem. Conflicts: drivers/char/adsprpc.c drivers/char/diag/diag_dci.c drivers/gpu/msm/kgsl.c drivers/gpu/msm/kgsl_debugfs.c drivers/gpu/msm/kgsl_iommu.c drivers/gpu/msm/kgsl_mmu.c drivers/gpu/msm/kgsl_sharedmem.c drivers/gpu/msm/kgsl_trace.h kernel/futex.c kernel/locking/rtmutex.c kernel/locking/rtmutex_common.h Change-Id: I777ee96b855e2967ef6733e603d12f40174974d0
| * msm: kgsl: Fix gpuaddr_in_range() to check upper boundAbhishek Barman2022-05-05
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently gpuaddr_in_range() accepts only the gpuaddr & returns true if it lies in valid range. But this does not mean that the entire buffer is within range. Modify the function to accept size as a parameter and check that both starting & ending points of buffer lie within mmu range. Change-Id: I1d722295b9a27e746bfdb6d3bf409ffe722193cb Signed-off-by: Rohan Sethi <quic_rohsethi@quicinc.com> Signed-off-by: Abhishek Barman <quic_abarman@quicinc.com> Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>
| * msm: kgsl: Compare pid pointer instead of TGID for a new processArchana Sriram2021-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Protect the memdesc->gpuaddr in SVM use cases.Jordan Crouse2021-03-15
| | | | | | | | | | | | | | | | | | | | | | 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: Change start variable type to int in kgsl_iommu_add_globalDeepak Kumar2021-02-22
| | | | | | | | | | | | | | | | | | | | Variable start should be of type int instead of u32. Correct this to ensure while loop can exit and WARN_ON statement is effective in case global VA space doesn't have enough space for current request. Change-Id: I0bc817abc9a16934b5c91fc31ba9c6dff3545c90 Signed-off-by: Deepak Kumar <dkumar@codeaurora.org> Signed-off-by: Pranav Patel <pranavp@codeaurora.org>
* | 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: 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: skip if requested address doesn't fall in the svm rangegkiranku2020-08-26
| | | | | | | | | User should not be provided address out of SVM region. Return error for any such requests from user. Change-Id: If149044039b156f8192f405714f5c1a0571004e7 Signed-off-by: gkiranku <gkiranku@codeaurora.org> Signed-off-by: Sebanti Das <sebadas@codeaurora.org>
* msm: kgsl: Make the "scratch" global buffer use a random GPU addressJordan Crouse2019-09-17
| | | | | | | | | Select a random global GPU address for the "scratch" buffer that is used by the ringbuffer for various tasks. Change-Id: Ic0dedbaddda71dbf9cb2adab3c6c33a24d6a604c Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Harshitha Sai Neelati <hsaine@codeaurora.org>
* msm: kgsl: Use a bitmap allocator for global addressingJordan Crouse2019-09-17
| | | | | | | | | To prepare to allow global buffers to allocate a semi-random GPU address move from a sequential allocator to a bitmap based one. Change-Id: Ic0dedbadba36c4c7b7839528103997724eac7d6d Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Harshitha Sai Neelati <hsaine@codeaurora.org>
* msm: kgsl: Log context type in case of GPU faultsRajesh Kemisetti2018-11-07
| | | | | | | | 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>
* msm: kgsl: Move global memory region to 0x100000000Deepak Kumar2018-01-23
| | | | | | | | | | | | | | | On a 64bit kernel, a 32bit user application is not restricted to 3GB limit of virtual memory. It is allowed to access complete 4GB range. Move global memory region to 0x100000000 outside of 32bit range on 64bit kernel to increase the virtual memory range for a 32bit application running on a 64bit kernel. This will also move secure memory region to 0xF0000000. Change-Id: I017ac0c052b4d9466f9f1a66af4a83f0636450cb Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
* msm: kgsl: Do not expose kernel pointer for global entriesHareesh Gundu2017-11-11
| | | | | | | | Add kernel pointer restriction while printing the global page table entries through the debugfs. Change-Id: Ia2ef4243248ece477e3f679c0027379686670928 Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
* msm: kgsl: Deal with a NULL pointer when creating default pagetableLynus Vaz2017-05-26
| | | | | | | Return an appropriate error code if the default pagetable is NULL. Change-Id: Ic88b066c40a8f840d95fd3fbc9ee9274c428b66a Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
* msm: kgsl: Map GPU QTimer through GPU IOMMUJonathan Wicks2017-02-28
| | | | | | | | Map the GPU QTimer area as a global into the GPU IOMMU so that the GPU can access the QTimer. Change-Id: If50bd36681123adde7e3a37644c41316f101154c Signed-off-by: Jonathan Wicks <jwicks@codeaurora.org>
* msm: kgsl: Relocate the pagefault tracepointSunil Khatri2017-01-29
| | | | | | | | | | | | | | During a pagefault we print trace with the fault information which gets delayed by unacceptable time. It happens due to the the code that searches the faulty address in the recently freed addresses for a matching entry. Moving it to new position wont have any impact on debugging instead trace is dumped without any delay. Change-Id: I11487798b60742096e06605cf3046b4cfc8cc057 Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
* msm: kgsl: Remove BUG_ON from the map globalHareesh Gundu2017-01-02
| | | | | | | | | Return error instead of BUG_ON on map global failure. This will avoid crashing the entire system. CRs-Fixed: 1106621 Change-Id: I693dc196bb7a2e01f6a033f5fbbf7b454108108d Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
* 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: Remove obsolete IOMMU domain attributeMitchel Humpherys2016-09-26
| | | | | | | | | The DOMAIN_ATTR_COHERENT_HTW_DISABLE IOMMU domain attribute is being removed. SMMU coherency will be configured through the SMMU device tree nodes moving forward. Remove the obsolete option. Change-Id: I4bbbfb90fe172e048cc9504c4e6be5f36501b485 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* msm: kgsl: Improve logs for pagefaults on global buffersSushmita Susheelendra2016-08-25
| | | | | | | | | | | | Log the nearby allocations for pagefaults on global buffers. Print the names of the allocations that fall around the faulting address on a global buffer. Also add a new debugfs file to list all the global pagetable entries. Useful for debugging pagefaults and other issues with "global" objects. CRs-Fixed: 985631 Change-Id: Ifbbdc69044fc64d7ea02509bf8113ed94eeece1e Signed-off-by: Sushmita Susheelendra <ssusheel@codeaurora.org>
* msm: kgsl: Add sparse memory supportCarter Cooper2016-08-15
| | | | | | | | | | | | | | | | | Add support to allocate/reserve a virtual address range without physically backing. Add support to allocate physically backing memory without assigning it a virtual address. Add support to unite the two forementioned allocations together. Add support to divorce them from one another. Add support to let their kids do cache operations as they see fit. Create a 'dummy' page that is used to back virtual allocations that are not yet backed by physical memory. CRs-Fixed: 1046456 Change-Id: Ifaa687b036eeab22ab4cf0238abdfbe7b2311ed3 Signed-off-by: Carter Cooper <ccooper@codeaurora.org> Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
* 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>
* Merge "msm: kgsl: Map GPU QDSS STM through GPU IOMMU"Linux Build Service Account2016-07-27
|\
| * msm: kgsl: Map GPU QDSS STM through GPU IOMMUJonathan Wicks2016-07-19
| | | | | | | | | | | | | | | | | | | | | | Map the GPU QDSS STM area as a global into the GPU IOMMU so that GPU traces can be routed to QDSS. Enable the gpuaddr and size of the area to be queried from userspace. CRs-Fixed: 1031648 Change-Id: I2e32522a42508a6bee088c95dc56a13935dd691c Signed-off-by: Jonathan Wicks <jwicks@codeaurora.org>
* | msm: kgsl: Keep the active draw context until it is switched outJordan Crouse2016-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of trying to make a decision to switch out the active draw context for NULL at detach time leave the reference count for it until the next context switch or until the next slumber whichever comes first. This avoids races with the preemption code and ensures a smooth transition. A side effect is that we were depending heavily on the context detach to reset the ringbuffer to the default at power down and we didn't touch it on power up (though we did on soft reset and wake from slumber. Curious). Obviously if we are no longer switching we will need to force the default pagetable during start but it seems to me like this would be the right thing to do even if we were still switching out. CRs-Fixed: 1009124 Change-Id: Ic0dedbadff8df192096292b221130c8ef5b31e12 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* | msm: kgsl: Remove unneeded error message in kgsl_iommu.cJordan Crouse2016-07-20
| | | | | | | | | | | | | | | | | | | | | | iommu_attach_device() should return a log message for every possible error and we don't need to double up the pain especially for situations when we run out of available domains and start getting a storm of ENOSPC errors back. CRs-Fixed: 1009158 Change-Id: Ic0dedbad7416abb23c769a4d3be9ebd0ca04810c Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* | msm: kgsl: Remove idle wait in kgsl_iommu_set_pf_policy()Jordan Crouse2016-07-20
|/ | | | | | | | | | We don't need to wait for idle before changing the pagefault policy on the IOMMU which is a good thing because on a busy system we may never hit idle. CRs-Fixed: 1009187 Change-Id: Ic0dedbadb8f6122e32a0a34a65c54a7bca2a523c Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* msm: kgsl: Add MMU offset mapping functionsCarter Cooper2016-05-05
| | | | | | | | | Allow MMU mappings to take offsets rather than only allowing full range mappings. CRs-Fixed: 971174 Change-Id: Iaa113c8414a2d2d8f92b3cb21eaf2e422f273454 Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
* msm: kgsl: Allocate guard page on demandHareesh Gundu2016-03-25
| | | | | | | | | | | Allocate guard page when the first buffer is mapped into the IOMMU. This also ensures that the guard page gets allocated if the guard page mmu feature is enabled. CRs-Fixed: 988093 Change-Id: Id97492707463a1f15a4bf1c67b9c0f03214e6283 Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
* msm: kgsl: Disable guardpage for A5x and suppress pagefaultsSushmita Susheelendra2016-03-25
| | | | | | | | | | | | Disable the guardpage workaround for A5x and instead selectively suppress pagefaults. Suppress read pagefaults that are likely caused due to UCHE overfetches. For this, the fault address must be within the first 64 bytes of a page and the fault page must be preceded by a valid allocation. CRs-Fixed: 975293 Change-Id: I6a0995af3ab4129c6923726043c5f34c747641f9 Signed-off-by: Sushmita Susheelendra <ssusheel@codeaurora.org>
* msm: kgsl: Submit a set of critical packets right after ME initShrenuj Bansal2016-03-23
| | | | | | | | | | During the initialization sequence, submit a set of important packets to the GPU in order to pre-load the I-cache with the critical ucode instructions. CRs-Fixed: 978777 Change-Id: Ic6a17b24d8c3aa383af8e25cf9ef771459d65796 Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
* msm: kgsl: Use fault context to retrieve process informationSushmita Susheelendra2016-03-23
| | | | | | | | | | | | | Instead of looking up the process by pagetable base and name, use the fault context to extract the pid and other process specific information. This works for both the per-process and global pagetable configurations and also reduces some locking. This also reports the correct pid and task name in the global pagetable configuration. CRs-Fixed: 971753 Change-Id: I9c869527c3d1b2606f3d12234163935d6f5e43a9 Signed-off-by: Sushmita Susheelendra <ssusheel@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 and use KGSL_DEVICE macroJordan Crouse2016-03-23
| | | | | | | | | | Add a helper macro to convert an adreno_device pointer to a struct kgsl_device pointer. This is mostly syntatic sugar but it makes the code a bit cleaner and it abstracts a bit of the ugliness away. Change-Id: Ic0dedbadd97bda3316a58514a5a64757bd4154c7 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* msm: kgsl: Move global pagetable entries to the IOMMU driverJordan Crouse2016-03-23
| | | | | | | | | Global pagetable entries are exclusively for IOMMU and per-process pagetables. Move all the code out of the generic driver and into the IOMMU driver and clean up a bunch of stuff along the way. Change-Id: Ic0dedbadbb368bb2a289ba4393f729d7e6066a17 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* msm: kgsl: Move setstate to the IOMMU initializationJordan Crouse2016-03-23
| | | | | | | | The setstate memory is a IOMMU specific construct. Move it to the IOMMU code where it belongs. Change-Id: Ic0dedbada977f2861f7c1300a5365da5b09d70a9 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* msm: kgsl: Add missing check for size against lower VARajesh Kemisetti2016-03-23
| | | | | | | | | | | | _get_unmapped_area_topdown() subtracts the requested size from lower entry base without really checking its value. This leads to overflow while working at boundary conditions. Add a condition to check entry base with the size and proceed. Change-Id: Ic695da683b11de35c7c4b8936a35d693dc8fa452 Signed-off-by: Rajesh Kemisetti <rajeshk@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: Cleanup iommu interactions for secured MMU casesCarter Cooper2016-03-23
| | | | | | | | | | The code has gotten bloated and repeats the same logic in several places leading to very stringy code. Consolidate this code to enable easier readability as well as prep the code for future changes to this area. Change-Id: Ibb70cbae3a8a5157e589020ccebefff11b6ffaf1 Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
* msm: kgsl: Add a macro to derive the device from the mmu structureJordan Crouse2016-03-23
| | | | | | | | | struct kgsl_mmu is a static member of struct kgsl_device so we can use the usual container_of trick to get the device from a mmu pointer rather than carry around an unneeded back reference. Change-Id: Ic0dedbad7ff22e598b03d980dfbb738374ed5a7a Signed-off-by: Jordan Crouse <jcrouse@codeaurora.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>