[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240528112956.5979-9-quic_ekangupt@quicinc.com>
Date: Tue, 28 May 2024 16:59:54 +0530
From: Ekansh Gupta <quic_ekangupt@...cinc.com>
To: <srinivas.kandagatla@...aro.org>, <linux-arm-msm@...r.kernel.org>
CC: <gregkh@...uxfoundation.org>, <quic_bkumar@...cinc.com>,
<linux-kernel@...r.kernel.org>, <quic_chennak@...cinc.com>
Subject: [PATCH v2 8/8] misc: fastrpc: Add system unsigned PD support
Trusted CPU applications currently offload to signed PDs on CDSP to
gain some additional services provided by root PD. Unsigned PDs have
access to limited root PD services that may not be sufficient for
all use-cases. Signed PDs have a higher dynamic loading latency
which impacts the performance of applications. Limited root PD
services could be opened up for unsigned PDs but that should be
restricted for untrusted processes. For this requirement, System
unsigned PD is introduced which will be same as Unsigned PD for
most part but will have access to more root PD services. Add
changes to offload trusted applications to System unsigned PD
when unsigned offload is requested.
Signed-off-by: Ekansh Gupta <quic_ekangupt@...cinc.com>
---
drivers/misc/fastrpc.c | 9 +++++++++
include/uapi/misc/fastrpc.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 7f81a18b8aea..ebe20915392f 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -122,6 +122,7 @@
enum fastrpc_userpd_type {
SIGNED_PD = 1,
UNSIGNED_PD = 2,
+ SYSTEM_UNSIGNED_PD = 3,
};
static const char *domains[FASTRPC_DEV_MAX] = { "adsp", "mdsp",
@@ -1552,12 +1553,20 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl,
if (init.attrs & FASTRPC_MODE_UNSIGNED_MODULE)
fl->userpd_type = UNSIGNED_PD;
+ /* Disregard any system unsigned PD attribute from userspace */
+ init.attrs &= (~FASTRPC_MODE_SYSTEM_UNSIGNED_PD);
if (is_session_rejected(fl, !(fl->userpd_type == SIGNED_PD))) {
err = -EACCES;
goto err;
}
+ /* Trusted apps will be launched as system unsigned PDs */
+ if (!fl->untrusted_process && (fl->userpd_type != SIGNED_PD)) {
+ fl->userpd_type = SYSTEM_UNSIGNED_PD;
+ init.attrs |= FASTRPC_MODE_SYSTEM_UNSIGNED_PD;
+ }
+
if (init.filelen > INIT_FILELEN_MAX) {
err = -EINVAL;
goto err;
diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h
index f33d914d8f46..3b3279bb2cf9 100644
--- a/include/uapi/misc/fastrpc.h
+++ b/include/uapi/misc/fastrpc.h
@@ -62,6 +62,8 @@ enum fastrpc_proc_attr {
FASTRPC_MODE_SYSTEM_PROCESS = (1 << 5),
/* Macro for Prvileged Process */
FASTRPC_MODE_PRIVILEGED = (1 << 6),
+ /* Macro for system unsigned PD */
+ FASTRPC_MODE_SYSTEM_UNSIGNED_PD = (1 << 17),
};
/* Fastrpc attribute for memory protection of buffers */
--
2.43.0
Powered by blists - more mailing lists