Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6ffea3f authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

msm: vidc: Add support for the new scm_call2 API



The scm library has added support for a new secure world
interface that is more aligned to the ARMv8 SMC calling
convention. Use the new API while maintaining backward
compatibility.

Change-Id: I00c37ca0a98358c038f9aa39d1996059c9609694
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent c141bcf6
Loading
Loading
Loading
Loading
+28 −9
Original line number Diff line number Diff line
@@ -1220,10 +1220,20 @@ static inline int venus_hfi_tzbsp_set_video_state(enum tzbsp_video_state state)
	struct tzbsp_video_set_state_req cmd = {0};
	int tzbsp_rsp = 0;
	int rc = 0;
	cmd.state = state;
	cmd.spare = 0;
	rc = scm_call(SCM_SVC_BOOT, TZBSP_VIDEO_SET_STATE, &cmd, sizeof(cmd),
			&tzbsp_rsp, sizeof(tzbsp_rsp));
	struct scm_desc desc = {0};

	desc.args[0] = cmd.state = state;
	desc.args[1] = cmd.spare = 0;
	desc.arginfo = SCM_ARGS(2);

	if (!is_scm_armv8()) {
		rc = scm_call(SCM_SVC_BOOT, TZBSP_VIDEO_SET_STATE, &cmd,
				sizeof(cmd), &tzbsp_rsp, sizeof(tzbsp_rsp));
	} else {
		rc = scm_call2(SCM_SIP_FNID(SCM_SVC_BOOT,
				TZBSP_VIDEO_SET_STATE), &desc);
		tzbsp_rsp = desc.ret[0];
	}
	if (rc) {
		dprintk(VIDC_ERR, "Failed scm_call %d\n", rc);
		return rc;
@@ -3740,6 +3750,7 @@ static int protect_cp_mem(struct venus_hfi_device *device)
	struct iommu_set *iommu_group_set;
	struct iommu_info *iommu_map;
	int i;
	struct scm_desc desc = {0};

	if (!device)
		return -EINVAL;
@@ -3758,21 +3769,29 @@ static int protect_cp_mem(struct venus_hfi_device *device)
	for (i = 0; i < iommu_group_set->count; i++) {
		iommu_map = &iommu_group_set->iommu_maps[i];
		if (strcmp(iommu_map->name, "venus_ns") == 0)
			memprot.cp_size = iommu_map->addr_range[0].start;
			desc.args[1] = memprot.cp_size =
				iommu_map->addr_range[0].start;

		if (strcmp(iommu_map->name, "venus_sec_non_pixel") == 0) {
			memprot.cp_nonpixel_start =
			desc.args[2] = memprot.cp_nonpixel_start =
				iommu_map->addr_range[0].start;
			memprot.cp_nonpixel_size =
			desc.args[3] = memprot.cp_nonpixel_size =
				iommu_map->addr_range[0].size;
		} else if (strcmp(iommu_map->name, "venus_cp") == 0) {
			memprot.cp_nonpixel_start =
			desc.args[2] = memprot.cp_nonpixel_start =
				iommu_map->addr_range[1].start;
		}
	}

	if (!is_scm_armv8()) {
		rc = scm_call(SCM_SVC_MP, TZBSP_MEM_PROTECT_VIDEO_VAR, &memprot,
			sizeof(memprot), &resp, sizeof(resp));
	} else {
		desc.arginfo = SCM_ARGS(4);
		rc = scm_call2(SCM_SIP_FNID(SCM_SVC_MP,
			       TZBSP_MEM_PROTECT_VIDEO_VAR), &desc);
		resp = desc.ret[0];
	}
	if (rc)
		dprintk(VIDC_ERR,
		"Failed to protect memory , rc is :%d, response : %d\n",