msm: camera: mem_mgr: Fix expanded memory allocations
Fixes expanded memory allocations to only happen for ICP context banks. Re-maps the command buffers to shared region of ICP context bank. CRs-Fixed: 2985358 Change-Id: I3c2d5866b0041489577f6c5c0ec113c886437107 Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Dieser Commit ist enthalten in:
@@ -842,10 +842,16 @@ static int cam_mem_util_map_hw_va(uint32_t flags,
|
||||
dis_delayed_unmap = true;
|
||||
|
||||
CAM_DBG(CAM_MEM,
|
||||
"map_hw_va : fd = %d, flags = 0x%x, dir=%d, num_hdls=%d",
|
||||
"map_hw_va : fd = %d, flags = 0x%x, dir=%d, num_hdls=%d",
|
||||
fd, flags, dir, num_hdls);
|
||||
|
||||
for (i = 0; i < num_hdls; i++) {
|
||||
/* If 36-bit enabled, check for ICP cmd buffers and map them within the shared region */
|
||||
if (cam_smmu_is_expanded_memory() &&
|
||||
cam_smmu_supports_shared_region(mmu_hdls[i]) &&
|
||||
(flags & CAM_MEM_FLAG_CMD_BUF_TYPE))
|
||||
region = CAM_SMMU_REGION_SHARED;
|
||||
|
||||
if (flags & CAM_MEM_FLAG_PROTECTED_MODE)
|
||||
rc = cam_smmu_map_stage2_iova(mmu_hdls[i], fd, dmabuf, dir, hw_vaddr, len);
|
||||
else
|
||||
@@ -942,8 +948,7 @@ int cam_mem_mgr_alloc_and_map(struct cam_mem_mgr_alloc_cmd *cmd)
|
||||
region = CAM_SMMU_REGION_IO;
|
||||
|
||||
|
||||
if (cmd->flags & CAM_MEM_FLAG_HW_SHARED_ACCESS ||
|
||||
(cam_smmu_is_expanded_memory() && cmd->flags & CAM_MEM_FLAG_CMD_BUF_TYPE))
|
||||
if (cmd->flags & CAM_MEM_FLAG_HW_SHARED_ACCESS)
|
||||
region = CAM_SMMU_REGION_SHARED;
|
||||
|
||||
if (cmd->flags & CAM_MEM_FLAG_PROTECTED_MODE)
|
||||
|
@@ -173,7 +173,7 @@ struct cam_context_bank_info {
|
||||
dma_addr_t discard_iova_start;
|
||||
size_t discard_iova_len;
|
||||
|
||||
atomic64_t monitor_head;
|
||||
atomic64_t monitor_head;
|
||||
struct cam_smmu_monitor monitor_entries[CAM_SMMU_MONITOR_MAX_ENTRIES];
|
||||
};
|
||||
|
||||
@@ -3192,6 +3192,18 @@ static int cam_smmu_map_iova_validate_params(int handle,
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool cam_smmu_supports_shared_region(int handle)
|
||||
{
|
||||
int idx = GET_SMMU_TABLE_IDX(handle);
|
||||
bool is_shared;
|
||||
|
||||
mutex_lock(&iommu_cb_set.cb_info[idx].lock);
|
||||
is_shared = (iommu_cb_set.cb_info[idx].shared_support) ? true : false;
|
||||
mutex_unlock(&iommu_cb_set.cb_info[idx].lock);
|
||||
|
||||
return is_shared;
|
||||
}
|
||||
|
||||
int cam_smmu_map_user_iova(int handle, int ion_fd, struct dma_buf *dmabuf,
|
||||
bool dis_delayed_unmap, enum cam_smmu_map_dir dir, dma_addr_t *paddr_ptr,
|
||||
size_t *len_ptr, enum cam_smmu_region_id region_id,
|
||||
|
@@ -234,12 +234,13 @@ int cam_smmu_put_scratch_iova(int handle,
|
||||
int cam_smmu_destroy_handle(int handle);
|
||||
|
||||
/**
|
||||
* @brief : Finds index by handle in the smmu client table
|
||||
* @brief : Returns if context bank identified by handle has a shared region
|
||||
*
|
||||
* @param handle: Handle to identify the CAM SMMU client (VFE, CPP, FD etc.)
|
||||
* @return Index of SMMU client. Nagative in case of error.
|
||||
* @param handle: Handle to identify the context bank
|
||||
* @return : True if context banks supports shared region, false otherwise
|
||||
* @note : Currently, only ICP context banks support shared regions.
|
||||
*/
|
||||
int cam_smmu_find_index_by_handle(int hdl);
|
||||
bool cam_smmu_supports_shared_region(int handle);
|
||||
|
||||
/**
|
||||
* @brief : Registers smmu fault handler for client
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren