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>
Variable fps usecase needs to get valid req with init packet
flag after flush, this change adds a flag to detect if we
get a valid req before resuming HW. This change also stops
the sensors during flush if useland already request to stop
dev.
CRs-Fixed: 3256139
Change-Id: Ieabd327a3b5cf380ca60548c85714c96635a272d
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
This change extends internal scheme for certain specific
scenarios. If the mode switch is applied in between exposures
it could potentially lead to out_of_sync/hang. On the switching
frame if there is no sufficient common blanking among different
exposures, CSID HW flags it, internal recovery is triggered for this.
Also it's possible that due to packet delays, IFE & sensor go out of sync,
we can try internal recovery in this case as well on receiving
out of sync error consecutively for 3 frames.
CRs-Fixed: 3254775
Change-Id: I56b40bb9f73959e66174af382025c897c18ffed4
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
This change fix ISP log error and function annotation error.
CRs-Fixed: 3248587
Change-Id: Ibe9305cb666831b98314a834049c3402b52bf389
Signed-off-by: Wang Kan <quic_wkan@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>
The change handles tasklet scheduling delays in buf done handling.
If there is a scenario where in we have a request N in active list,
and N+1 is applied on the output frame for N. It's possible
that after applying N+1, the buf done tasklet for N is not scheduled
in time, and if it so happens that the tasklet is scheduled
out beyond the next frame, HW would have consumed N+1, and we
end up reading the last consumed addr for N+1 in the buf done bh for N.
The read last consumed address from N+1, will never match with N
ultimately stalling N. We could read the last consumed
addr registers in top half, but that would lead to increased
register reads in ISR, delaying top half processing therefore the change
handle such delays within the ISP state machine.
The underlying understanding here is if HW has generated buf
done for client X on request N+1, it's bound to have processed the
buffer for client X on request N.
CRs-Fixed: 3223063
Change-Id: I1e96f5b51b6fc388f3c189f882f8ae543a6ccb06
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Fixes LDAR dump for ISP active requests by passing in the correct
address to dump helper function.
CRs-Fixed: 3215380
Change-Id: I1b4ad1c041cc3c965e7f95f9ef8129e26dce5344
Signed-off-by: Joshua Florez <quic_jflorez@quicinc.com>
Some unhandled buf dones belong to next req, we need
to add them to deferred buf done list and process it
in future.
CRs-Fixed: 3197114
Change-Id: I5489cb6faacf2b6c9018b3b660a1df2ee6ac9564
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Removes IFE HW manager reference from ISP context and moves some
LDAR dump functionality for stream info to IFE HW manager.
CRs-Fixed: 3210247
Change-Id: I311c7cd8d8684a68ba0bfbe279ef9ba55cfbbe82
Signed-off-by: Joshua Florez <quic_jflorez@quicinc.com>
Use spin_lock_bh utility to avoid the preemtpion of recovery thread
in ISP context. This can come in rare conditions when IRQ is received
on same CPU which is handling the thread.
Such cases will result in deadlock conditions.
CRs-Fixed: 3208733
Change-Id: I25fde15b484fd72fa779aed393ef94d4fbb183b6
Signed-off-by: Gaurav Jindal <quic_gjindal@quicinc.com>
This change adds supoort for variable fps feature, this
feature needs to stream off the sensor at EOF. So, this
change sends an EOF event to sensor to do the streamimg
off. Since sensor only outputs one frame every round, so
we need to apply the IFE packet to HW immediately, then
the every frame will be valid frame.
CRs-Fixed: 3178221
Change-Id: Ifc57987aac11c9655edd979734e5568c19262571
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Due to delays, frame count may not be increamented. Sending such
notifications increase the number of invalid notifications in User
space. If the frame count is same, skip sending the timestamp
to userspace. This provides more time to recover from the delays.
CRs-Fixed: 3164368
Change-Id: I09a96bbafb80233e962304d9a82fde45233a5f89
Signed-off-by: Gaurav Jindal <quic_gjindal@quicinc.com>
Add output port - HDR_STATS for SFE880 and update all mappings
associated with the port.
CRs-Fixed: 3175256
Change-Id: I1a856f3c705d651a486e0aba5a77ca73f0deb5a5
Signed-off-by: sokchetra eung <quic_eung@quicinc.com>
In case of bubble recovery stalling try internal recovery,
halt, reset and resume IFE pipeline. If internal recovery
succeeds skip notifying userland for pipeline recovery.
If the same slot [same request] is stalled again, it will
flag for userspace recovery.
CRs-Fixed: 3098892
Change-Id: I6fff844fecd653897451ab920ddf6c4d8ca2f49e
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Add output port for STATS_ALSC for VFE880 and update all mappings
associated with the port.
CRs-Fixed: 3168484
Change-Id: I0a674e7d2d6fe5fa5a51ff31e22f066fa222e5b7
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
Tweak SOF timestamp recovery logic to handle sending timestamp for
first frame. This is needed when due priority inversion, ISP context
notifies timestamp before SOF.
CRs-Fixed: 3085335
Change-Id: I9baea8d906bb8f820c7aeb2d7d4ae1c1c6f348b2
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
This change does hw recovery and reapply all alive requests
for bus overflow issues.
When we face bus overflow KMD fatal errors, instead of
sending error to UMD, we will try internal recovery and
send a warn message to UMD once internal recovery happens,
if we fail to do recovery, then sending error to UMD.
CRs-Fixed: 3098892
Change-Id: Idee3679ff06227f985e106470bc1f5a14c9cb404
Signed-off-by: chengxue <quic_chengxue@quicinc.com>
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
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>
Due to the scheduling delay, We are seeing back to back
two top half for buff done for 2 different requests
but we were expecting the bottom half after 1st top half.
We update the last consumed address in the bottom half so
we have 2nd req buffer address in last consumed reg as
we received 2nd req top half before 1st req bottom half.
We increment num_ack variable of 2nd request in case
of 1st req buff-done as it had 2nd buffer address in
last consumed address.
Ack is going beyond during the 2nd req buff-done.
This check will prevent duplicate acknowledgment increment.
CRs-Fixed: 3165255
Change-Id: I9ea3bca2a782bae6017565f30162484adf2fc789
Signed-off-by: Chandan Kumar Jha <quic_cjha@quicinc.com>
For RDI only context EOF is not notified; it should be
notified, for the corner case if the flash is
configured to apply at EOF then it will block apply for
ISP on SOF as well until the EOF is notified, this
change adds EOF notification.
CRs-Fixed: 3091241
Change-Id: If6d974d092d640d9def89bbcf7a88fba0d85579b
Signed-off-by: Tejas Prajapati <quic_tpraja@quicinc.com>
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>
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>
In RDI only usecase, if we get RUP and buf done
late, then we will enter bubble substate. In
current logic, we will move to SOF substate if
we get SOF in bubble substate, it causes the
buf done of bubble req can't be received. Since
we don't have valid interface for buf done in
SOF substate.
This changes don't move substate to SOF if we
are processing bubble.
CRs-Fixed: 3126554
Change-Id: I955173f12b5c1f5a699fa102e1ca6c82913c86e4
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Add support to report causes of fence errors for ICP and IFE.
The change also reports ICP critical failures like WD bark
and system error to userspace.
CRs-Fixed: 3035452
Change-Id: I699621ae71e0f8902cb7b9d42203effd2e2e40de
Signed-off-by: sokchetra eung <quic_eung@quicinc.com>
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>
Combine the num_exp for sHDR EPCR case, and we can
override the mode switch related parameters only
when the mup is enabled in new req.
CRs-Fixed: 3106141
Change-Id: I1bd0b38402962ca598f2e5c6bd528a0af2adc55f
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Extension of Lets do a reset (LDAR) to include more information
in dump with more dump output enhancements.
CRs-Fixed: 3068971
Change-Id: I6b61bcf546e32c096e45c511faf64514ff391e62
Signed-off-by: Joshua Florez <quic_jflorez@quicinc.com>
Fix few incorrect log and add ctx id for
irq handling log.
CRs-Fixed: 3101894
Change-Id: Ibd2783124ed6354a379b9804e6e6bc01f2ab6fb3
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Sometimes, all the buf dones of bubble req have been
received, but they are deferred buf done. If we handle
the deferred buf done before moving the req to active
list, the req will be moved to pending list first during
processing the buf done of bubble req, then moved to
active req list in the processing of epoch_in_applied.
This change moves the bubble req to active list first,
then handle the deferred buffer done.
CRs-Fixed: 3096361
Change-Id: I1e9b1ba5a46509b1c08ec92bbca0c2d7fbde679c
Signed-off-by: Depeng Shao <quic_depengs@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>
For RDI only context where the buf_done is handled from wait list,
if the buf_done is moved to deferred list then the bubble
recovery might fail. To make sure the bubble is processed the request
needs to be moved pending list. This change helps moving the request
from active list to pending list.
CRs-Fixed: 3079621
Change-Id: Ibb271e68ca2312cbd3d71bd64e2ed7963bf60b55
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
On PF based on the faulting client [IFE WR/SFE WR/SFE RD], invoke
the appropriate resource to dump it's info.
CRs-Fixed: 3079337
Change-Id: I0160fa9b29fca3991952370eb1fb37b667136bc4
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Update ISP offline state machine, to ensure any IRQ scheduling
issues would not lead to complete stalling of the stream.
CRs-Fixed: 3068998
Change-Id: I116019e4963f93c28bcfb1f09c5278f478961a5d
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
Sometimes we already get all the buf done before the bubble
is detected, so we also need to handle the deferred buf done
when the bubble is detected, otherwise, the bubble request
can't be finished.
CRs-Fixed: 3066543
Change-Id: Ied46ad0a5efe3a7d8132bc9560ae3f35d69fee89
Signed-off-by: Depeng Shao <depengs@codeaurora.org>
The reg upd and buf done irq may be got earlier
than the request is applied and before req is
added to wait req list, then these irq will
be dropped in current logic, then the req can't
be finished. This change stores the buf done as
deferred buf done in case of missing the buf done.
CRs-Fixed: 3063894
Change-Id: If0e2dbbc1ac033c13386ef06fda51736e4dbbf3b
Signed-off-by: Depeng Shao <depengs@codeaurora.org>
In case SOF interrupt is not received by the camera driver, we can
recover the missing SOF timestamp for the frame at epoch using the
previous and current SOF timestamps from CSID.
CRs-Fixed: 3067696
Change-Id: I25c8596132b99829d04ea38dbd3d904fc2a302c2
Signed-off-by: Anand Ravi <ananravi@codeaurora.org>
When internal recovery is in progress skip notifying
SOF trigger to CRM. Also for AEB add a threshold check when
slave RDIs SOF is seen post IFE epoch, flag as fatal error
only on hitting this scenario on threshold number of
consecutive occasions.
CRs-Fixed: 3064736
Change-Id: Ibda10d3c42cff6ce128197221da298d2e88cb286
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
Only realtime context can pause the CRM timer, since offline
context doesn't have ctx_crm_intf.
CRs-Fixed: 3067871
Change-Id: Ib70c2b48c95eaaf38a001a9ce39663abc5f30a83
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
This change handles race condition in which flush is handled in
flushed state.
CRs-Fixed: 3038297
Change-Id: I8be1f8c70431c77366f8846d8ccab3414f3ede3e
Signed-off-by: Vikram Sharma <vikramsa@codeaurora.org>
Avoid programming RUP/AUP at CSID start for internal recovery.
The request being recovered will configure this appropriately via CDM.
Also avoid resetting epoch factor for IFE PIX resource at stream off
that is triggered internally, the UMD configured epoch factor is
needed to stream on again post recovery.
CRs-Fixed: 3045706
Change-Id: I865ad0c2c08330a29eacfea63b4e15892a84bd69
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
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>