Merge "qcom: scm: Milestone call to enable kernel memory protection"

This commit is contained in:
qctecmdr 2020-09-02 17:08:20 -07:00 • committed by Gerrit - the friendly Code Review server
commit 2cf6d6b0e3
3 changed files with 48 additions and 0 deletions

View file

@ -2086,6 +2086,38 @@ int __qcom_scm_qseecom_do(struct device *dev, u32 cmd_id, struct scm_desc *desc,
return _ret;
}
#ifdef CONFIG_QCOM_RTIC
#define TZ_RTIC_ENABLE_MEM_PROTECTION 0x4
int __init scm_mem_protection_init_do(struct device *dev)
{
int ret = 0, resp;
struct qcom_scm_desc desc = {
.svc = SCM_SVC_RTIC,
.cmd = TZ_RTIC_ENABLE_MEM_PROTECTION,
.owner = ARM_SMCCC_OWNER_SIP,
};
desc.args[0] = 0;
desc.arginfo = 0;
ret = qcom_scm_call(dev, &desc);
resp = desc.res[0];
if (ret == -1) {
pr_err("%s: SCM call not supported\n", __func__);
return ret;
} else if (ret || resp) {
pr_err("%s: SCM call failed\n", __func__);
if (ret)
return ret;
else
return resp;
}
return resp;
}
#endif
void __qcom_scm_init(void)
{
__query_convention();

View file

@ -1165,6 +1165,15 @@ static int __init qcom_scm_init(void)
}
subsys_initcall(qcom_scm_init);
#ifdef CONFIG_QCOM_RTIC
static int __init scm_mem_protection_init(void)
{
return scm_mem_protection_init_do(__scm ? __scm->dev : NULL);
}
early_initcall(scm_mem_protection_init);
#endif
#if IS_MODULE(CONFIG_QCOM_SCM)
static void __exit qcom_scm_exit(void)
{

View file

@ -269,6 +269,13 @@ extern int __qcom_scm_invoke_callback_response(struct device *dev,
extern void __qcom_scm_init(void);
#ifdef CONFIG_QCOM_RTIC
#define SCM_SVC_RTIC 0x19
extern int __init scm_mem_protection_init_do(struct device *dev);
#endif
/* common error codes */
#define QCOM_SCM_V2_EBUSY -12
#define QCOM_SCM_ENOMEM -5