From patchwork Mon Sep 14 14:22:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1363642 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Qp+SANYl; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BqpWP6cPLz9sV1 for ; Tue, 15 Sep 2020 00:23:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1FABD82319; Mon, 14 Sep 2020 16:23:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qp+SANYl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 89A33821ED; Mon, 14 Sep 2020 16:23:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A9E2D81996 for ; Mon, 14 Sep 2020 16:23:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x843.google.com with SMTP id p65so13591046qtd.2 for ; Mon, 14 Sep 2020 07:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jkvHO5kOKNVVLaIuvobXZdymCZ4LpSHu602oT1pGDuA=; b=Qp+SANYlfToSrhPTmIPqMj+M1TJPLce7OuKp0Z8Re3t9n7FdogmBd0Hf9bsqaCz9Fx DJahpoTEsKkKC86BJ+d88DtwPr/IJ/pqm28a+6F2XEbgGOUaBAzZiwkMthu+9oDcoEmJ NbCBzgoyY87nKqi2yKcH2MgKOgYFL1aiWSZI4C44AuNtyasdzQbYByD7i1iqpj7jdXE4 cCN8FPe5fBrX+NENGU8zjsN1IQxx/HZBF8ZxCbR4b1eVKWqfx9lqou7cKFD3N8+i/Fru 05h/vsbCEJ4Amptfr/gunBUoBErSgxuhkPByYwGp6b4HhzuJylH2H1G/fWycDWtQN1fj O8jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jkvHO5kOKNVVLaIuvobXZdymCZ4LpSHu602oT1pGDuA=; b=h1o7BdMMHSfivaoWuYxoKiIVP1qQJe2gJ9B6PulFtBpMA63jYezAr04Jtj6wg2szxV qLphXxxeFY7xvVEIhccwlfmVc9rmnpVeQ5dIsg5QUBZYA/tkEju8YiFDKCZLxNBnZcPO 98jh85to6eb2ByeTN25ykW8OLrrK3BcQJwyQ6PGav2sTvu0gXIIwX3/4c6Xpu4hW7u/0 DQIUIm7ma0W7pGw3XVasIqeO2BIoQMYzIthg1IG2XLhSoPj2OPhAR/pjcOb+irzOAG7H +4OYWXbY1dlRYcYm4WcPk80QPmJGuREiO4HPo+cwqjJC7+trwQwZsE4+4CNyBfdyslsl yJLA== X-Gm-Message-State: AOAM533EzC5/iRCRfK+KWtrDfmhyVtfqZ6qnOvo839IGMDs4s14W+Aey WHU5TYuhvPGqiI2Dfq1DDq1iX6Mmu7ugwg== X-Google-Smtp-Source: ABdhPJzJRar9fe24DixxyRG9hyq8HyNamQmE2b6Bf7cwe/xbQINEZ7l3WqhkZwJMsf1xkeCiFFkfwA== X-Received: by 2002:aed:2907:: with SMTP id s7mr12415902qtd.321.1600093398448; Mon, 14 Sep 2020 07:23:18 -0700 (PDT) Received: from godwin.fios-router.home (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.gmail.com with ESMTPSA id k20sm14770988qtb.34.2020.09.14.07.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 07:23:17 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de Cc: alankao@andestech.com, Leo Liang , Heinrich Schuchardt , Bin Meng , Rick Chen , Sean Anderson , Bin Meng Subject: [PATCH v2 2/7] riscv: Match memory barriers between send_ipi_many and handle_ipi Date: Mon, 14 Sep 2020 10:22:58 -0400 Message-Id: <20200914142303.21307-3-seanga2@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200914142303.21307-1-seanga2@gmail.com> References: <20200914142303.21307-1-seanga2@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Without a matching barrier on the write side, the barrier in handle_ipi does nothing. It was entirely possible for the boot hart to write to addr, arg0, and arg1 *after* sending the IPI, because there was no barrier on the sending side. Fixes: 90ae281437 ("riscv: add option to wait for ack from secondary harts in smp functions") Signed-off-by: Sean Anderson Reviewed-by: Bin Meng Reviewed-by: Rick Chen Reviewed-by: Leo Liang --- (no changes since v1) arch/riscv/lib/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/lib/smp.c b/arch/riscv/lib/smp.c index ac22136314..ab6d8bd7fa 100644 --- a/arch/riscv/lib/smp.c +++ b/arch/riscv/lib/smp.c @@ -54,6 +54,8 @@ static int send_ipi_many(struct ipi_data *ipi, int wait) gd->arch.ipi[reg].arg0 = ipi->arg0; gd->arch.ipi[reg].arg1 = ipi->arg1; + __smp_mb(); + ret = riscv_send_ipi(reg); if (ret) { pr_err("Cannot send IPI to hart %d\n", reg);