* [PATCH v2 0/3] misc: fastrpc: add ioctl for attaching to sensors pd
@ 2020-09-08 13:10 Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 1/3] misc: fastrpc: fix indentation error in uapi header Jonathan Marek
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Marek @ 2020-09-08 13:10 UTC (permalink / raw)
To: linux-arm-msm
Cc: Arnd Bergmann, Greg Kroah-Hartman, Jorge Ramirez-Ortiz,
open list, Srinivas Kandagatla
Initializing sensors requires attaching to pd 2. Add an ioctl for that.
This corresponds to FASTRPC_INIT_ATTACH_SENSORS in the downstream driver.
v2:
- define names of PD values in a separate patch
- split out identation fix in a separate patch
Jonathan Marek (3):
misc: fastrpc: fix indentation error in uapi header
misc: fastrpc: define names for protection domain ids
misc: fastrpc: add ioctl for attaching to sensors pd
drivers/misc/fastrpc.c | 16 ++++++++++++----
include/uapi/misc/fastrpc.h | 5 +++--
2 files changed, 15 insertions(+), 6 deletions(-)
--
2.26.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] misc: fastrpc: fix indentation error in uapi header
2020-09-08 13:10 [PATCH v2 0/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
@ 2020-09-08 13:10 ` Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 2/3] misc: fastrpc: define names for protection domain ids Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 3/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Marek @ 2020-09-08 13:10 UTC (permalink / raw)
To: linux-arm-msm
Cc: Srinivas Kandagatla, Jorge Ramirez-Ortiz, Greg Kroah-Hartman, open list
Use tabs instead of spaces.
Fixes: 2419e55e532d ("misc: fastrpc: add mmap/unmap support")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
include/uapi/misc/fastrpc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h
index 07de2b7aac85..de31f0bd4779 100644
--- a/include/uapi/misc/fastrpc.h
+++ b/include/uapi/misc/fastrpc.h
@@ -10,8 +10,8 @@
#define FASTRPC_IOCTL_INVOKE _IOWR('R', 3, struct fastrpc_invoke)
#define FASTRPC_IOCTL_INIT_ATTACH _IO('R', 4)
#define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create)
-#define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)
-#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap)
+#define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)
+#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap)
struct fastrpc_invoke_args {
__u64 ptr;
--
2.26.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] misc: fastrpc: define names for protection domain ids
2020-09-08 13:10 [PATCH v2 0/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 1/3] misc: fastrpc: fix indentation error in uapi header Jonathan Marek
@ 2020-09-08 13:10 ` Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 3/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Marek @ 2020-09-08 13:10 UTC (permalink / raw)
To: linux-arm-msm; +Cc: Arnd Bergmann, Greg Kroah-Hartman, open list
Define SENSORS_PD for the next patch, to void using magic values for these.
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
drivers/misc/fastrpc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 7939c55daceb..07b381c042cd 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -73,6 +73,11 @@
#define FASTRPC_RMID_INIT_CREATE_ATTR 7
#define FASTRPC_RMID_INIT_CREATE_STATIC 8
+/* Protection Domain(PD) ids */
+#define AUDIO_PD (0) /* also GUEST_OS PD? */
+#define USER_PD (1)
+#define SENSORS_PD (2)
+
#define miscdev_to_cctx(d) container_of(d, struct fastrpc_channel_ctx, miscdev)
static const char *domains[FASTRPC_DEV_MAX] = { "adsp", "mdsp",
@@ -1037,7 +1042,7 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl,
inbuf.pageslen = 1;
inbuf.attrs = init.attrs;
inbuf.siglen = init.siglen;
- fl->pd = 1;
+ fl->pd = USER_PD;
if (init.filelen && init.filefd) {
err = fastrpc_map_create(fl, init.filefd, init.filelen, &map);
@@ -1287,7 +1292,7 @@ static int fastrpc_init_attach(struct fastrpc_user *fl)
args[0].fd = -1;
args[0].reserved = 0;
sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_ATTACH, 1, 0);
- fl->pd = 0;
+ fl->pd = AUDIO_PD;
return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE,
sc, &args[0]);
--
2.26.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] misc: fastrpc: add ioctl for attaching to sensors pd
2020-09-08 13:10 [PATCH v2 0/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 1/3] misc: fastrpc: fix indentation error in uapi header Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 2/3] misc: fastrpc: define names for protection domain ids Jonathan Marek
@ 2020-09-08 13:10 ` Jonathan Marek
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Marek @ 2020-09-08 13:10 UTC (permalink / raw)
To: linux-arm-msm
Cc: Arnd Bergmann, Greg Kroah-Hartman, Srinivas Kandagatla,
Jorge Ramirez-Ortiz, open list
Initializing sensors requires attaching to pd 2. Add an ioctl for that.
This corresponds to FASTRPC_INIT_ATTACH_SENSORS in the downstream driver.
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
drivers/misc/fastrpc.c | 9 ++++++---
include/uapi/misc/fastrpc.h | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 07b381c042cd..f05f4b5934bd 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1281,7 +1281,7 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp)
return 0;
}
-static int fastrpc_init_attach(struct fastrpc_user *fl)
+static int fastrpc_init_attach(struct fastrpc_user *fl, int pd)
{
struct fastrpc_invoke_args args[1];
int tgid = fl->tgid;
@@ -1292,7 +1292,7 @@ static int fastrpc_init_attach(struct fastrpc_user *fl)
args[0].fd = -1;
args[0].reserved = 0;
sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_ATTACH, 1, 0);
- fl->pd = AUDIO_PD;
+ fl->pd = pd;
return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE,
sc, &args[0]);
@@ -1482,7 +1482,10 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int cmd,
err = fastrpc_invoke(fl, argp);
break;
case FASTRPC_IOCTL_INIT_ATTACH:
- err = fastrpc_init_attach(fl);
+ err = fastrpc_init_attach(fl, AUDIO_PD);
+ break;
+ case FASTRPC_IOCTL_INIT_ATTACH_SNS:
+ err = fastrpc_init_attach(fl, SENSORS_PD);
break;
case FASTRPC_IOCTL_INIT_CREATE:
err = fastrpc_init_create_process(fl, argp);
diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h
index de31f0bd4779..0a89f95463f6 100644
--- a/include/uapi/misc/fastrpc.h
+++ b/include/uapi/misc/fastrpc.h
@@ -12,6 +12,7 @@
#define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create)
#define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)
#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap)
+#define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8)
struct fastrpc_invoke_args {
__u64 ptr;
--
2.26.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-08 19:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 13:10 [PATCH v2 0/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 1/3] misc: fastrpc: fix indentation error in uapi header Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 2/3] misc: fastrpc: define names for protection domain ids Jonathan Marek
2020-09-08 13:10 ` [PATCH v2 3/3] misc: fastrpc: add ioctl for attaching to sensors pd Jonathan Marek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).