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

Commit 2cf6d6b0 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents f5f18394 dc1e47c1
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -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();
+9 −0
Original line number Diff line number Diff line
@@ -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)
{
+7 −0
Original line number Diff line number Diff line
@@ -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