Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 8f585d14030d ("mailbox: tegra-hsp: Add tegra_hsp_sm_ops")
Fixes: 74c20dd0f892 ("mailbox: tegra-hsp: Add 128-bit shared mailbox support")
Cc: stable@vger.kernel.org
Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>

authored by

Pekka Pessi and committed by
Jassi Brar
0b7f8328 f055feb4

+4 -2
+4 -2
drivers/mailbox/tegra-hsp.c
··· 388 388 value = tegra_hsp_channel_readl(channel, HSP_SM_SHRD_MBOX); 389 389 value &= ~HSP_SM_SHRD_MBOX_FULL; 390 390 msg = (void *)(unsigned long)value; 391 - mbox_chan_received_data(channel->chan, msg); 392 391 393 392 /* 394 393 * Need to clear all bits here since some producers, such as TCU, depend ··· 397 398 * explicitly, so we have to make sure we cover all possible cases. 398 399 */ 399 400 tegra_hsp_channel_writel(channel, 0x0, HSP_SM_SHRD_MBOX); 401 + 402 + mbox_chan_received_data(channel->chan, msg); 400 403 } 401 404 402 405 static const struct tegra_hsp_sm_ops tegra_hsp_sm_32bit_ops = { ··· 434 433 value[3] = tegra_hsp_channel_readl(channel, HSP_SHRD_MBOX_TYPE1_DATA3); 435 434 436 435 msg = (void *)(unsigned long)value; 437 - mbox_chan_received_data(channel->chan, msg); 438 436 439 437 /* 440 438 * Clear data registers and tag. ··· 443 443 tegra_hsp_channel_writel(channel, 0x0, HSP_SHRD_MBOX_TYPE1_DATA2); 444 444 tegra_hsp_channel_writel(channel, 0x0, HSP_SHRD_MBOX_TYPE1_DATA3); 445 445 tegra_hsp_channel_writel(channel, 0x0, HSP_SHRD_MBOX_TYPE1_TAG); 446 + 447 + mbox_chan_received_data(channel->chan, msg); 446 448 } 447 449 448 450 static const struct tegra_hsp_sm_ops tegra_hsp_sm_128bit_ops = {