Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions drivers/misc/fastrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
*/
#define FASTRPC_MAX_STATIC_HANDLE (20)
#define FASTRPC_CTXID_MASK GENMASK(15, 8)

/*
* Newer DSP firmware implements a PD (Protection Domain) notification
* framework that sends PD state notifications upon request. The PD exit
* notification is unconditionally sent by the DSP with this fixed sentinel
* in the context field rather than the context of an outstanding invocation.
* Since the fastrpc driver does not support the DSP PD notification framework,
* this message must be dropped rather than matched against the context idr.
*/
#define FASTRPC_DSP_PD_NOTIFY_CTX 0xABCDABCD

#define INIT_FILELEN_MAX (2 * 1024 * 1024)
#define INIT_FILE_NAMELEN_MAX (128)
#define FASTRPC_DEVICE_NAME "fastrpc"
Expand Down Expand Up @@ -2830,6 +2841,14 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
if (!cctx)
return -ENODEV;

/*
* A PD exit notification from the DSP PD notification framework carries
* this sentinel rather than a real context. Drop it: a real context is
* (idr_index << 4) | pd and can never collide with this value.
*/
if (rsp->ctx == FASTRPC_DSP_PD_NOTIFY_CTX)
return 0;

ctxid = FIELD_GET(FASTRPC_CTXID_MASK, rsp->ctx);

spin_lock_irqsave(&cctx->lock, flags);
Expand Down