public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Xu Lu <luxu.kernel@bytedance.com>
To: daniel.lezcano@linaro.org, tglx@linutronix.de,
	anup@brainfault.org, paul.walmsley@sifive.com,
	palmer@dabbelt.com
Cc: lihangjing@bytedance.com, xieyongji@bytedance.com,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Xu Lu <luxu.kernel@bytedance.com>
Subject: [PATCH 3/5] irqchip/riscv-imsic: Use wmb() to order normal writes and IPI writes
Date: Mon, 13 Jan 2025 23:09:31 +0800	[thread overview]
Message-ID: <20250113150933.65121-4-luxu.kernel@bytedance.com> (raw)
In-Reply-To: <20250113150933.65121-1-luxu.kernel@bytedance.com>

During an IPI procedure, we need to ensure all previous write operations
are visible to other CPUs before sending a real IPI. We use wmb() barrier
to ensure this as IMSIC issues IPI via mmio writes.

Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
---
 drivers/irqchip/irq-riscv-imsic-early.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-riscv-imsic-early.c
index 63097f2bbadf..c6317cb557fb 100644
--- a/drivers/irqchip/irq-riscv-imsic-early.c
+++ b/drivers/irqchip/irq-riscv-imsic-early.c
@@ -29,6 +29,12 @@ static void imsic_ipi_send(unsigned int cpu)
 {
 	struct imsic_local_config *local = per_cpu_ptr(imsic->global.local, cpu);
 
+	/*
+	 * Ensure that stores to normal memory are visible to the other CPUs
+	 * before issuing IPI.
+	 */
+	wmb();
+
 	writel_relaxed(IMSIC_IPI_ID, local->msi_va);
 }
 
-- 
2.20.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2025-01-13 15:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 15:09 [PATCH 0/5] riscv: irqchip: Optimization of interrupt handling Xu Lu
2025-01-13 15:09 ` [PATCH 1/5] irqchip/riscv-intc: Balance priority and fairness during irq handling Xu Lu
2025-01-15 11:39   ` Anup Patel
2025-01-15 12:37     ` [External] " Xu Lu
2025-01-15 17:01       ` Anup Patel
2025-01-16  2:26         ` Xu Lu
2025-01-13 15:09 ` [PATCH 2/5] irqchip/riscv-imsic: Add a threshold to ext irq handling times Xu Lu
2025-01-13 15:09 ` Xu Lu [this message]
2025-01-14  4:34   ` [PATCH 3/5] irqchip/riscv-imsic: Use wmb() to order normal writes and IPI writes Anup Patel
2025-01-14  6:39     ` [External] " Xu Lu
2025-01-14  8:58       ` Anup Patel
2025-01-14  9:07         ` Xu Lu
2025-01-13 15:09 ` [PATCH 4/5] irqchip/timer-clint: " Xu Lu
2025-01-14  4:34   ` Anup Patel
2025-01-13 15:09 ` [PATCH 5/5] irqchip/aclint-sswi: " Xu Lu
2025-01-14  4:34   ` Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250113150933.65121-4-luxu.kernel@bytedance.com \
    --to=luxu.kernel@bytedance.com \
    --cc=anup@brainfault.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=lihangjing@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=tglx@linutronix.de \
    --cc=xieyongji@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox