[PATCH 3/4] misc: fastrpc: Set channel as secure

Jeya R
2021-09-24T12:19:43Z

Set channel as secure based on domain ID and secure domain DT property.
All DSP domains other than CDSP are set as secure by default and for
CDSP domain, secure flag is set if property is added to DT file.

Signed-off-by: Jeya R <jeyr@codeaurora.org>
---
drivers/misc/fastrpc.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 07c41a5..631713d 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -216,6 +216,7 @@ struct fastrpc_channel_ctx {
struct miscdevice miscdev;
struct miscdevice securedev;
struct kref refcount;
+ bool secure;
};

struct fastrpc_user {
@@ -1646,6 +1647,12 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
if (!data)
return -ENOMEM;

+ if (domain_id != CDSP_DOMAIN_ID)
+ data->secure = true;
+ else
+ data->secure = of_property_read_bool(rdev->of_node,
+ "qcom,secure-domain");
+
data->miscdev.minor = MISC_DYNAMIC_MINOR;
data->miscdev.name = devm_kasprintf(rdev, GFP_KERNEL, "fastrpc-%s",
domains[domain_id]);
--
2.7.4