From patchwork Mon Sep 7 18:16:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1359180 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=TEzybVBA; 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 4Blc2f1q43z9sT6 for ; Tue, 8 Sep 2020 04:17:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 17A4A82502; Mon, 7 Sep 2020 20:17:24 +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="TEzybVBA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CCB2D824F6; Mon, 7 Sep 2020 20:17:21 +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 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 8B064824B3 for ; Mon, 7 Sep 2020 20:17:18 +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 p65so10309487qtd.2 for ; Mon, 07 Sep 2020 11:17:18 -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=qz55qPE5Kuhk+n2i5gJHk7HTy11orZR7kqBdgfkVlZ0=; b=TEzybVBAWhNnhD8NMxcTd4beo9Nl6HXi31t6Q8MxLHKdvSPY4BX6Y9WUeZpvozpRUF ugsOu/UGEy0MbTKREwKBfXpcrlMsZX2UnZ2kFj7LlPwrODhWQRcdcG83CAyywsjtTDJO muosDZAmGiiKJyR2cChGrUXJbZWWOQQoF6pUqOhIBeJinaczU5QrfS9/aQOVikQLejZe ljngDn1dNnA1A6VJ+llkMRg+q+W6LREAYhMD0LAtj13BWO/Tc4dQhFPlJYqM8uNcB5J3 Ub+EtyksRppJHyCX5pB22ZhS1UGxf3dYjpnEbXHijKCO+VBP00uswrOEsOvVf0js+RdT OeAA== 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=qz55qPE5Kuhk+n2i5gJHk7HTy11orZR7kqBdgfkVlZ0=; b=ZxrtXJ4lupa5fm+gxj6vRvJDf1iBggERjKnkFh10VHuZfAfXNjPIJtXDUIhJUPxMlO qAbLVAMZSNXfk9NFlwnCtQYWeCJ2dvUnDjkQgC3rs1vW4yBHJEsoB4bCmbrRxevJQPbK IOMqKRntNcVMb/KINGqsu9N699ZNbNlYhB3xdt0XHKZyOXjY62YBhhoF47kXNFNND+/F dj80O13YvYWrwlNXH+0AN50Oeipq2NIPJRwFztwEhRAtp1+nkCjFzIasIeSvcggYeh1T zZcBQYPqC/8EXJqFi1QE1QIcHZx9jxI/wJzkaljx/E6jueFHmvv1xhn65/R7HP4/Gqj/ n0Tg== X-Gm-Message-State: AOAM531FEi7o6fMrhdkO27r+L4o2o+hhlndll1iaiLHXN9OYsDFvxW1i 8oSLsVH3eeJYkhCY9LIHmJjQmNx8OHQ5vA== X-Google-Smtp-Source: ABdhPJwQF+k+Im16ORpLYXdnUnzaKxlBG/q9Rafg+KfYxyvIF/GLzHlCMuHNAYzdoPBHSNMfieNCew== X-Received: by 2002:ac8:794f:: with SMTP id r15mr5975888qtt.147.1599502637222; Mon, 07 Sep 2020 11:17:17 -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 w3sm11577212qkc.10.2020.09.07.11.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 11:17:16 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de Cc: Rick Chen , Heinrich Schuchardt , Bin Meng , Sean Anderson Subject: [PATCH 2/7] riscv: Match memory barriers between send_ipi_many and handle_ipi Date: Mon, 7 Sep 2020 14:16:54 -0400 Message-Id: <20200907181659.92449-3-seanga2@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907181659.92449-1-seanga2@gmail.com> References: <20200907181659.92449-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: 90ae28143700bae4edd23930a7772899ad259058 Signed-off-by: Sean Anderson Reviewed-by: Bin Meng --- 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);