Add support to create, release, signal and import a synx object
using the existing generic fence operations. Handle signaling of
underlying synx object when a sync object is signaled & vice versa.
CRs-Fixed: 3317280
Change-Id: Ia6fac6eb732ed7091ec62f04875bdb30d88c8676
Signed-off-by: Petar Nedev <quic_pnedev@quicinc.com>
There is a narrow window, in which the critical section is
not fully protected which possibly could lead to use after free.
To avoid this, hold the row lock and validate the state prior
to processing the dma fence.
CRs-Fixed: 3273450
Change-Id: Ib1f09e62a5060a38b5cd8f3d4594bce2e533b3d3
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Remove unnecessary memsets of the structure variables
whose fields are assigned prior to their usage or they
are dynamically allocated with calls that set the memory
to 0. This memset usage optimization is to improve
performance.
CRs-Fixed: 3228092
Change-Id: Iec68c6d072863627959ce603cff28afd26a1c408
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
Update sync headers to remove third party update for year 2021.
CRs-Fixed: 3207212
Change-Id: I30d029d5755d4fb129c256f9771b20c115970388
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Add support to create, release, signal and import
a dma fence. When a sync object is imported for a dma fence
signal the dma fence when signaling the sync object with
appropriate status. This is achieved by implementing
generic fence scheme. The change also adds support
for batched fences.
CRs-Fixed: 3207212
Change-Id: I23fbc0992281cfee0303e213a30bce138ae7bdff
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Create common root folder under debugfs root named camera at probe. Add
utility functions to create subdirectories under the common camera root.
CRs-Fixed: 3093049
Change-Id: Ia4cefb5d2263ecabf1b9d70deefa1ee624b04f07
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
Remove return checks from debugfs_create_bool, as the API changed in
kernel 5.15+.
CRs-Fixed: 3048249
Change-Id: I2351776615a5fb17db1c54d285be2bf8e55443ab
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Issue:
strlcpy calls strlen on src ptr. If src is not NULL terminated then OOB
access will occur in below stack.
strlen
strlcpy
cam_sync_init_row
cam_sync_handle_create
cam_sync_dev_ioctl
Fix:
Pad user-space supplied name with NULL.
CRs-Fixed: 3010262
Change-Id: Ib5c2fbfe395025ec05e0bb2980f86111e95ff54c
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
This changes is to detect workqueue and tasklet
scheduling and execution delay.
CRs-Fixed: 2977775
Change-Id: Ia4b4845a067c22bd1f24bd63a971d103fcfc049c
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
Append sync obj's name to logs to help debugging.
CRs-Fixed: 2998236
Change-Id: I461865b72e49b11267c2dc20176985b4545a42e8
Signed-off-by: Sokchetra Eung <eung@codeaurora.org>
Append workq name in workq delay detect API to identify
which workq is scheduled late. Create workq name macros for
cci and cpas to pass to workq delay detect API.
CRs-Fixed: 2994927
Change-Id: Iebc14520b918272e92b59c900de5fe17f38a2406
Signed-off-by: Sokchetra Eung <eung@codeaurora.org>
In current implementation, each driver call wait_for_completion_timeout
and readl_poll_timeout with own timeout values.
In case of slow environments like presil, lot of hacks are needed to
change the timeouts for each driver. It needs multiple code changes
and compilations, thus consuming time.
This commit implements a common interface to call
wait_for_completion_timeout and readl_poll_timeout.
Debug variable is also introduced to
change the timeout value. This will help to change the timeout
without compilations and changes at multiple places.
Change-Id: Iba51e0805a49ed325147a12688c2fe6619bb68e6
CRs-Fixed: 2830502
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
For MFHDR plus EIS case, both long and short exposure
input ports will be connected. Thus overall connected
ports for EIS will be 8, resulting in V4L2 queue
depth to 240.
CRs-Fixed: 2794286
Change-Id: I12a1ae4129ccb7e3b7211a22891016ecd769b949
Signed-off-by: Shravya Samala <shravyas@codeaurora.org>
msm: camera: cdm: Fix dangling pointer issue
msm: camera: cdm: change work record to atomic variable
msm: camera: utils: Adding device type to track device handles
msm: camera: tfe: Reduce stack footprint during bw vote
msm: camera: req_mgr: Thread switch delay detection mechanisms
msm: camera: cdm: Avoid submitting BL if FIFO is full
msm: camera: tfe: check cdm hang in the tfe config timeout
msm: camera: req_mgr: Delay detection mechanism
msm: camera: cdm: Debug info in case of cdm page fault
msm: camera: isp: Max context reduction for TFE in isp driver
msm: camera: ope: Maintain current clock value during acquire
msm: camera: req_mgr: Limit CAM_ERR log in case of no empty task
msm: camera: cdm: Decrement write-count only after Bl commit
msm: camera: isp: Added CSID recovery mechanism.
CRs-Fixed: 2792394
Change-Id: I1c7a903ae15b572acf3f6318cda7394cb6549c8d
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
Fix the order of imports for to resolve cam_sync
typedef for kernel CFI.
CRs-Fixed: 2772200
Change-Id: I4e5e642e6b45412904585aaa68c0ef77fedeee2d
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Add SYNC_V4L_EVENT_V2 support in sync driver. As part of this
change, added the reason code field as part of sync event header.
This failure reason code is filled by camera kernel driver and
propagate to userspace.
CRs-Fixed: 2750553
Change-Id: I206d0d51c38cfe4214814b89d241f51c1f50605b
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Guards debugfs features in camera driver to only be compiled when
CONFIG_DEBUG_FS is enabled.
CRs-Fixed: 2717236
Change-Id: I0de77741301d259cbec64e8a2e27830981b2b69d
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Fixes exit call flow as a part of rmmod.
CRs-Fixed: 2675526
Change-Id: I47111a737cb06d9bb3d0a417a471c5c9fb545999
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
Some mfhdr usecases require more than 1024 fences because of
delayed request processing and bypass. Increase maximum number
of fences or sync objects to 2048.
CRs-Fixed: 2598592
Change-Id: If11fa2986fce0cd97c14370d29a117230134d6f5
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
External configs should be checked by using IS_REACHABLE/IS_ENABLED
macro's to check if the config option is set for the build target.
CRs-Fixed: 2584631
Change-Id: I07a0d95391a83a2264f826e2935d67686d295317
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
When sync object is invalid and num_in_map > 1,
it will lead to context ref leak. Check sync
object first, then register sync call back.
CRs-Fixed: 2594185
Change-Id: I2d39ce3ea43bbe7bc05420b86b37fdfba4aa795a
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
Missing video unregister was causing list delete corruption.
Also, there were double free errors in Sync and CRM driver. Fix
v4l2 issues by adding the missing unregister calls and changing
release callback to empty, because we are freeing it during
cleanup. Improve logging during bind/unbind to better reflect what
is happening.
CRs-Fixed: 2584631
Change-Id: Idc5db655d22df54e8bdb470d29896e10f6987796
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
Due to the asynchronous nature of platform probes, inter
dependency between drivers needs to be taken care during
kernel boot up. Component helper provides the facility of
adding matching drivers in a list ordered in the way we want
to bind those drivers. The CRM driver acts as component master
to make sure all slave drivers are bound before it returns
from its own bind call. Add support for serializing platform
probes through component framework.
CRs-Fixed: 2584631
Change-Id: I345da1d2b9cccf6021ac6fc899143013b7714ec4
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
Currently sync driver is independent from dtsi matching in order
to get it probe. Update the logic to make sure probe is getting
invoked if respective dtsi is present.
CRs-Fixed: 2590413
Change-Id: I69124e49d68e223d082521a9431cb7e8d846e8d7
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
The v4l2 registration requires all devices that are not subdevs
to have device caps field to be non zero. Add device caps for
CRM and SYNC devices during probe.
CRs-Fixed: 2582994
Change-Id: I804e7bc00d597debc39d1f71259cf607c60ed069
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
Currently camera modules platform registration/remove function
is being called as a part of module_init function individually.
Building camera as module, current infrastructure cannot support
it, as DLKM only support single module_init/exit function.
This change enables that support by combining all platform
entry/remove functions centrally. Also, remove all submodule
makefiles and combined into one root makefile in order to generate
single kernel object file to dynamically loading the kernel module
in case of DLKM compilation.
CRs-Fixed: 2569808
Change-Id: I59db3ed6cef60123e474db2f222c39836056bd6e
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Adds fixes to makefile in order to support legacy kernel build systems.
CRs-Fixed: 2560543
Change-Id: Iab571871e5171aab501c41496cc09e3c5d942985
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Add error message in case of fence exhaust.
Add support to dump fence table in case of fence exhaust.
CRs-Fixed: 2556458
Change-Id: I9910a04c69b54fe99541524b6581fa9994fd523f
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Kernel uses v4l2 events to communicate with userspace.
If userspace is not dequeuing events and kernel is pushing more events
then v4l2_event_queue fails silently.
This change uses v4l2 callbacks to log v4l2_event_queue failure.
CRs-Fixed: 2541894
Change-Id: I98f8f609f615104ec6dde569bf1f39de1eb368fc
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
EIS have 6 fences per request and uses 15 frame window. On camera close
it signals ~90 fences at once. This can overflow v4l2 event queue.
Increase v4l2 queue length for sync events to prevent overflow.
CRs-Fixed: 2498880
Change-Id: Ie886318168e326c1525b4f8be5cacc5f70d0c477
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
Correct some Makefiles and drivers header inclusion.
Change-Id: Iec3e6e0333ae55e8f1cff9780723e0dad954ff83
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
Synx driver is dependent on camera driver for registering callback
functions of sync driver. This change invert the logic, and camera
driver will register the callback functions for synx driver at the
time of sync driver probe.
Change-Id: I2dbee15ba4c7a9dde336a4bb1f2a4dddcd90348b
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
Bring over camera driver changes as of msm-4.19
commit 5a5551a7 (Merge "msm: camera: reqmgr: Fix CRM
shift one req issue").
Change-Id: Ic0c2b2d74d1b3470c1c51d98228e312fb13c501a
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>