From 38ca55b8e54cf4b32e29f5514977cb3d1ec7f2c0 Mon Sep 17 00:00:00 2001 From: Himateja Reddy Date: Thu, 10 Nov 2022 15:33:05 -0800 Subject: [PATCH] msm: adsprpc: Share CP secure context banks Currently CPZ secure context banks are not shared on CDSP. Share CP secure context banks among applications that use secure memory, so that many CPZ applications can be spawned and offloaded to DSP. Change-Id: I77d95bab86ef527e41c9fe79058742615f4adb0e Signed-off-by: Himateja Reddy --- dsp/adsprpc.c | 5 ++++- dsp/adsprpc_shared.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dsp/adsprpc.c b/dsp/adsprpc.c index dfed99a68e..60cea8826f 100644 --- a/dsp/adsprpc.c +++ b/dsp/adsprpc.c @@ -1207,7 +1207,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd, struct dma_buf * map->secure = (mem_buf_dma_buf_exclusive_owner(map->buf)) ? 0 : 1; if (map->secure) { if (!fl->secsctx) - err = fastrpc_session_alloc(chan, 1, 0, + err = fastrpc_session_alloc(chan, 1, me->share_securecb, &fl->secsctx); if (err) { ADSPRPC_ERR( @@ -7374,6 +7374,9 @@ static int fastrpc_cb_probe(struct device *dev) if (of_get_property(dev->of_node, "shared-cb", NULL) != NULL) { sess->smmu.sharedcb = 1; + // Set share_securecb, if the secure context bank is shared + if (sess->smmu.secure) + me->share_securecb = 1; err = of_property_read_u32(dev->of_node, "shared-cb", &sharedcb_count); if (err) diff --git a/dsp/adsprpc_shared.h b/dsp/adsprpc_shared.h index ad434b2407..0b66a622db 100644 --- a/dsp/adsprpc_shared.h +++ b/dsp/adsprpc_shared.h @@ -945,6 +945,8 @@ struct fastrpc_apps { struct mutex mut_uid; /* Indicates cdsp device status */ int remote_cdsp_status; + /* Indicates secure context bank to be shared */ + int share_securecb; }; struct fastrpc_mmap {