From patchwork Mon Sep 14 14:23:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1363645 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=Kj2kDzed; 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 4BqpX06czJz9sT6 for ; Tue, 15 Sep 2020 00:24:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23DE282332; Mon, 14 Sep 2020 16:23:28 +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="Kj2kDzed"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E5048230E; Mon, 14 Sep 2020 16:23:24 +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-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) (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 B5EDF808B2 for ; Mon, 14 Sep 2020 16:23:21 +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-qv1-xf43.google.com with SMTP id h1so9004944qvo.9 for ; Mon, 14 Sep 2020 07:23:21 -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=vp6tPwWy+UrdhUd6Ybj40Jv/jZPzK47gnT4dAKWaFhk=; b=Kj2kDzedZQVMCjzaZc1529UR63wSwzMh3OoPPP3KbMhFBOrcrFtt729a6Rg22EFvgx QfR0It3B0lcPxl00iu5ATSCxgGYfBFecWd7YaSMg67ubpKPrRPYCcaSylABDRGCZ7+sn pb+zQpKsz2RWNgT0Cvu3a/XRPWEsjuohN1T6vMi2VEOYVqWE0BO2rwXCHZcIzjpaywDg vK2XKUcLYhZohvo5oa2bh6RCQZAuci/0rIzW3t8DBI1YaiUuAzHNp61z9EQi9jtWj4Ge dg4GE1U1qz53UCXF44R4aB9f1sx2ez4uITkRquJtRyQPqPnAlNWTRDGlVcWP3VhPKiY8 iIYA== 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=vp6tPwWy+UrdhUd6Ybj40Jv/jZPzK47gnT4dAKWaFhk=; b=JTq+dIOZoGyoP4kOwmMQfjbT9JUsJPbasSNt20X5gUWS6I0IP2rCL6idYYSdOMy8dp Rshmln9UZkH3kIq2xfBIcElFjkks4DXHfFqZAjSmau8r+jf+LJIFl7cj4a2f4+EOVcT3 /gr1BWmlJx3FlchD1iq2d3enFiqqAPEzVoP7ZDj3MKmkfPnErPWoUzLYhaYO1OSxc1E7 7kwuGUjmitANqyhanA7qFG4ISvEE7bo/uOR9wVkCuhmOdkf5VYhmtufJ8R0/Gjw0YWZ9 d8eUIhrruNBjNHeHPjGq+xlzPqqvh4PV0+PbXLqXbEsmEIAeiAG5kN//a0NO2HoI2plr 58Mg== X-Gm-Message-State: AOAM5301FvuuQgr83mwv4hiMF5ynUL6jR5b7IsOHsGlY1ErQjIVNnV25 o9WJE4Co3X43fPfseQPiphu+lqvSy4gK+g== X-Google-Smtp-Source: ABdhPJwjMYkizF7Csa+vxcM7V431pDGWe7KUueqpdqcUxnvmZ62CJYZFmYDv7ZgCojiZzbSH8BXQrQ== X-Received: by 2002:a05:6214:a61:: with SMTP id ef1mr13968726qvb.115.1600093400455; Mon, 14 Sep 2020 07:23:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 07:23:20 -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 4/7] riscv: Clear pending IPIs on initialization Date: Mon, 14 Sep 2020 10:23:00 -0400 Message-Id: <20200914142303.21307-5-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 Even though we no longer call smp_function if an IPI was not sent by U-Boot, we still need to clear any IPIs which were pending from the execution environment. Otherwise, secondary harts will busy-wait in secondary_hart_loop, instead of relaxing. Signed-off-by: Sean Anderson Reviewed-by: Bin Meng --- Changes in v2: - Make riscv_ipi_init_secondary_hart static arch/riscv/cpu/cpu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index bfa2d4a426..ab08af5a33 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -72,6 +72,15 @@ static int riscv_cpu_probe(void) return 0; } +/* + * This is called on secondary harts just after the IPI is init'd. Currently + * there's nothing to do, since we just need to clear any existing IPIs, and + * that is handled by the sending of an ipi itself. + */ +static void riscv_ipi_init_secondary_hart(ulong hart, ulong arg0, ulong arg1) +{ +} + int arch_cpu_init_dm(void) { int ret; @@ -111,6 +120,15 @@ int arch_cpu_init_dm(void) ret = riscv_init_ipi(); if (ret) return ret; + + /* + * Clear all pending IPIs on secondary harts. We don't do anything on + * the boot hart, since we never send an IPI to ourselves, and no + * interrupts are enabled + */ + ret = smp_call_function((ulong)riscv_ipi_init_secondary_hart, 0, 0, 0); + if (ret) + return ret; #endif return 0;