soc: qcom: smp2p: Add memory barrier for irq_pending

There is a very tight race where the irq_retrigger function is run
on one cpu and the actual retrigger softirq is running on a second
cpu. When this happens, there may be a chance that the second cpu
will not see the updated irq_pending value from first cpu.

Add a memory barrier to ensure that irq_pending is read correctly.

Change-Id: I3dd185decc4f050bd57c0b6558f417ead2a3aa5a
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
This commit is contained in:
Chris Lew 2022-06-24 15:19:13 -07:00
parent 317e578589
commit 88ec8244ee

View File

@ -250,6 +250,9 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)
status = val ^ entry->last_value;
entry->last_value = val;
/* Ensure irq_pending is read correctly */
mb();
status |= *entry->irq_pending;
/* No changes of this entry? */
@ -357,6 +360,11 @@ static int smp2p_retrigger_irq(struct irq_data *irqd)
set_bit(irq, entry->irq_pending);
/* Ensure irq_pending is visible to all cpus that retried interrupt
* can run on
*/
mb();
return 0;
}