msm: camera: csiphy: Integrate mink call for secure camera

Adds support for new mink call to configure secure
camera sessions. This new mink call takes in additional
parameters to support the new domain-id based
security scheme. The additional parameters are in the
form of csid_hw_idx_mask, cdm_hw_idx_mask and
vc_mask. These are in addition to the existing PHY idx
and CPHY/DPHY lanes info.

The introduction of this new mink call deprecates the
existing SCM call used to service secure camera sessions.
What this means is that on all subsequent versions of this
driver, all secure camera sessions will be serviced by this
mink call, which is able to accommodate older and newer targets,
and their programming of different register sets.

This design enables the cam_csiphy_notify_secure_mode
wrapper to remain the same, with the underlying mink call
made in the cam_compat layer, depending on camera driver
version.

CRs-Fixed: 3317248
Change-Id: I575f4b85097c81f047f398216d0190b249e6b200
Signed-off-by: Li Sha Lim <quic_lishlim@quicinc.com>
This commit is contained in:
Li Sha Lim
2022-10-19 16:14:46 -07:00
committed by Camera Software Integration
父節點 8f5c061dc5
當前提交 f2360705b1
共有 7 個文件被更改,包括 177 次插入107 次删除

查看文件

@@ -482,6 +482,13 @@ static int cam_csiphy_update_secure_info(struct csiphy_device *csiphy_dev, int32
uint32_t cpas_version;
int rc;
if (csiphy_dev->domain_id_security) {
CAM_DBG(CAM_CSIPHY, "Domain ID scheme for CSIPHY [%u], skipping legacy update",
csiphy_dev->soc_info.index);
return 0;
}
lane_assign = csiphy_dev->csiphy_info[index].lane_assign;
lane_cnt = csiphy_dev->csiphy_info[index].lane_cnt;
@@ -1226,22 +1233,26 @@ static int cam_csiphy_program_secure_mode(struct csiphy_device *csiphy_dev,
{
int rc = 0;
if (!csiphy_dev->domain_id_security)
rc = cam_csiphy_notify_secure_mode(csiphy_dev, protect, offset);
if (csiphy_dev->domain_id_security && protect) {
if (!csiphy_dev->csiphy_info[offset].secure_info_updated) {
CAM_ERR(CAM_CSIPHY,
"PHY[%u] domain id info not updated, aborting secure call",
csiphy_dev->soc_info.index);
/* Else a new scm call here */
else {
if (protect && !csiphy_dev->csiphy_info[offset].secure_info_updated) {
CAM_ERR(CAM_CSIPHY, "Secure info not updated prior to stream on");
return -EINVAL;
}
csiphy_dev->csiphy_info[offset].secure_info.protect = protect;
CAM_DBG(CAM_CSIPHY, "To call new scm, protect: %d, offset: %d",
protect, offset);
rc = cam_cpas_enable_clks_for_domain_id(true);
if (rc)
return rc;
}
if (!protect)
csiphy_dev->csiphy_info[offset].secure_info_updated = false;
rc = cam_csiphy_notify_secure_mode(csiphy_dev, protect, offset);
if (csiphy_dev->domain_id_security && !protect) {
cam_cpas_enable_clks_for_domain_id(false);
csiphy_dev->csiphy_info[offset].secure_info_updated = false;
}
return rc;

查看文件

@@ -28,27 +28,13 @@ static inline void cam_csiphy_trigger_reg_dump(struct csiphy_device *csiphy_dev)
}
}
int cam_csiphy_format_secure_phy_lane_info(
struct csiphy_device *csiphy_dev, int offset)
static int cam_csiphy_format_secure_phy_lane_info(
struct csiphy_device *csiphy_dev, int offset, uint64_t *mask)
{
struct cam_csiphy_tz_secure_info *tz_secure_info;
struct cam_csiphy_param *param;
uint64_t phy_lane_sel_mask = 0;
if (!csiphy_dev) {
CAM_ERR(CAM_CSIPHY, "Invalid param, csiphy_dev: %s",
CAM_IS_NULL_TO_STR(csiphy_dev));
return -EINVAL;
}
if (offset >= CSIPHY_MAX_INSTANCES_PER_PHY) {
CAM_ERR(CAM_CSIPHY, "Invalid CSIPHY param offset: %d",
offset);
return -EINVAL;
}
param = &csiphy_dev->csiphy_info[offset];
tz_secure_info = &param->secure_info;
if (param->csiphy_3phase) {
if (param->lane_enable & CPHY_LANE_0)
@@ -74,12 +60,12 @@ int cam_csiphy_format_secure_phy_lane_info(
csiphy_dev->soc_info.index);
return -EINVAL;
}
phy_lane_sel_mask |= BIT(csiphy_dev->soc_info.index);
tz_secure_info->phy_lane_sel_mask |= phy_lane_sel_mask;
*mask = phy_lane_sel_mask;
CAM_DBG(CAM_CSIPHY, "Formatted PHY[%u] phy_lane_sel_mask: 0x%llx",
csiphy_dev->soc_info.index,
tz_secure_info->phy_lane_sel_mask);
csiphy_dev->soc_info.index, *mask);
return 0;
@@ -108,35 +94,34 @@ static void cam_csiphy_populate_secure_info(
struct cam_csiphy_secure_info *secure_info =
(struct cam_csiphy_secure_info *)data;
struct cam_csiphy_param *param;
struct cam_csiphy_tz_secure_info *tz_secure_info;
for (i = 0; i < CSIPHY_MAX_INSTANCES_PER_PHY; i++) {
param = &csiphy_dev->csiphy_info[i];
if (param->secure_mode &&
param->lane_assign == secure_info->lane_assign) {
tz_secure_info = &param->secure_info;
tz_secure_info->cdm_hw_idx_mask = secure_info->cdm_hw_idx_mask;
tz_secure_info->csid_hw_idx_mask = secure_info->csid_hw_idx_mask;
tz_secure_info->vc_mask = secure_info->vc_mask;
tz_secure_info->phy_lane_sel_mask = 0;
param->secure_info.cdm_hw_idx_mask = secure_info->cdm_hw_idx_mask;
param->secure_info.csid_hw_idx_mask = secure_info->csid_hw_idx_mask;
param->secure_info.vc_mask = secure_info->vc_mask;
param->secure_info.phy_lane_sel_mask = 0;
if (!cam_csiphy_format_secure_phy_lane_info(csiphy_dev, i)) {
if (!cam_csiphy_format_secure_phy_lane_info(csiphy_dev, i,
&param->csiphy_phy_lane_sel_mask)) {
param->secure_info_updated = true;
CAM_DBG(CAM_CSIPHY,
"PHY[%d] secure info, phy_lane_mask: 0x%llx, ife: 0x%x, cdm: 0x%x, vc_mask: 0x%llx",
csiphy_dev->soc_info.index,
tz_secure_info->phy_lane_sel_mask,
tz_secure_info->csid_hw_idx_mask,
tz_secure_info->cdm_hw_idx_mask,
tz_secure_info->vc_mask);
param->csiphy_phy_lane_sel_mask,
param->secure_info.csid_hw_idx_mask,
param->secure_info.cdm_hw_idx_mask,
param->secure_info.vc_mask);
} else
CAM_ERR(CAM_CSIPHY,
"Error in formatting PHY[%u] phy_lane_sel_mask: 0x%llx",
csiphy_dev->soc_info.index,
tz_secure_info->phy_lane_sel_mask);
param->csiphy_phy_lane_sel_mask);
break;
}

查看文件

@@ -123,28 +123,6 @@ struct cam_csiphy_secure_info {
uint32_t cdm_hw_idx_mask;
};
/**
* struct cam_csiphy_tz_secure_info
*
* This is the struct containing all the necessary values
* for scm programming of domain id
*
* @phy_lane_sel_mask: This value to be filled completely by csiphy
* @csid_hw_idx_mask: Bit position denoting CSID(s) in use for secure
* session
* @cdm_hw_idx_mask: Bit position denoting CDM in use for secure
* session
* @vc_mask: VC mask (unused in mobile case)
* @protect: To protect or reset previously protected lanes
*/
struct cam_csiphy_tz_secure_info {
uint64_t phy_lane_sel_mask;
uint32_t csid_hw_idx_mask;
uint32_t cdm_hw_idx_mask;
uint32_t vc_mask;
uint32_t protect;
};
/**
* struct cam_csiphy_aon_sel_params_t
* @aon_cam_sel_offset : AON Cam Select Register offset in cpas top
@@ -329,9 +307,10 @@ struct csiphy_ctrl_t {
* @csiphy_3phase : To identify DPHY or CPHY
* @mipi_flags : MIPI phy flags
* @csiphy_cpas_cp_reg_mask : CP reg mask for phy instance
* @csiphy_phy_lane_sel_mask : Generic format for CP information for PHY and lane
* @hdl_data : CSIPHY handle table
* @secure_info : All domain-id security related information packed in proper
* format for scm call
* format for mink call
* @secure_info_updated : If all information in the secure_info struct above
* is passed and formatted properly from CSID driver
* @conn_csid_idx : Connected CSID core idx (Primary csid in case of dual ife)
@@ -348,8 +327,9 @@ struct cam_csiphy_param {
int csiphy_3phase;
uint16_t mipi_flags;
uint64_t csiphy_cpas_cp_reg_mask;
uint64_t csiphy_phy_lane_sel_mask;
struct csiphy_hdl_tbl hdl_data;
struct cam_csiphy_tz_secure_info secure_info;
struct cam_csiphy_secure_info secure_info;
bool secure_info_updated;
int32_t conn_csid_idx;
bool use_hw_client_voting;