msm: camera: smmu: Early PF detection

This change adds support to detect early
unmapping of buffers from UMD, and signal
when the error occurs by sending an error
code to UMD.

At present, buffers are allocated and/or mapped
by UMD, and the following sequence occurs.

KMD prepares packets sent during a config ioctl,
and these packets reside in the mapped buffers;
HW blocks then access these buffers, and may
write output to other mapped buffers(io buffers);
Once HW is done(upon a buf done), KMD signals
this event to UMD;
UMD may free/unmap these relevant buffers.

This change adds support to detect cases where a
free/unmap happens before/while HW is accessing
these buffers.

This feature is enabled by default, but a debugfs
variable disable_buf_tracking is added under smmu
which will enable the user to disable the feature.
Camera server needs to be restarted whenever this
variable is set/unset for changes to take place.

CRs-Fixed: 3382609
Change-Id: I39c3f0c373743c10bc2e6304ffbdc820e3c95970
Signed-off-by: Li Sha Lim <quic_lishlim@quicinc.com>
This commit is contained in:
Li Sha Lim
2022-04-07 17:46:51 -07:00
committed by Camera Software Integration
parent c23a3f448c
commit b3f493269c
23 changed files with 539 additions and 178 deletions

View File

@@ -46,6 +46,7 @@ struct cam_presil_dmabuf_params {
* @iommu_hdl: IOMMU handle for the given bank
* @vaddr: IOVA of the buffer
* @len: cached length for a given handle
* @ref_count: ref count for buffer
* @addr_updated: Indicates if entry is updated only for addr caching
* @valid_mapping: Indicates if entry is indeed a valid mapping for this buf
*
@@ -54,6 +55,7 @@ struct cam_mem_buf_hw_hdl_info {
int32_t iommu_hdl;
dma_addr_t vaddr;
size_t len;
struct kref *ref_count;
bool addr_updated;
bool valid_mapping;