Skip to content

Commit 8135d1d

Browse files
sumanannaandersson
authored andcommitted
remoteproc/omap: Check for undefined mailbox messages
Add some checks in the mailbox callback function to limit any processing in the mailbox callback function to only certain currently valid messages, and drop all the remaining messages. A debug message is added to print any such invalid messages when the appropriate trace control is enabled. Co-developed-by: Subramaniam Chanderashekarapuram <[email protected]> Signed-off-by: Subramaniam Chanderashekarapuram <[email protected]> Signed-off-by: Suman Anna <[email protected]> Signed-off-by: Tero Kristo <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Reviewed-by: Andrew F. Davis <[email protected]> Acked-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 1070f24 commit 8135d1d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/remoteproc/omap_remoteproc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ static void omap_rproc_mbox_callback(struct mbox_client *client, void *data)
130130
dev_info(dev, "received echo reply from %s\n", name);
131131
break;
132132
default:
133+
if (msg >= RP_MBOX_READY && msg < RP_MBOX_END_MSG)
134+
return;
135+
if (msg > oproc->rproc->max_notifyid) {
136+
dev_dbg(dev, "dropping unknown message 0x%x", msg);
137+
return;
138+
}
133139
/* msg contains the index of the triggered vring */
134140
if (rproc_vq_interrupt(oproc->rproc, msg) == IRQ_NONE)
135141
dev_dbg(dev, "no message was found in vqid %d\n", msg);

drivers/remoteproc/omap_remoteproc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
*
5757
* @RP_MBOX_ABORT_REQUEST: a "please crash" request, used for testing the
5858
* recovery mechanism (to some extent).
59+
*
60+
* Introduce new message definitions if any here.
61+
*
62+
* @RP_MBOX_END_MSG: Indicates end of known/defined messages from remote core
63+
* This should be the last definition.
64+
*
5965
*/
6066
enum omap_rp_mbox_messages {
6167
RP_MBOX_READY = 0xFFFFFF00,
@@ -64,6 +70,7 @@ enum omap_rp_mbox_messages {
6470
RP_MBOX_ECHO_REQUEST = 0xFFFFFF03,
6571
RP_MBOX_ECHO_REPLY = 0xFFFFFF04,
6672
RP_MBOX_ABORT_REQUEST = 0xFFFFFF05,
73+
RP_MBOX_END_MSG = 0xFFFFFF06,
6774
};
6875

6976
#endif /* _OMAP_RPMSG_H */

0 commit comments

Comments
 (0)