Commit graph android_kernel_sony_sdm845/drivers/gpu/msm
Message SHA1
msm: kgsl: enlarge the preemption counters buffer
The buffer is also used for KMD postamble after commit 27c8851a,
so make it as big as what it would have been (PAGE_SIZE) if we
had the priviledged scratch buffer to prevent override or overflow.

Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
Signed-off-by: Sorayukii <sorayukii69@gmail.com>

Chenyang Zhong   authored and   Sorayukii   commited 2026-05-15 17:48:18 +07:00
4c74203b85
msm: kgsl: change the buffer name back to counters
Because we reverted the priviledged buffer commit 76518d9

Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
Change-Id: I84c65af9beaefe777e34c765bccf9df5cf20cf77
Signed-off-by: Sorayukii <sorayukii69@gmail.com>

Chenyang Zhong   authored and   Sorayukii   commited 2026-05-15 17:48:18 +07:00
2b984f46a0
Revert "msm: kgsl: Mark the scratch buffer as privileged"
This reverts commit 76518d99f8.

Signed-off-by: Sorayukii <sorayukii69@gmail.com>

Sorayukii   commited 2026-05-15 17:48:18 +07:00
d8cbd060f2
Revert "msm: kgsl: Keep postamble packets in a privileged buffer"
This reverts commit 47672094a5.

Signed-off-by: Sorayukii <sorayukii69@gmail.com>

Sorayukii   commited 2026-05-15 17:48:18 +07:00
f40d1ce68e
Merge tag 'LA.UM.8.3.c25-09700-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9 into android13-4.9-sdm845
"LA.UM.8.3.c25-09700-sdm845.0"

* tag 'LA.UM.8.3.c25-09700-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9:
  securemsm-kernel: Fixed multiple listener registration on same fd
  msm: kgsl: Fix error handling during drawctxt switch
  msm: kgsl: Update the protect register list
  msm: kgsl: Do not release dma and anon buffers if unmap fails
  soc: qcom: smem: Add boundary checks for partitions
  msm: kgsl: Do not free sharedmem if it cannot be unmapped

 Conflicts:
	drivers/gpu/msm/kgsl_mmu.c

Change-Id: I62a1cc70492f769d35a9e91e140b1cb987269224

Michael Bestas   commited 2024-10-10 16:46:34 +03:00
2cb72020b2
msm: kgsl: Fix error handling during drawctxt switch
Currently, separate submissions are made for page table
switch and context switch to the ring buffer. However, if the
page table switch succeeds but the context switch fails,
it can lead to use of wrong page table for drawctxt.
To address this issue, rollback the pagetable to current pagetable.

Also,correctly put the refcount of adreno context during error
cleanup.

Change-Id: I1bb4ee3ebb0ce6ea32f0b6799cfb7fa89c0d09c7
Signed-off-by: Rakesh Naidu Bhaviripudi <quic_rakeshb@quicinc.com>

Rakesh Naidu Bhaviripudi   authored and   SIVA MULLATI   commited 2024-07-15 17:29:56 +05:30
a8985ca6d3
msm: kgsl: Update the protect register list
Update the protect register list as per the latest recommendation. Since
we are now relying on last-span-unbound feature, following are changed.

1. Last-span-unbound feature covers GMU_AO block, we have to replace
A6XX_GMU_ALWAYS_ON_COUNTER_L with A6XX_CP_ALWAYS_ON_COUNTER_LO
while accessing from GPU.

2. GMU power perf counters are unused and we are out of register address
protection spans to make them available for on older targets.

3. Remove PWR counter group safely for a6xx targets and setup the
counters internally.

4. IFPC counters are moved to part of target specific code and enabled
with ADRENO feature flag.

Change-Id: Ifcff462b669bbf9da8e4d53c87affdc8a9fcb740
Signed-off-by: Rakesh Naidu Bhaviripudi <quic_rakeshb@quicinc.com>

Rakesh Naidu Bhaviripudi   authored and   Harshitha Sai Neelati   commited 2024-04-22 15:51:54 +05:30
3434400aa9
msm: kgsl: Do not release dma and anon buffers if unmap fails
If iommu unmap fails and leaves dma or anon buffers still mapped in the
iommu, do not free them.

Change-Id: Ice0e1a59c1ac0ee7a9d62d8899966b84fa63d5ca
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>

Lynus Vaz   authored and   Harshitha Sai Neelati   commited 2024-04-22 15:49:04 +05:30
727b020d14
Merge tag 'LA.UM.10.3.c25-02100-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9 into android13-4.9-sdm845
"LA.UM.10.3.c25-02100-sdm845.0"

* tag 'LA.UM.10.3.c25-02100-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9:
  soc: qcom: smem: Add boundary checks for partitions
  msm: kgsl: Update the protect register list
  msm: kgsl: Do not release dma and anon buffers if unmap fails
  msm: kgsl: Do not free sharedmem if it cannot be unmapped
  msm: ADSPRPC: Restrict untrusted applications from attaching to GuestOS
  msm: kgsl: Use dma_buf_get() to get dma_buf structure
  pinctrl: qcom: Using readl_relaxed/writel_relaxed APIs
  msm: adsprpc: Handle UAF in fastrpc internal munmap
  iommu: Fix missing return check of arm_lpae_init_pte
  bus: mhi: misc: Add check for dev_rp if it is iommu range or not
  net: ipc_router: Add bounds check on tx path
  msm: kgsl: Remove 'fd' dependency to get dma_buf handle
  msm: kgsl: Keep postamble packets in a privileged buffer
  msm: kgsl: Make sure that pool pages don't have any extra references
  msm: kgsl: Prevent wrap around during user address mapping

 Conflicts:
	drivers/char/adsprpc.c
	drivers/gpu/msm/kgsl.c
	drivers/gpu/msm/kgsl_iommu.c
	drivers/gpu/msm/kgsl_mmu.c
	drivers/pinctrl/qcom/pinctrl-msm.c

Change-Id: I431924199616b135e180fd3a6421bb5037bcf164

Michael Bestas   commited 2024-04-20 00:36:50 +03:00
262ef91bdf
msm: kgsl: Update the protect register list
Update the protect register list as per the latest recommendation. Since
we are now relying on last-span-unbound feature, following are changed.

1. Last-span-unbound feature covers GMU_AO block, we have to replace
A6XX_GMU_ALWAYS_ON_COUNTER_L with A6XX_CP_ALWAYS_ON_COUNTER_LO
while accessing from GPU.

2. GMU power perf counters are unused and we are out of register address
protection spans to make them available for on older targets.

3. Remove PWR counter group safely for a6xx targets and setup the
counters internally.

4. IFPC counters are moved to part of target specific code and enabled
with ADRENO feature flag.

Change-Id: Ifcff462b669bbf9da8e4d53c87affdc8a9fcb740
Signed-off-by: Rakesh Naidu Bhaviripudi <quic_rakeshb@quicinc.com>

Rakesh Naidu Bhaviripudi   commited 2024-02-22 11:59:05 +05:30
a7b9424f01
msm: kgsl: Do not release dma and anon buffers if unmap fails
If iommu unmap fails and leaves dma or anon buffers still mapped in the
iommu, do not free them.

Change-Id: Ice0e1a59c1ac0ee7a9d62d8899966b84fa63d5ca
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>

Lynus Vaz   authored and   Gayathri Veeragandam   commited 2024-02-01 14:57:31 +05:30
326e137e38
msm: kgsl: Do not free sharedmem if it cannot be unmapped
If sharedmem cannot be unmapped from the mmu, it can still be accessed
by the GPU. Therefore it is not safe to free the backing memory. In the
case that unmap fails, do not free it or return it to the system.

Change-Id: Iad3e86d043f129a4d71cf862865d9033d4a315e3
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>
Signed-off-by: Kaushal Sanadhya <quic_ksanadhy@quicinc.com>

Kaushal Sanadhya   authored and   Harshitha Sai Neelati   commited 2023-12-29 18:29:23 +05:30
e2584fa02c
msm: kgsl: Do not free sharedmem if it cannot be unmapped
If sharedmem cannot be unmapped from the mmu, it can still be accessed
by the GPU. Therefore it is not safe to free the backing memory. In the
case that unmap fails, do not free it or return it to the system.

Change-Id: Iad3e86d043f129a4d71cf862865d9033d4a315e3
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>
Signed-off-by: Kaushal Sanadhya <quic_ksanadhy@quicinc.com>

Kaushal Sanadhya   authored and   Rakesh Naidu Bhaviripudi   commited 2023-12-22 12:56:00 +05:30
6514991083
msm: kgsl: Prevent wrap around during user address mapping
When setting svm region during the gpuobj import ioctl call for a usermem
address, there is a possibility of a very large input size causing the
region's 64-bit end address to wrap around. This can cause the region
to incorrectly be considered valid, ultimately allowing a use after free
scenario. To prevent this, detect the occurrence of a wrap and reject the
import.

Change-Id: I4a88f56c58b830d4342e47dc1d1f6290c78ab6b4
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>
Signed-off-by: Puranam V G Tejaswi <quic_pvgtejas@quicinc.com>

Mohammed Mirza Mandayappurath Manzoor   authored and   Michael Bestas   commited 2023-12-12 01:48:34 +02:00
58c8b3aebd
msm: kgsl: Use dma_buf_get() to get dma_buf structure
Currently we don't ensure if vma->vm_file is associated with dma_buf. This
can cause issues later when private_data from a non dma_buf file is used as
dma_buf structure. Hence get the fd that is associated with vma->vm_file
and use dma_buf_get() to get pointer to dma_buf structure. dma_buf_get()
ensures that the file from the input fd is associated with dma_buf.

Change-Id: Ib78aef8b16bedca5ca86d3a132278ff9f07dce73
Signed-off-by: Puranam V G Tejaswi <quic_pvgtejas@quicinc.com>

Puranam V G Tejaswi   authored and   Rakesh Naidu Bhaviripudi   commited 2023-11-28 10:34:02 +05:30
2dc9656767
msm: kgsl: Remove 'fd' dependency to get dma_buf handle
Get the dma_buf handle directly from 'vm_file' after
doing necessary checks on the file.

Change-Id: Id5eec16588d64e4e28483b32bb52d4d3d9b86b99
Signed-off-by: ravnar <quic_ravnar@quicinc.com>
Signed-off-by: Sanjay Yadav <quic_sanjyada@quicinc.com>
Signed-off-by: Abhishek Barman <quic_abarman@quicinc.com>
Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>
Signed-off-by: NISARG SHETH <quic_nsheth@quicinc.com>

NISARG SHETH   commited 2023-11-21 11:11:54 +05:30
b3ce2cd74c
msm: kgsl: Keep postamble packets in a privileged buffer
Postamble packets are executed in privileged mode by gpu. So we should keep
them in a privileged scratch buffer to block userspace access. For
targets with APRIV feature support, we can mark the preemption scratch
buffer as privileged too to avoid similar issues in future.

Change-Id: Ifda360dda251083f38dfde80ce1b5dc83daae902
Signed-off-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Signed-off-by: Kaushal Sanadhya <quic_ksanadhy@quicinc.com>
Signed-off-by: NISARG SHETH <quic_nsheth@quicinc.com>

NISARG SHETH   commited 2023-11-21 11:10:39 +05:30
47672094a5
msm: kgsl: Make sure that pool pages don't have any extra references
Before putting a page back in the pool be sure that it doesn't have
any additional references that would be a signal that somebody else
is looking at the page and that it would be a bad idea to keep it
around and run the risk of accidentally handing it to a different
process.

Change-Id: Ic0dedbad0cf2ffb34b76ad23e393c5a911114b82
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Harshitha Sai Neelati <quic_hsaineel@quicinc.com>
Signed-off-by: NISARG SHETH <quic_nsheth@quicinc.com>

NISARG SHETH   commited 2023-11-21 11:10:04 +05:30
37db312f1e
msm: kgsl: Prevent wrap around during user address mapping
When setting svm region during the gpuobj import ioctl call for a usermem
address, there is a possibility of a very large input size causing the
region's 64-bit end address to wrap around. This can cause the region
to incorrectly be considered valid, ultimately allowing a use after free
scenario. To prevent this, detect the occurrence of a wrap and reject the
import.

Change-Id: I4a88f56c58b830d4342e47dc1d1f6290c78ab6b4
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>
Signed-off-by: NISARG SHETH <quic_nsheth@quicinc.com>

NISARG SHETH   commited 2023-11-21 11:09:34 +05:30
5b2b4b2def
msm: kgsl: Prevent wrap around during user address mapping
When setting svm region during the gpuobj import ioctl call for a usermem
address, there is a possibility of a very large input size causing the
region's 64-bit end address to wrap around. This can cause the region
to incorrectly be considered valid, ultimately allowing a use after free
scenario. To prevent this, detect the occurrence of a wrap and reject the
import.

Change-Id: I4a88f56c58b830d4342e47dc1d1f6290c78ab6b4
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>

Mohammed Mirza Mandayappurath Manzoor   authored and   NISARG SHETH   commited 2023-09-21 16:38:01 +05:30
09ff75496d
Merge tag 'LA.UM.8.3.c25-08000-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9 into android13-4.9-sdm845
"LA.UM.8.3.c25-08000-sdm845.0"

* tag 'LA.UM.8.3.c25-08000-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9:
  msm: kgsl: Keep postamble packets in a privileged buffer
  msm: kgsl: Make sure that pool pages don't have any extra references
  msm: kgsl: Use dma_buf_get() to get dma_buf structure
  net: ipc_router: Add bounds check on tx path

 Conflicts:
	drivers/gpu/msm/kgsl.c

Change-Id: Icf8c4ad9804ab5636b8a10b85e7cfc641f82b6d2

Michael Bestas   commited 2023-05-11 14:21:34 +03:00
ec69a60d18
msm: kgsl: Make sure that pool pages don't have any extra references
Before putting a page back in the pool be sure that it doesn't have
any additional references that would be a signal that somebody else
is looking at the page and that it would be a bad idea to keep it
around and run the risk of accidentally handing it to a different
process.

Change-Id: Ic0dedbad0cf2ffb34b76ad23e393c5a911114b82
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>

Kamal Agrawal   authored and   Michael Bestas   commited 2023-05-02 20:36:07 +03:00
c2afd98c87
msm: kgsl: Use dma_buf_get() to get dma_buf structure
Currently we don't ensure if vma->vm_file is associated with dma_buf. This
can cause issues later when private_data from a non dma_buf file is used as
dma_buf structure. Hence get the fd that is associated with vma->vm_file
and use dma_buf_get() to get pointer to dma_buf structure. dma_buf_get()
ensures that the file from the input fd is associated with dma_buf.

Change-Id: Ib78aef8b16bedca5ca86d3a132278ff9f07dce73
Signed-off-by: Puranam V G Tejaswi <quic_pvgtejas@quicinc.com>

Puranam V G Tejaswi   authored and   Michael Bestas   commited 2023-05-02 20:36:07 +03:00
be9da5eeca
msm: kgsl: Keep postamble packets in a privileged buffer
Postamble packets are executed in privileged mode by gpu. So we should keep
them in a privileged scratch buffer to block userspace access. For
targets with APRIV feature support, we can mark the preemption scratch
buffer as privileged too to avoid similar issues in future.

Change-Id: Ifda360dda251083f38dfde80ce1b5dc83daae902
Signed-off-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Signed-off-by: Kaushal Sanadhya <quic_ksanadhy@quicinc.com>

Akhil P Oommen   authored and   Gerrit - the friendly Code Review server   commited 2023-04-18 23:22:17 -07:00
62ab4b820f
Merge "msm: kgsl: Make sure that pool pages don't have any extra references"
Linux Build Service Account   authored and   Gerrit - the friendly Code Review server   commited 2023-03-05 20:57:10 -08:00
5b4853e8ef
msm: kgsl: Make sure that pool pages don't have any extra references
Before putting a page back in the pool be sure that it doesn't have
any additional references that would be a signal that somebody else
is looking at the page and that it would be a bad idea to keep it
around and run the risk of accidentally handing it to a different
process.

Change-Id: Ic0dedbad0cf2ffb34b76ad23e393c5a911114b82
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Harshitha Sai Neelati <quic_hsaineel@quicinc.com>

Harshitha Sai Neelati   authored and   Rajesh Kemisetti   commited 2023-03-05 20:20:35 +05:30
b9b8bc658c
msm: kgsl: Use dma_buf_get() to get dma_buf structure
Currently we don't ensure if vma->vm_file is associated with dma_buf. This
can cause issues later when private_data from a non dma_buf file is used as
dma_buf structure. Hence get the fd that is associated with vma->vm_file
and use dma_buf_get() to get pointer to dma_buf structure. dma_buf_get()
ensures that the file from the input fd is associated with dma_buf.

Change-Id: Ib78aef8b16bedca5ca86d3a132278ff9f07dce73
Signed-off-by: Puranam V G Tejaswi <quic_pvgtejas@quicinc.com>

Puranam V G Tejaswi   authored and   Rajesh Kemisetti   commited 2023-03-05 08:43:08 +05:30
ae0923eb75
Merge tag 'LA.UM.8.3.c25-07000-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9 into android13-4.9-sdm845
"LA.UM.8.3.c25-07000-sdm845.0"

* tag 'LA.UM.8.3.c25-07000-sdm845.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.9:
  msm: ADSPRPC: Restrict untrusted applications from attaching to GuestOS
  msm: kgsl: Remove 'fd' dependency to get dma_buf handle
  msm: kgsl: Fix gpuaddr_in_range() to check upper bound
  msm: kgsl: Zap performance counters across context switches
  msm: kgsl: Add a sysfs node to control performance counter reads
  msm: kgsl: Perform cache flush on the pages obtained using get_user_pages()
  msm: kgsl: Fix memory leak for anonymous buffers
  msm: kgsl: Update register protection config
  disp: msm: sde: protect file private structure with mutex lock
  msm: kgsl: Fix out of bound write in adreno_profile_submit_time
  soc: qcom: glink: wait for tx blocked signal response
  msm: kgsl: Deregister gpu address on memdesc_sg_virt failure
  disp: msm: sde: add null check for drm file in msm_release
  msm: adsprpc: Handle UAF in process shell memory
  msm: adsprpc: Fix race condition in internal_control
  msm: adsprpc: overflow vulnerability by race condition in adsprpc driver
  crypto: Fix possible stack out-of-bound error
  net:sockev: hold file reference till the sock event is sent
  msm: kgsl: Access map_count only if entry is successfully allocated
  msm: kgsl: Correct the refcount on current process PID
  msm: kgsl: Stop using memdesc->usermem
  msm: kgsl: Protect the memdesc->gpuaddr in SVM use cases
  msm:ADSPRPC :Fix to avoid Use after free in fastrpc_internal_munmap
  msm: kgsl: Allocate user_ctxt_record based on preemption feature flag

 Conflicts:
	drivers/char/adsprpc.c
	drivers/gpu/msm/kgsl_iommu.c
	drivers/gpu/msm/kgsl_mmu.c

Change-Id: I918030d8b29f3a67939a7711b4fa9f65da4c02b8

Michael Bestas   commited 2022-10-13 02:32:26 +03:00
a2ec1d2ec1
Merge "msm: kgsl: Remove 'fd' dependency to get dma_buf handle"
Linux Build Service Account   authored and   Gerrit - the friendly Code Review server   commited 2022-05-23 04:41:30 -07:00
f4fb629ace
Merge "msm: kgsl: Fix gpuaddr_in_range() to check upper bound"
Linux Build Service Account   authored and   Gerrit - the friendly Code Review server   commited 2022-05-23 04:41:27 -07:00
22d6b4a1bf
msm: kgsl: Remove 'fd' dependency to get dma_buf handle
Get the dma_buf handle directly from 'vm_file' after
doing necessary checks on the file.

Change-Id: Id5eec16588d64e4e28483b32bb52d4d3d9b86b99
Signed-off-by: ravnar <quic_ravnar@quicinc.com>
Signed-off-by: Sanjay Yadav <quic_sanjyada@quicinc.com>
Signed-off-by: Abhishek Barman <quic_abarman@quicinc.com>
Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>

Abhishek Barman   authored and   Kamal Agrawal   commited 2022-05-11 15:07:20 +05:30
db2b3cf93d
msm: kgsl: Fix gpuaddr_in_range() to check upper bound
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>

Abhishek Barman   authored and   Kamal Agrawal   commited 2022-05-11 14:59:18 +05:30
50d74c6b62
Merge "msm: kgsl: Perform cache flush on the pages obtained using get_user_pages()"
Linux Build Service Account   authored and   Gerrit - the friendly Code Review server   commited 2022-04-23 04:32:11 -07:00
8e0e8dc1de
Merge tag 'LA.UM.10.3.r1-01000-sdm845.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.9 into android12-4.9-sdm845
"LA.UM.10.3.r1-01000-sdm845.0"

* tag 'LA.UM.10.3.r1-01000-sdm845.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.9:
  msm: camera: sensor: Add copyright details
  msm: adsprpc: Handle UAF in fastrpc debugfs read
  Input: uinput - avoid FF flush when destroying device
  drm/dp: via debugfs entry node perform power transition
  msm: kgsl: Perform cache flush on the pages obtained using get_user_pages()
  drm/atomic: Remove WARN_ON for invalid plane configuration.
  msm: camera: sensor: Add support for sensor read
  drm/dp: handle power state transitions
  scripts: checkpatch: Allow quicinc.com identity
  arm: dts: msm: regulator change to power up imx334 lc sensor on hp device
  msm: camera: isp: Fix race condition b/w add and apply req
  ion: Fix integer overflow in msm_ion_custom_ioctl
  ipa: Null persistent pointers after free
  drm/msm/dp: read extended dpcd if present
  Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation
  msm: camera: jpeg: Ensure in/out map entries are within allowed range
  msm-ipa: fix use-after-free of rt_tbl
  diag: Prevent out of bound write while sending dci pkt to remote

Change-Id: I12e95a812e3aca20abaa10ab2c89e453eadb1769

Michael Bestas   commited 2022-03-31 20:16:10 +03:00
f5077be5d7
msm: kgsl: Zap performance counters across context switches
Performance counter values need not be retained across contexts unless
specifically requested for debug. Zap the counters by initialising
perfcounter SRAM with 0's using GPU_RBBM_PERFCTR_SRAM_INIT_CMD.

Add pm4 packets during context switches and add a KMD postamble packet to
clear the counters during preemption. Do not enable perfcounter save and
restore unless requested.

Change-Id: I371779ce659c07a1cc664327f5ecdcf0374201d8
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>
Signed-off-by: Sebanti Das <quic_sebadas@quicinc.com>
Signed-off-by: Pankaj Gupta <quic_gpankaj@quicinc.com>
Signed-off-by: Harshitha Sai Neelati <quic_hsaineel@quicinc.com>

Pankaj Gupta   authored and   Gerrit - the friendly Code Review server   commited 2022-03-23 05:03:19 -07:00
2c691e37df
msm: kgsl: Add a sysfs node to control performance counter reads
Currently performance counters are global and can be read by anyone. Change
the behaviour to disable reading global counters as default and add a sysfs
node to enable/disable reads.

Change-Id: Ic3785acd9bd7425c2a844ed103d7b870d9f80adf
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>
Signed-off-by: Pankaj Gupta <quic_gpankaj@quicinc.com>
Signed-off-by: Harshitha Sai Neelati <quic_hsaineel@quicinc.com>

Pankaj Gupta   authored and   Gerrit - the friendly Code Review server   commited 2022-03-23 05:02:35 -07:00
cc4445fc27
msm: kgsl: Zap performance counters across context switches
Performance counter values need not be retained across contexts unless
specifically requested for debug. Zap the counters by initialising
perfcounter SRAM with 0's using GPU_RBBM_PERFCTR_SRAM_INIT_CMD.

Add pm4 packets during context switches and add a KMD postamble packet to
clear the counters during preemption. Do not enable perfcounter save and
restore unless requested.

Change-Id: I371779ce659c07a1cc664327f5ecdcf0374201d8
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>
Signed-off-by: Sebanti Das <quic_sebadas@quicinc.com>
Signed-off-by: Pankaj Gupta <quic_gpankaj@quicinc.com>

Pankaj Gupta   authored and   Sebanti Das   commited 2022-03-21 13:36:41 +05:30
58f8d1d270
msm: kgsl: Add a sysfs node to control performance counter reads
Currently performance counters are global and can be read by anyone. Change
the behaviour to disable reading global counters as default and add a sysfs
node to enable/disable reads.

Change-Id: Ic3785acd9bd7425c2a844ed103d7b870d9f80adf
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <quic_mmandaya@quicinc.com>
Signed-off-by: Harshitha Sai Neelati <quic_hsaineel@quicinc.com>
Signed-off-by: Pankaj Gupta <quic_gpankaj@quicinc.com>
Signed-off-by: Sebanti Das <quic_sebadas@quicinc.com>

Pankaj Gupta   authored and   Sebanti Das   commited 2022-03-21 13:32:45 +05:30
f61222b5e8
msm: kgsl: Perform cache flush on the pages obtained using get_user_pages()
Consider a scenario where user allocates anonymous memory but does not
write to it. Here the physical pages are not yet allocated. Now when this
memory is requested to be imported, a list of newly allocated zero pages
is obtained using get_user_pages(). Currently cache flush is not done for
these pages and hence GPU sees stale data. Fix this by performing cache
flush on these pages.

Change-Id: Id1e8aa20e8a9de112761732ed92f30c01088840b
Signed-off-by: Puranam V G Tejaswi <quic_pvgtejas@quicinc.com>
Signed-off-by: Sebanti Das <quic_sebadas@quicinc.com>
Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>

Puranam V G Tejaswi   authored and   Kamal Agrawal   commited 2022-02-01 12:44:29 +05:30
63b454fefb
msm: kgsl: Perform cache flush on the pages obtained using get_user_pages()
Consider a scenario where user allocates anonymous memory but does not
write to it. Here the physical pages are not yet allocated. Now when this
memory is requested to be imported, a list of newly allocated zero pages
is obtained using get_user_pages(). Currently cache flush is not done for
these pages and hence GPU sees stale data. Fix this by performing cache
flush on these pages.

Change-Id: Id1e8aa20e8a9de112761732ed92f30c01088840b
Signed-off-by: Puranam V G Tejaswi <quic_pvgtejas@quicinc.com>
Signed-off-by: Sebanti Das <quic_sebadas@quicinc.com>

Puranam V G Tejaswi   authored and   Gerrit - the friendly Code Review server   commited 2022-01-19 23:35:45 -08:00
d399eb5fb2
Merge tag 'LA.UM.10.3.r1-00500-sdm845.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.9 into lineage-18.1-caf-sdm845
"LA.UM.10.3.r1-00500-sdm845.0"

* tag 'LA.UM.10.3.r1-00500-sdm845.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.9:
  tty: Fix ->pgrp locking in tiocspgrp()
  msm: kgsl: Update register protection config
  msm: camera: req_mgr: Table info dump removed
  msm: camera: cdm: Acquire mutex lock before accessing client data
  disp: msm: sde: protect file private structure with mutex lock
  ARM: dts: msm: update subtype for qcs605 LC ipcamera
  msm: camera: jpeg: Ensure in/out map entries are within allowed range
  defconfig: enable splash logo via defconfig
  drm: msm: dp: prevent calling client_register multiple times
  drm: read boolan flag to enable static splash
  drm: drm bootsplash enable for display port
  drm: add single commit in place of multiple commits
  drm: call drm client for bootsplash entry
  drm/client: Hack: Add bootsplash example
  drm: bitmap image of splash logo
  drm: include function pointer for vmap
  drm: Add drm_connector_for_each_possible_encoder()
  drm/modes: Introduce drm_mode_match()
  drm/file: Don't set master on in-kernel clients
  drm/debugfs: Fix framebuffer debugfs file init
  drm/client: Support unmapping of DRM client buffers
  drm/modes: Skip invalid cmdline mode
  msm: kgsl: Fix out of bound write in adreno_profile_submit_time
  drm/modes: Support modes names on the command line
  drm/client: Restrict the plane_state scope
  drm/fb-helper: Move out modeset config code
  drm: Add drm_connector_for_each_possible_encoder()
  drm/modes: Introduce drm_mode_match()
  drm/fb-helper: Move out commit code
  drm/fb-helper: Avoid race with DRM userspace
  drm: move drv test macros out of drmP.h
  drm/atomic: Add macros to access existing old/new state, v2.
  drm/atomic: Add new iterators over all state, v3.
  drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI
  drm/fb-helper: Remove drm_fb_helper_crtc
  drm/client: Rename drm_client_add() to drm_client_register()
  drm/cma-helper: Fix crash in fbdev error path
  drm/client: Fix double free in error path
  drm/client: Fix: drm_client_new: Don't require DRM to be registered
  drm/debugfs: Add internal client debugfs file
  drm: Begin an API for in-kernel clients
  drm/framebuffer: Print task that allocated the fb in debug info.
  drm: Make ioctls available for in-kernel clients
  drm: provide management functions for drm_file
  uapi: sound: add bt external sink delay parameter
  msm: kgsl: Fix memory leak for anonymous buffers
  uapi: Add UAPI headers for slatecom_interface driver
  drm/msm/sde: enable continuous splash for external bridge
  drm/msm/dsi-staging: skip regulator configuration for external bridge
  diag: Add protection while accessing diag client map
  mhi: core: Fix find_last_bit() usage
  ARM: dts: msm: add bootloader enabled regulators for QCS605 MTP
  Revert "usb: gadget: Add check gadget function bind or not"
  Revert "usb: gadget: f_ecm: allocate/free net device upon driver bind/unbind"
  Revert "usb: gadget: f_rndis: allocate/free net device upon driver bind/unbind"
  Revert "usb: gadget: f_ncm: allocate/free net device upon driver bind/unbind"
  diag: Use file's private data to get pid of exiting process
  drm/msm/dsi-staging: fix dsi clock calculation for low bpp
  drivers/clk/qcom: Remove 2/3 divider from frac_table_pixel
  ARM: dts: msm: correct cdc reset contol active voltage level
  msm: vidc: Enable dual core in LP for higher resolutions
  ARM: dts: Remove disabled camera nodes from sdxpoorwills
  Use environment variable to find unifdef tool
  Change the subprocess argument to fix the build issue
  kernel_headers: Explicitly run headers_install under 'sh'
  disp: msm: sde: add null check for drm file in msm_release
  msm: adsprpc: Handle UAF in process shell memory
  ARM: dts: msm: Update CDSP pil region
  msm: ADSPRPC: Fix return value when dsp capabilities is not supported

 Conflicts:
	drivers/tty/tty_io.c

Change-Id: Icfcd7b69025e4b6475416a518fa64f14ca89bc54

Michael Bestas   commited 2021-12-27 02:19:13 +02:00
9cbdc309e8
msm: kgsl: Fix memory leak for anonymous buffers
Currently, clean up is not done properly for anonymous buffer
(KGSL_MEM_ENTRY_USER). Fix it by freeing up resources allocated
during memdesc_sg_virt.

Change-Id: I75bff2e718b494c102a8075a5f27323e1823b212
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>

Kamal Agrawal   authored and   Rajesh Kemisetti   commited 2021-12-23 18:45:24 +05:30
ca935e323f
Merge "msm: kgsl: Update register protection config"
Linux Build Service Account   authored and   Gerrit - the friendly Code Review server   commited 2021-11-11 04:35:14 -08:00
47e141f59d
msm: kgsl: Update register protection config
Update the register protection configuration as per the latest
recommendation.

Change-Id: I70365268e8e4c7ee4ff28538f22e970822e4edf0
Signed-off-by: Akhil P Oommen <akhilpo@codeaurora.org>

Akhil P Oommen   authored and   Kamal Agrawal   commited 2021-11-08 12:21:41 +05:30
ebab7d23f3
msm: kgsl: Update register protection config
Update the register protection configuration as per the latest
recommendation.

Change-Id: I70365268e8e4c7ee4ff28538f22e970822e4edf0
Signed-off-by: Akhil P Oommen <akhilpo@codeaurora.org>

Akhil P Oommen   authored and   Kamal Agrawal   commited 2021-11-08 12:17:13 +05:30
a511cc2fc4
msm: kgsl: Fix out of bound write in adreno_profile_submit_time
Make sure there is enough room in the memory descriptor to store the
entire profiling buffer object.

Change-Id: I1e1c73097bb2bba9645b0a3c66fdbbc71d8ba8fa
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>

Kamal Agrawal   authored and   Rajesh Kemisetti   commited 2021-09-28 11:52:14 +05:30
978b423aba
msm: kgsl: Fix out of bound write in adreno_profile_submit_time
Make sure there is enough room in the memory descriptor to store the
entire profiling buffer object.

Change-Id: I1e1c73097bb2bba9645b0a3c66fdbbc71d8ba8fa
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>

Kamal Agrawal   authored and   Gerrit - the friendly Code Review server   commited 2021-09-27 07:23:22 -07:00
77d3ec60d1
msm: kgsl: Fix memory leak for anonymous buffers
Currently, clean up is not done properly for anonymous buffer
(KGSL_MEM_ENTRY_USER). Fix it by freeing up resources allocated
during memdesc_sg_virt.

Change-Id: I75bff2e718b494c102a8075a5f27323e1823b212
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
Signed-off-by: Pranav Patel <pranavp@codeaurora.org>

Kamal Agrawal   authored and   Pranav Patel   commited 2021-09-16 17:59:40 +05:30
501a3cbad8
msm: kgsl: Deregister gpu address on memdesc_sg_virt failure
When memdesc_sg_virt returns error in kgsl_setup_anon_useraddr function,
the gpu address registered in SVM region will not be deregistered.
This change deregisters the gpu address on memdesc_sg_virt failure.

Change-Id: Ic99167e283a0c6331bb9f5f0b608b6cdb3c918e4
Signed-off-by: Neeraja P <neerp@codeaurora.org>
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>

Rajesh Kemisetti   authored and   Harshitha Sai Neelati   commited 2021-08-16 13:57:05 +05:30
b87350e732
msm: kgsl: Stop slab shrinker when no more pages can be reclaimed
do_shrink_slab() scans each shrinker in batches of at most
batch_size (128) pages at a time until total_scan pages are
scanned or until shrinker returns SHRINK_STOP. Under heavy
memory pressure total_scan can be large (in thousands) and
kgsl_pool_shrink_scan_objects() ends up returning 0 after
all pages that were reclaimable are reclaimed. This results in
multiple calls to kgsl_pool_shrink_scan_objects() that do not
reclaim any memory. To prevent this kgsl_pool_shrink_scan_objects()
is modified to return SHRINK_STOP as soon as no more memory can
be reclaimed.

Bug: 69931996
Test: tested using alloc-stress with additional traces

Change-Id: Ia48fc2c0d888c54ec9642c0b0962a70ca3cb4c5e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>

Suren Baghdasaryan   authored and   Michael Bestas   commited 2021-05-26 19:41:12 +03:00
02a9419eaf