From nobody Thu Dec 18 20:36:39 2025 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA1DD22F85E for ; Mon, 13 Jan 2025 15:09:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736780997; cv=none; b=jBKM/V4KsO74D7KTNolcQYhJaXLU25tO7fF2rEtPRNAlmVqYG19mz+LNXCRQu6cZ43h3qFHXNf6+ChJdRXpvlp/DhTzLsuvkLGGjLUaDrw2qLI/Iqc9wmVIiR64AbSpoCgV+KIHyB5wQDIgvNlxCXvqCzG7vwH/qbATs4F7bXHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736780997; c=relaxed/simple; bh=cjs15jK69wTWHeTzFsEAxjlxJ72Yi6fwabDsS7bUAk8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aTRE0CHR7LqMTxrrMzT662CHO0llz4ShJdtI96NRqCAlzmwBgQFohJJkLUoSE03Id45gShizTX7XgQ7o7v85mjIIXzsx6A5BLIT/lnkr1RztNerhEfZrV3CU30mcrFbY43o0HY7pWMdex/iYd4m2hQ3DcR2acCoYmz3brPELG/s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=D5SYFMid; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="D5SYFMid" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ee989553c1so7349050a91.3 for ; Mon, 13 Jan 2025 07:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1736780995; x=1737385795; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YIiPPBeekRqOc2QhM+9hoY1BatS99yweNfycJQ5OTwE=; b=D5SYFMid6MiKGCkQX5p5laSZ8UPKivqe/Amwf8652/R6RVmnlb6Ai2i+5LqiXpQ/zr CbgjBcU/O7AlQZfh9+MLdWWyoCgXlXYS1QAQA0JkE4gZsMhjfR0tR0cpkB9YWCE6insX /9+ERZPZWdGJmaVTn1BCZjU5UNprPFRdKrRexA0KcIQkK+yHzkQ4kLq/58QWkavhsuWA 1oPog4Q9nhtO/G/c58J1vluyJZBrp1Kq4ZYyK0OcOwRjjE61QG1Zf/QD5wB9WIRfS95+ 2tRI4Z+pz9C407XHTVSdCf2dKyk/6ZXfRs1G072Cr8HEaQZCEVncMLA5OkHSDTZ1D//g Fw6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736780995; x=1737385795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YIiPPBeekRqOc2QhM+9hoY1BatS99yweNfycJQ5OTwE=; b=bt0V8kCcpWdBTy12w9m3/otXWo9WZo5qLxZLagWssSjPAubfvU80JysydCsPvf0yJI 4EqRkXF6vcmHWzs0pkHoAIJGRRVcML59OpV5YyxiGPxepnimb4JoW2spDsWRslNV88TM yOQWIsT/7xImi6oekR9qGWePQvtj+ZPGHziK1RJtYQFqblS82wWHcSX8S38xaGLnxeSH KLN+3y/2e5tOogp0lp8r7ctnfS7Dq8aFjvHLT8IRa3QuMxKz28epGCUom9iEsT7xz0uU f5avbpIdNXXIZtOxctnbT+YoRYTyxcHfRP3juWld7VsQ12iX6MZ2LPMCwoR7In15C7XQ F4zA== X-Forwarded-Encrypted: i=1; AJvYcCUhtoftMFArts/faz2BnMJDxNrACtnZJD91j6GDj/rQcDbm/3TLoqhAae+QoMJI3OwR1PVTYqHikbNzIBY=@vger.kernel.org X-Gm-Message-State: AOJu0YzxaEW9xNd4yz07OBjrgtnImIWGtUW1NRHPVU/kXORB2wgH8CBA 18HfNwbMfuJfxGIGDAT/XvalKwglzJaVPqhjARQE1/u4PzvyYxezVXMQFnpPAPE= X-Gm-Gg: ASbGncszTIT8iXyCXeP8mqS/Dmb10vwqWu8Lg8/J9FtzsXiSPSrWlrzbh40JcWsKoKy hl8eCPBmJjz6tgfEKBj6E0+3o5xNm5GUZZ+DX6tEWSvSnShIBwrv94vg+XS6R6xikKKBtVSPKs5 hbvL1SKt4Ok+zJDyl+C7jKdDdB3/z9B4E4a3UJlqzllR2RpjEYQ7oBIgF3aGmT8IYozEkoCg07M tAe90QPCEiS6zQ+jy9UuYmb1kJgB+DWtXmhOe5ZufKzSoC6NySsgcPNITn87vT/ABDMZA2ER0Gh OGKLZzr+pAcPFCN26B/XRRYMBZN0jJC9Bl4D30g= X-Google-Smtp-Source: AGHT+IGwqAU+RazQwQZ4ObAHTF1lghFEYQ7OECgOK3uVk6YUXijH2S/i+ipHWDd9Jv5Ntsb3FLbl6g== X-Received: by 2002:a17:90b:2f0c:b0:2ee:7411:ca99 with SMTP id 98e67ed59e1d1-2f548f09f6cmr27569201a91.1.1736780994908; Mon, 13 Jan 2025 07:09:54 -0800 (PST) Received: from J9GPGXL7NT.bytedance.net ([61.213.176.56]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f54a26ae2fsm10193120a91.9.2025.01.13.07.09.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 07:09:54 -0800 (PST) From: Xu Lu 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 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 Message-Id: <20250113150933.65121-4-luxu.kernel@bytedance.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250113150933.65121-1-luxu.kernel@bytedance.com> References: <20250113150933.65121-1-luxu.kernel@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D per_cpu_ptr(imsic->global.local, cpu= ); =20 + /* + * Ensure that stores to normal memory are visible to the other CPUs + * before issuing IPI. + */ + wmb(); + writel_relaxed(IMSIC_IPI_ID, local->msi_va); } =20 --=20 2.20.1