Skip to content

Commit 0b7f832

Browse files
pessiJassi Brar
authored andcommitted
mailbox: tegra-hsp: Clear mailbox before using message
The Tegra RCE (Camera) driver expects the mailbox to be empty before processing the IVC messages. On RT kernel, the threads processing the IVC messages (which are invoked after `mbox_chan_received_data()` is called) may be on a different CPU or running with a higher priority than the HSP interrupt handler thread. This can cause it to act on the message before the mailbox gets cleared in the HSP interrupt handler resulting in a loss of IVC notification. Fix this by clearing the mailbox data register before calling `mbox_chan_received_data()`. Fixes: 8f585d1 ("mailbox: tegra-hsp: Add tegra_hsp_sm_ops") Fixes: 74c20dd ("mailbox: tegra-hsp: Add 128-bit shared mailbox support") Cc: [email protected] Signed-off-by: Pekka Pessi <[email protected]> Signed-off-by: Kartik Rajput <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent f055feb commit 0b7f832

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/mailbox/tegra-hsp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ static void tegra_hsp_sm_recv32(struct tegra_hsp_channel *channel)
388388
value = tegra_hsp_channel_readl(channel, HSP_SM_SHRD_MBOX);
389389
value &= ~HSP_SM_SHRD_MBOX_FULL;
390390
msg = (void *)(unsigned long)value;
391-
mbox_chan_received_data(channel->chan, msg);
392391

393392
/*
394393
* Need to clear all bits here since some producers, such as TCU, depend
@@ -398,6 +397,8 @@ static void tegra_hsp_sm_recv32(struct tegra_hsp_channel *channel)
398397
* explicitly, so we have to make sure we cover all possible cases.
399398
*/
400399
tegra_hsp_channel_writel(channel, 0x0, HSP_SM_SHRD_MBOX);
400+
401+
mbox_chan_received_data(channel->chan, msg);
401402
}
402403

403404
static const struct tegra_hsp_sm_ops tegra_hsp_sm_32bit_ops = {
@@ -433,7 +434,6 @@ static void tegra_hsp_sm_recv128(struct tegra_hsp_channel *channel)
433434
value[3] = tegra_hsp_channel_readl(channel, HSP_SHRD_MBOX_TYPE1_DATA3);
434435

435436
msg = (void *)(unsigned long)value;
436-
mbox_chan_received_data(channel->chan, msg);
437437

438438
/*
439439
* Clear data registers and tag.
@@ -443,6 +443,8 @@ static void tegra_hsp_sm_recv128(struct tegra_hsp_channel *channel)
443443
tegra_hsp_channel_writel(channel, 0x0, HSP_SHRD_MBOX_TYPE1_DATA2);
444444
tegra_hsp_channel_writel(channel, 0x0, HSP_SHRD_MBOX_TYPE1_DATA3);
445445
tegra_hsp_channel_writel(channel, 0x0, HSP_SHRD_MBOX_TYPE1_TAG);
446+
447+
mbox_chan_received_data(channel->chan, msg);
446448
}
447449

448450
static const struct tegra_hsp_sm_ops tegra_hsp_sm_128bit_ops = {

0 commit comments

Comments
 (0)