msm: vidc: Migrate SCM calls

Migrate secure world calls to upstream qcom_scm driver.

Change-Id: I97fe0376bca265db9e2b851294c83f52e61c9544
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
This commit is contained in:
Mihir Ganu 2019-11-18 17:02:13 -08:00 committed by Gerrit - the friendly Code Review server
parent 9fc266c742
commit fc82551de5
2 changed files with 11 additions and 46 deletions

View File

@ -13,7 +13,6 @@
static struct hal_device_data hal_ctxt;
static struct venus_hfi_device venus_hfi_dev;
#define TZBSP_MEM_PROTECT_VIDEO_VAR 0x8
struct tzbsp_memprot {
u32 cp_start;
u32 cp_size;
@ -21,12 +20,6 @@ struct tzbsp_memprot {
u32 cp_nonpixel_size;
};
struct tzbsp_resp {
int ret;
};
#define TZBSP_VIDEO_SET_STATE 0xa
/* Poll interval in uS */
#define POLL_INTERVAL_US 50
@ -36,11 +29,6 @@ enum tzbsp_video_state {
TZBSP_VIDEO_STATE_RESTORE_THRESHOLD = 2,
};
struct tzbsp_video_set_state_req {
u32 state; /* should be tzbsp_video_state enum value */
u32 spare; /* reserved for future, should be zero */
};
const struct msm_vidc_bus_data DEFAULT_BUS_VOTE = {
.total_bw_ddr = 0,
.total_bw_llcc = 0,
@ -1005,23 +993,7 @@ err_create_pkt:
static int __tzbsp_set_video_state(enum tzbsp_video_state state, u32 sid)
{
struct tzbsp_video_set_state_req cmd = {0};
int tzbsp_rsp = 0;
int rc = 0;
struct scm_desc desc = {0};
desc.args[0] = cmd.state = state;
desc.args[1] = cmd.spare = 0;
desc.arginfo = SCM_ARGS(2);
rc = scm_call2(SCM_SIP_FNID(SCM_SVC_BOOT,
TZBSP_VIDEO_SET_STATE), &desc);
tzbsp_rsp = desc.ret[0];
if (rc) {
s_vpr_e(sid, "Failed scm_call %d\n", rc);
return rc;
}
int tzbsp_rsp = qcom_scm_set_remote_state(state, 0);
s_vpr_l(sid, "Set state %d, resp %d\n", state, tzbsp_rsp);
if (tzbsp_rsp) {
@ -3403,10 +3375,8 @@ static void __deinit_resources(struct venus_hfi_device *device)
static int __protect_cp_mem(struct venus_hfi_device *device)
{
struct tzbsp_memprot memprot;
unsigned int resp = 0;
int rc = 0;
struct context_bank_info *cb;
struct scm_desc desc = {0};
if (!device)
return -EINVAL;
@ -3418,32 +3388,27 @@ static int __protect_cp_mem(struct venus_hfi_device *device)
list_for_each_entry(cb, &device->res->context_banks, list) {
if (!strcmp(cb->name, "venus_ns")) {
desc.args[1] = memprot.cp_size =
cb->addr_range.start;
memprot.cp_size = cb->addr_range.start;
d_vpr_h("%s: memprot.cp_size: %#x\n",
__func__, memprot.cp_size);
}
if (!strcmp(cb->name, "venus_sec_non_pixel")) {
desc.args[2] = memprot.cp_nonpixel_start =
cb->addr_range.start;
desc.args[3] = memprot.cp_nonpixel_size =
cb->addr_range.size;
memprot.cp_nonpixel_start = cb->addr_range.start;
memprot.cp_nonpixel_size = cb->addr_range.size;
d_vpr_h("%s: cp_nonpixel_start: %#x size: %#x\n",
__func__, memprot.cp_nonpixel_start,
memprot.cp_nonpixel_size);
}
}
desc.arginfo = SCM_ARGS(4);
rc = scm_call2(SCM_SIP_FNID(SCM_SVC_MP,
TZBSP_MEM_PROTECT_VIDEO_VAR), &desc);
resp = desc.ret[0];
rc = qcom_scm_mem_protect_video(memprot.cp_start, memprot.cp_size,
memprot.cp_nonpixel_start, memprot.cp_nonpixel_size);
if (rc) {
d_vpr_e("Failed to protect memory(%d) response: %d\n",
rc, resp);
}
if (rc)
d_vpr_e("Failed to protect memory(%d)\n", rc);
trace_venus_hfi_var_done(
memprot.cp_start, memprot.cp_size,

View File

@ -11,7 +11,7 @@
#include <linux/pm_qos.h>
#include <linux/clk-provider.h>
#include <linux/iommu.h>
#include <soc/qcom/scm.h>
#include <linux/qcom_scm.h>
#include <linux/soc/qcom/smem.h>
#include <linux/irqreturn.h>
#include <linux/reset.h>