Add precision to nanosecond part of monotonic timestamps.
Update delimiters between second and nanosecond values.
CRs-Fixed: 3307225
Change-Id: I4e7aab0ea9256c2ff769a87c3873002d715ed3c9
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
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>
Add support for bw update version 3. Add provision to
maintain cpas per path bw info internally in drivers.
CRs-Fixed: 3065551
Change-Id: I65e97c6e41f933818f1211bbc27651842e93c028
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
Fix syntactical errors that resulted in failed compilation
for TFE and OPE.
CRs-Fixed: 3179075
Change-Id: Iec4dc104160651fb46b18be17a556356dce3b3c0
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
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>
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>
Currently the ope request timeout value for RT and NRT context
are same. In some usecases, NRT request processing takes more time.
Hence, initialize the RT and NRT request timeout value separately.
CRs-Fixed: 3082993
Change-Id: I17e86d26403fb21cdff518a81dee7a19c865144e
Signed-off-by: Alok Chauhan <quic_alokc@quicinc.com>
Currently we allocate the memory for CDM GENIRQ command
within the Kernel on every stream on. Presil framework
do not have an ability to transfer the kernel only buffers
to the user daemon. For that reason we need to add support
to use the user allocated command buffer instead of the
kernel generated memory to add the GenIRQ cdm command
while submitting BLs. This change also helps to reduce
the stream on and stream off latency by not having to
allocate and free the GENIRQ memory on every stream on and
stream off respectively.
CRs-Fixed: 3115399
Change-Id: Ic159efd56fb9c4480ed1eb25cf2c058cbb914332
Signed-off-by: Jigar Agrawal <quic_jigar@quicinc.com>
Increase “OPE_MAX_CDM_BLS” to 32 from 24 and MAX_STRIPES to
64 from 48.
CRs-Fixed: 3082993
Change-Id: I9e3631cc86c5e10e4e2020d4a9b2264ea282e437
Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
Force callers to say if they are using 36 bit address patching or not.
CRs-fixed: 3121782
Change-Id: I4dee25e3f73104a1be043fe18a295cd4f8447821
Signed-off-by: Karthik Jayakumar <quic_kjayakum@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>
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>
Add a check for reg-val count=0 in reg_random command. Count=0 in
reg_random cdm command will throw an invalid command HW error.
CRs-Fixed: 2916477
Change-Id: Idb8654c3752963cf5a52147d350e291208b917d0
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
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>
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>
Added changes to dump new IQ modules as well
in OPE during page fault and hang scenarios.
CRs-Fixed: 2878214
Change-Id: I97e7d4ee2ed9899ed299155c9aca8b094dff18f0
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Add logic to dump stripe info and wait event status at the
time of cdm hang.
CRs-Fixed: 2878214
Change-Id: Ib9892b0273e4436988c5f1384d18d60d29529c94
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Having a global variable and using the same for all devices
will overwrite the name of previous device. Use pdev name
to be consistent and helps in debugging logs.
CRs-Fixed: 2901925
Change-Id: I086f3dbd12e720c5e6497355eae40ca242d3d408
Signed-off-by: Pavan Kumar Chilamkurthi <pchilamk@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>
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>
Add support to dynamically switch pix_pattern of read clients
based on data received in each request.
CRs-Fixed: 2811530
Change-Id: Icb3ebd33cae59b8db87bc0011d6560492ad29c3a
Signed-off-by: Rishabh Jain <risjai@codeaurora.org>
Kernel 5.10 and up have renamed kzfree to kfree_secure. As such,
we have added a cam_free_clear function to redirect all uses of kzfree
uses to the appropriate function depending on the kernel version the
driver is built against.
CRs-Fixed: 2835738
Change-Id: I72d191c9fb0454a4dbb1392894a909e81fe07caa
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
In current implementation, cam_ctx_req has a array of
hw_update_entries, in_map_entries and out_map_entries. Each
context has array of N requests. Memory for all contexts is
allocated during probe. This causes a huge memory remaining
unutilized.
This commit moves the memory allocation to context acquire time
and freeing this memory during context release. In place
of using array, now dynamic allocation is used.
A top level calculation shows a memory reduction of around 2M-
2.5M with this change including all the camera drivers.
CRs-Fixed: 2830502
Change-Id: Id63cf2a52272e2a419704dc95100694e384330c3
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
Reduce logging as part of error handling to avoid
flooding kernel log with excessive log. Apart from
that send feedback to client irrespective of cdm
reset status.
CRs-Fixed: 2826285
Change-Id: I9b0d8c6f64ced4972bb20e26774508573c815e4f
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
OPE driver allocate memory dynamically to store cdm
acquire and bw data in acquire time and don't use later.
These memories can be freed before returning from acquire.
CRs-Fixed: 2827058
Change-Id: Ibf87282862f2ae4655da3c69016bedb7f96bca1c
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
In corner case, there is a chance that userspace can submit
request while flush is ongoing. In some cases submitted request
can get flushed and corresponding data structures memory gets
freed.
Add a logic to check for pending request before submitting request
to cdm hw.
CRs-Fixed: 2815901
Change-Id: I74096201e204f204c4f15d14698b4e9af6435f55
Signed-off-by: Alok Chauhan <alokc@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>
While preparing config packet at HW layer,
we are setting Ope request timer even before
processing command buffer and IO cfg. This is
leading to false hw hand detection.
Expectation is Ope request timer has to
start after req is submitted to HW.
CRs-Fixed: 2788900
Change-Id: Idd1420b2ee1aed4bfe947cf5617bbec9b39147d3
Signed-off-by: Shravya Samala <shravyas@codeaurora.org>
While dumping OPE req list we were not protecting it in context mutex,
this can result into unexpected behaviors. This change take care of
protecting the dump logic using mutex.
CRs-Fixed: 2750458
Change-Id: I916822b498cde3922274c18a06b98c898bff1d65
Signed-off-by: Vikram Sharma <vikramsa@codeaurora.org>
Increase max bl limit for OPE to 24 to support maximum
48 stripes.
CRs-Fixed: 2761455
Change-Id: I961be1344fac0084649df321225e94a50d4e5a98
Signed-off-by: Rishabh Jain <risjai@codeaurora.org>
Calculate the total clk of all the ctx
irrespective of the use case for the ctx. Remove
dev_type check to add all the ctx clk while
calculating total clk.
CRs-Fixed: 2754351
Change-Id: I5c1681ac1a88cfec752ff58fd8b1f6ac5d05b28a
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
Ope driver was incorrectly calculating the number
of bw path. This is causing bw to be skip for some
of the ports.
Updated logic to correctly calculate number of path
based on valid path type.
CRs-Fixed: 2715586
Change-Id: I95b6dcfae454713a7b5db6d629310244bb304b19
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Currently when page fault happen, iommu driver callers camera
handler with CB details and iova address which caused the page
fault. With iommu iova address cam smmu driver finds the
closest mapping address for that cb and call the
corresponding driver to find the which port caused page fault.
This has limitation has page fault address always not mapped.
New approach is get the page fault ids from iommu driver.
Based on the Pid and Mid values, get the HW id and port ids,
go through all context which has this hw id and port id and log
the data. Once context id is identified, log the acquire data and
last consumed client address details. Dump the hw register data
in the given buffer. Send the smmu page fault event through
v4l2 queue to user.
CRs-Fixed: 2750690
Change-Id: I87c809b3229992c7c95655a4f3c6c70ebc035ae8
Signed-off-by: Ravikishore Pampana <rpampana@codeaurora.org>
Handle event failure reason propagation in camera kernel
driver. Individual camera kernel driver will fill reason
codes for sync failure and send it to sync driver. Sync
driver will add this as part of sync event header and
propagate to user space.
CRs-Fixed: 2750553
Change-Id: I284390fc45757ba8291a44400e2263b9be64b092
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>