Commit Graph

90 Commits

Author SHA1 Message Date
Petar Ivanov
94a49971d2 msm: camera: icp: Add LDAR support for wait and pending lists
When LDAR dump is triggered check for any remaining buffers in all
possible buffer lists in the ICP, in case of found buffers add their
info to the LDAR Dump.

CRs-Fixed: 3298809
Change-Id: I55d3780c7d789e3a77e78c9ef3ecffc9a36419f3
Signed-off-by: Petar Ivanov <quic_pivanov@quicinc.com>
2022-10-07 16:36:33 -07:00
Soumen Ghosh
d376c5da40 msm: camera: core: fix the compilation error
fix the compilation issue, of switch case where break statement was
missing.

Change-Id: Ibae74f966f13cea0e218c14caf9dafbb4bfb87cb
CRs-Fixed: 3306362
Signed-off-by: Soumen Ghosh <quic_soumeng@quicinc.com>
2022-10-07 16:36:12 -07:00
Sokchetra Eung
c87d8891b9 msm: camera: common: Enhance error injection framework
Update from error injection framework to event injection framework to
support PF event inducement and node event. Different set of user
input parameters are required dependent on which event to injection.

ICP and ISP support error event and page fault event injection. JPEG
supports node event and page fault event injection. However, buf done
error injection is only supported for JPEG and ICP.

Create a query API to check whether PF is fatal for a context bank.
Using the API, if PF is fatal, page fault event injection is not
supported for the device that owns the context bank.

Make change to JPEG context event callback handling to account for
various events including Event Injection event.

CRs-Fixed: 3210139
Change-Id: I582ee0bda8dbf631ece2522a5a8145f38ec71928
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2022-09-29 15:06:49 -07:00
Sokchetra Eung
56cc1d37bc msm: camera: common: Fix invalid packet access
Instead of caching packet address pointer, store packet handle
in page fault req info structutre to obtain packet address through
mem manager to avoid potential access to dangling packet pointer which
resulted from UMD called to free the packet buffer before kernel finishes
handling page fault. If the packet was freed, then querying to get packet
address from memory manager will fail since the mem handle is invalid.
If it is invalid, the page fault handler will return before accessing
the dangling packet.

CRs-Fixed: 3287554
Change-Id: I02bc0c706b64f1dc0d098d8189f2f129a91efba7
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2022-09-19 18:36:54 -07:00
Stark Lin
45d440634d msm: camera: common: Fix possible dereference of NULL pointer
Null pointer 'flush_args.flush_req_pending' may be dereferenced,
this change add check snippet before the dereference.

CRs-Fixed: 3250285
Change-Id: I1170a291e7d0d986abe2d5909e6c328e248e4d27
Signed-off-by: Stark Lin <quic_starlin@quicinc.com>
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
2022-07-29 17:06:32 -07:00
Sokchetra Eung
d2a1f0c968 msm: camera: common: memset usage optimization
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>
2022-07-26 11:03:32 -07:00
Tejas Prajapati
2827395809 msm: camera: reqmgr: reader writer locks to avoid memory faults
Shared memory is initialized by CRM and used by
other drivers; with CRM not active other drivers
would fail to access the shared memory if
memory manager is deinit. Reader Writer locks can
prevent the open/close/ioctl calls from other drivers
if CRM open/close is already being processed.

Issue observed with the below sequence if drivers
are opened from UMD directly without this change.
CRM Open successful,ICP open successful,
CRM close in progress, ICP open successful,
mem mgr deinit and CRM close successful,
ICP tries to access HFI memory and result in crash.

This change helps to serialze the calls and prevents
issue.

CRs-Fixed: 3019488
Change-Id: I84d50918713686a067c0e3deb64c9c6ae9edfcb5
Signed-off-by: Tejas Prajapati <quic_tpraja@quicinc.com>
2022-04-13 17:06:43 -07:00
sokchetra eung
c52c83e7ce msm: camera: common: Page Fault notification to userspace
Upon Page Fault, smmu driver invokes faulted client's callback
which looks for faulted buffer and context. The client driver
can be ISP, ICP, JPEG, IFE CDM and CPAS CDM. The driver then
fills PF msg struct, logs related info, and notify PF msg to
userspace. Userspace is expected to abort and calls to shut
down kernel drivers. When Titan powers on next session, CAMSS
undergoes async reset.
This change also ensures the page fault related changes added
to TFE, OPE, CRE do not break the drivers compilation.

CRs-Fixed: 3156671
Change-Id: Icd6c8c9a38cac206fe8260d374d03964fb280879
Signed-off-by: sokchetra eung <quic_eung@quicinc.com>
2022-04-07 20:36:52 -07:00
Joshua Florez
b31c24849c msm: camera: common: LDAR Dump Changes/Fixes
Separated ISP register dump from LDAR dump, fixed issue where LDAR dump
would fail if no active requests found, removed excessive logging function
call in ISP state monitor dump, fixed pending request/applied request dump
order to match tags in context utils, added more info from ISP stream.

CRs-Fixed: 3142549
Change-Id: Iaf25c0313714b5a776e3db81c11e96c7762d0f6e
Signed-off-by: Joshua Florez <quic_jflorez@quicinc.com>
2022-03-24 18:36:12 -07:00
Pranav Sanwal
1220255b08 msm: camera: common: Add camera error injection utility
Add and implement sysfs parameters to inject errors to
camera HW on demand through UMD for IFE,ICP and JPEG.

CRs-Fixed: 3115857
Change-Id: I4376fe31016cd81ad7e6f04cbc55e8ce010a6154
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
2022-03-24 12:36:48 -07:00
sokchetra eung
fb6888d8bb msm: camera: common: Dynamically allocated flush request array
Change flush request active and flush request pending arrays from
static of size 20 to dynamically allocated size based on current
pending and active request lists.

CRs-Fixed: 3046003
Change-Id: Iaa1179881d786359dbe9d37411a6ef3ae8038227
Signed-off-by: sokchetra eung <quic_eung@quicinc.com>
2022-02-18 13:36:17 -08:00
Joshua Florez
5ce71f412e msm: camera: icp: LDAR Dump ICP Extension
Extension of Let's do a reset (LDAR) for ICP to include more info.

CRs-Fixed: 3105929
Change-Id: I5fee181d009a8d69e8d3e673a552b289f72fb4aa
Signed-off-by: Joshua Florez <quic_jflorez@quicinc.com>
2022-02-02 22:36:14 -08:00
Wang Kan
df174ddd8a msm: camera: common: logging improvement
After flushed, KMD reports ERR including isp, actuator, sensor, flash.
However many CRs don't have fatal KMD error log, but participant is KMD.
Remove the non-fatal KMD error log.

CRs-Fixed: 3095401
Change-Id: I0e5e370c0c4d1daceb72d9eed8d0c45baad5179e
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
2022-01-27 19:36:09 -08:00
Pavan Kumar Chilamkurthi
5fafa34efe msm: camera: icp: Add traces for icp
Add acquire, buf_done traces for icp contexts.

CRs-Fixed: 3105126
Change-Id: Ic12640b703ae819915eb3df7dc69b3b39f4f10ac
Signed-off-by: Pavan Kumar Chilamkurthi <quic_pchilamk@quicinc.com>
2022-01-21 19:36:33 -08:00
Anand Ravi
1ff6fd9371 msm: camera: isp: Add mechanism to verify IRQ lines
IRQ line verification can now be triggerred from IFE HW manager by
writing to a debugfs file as follows:
    echo 1 > /d/camera/ife/test_irq_line

IRQ line verification can also be done at probe if
CONFIG_CAM_TEST_IRQ_LINE_AT_PROBE is set to true during compilation.
Both debugfs and probe-time verifications are only active if
CONFIG_CAM_TEST_IRQ_LINE is set to true during compilation.

CRs-Fixed: 3071027
Change-Id: I0f756ae76d366c254b4af64adf60fe6be7a1a2ef
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
2021-12-22 16:44:26 -08:00
Savita Patted
7db7eaf7a5 Merge "msm: camera: common: Update the ctx memory request logic" into camera-kernel.lnx.5.0 2021-10-26 20:45:40 -07:00
Jigar Agrawal
840b32b393 msm: camera: common: Update the ctx memory request logic
Make the context memory request for hw update entries,
in_map entries and the out_map entries per request, instead
of requesting the memory for all the requests at once in a
large blob. This will prevent the memory requests getting
denied in the situations like memory fragmentation.

CRs-Fixed: 3059124
Change-Id: I829407a6053ddddfe4bc9a07d3ae5724a57eb602
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
2021-10-19 17:08:53 -07:00
Camera Software Integration
74ae961cc1 Merge "msm: camera: core: Delete request from pending list in case of error" into camera-kernel.lnx.5.0 2021-10-19 14:43:46 -07:00
Gaurav Jindal
1414b82cc2 msm: camera: core: Delete request from pending list in case of error
While preparing hw for request, there is a possiblity of receiving
invalid sync object. In this case, we need to return error. By this
time, the request is already in pending list. While returning error,
request is moved back to free list. But deleting from the pending list
was missed.
This commit deleted the request from the pending list if the sync object
received is invalid.

CRs-Fixed: 2660625
Change-Id: Id619452889476b0c2811c8560361205b0d89bcb9
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
2021-10-13 21:39:11 -07:00
Karthik Anantha Ram
66b3f46f58 msm: camera: isp: Update reapply field in config args
Currently reapply field in config args signifies applying
only IO buffers. Update that field as an enum providing
the provision to reapply IQ or IO accordingly.

CRs-Fixed: 3045706
Change-Id: Id10ee846a6de093e5a79858689802e421628ce56
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-10-13 11:42:21 -07:00
Suraj Dongre
1d86110d7b msm: camera: common: Add wrapper for presil locking
Presil IRQ handling requires running in a workqueue, with
wait for acknowledgement in io operations. This busy wait
should be done while holding a mutex lock as opposed to
spinlock in usual irq context. Add wrapper to switch from
spinlock to mutex for presil mode in irq controller and
cdm. Add the hw lock wrapper in hw interface header.

CRs-Fixed: 2932495
Change-Id: I7600eb1e6ae8746a39e76f6cb3a2652b255f2ddd
Signed-off-by: Suraj Dongre <sdongre@codeaurora.org>
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2021-10-11 10:34:34 -07:00
Camera Software Integration
a41dc966a3 Merge "msm: camera: common: Add context flush state check" into camera-kernel.lnx.5.0 2021-09-27 15:36:33 -07:00
Depeng Shao
c8ac17dee6 msm: camera: reqmgr: Fix request sync issues
Fix several request sync issues.

CRs-Fixed: 3029196
Change-Id: I92b4048b392fa19e2c9748a5ee0efd9ef0b4e680
Signed-off-by: Depeng Shao <depengs@codeaurora.org>
2021-09-20 13:04:31 +08:00
zhuo
5ce3274d14 msm: camera: common: Add context flush state check
This commit add context flush state check to avoid invalid flush.

CRs-Fixed: 3034117
Change-Id: I45192f6b6255ffefedefe869badf04448dfaa5f6
Signed-off-by: zhuo <zhuo@codeaurora.org>
2021-09-10 19:05:12 +08:00
Mukund Madhusudan Atre
5dba22d1fc msm: camera: common: Add buffer send and receive mechanism
Add packet based buffer send and retrieve mechanism for
presil testing.

CRs-Fixed: 2932495
Change-Id: Ifd1e0fdb8b12feabb884e02a07a3813db01a3899
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2021-09-09 12:41:00 -07:00
Gaurav Jindal
2f5933b075 msm: camera: common: Add Minidump changes for NRT devices
Based on targets, in case of device crash, in place
of complete memory dump, mini dump can be extracted.
This commit adds changes in context utils for NRT devices
and in ICP, JPEG drivers.

CRs-Fixed: 2993116
Change-Id: I7c4af2cdf44713f741d3d772316080124e8a9a7f
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
2021-08-22 21:19:33 -07:00
Gaurav Jindal
d266ac8813 msm: camera: common: Add camera minidump changes
Based on targets, in case of device crash, in place
of complete memory dump, mini dump can be extracted.
This commit adds changes for basic framework
to interact with base kernel for mini dump.
This commit also adds changes for ISP, CRM, SMMU and
Memory Manager.

CRs-Fixed: 2993116
Change-Id: I02620bd79ee2f84847381509a5eb030ffb1ca9d4
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
2021-08-22 12:00:40 -07:00
Camera Software Integration
7e00864138 Merge "msm: camera: jpeg: Add Support for JPEG retry mechanism" into camera-kernel.lnx.5.0 2021-08-16 21:02:55 -07:00
Jigar Agrawal
e8f91ce471 msm: camera: jpeg: Add Support for JPEG retry mechanism
Add support for JPEG Thumbnail retry mechanism. Restructure
the command buffer arrangement, add JPEG generic blob functionality
and add support to notify user when the JPEG Thumbnail encoder
size increases than the threshold size received through blob.

CRs-Fixed: 2999106
Change-Id: Ica74f934939b562a3a88af551bfb5de79399e247
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
2021-08-12 18:14:36 -07:00
Anand Ravi
b811f12335 msm: camera: isp: Protect recovery callback from stop ioctl using mutex
Since recovery callback happens in workqueue context, it can run in
parallel with stop dev ioctl. This leads to many possible race
conditions. Instead, protect the recovery callback with the same context
mutex as ioctls to prevent parallel execution.

CRs-Fixed: 3003703
Change-Id: I92a635cfaeee4cf09047672a5cb925cf262cd816
Signed-off-by: Anand Ravi <ananravi@codeaurora.org>
2021-08-09 11:49:02 -07:00
Anand Ravi
ff11552d04 msm: camera: isp: Logging improvements to ISP context
Reduce number of logs printed by ISP and custom contexts for each
packet. Also move sync related error logs to debug logs.

CRs-Fixed: 2977145
Change-Id: Icf22eefdf0ae1d6ef006272f95352ae65cbf3b34
Signed-off-by: Anand Ravi <ananravi@codeaurora.org>
2021-07-19 11:38:22 -07:00
Mukund Madhusudan Atre
fc00541bb9 msm: camera: isp: Add support for clk bw update on config
Move clock update call from prepare to config. Add delay
in clock reduction and enable src clock update only when blob
is received. Optimize bw update and combine application of
clock and bw in ife and sfe. Finish update will be common for
clock and bw update, and will be called once per acquired hw.

CRs-Fixed: 2841729
Change-Id: Ideb8e8cfe6838bb9d5c861fb6b7cbc5e499ebee5
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2021-07-08 08:45:10 -07:00
Savita Patted
dba6c5e0f0 Merge "msm: camera: common: Change shutdown sequence for subdevices" into camera-kernel.lnx.5.0 2021-07-07 09:54:21 -07:00
Savita Patted
04222f7d6e Merge "msm: camera: ife: pagefault_ops access protected with mutex_lock" into camera-kernel.lnx.5.0 2021-07-01 15:27:38 -07:00
Karthik Anantha Ram
d785949196 msm: camera: common: Change shutdown sequence for subdevices
In subdev close call if CRM is still active wait for shutdown
from CRM [media device]. Remove subdevice check for active
handles, shutdown to happen irrespective of any active context.

If CRM is not active, subdevice shutdown should ensure there is
no access to kernel allocated buffers since at this point
memmgr is de-initialized.

As part of ICP close, remove usage of HFI queues, trigger PIL
to transfer FW memory ownership back to HLOS and power off ICP.

CRs-Fixed: 2976107
Change-Id: Ib05b3fbdcc33f4072da7ef77cf0118a807860e8c
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-06-30 17:04:11 -07:00
Karthik Jayakumar
9e5bc7a1f4 msm: camera: common: Fix dma_attr_t types
Fixes typecasts from dma_attr_t types to uint32_t types for memory
management.

CRs-Fixed: 2948659
Change-Id: Ie3898176195ac508f1a922a5e499e6e33ac8e490
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-06-23 10:09:24 -07:00
Savita Patted
68de607556 Merge "msm: camera: req_mgr: Enhance camera v4l2 subdev shutdown sequence" into camera-kernel.lnx.5.0 2021-06-21 18:38:47 -07:00
Tejas Prajapati
1a9a9042d2 msm: camera: ife: pagefault_ops access protected with mutex_lock
Pagefault_ops is protected by the mutex_lock to avoid the
list corruption by concurrent access via flush calls.

CRs-Fixed: 2904307
Change-Id: Ia6519a382ace7b89b6bd59a2dacfeca3c31e2705
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
2021-06-08 11:44:23 +05:30
Ayush Kumar
566ac7abf8 msm: camera: common: Multiple fixes for crm redesign
This change help to resolve below issues :-
1. Update frame duration calculation
   Add frame duration calculation with the use of fps. In some cases
   where horizonal blanking is more, frame duration calculation based
   on sof epoch calculation is not accurate.
2. Corner case in bubble handling
   Add support to handle master link bubble even if ISP linked with
   slave link receive few buf done irq for bubble request before master
   sends slave link to bubble state.

CRs-Fixed: 2783209
Change-Id: Ibf35f31f5263be7b6a6be6cd095447a2910a6878
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
2021-06-05 00:16:43 +05:30
Ayush Kumar
0259331da4 msm: camera: req_mgr: Re-design CRM to support multi links in sync mode
This change is to support multi links in sync mode. Supports dynmanic
switching to select master link in rtb and sat use case in sync mode.
Supports sync logic for rtb and sat use case in sync mode. Apply
requests for all links is triggered only on master epoch. Supports
bubble recovery and sync logic for different pd links in sync mode.

CRs-Fixed: 2783209
Change-Id: I81d1d0d37aa0d6e18c19ca87eac51ef3f160abfb
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
2021-06-04 20:23:00 +05:30
Camera Software Integration
5cf3a57890 Merge "msm: camera: reqmgr: add trace log for separating multi camera" into camera-kernel.lnx.5.0 2021-04-28 21:19:52 -07:00
Haibin Liu
693c6dfdae msm: camera: reqmgr: add trace log for separating multi camera
Based on link_hdl/sensor id, that can separate multi camera event
on reqmgr, apply request, bufdone, isp_active_irq.
Add log of link_hdl/sensor id in above trace event,
that systrace can show independent camera trace event.

CRs-Fixed: 2924042
Change-Id: I7088a8a489a05dae4e62dc131d1c0c45c72038e2
Signed-off-by: Haibin Liu <haibinl@codeaurora.org>
2021-04-19 21:51:51 +08:00
Alok Chauhan
2ebae4fabe msm: camera: req_mgr: Enhance camera v4l2 subdev shutdown sequence
when provider crash occurred, there was a CSID lane overflow
observed due to shutdown sequence from CRM(sensor, csid, csiphy).
To fix the issue need to change the shutdown sequence
(csid, sensor, csiphy).

This change will update the devices sequence in order while registering
and close the sequence accordingly.

CRs-Fixed: 2852076
Change-Id: Ia6d8022e995823bf031400c33528eb8544dc2e29
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2021-04-14 05:20:37 -07:00
Karthik Anantha Ram
9f4f8e114c msm: camera: common: Use the appropriate header for spinlock
With the allow list tightened, use the right header for spinlock
usage. Change replaces usage of linux/spinlock.h to
linux/spinlock_types.h.

CRs-Fixed: 2841729
Change-Id: I0247501b765436099f75c9725e9f614f0873c888
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-04-12 14:42:58 -07:00
Ravikishore Pampana
2c30b3e2f2 Revert "msm: camera: core: Allocate memory for flush req array dynamically"
This reverts commit 018d8dae943321b3ce7138090855c94831124846.

CRs-Fixed: 2901141
Change-Id: Ida945ea1b83fdf1f60d19b072f667a133ac9b9dc
Signed-off-by: Ravikishore Pampana <rpampana@codeaurora.org>
2021-04-05 21:20:17 -07:00
Depeng Shao
d0f46318e7 msm: camera: core: Allocate memory for flush req array dynamically
Allocate memory for flush req array dynamically based
on the list count, in case the req count bigger than
the size of req list.

CRs-Fixed: 2835525
Change-Id: I7e48fb9dc7815cb991c84195e761a3c3f1c26b48
Signed-off-by: Depeng Shao <depengs@codeaurora.org>
2021-03-12 23:40:43 -08:00
Savita Patted
90fb1ebc6c Merge "msm: camera: isp: Allocate max map entries based on the stream type" into camera-kernel.lnx.5.0 2021-03-10 16:10:01 -08:00
Karthik Anantha Ram
b15d7e1415 msm: camera: isp: Allocate max map entries based on the stream type
Allocate context map entries based on the chipset and also
the underlying HW acquired for the given context.

CRs-Fixed: 2841729
Change-Id: Ieeb442c74bd3b6c9c32fbe47b59f40a8485963b3
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-03-05 16:12:07 -08:00
Vikram Sharma
57bff5aede msm: camera: ope: Handle OPE smmu fault with pid info
Kernel apis provide information fault caused pid and mid data.
Handle the OPE smmu fault using pid and mid data. Based on the
mid data, dump only corresponding port info which caused the
fault. Pid and mid values are target dependent, these values
will be updated on the ope node dt entries.

CRs-Fixed: 2857868
Change-Id: I909f1787e71e67e5ed1d3464dfeb506418d151e4
Signed-off-by: Vikram Sharma <vikramsa@codeaurora.org>
2021-02-24 23:40:40 -08:00
Karthik Anantha Ram
fa9a698aa1 msm: camera: isp: Add per frame support for scratch buffers
If CRM skips applying settings on a given frame, in case of sHDR
program scratch buffers along with RUP/AUP to ensure
continuity with respect to sensor frames.

CRs-Fixed: 2841729
Change-Id: I296dbc713f49db54681043415b6ad1499dc13de4
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-01-21 09:01:34 -08:00