static int __secure_tz_update_entry3(unsigned int *scm_data, u32 size_scm_data, int *val, u32 size_val, bool is_64) { int ret; /* sync memory before sending the commands to tz*/ __iowmb(); if (!is_64) { spin_lock(&tz_lock); ret = scm_call_atomic3(SCM_SVC_IO, TZ_UPDATE_ID, scm_data[0], scm_data[1], scm_data[2]); spin_unlock(&tz_lock); *val = ret; } else { if (is_scm_armv8()) { struct scm_desc desc = {0}; desc.args[0] = scm_data[0]; desc.args[1] = scm_data[1]; desc.args[2] = scm_data[2]; desc.arginfo = SCM_ARGS(3); ret = scm_call2(SCM_SIP_FNID(SCM_SVC_DCVS, TZ_V2_UPDATE_ID_64), &desc); *val = desc.ret[0]; } else { ret = scm_call(SCM_SVC_DCVS, TZ_UPDATE_ID_64, scm_data, size_scm_data, val, size_val); } } return ret; }
/* Trap into the TrustZone, and call funcs there. */ static int __secure_tz_reset_entry2(unsigned int *scm_data, u32 size_scm_data, bool is_64) { int ret; /* sync memory before sending the commands to tz*/ __iowmb(); if (!is_64) { spin_lock(&tz_lock); ret = scm_call_atomic2(SCM_SVC_IO, TZ_RESET_ID, scm_data[0], scm_data[1]); spin_unlock(&tz_lock); } else { if (is_scm_armv8()) { struct scm_desc desc = {0}; desc.arginfo = 0; ret = scm_call2(SCM_SIP_FNID(SCM_SVC_DCVS, TZ_RESET_ID_64), &desc); } else { ret = scm_call(SCM_SVC_DCVS, TZ_RESET_ID_64, scm_data, size_scm_data, NULL, 0); } } return ret; }
/* Trap into the TrustZone, and call funcs there. */ static int __secure_tz_entry(u32 cmd, u32 val, u32 id) { int ret; spin_lock(&tz_lock); __iowmb(); ret = scm_call_atomic2(SCM_SVC_IO, cmd, val, id); spin_unlock(&tz_lock); return ret; }
static int __secure_tz_entry3(u32 cmd, u32 val1, u32 val2, u32 val3) { int ret; spin_lock(&tz_lock); /* sync memory before sending the commands to tz*/ __iowmb(); ret = scm_call_atomic3(SCM_SVC_IO, cmd, val1, val2, val3); spin_unlock(&tz_lock); return ret; }
static int __secure_tz_entry3(u32 cmd, u32 val1, u32 val2, u32 val3) { int ret; spin_lock(&tz_lock); __iowmb(); ret = scm_call_atomic3(SCM_SVC_IO, cmd, val1, val2, val3); spin_unlock(&tz_lock); return ret; }
/** * mc_write_command - writes a command to a Management Complex (MC) portal * * @portal: pointer to an MC portal * @cmd: pointer to a filled command */ static inline void mc_write_command(struct mc_command __iomem *portal, struct mc_command *cmd) { int i; /* copy command parameters into the portal */ for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) __raw_writeq(cmd->params[i], &portal->params[i]); __iowmb(); /* submit the command by writing the header */ __raw_writeq(cmd->header, &portal->header); }
/* Trap into the TrustZone, and call funcs there. */ static int __secure_tz_reset_entry2(unsigned int *scm_data, u32 size_scm_data, bool is_64) { int ret; /* sync memory before sending the commands to tz*/ __iowmb(); if (!is_64) { spin_lock(&tz_lock); ret = scm_call_atomic2(SCM_SVC_IO, TZ_RESET_ID, scm_data[0], scm_data[1]); spin_unlock(&tz_lock); } else { ret = scm_call(SCM_SVC_DCVS, TZ_RESET_ID_64, scm_data, size_scm_data, NULL, 0); } return ret; }
static int __secure_tz_update_entry3(unsigned int *scm_data, u32 size_scm_data, int *val, u32 size_val, bool is_64) { int ret; /* sync memory before sending the commands to tz*/ __iowmb(); if (!is_64) { spin_lock(&tz_lock); ret = scm_call_atomic3(SCM_SVC_IO, TZ_UPDATE_ID, scm_data[0], scm_data[1], scm_data[2]); spin_unlock(&tz_lock); *val = ret; } else { ret = scm_call(SCM_SVC_DCVS, TZ_UPDATE_ID_64, scm_data, size_scm_data, val, size_val); } return ret; }
static void __secure_writel(u32 v, u32 addr) { __iowmb(); scm_call_atomic2(SCM_SVC_IO, SCM_IO_WRITE, addr, v); }
/** * keystone_timer_barrier: write memory barrier * use explicit barrier to avoid using readl/writel non relaxed function * variants, because in our case non relaxed variants hide the true places * where barrier is needed. */ static inline void keystone_timer_barrier(void) { __iowmb(); }