Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9FC3C47095 for ; Wed, 9 Jun 2021 07:55:53 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE84B6128A for ; Wed, 9 Jun 2021 07:55:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE84B6128A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6397D82ECC; Wed, 9 Jun 2021 09:55:50 +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="McQK+stp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B94F80C68; Wed, 9 Jun 2021 09:55:48 +0200 (CEST) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 3A19080C68 for ; Wed, 9 Jun 2021 09:55:46 +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=bmeng.cn@gmail.com Received: by mail-ej1-x62a.google.com with SMTP id h24so37019177ejy.2 for ; Wed, 09 Jun 2021 00:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=7TkTjw219Xs27Nqm2AL9skpzrIwcduSLeBQ1THcPlrU=; b=McQK+stpfrLZjq5/JAHm9oX6tWkEZfBNwyZ26RjvcgAuf351LhOdz6edTk4jgV5Ykg q/cumPlEzg7HFb6AX0faNONIpcKA4rmHHxwu13JhLFxU2fl54b5fQb4+jUvv20q0l4UJ D/iJ00CN7jO8H33zEPyR2MyVWzA2K3sXZuTZ57LlRLQV3PwShLohm0ZkhUJohyhzEk6k YuvblYSIdyslsrhus27nWOleCrd9wzqIlvY4TykiGYX7LYa7Fj/H6q5uy98V0Qka2w30 Ow8Vw2/0o/Bp9a/YeLwmW2mxuYXSsL62gPUzjJYvxGmihm0GL/NrXsIwq5C2I+cncz0k vfgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=7TkTjw219Xs27Nqm2AL9skpzrIwcduSLeBQ1THcPlrU=; b=JBPrklLjLhY5XiOmP2HvrbAorH2FaNEo2al9L2O1ci4X+piBYpMIFj2epVPZenKbdp +bG241oH79RCYd6JN16x5vc8QRFnPyRB6ESofPWweuYUpbJrriLt/zdMNH9kDigjhRno tPlU7vnSaN7n5BgZBywy58tPYlj4/RvSaU4COIzZva/+USwuFlpgimTLBpQLunT7xAik U/Rpq/2Fk/Mzc3cgaEiIg33DVF2nDdMdmeCLT4sE8/SRx8mnNPdbduMOFkj57o83HY9q WA3ju2Inotv8HsOVcl+jNo0LtESXh8NM87aJOJWAnLnKVakSJo555ovvJLcHMvu6M9BJ PKaw== X-Gm-Message-State: AOAM531TlVVlync8tPzX54LuM1oQI4J9uOfKBPy+7k/RU+lw8TV7BCcz 5PMmqjpvaZFoim8GpbqRz5luoiBaGyGq1g== X-Google-Smtp-Source: ABdhPJyhUPEWx9gyJdpZFbwYF11wS7uNMXSV5ENR7vcutql8qUFpgcX6J5G70W/N5RLCVYv+OO/q7Q== X-Received: by 2002:a17:906:b190:: with SMTP id w16mr2507528ejy.332.1623225345870; Wed, 09 Jun 2021 00:55:45 -0700 (PDT) Received: from pek-vx-bsp2.wrs.com (ec2-44-242-66-180.us-west-2.compute.amazonaws.com. [44.242.66.180]) by smtp.gmail.com with ESMTPSA id o5sm799356edq.8.2021.06.09.00.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 00:55:45 -0700 (PDT) From: Bin Meng To: Rick Chen , Leo Liang , U-Boot Mailing List Subject: [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask Date: Wed, 9 Jun 2021 15:56:02 +0800 Message-Id: <20210609075602.157709-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.4 at phobos.denx.de X-Virus-Status: Clean Current logic in riscv_get_ipi() for Andes PLICSW does not look good to me. The mask to test IPI pending bits for a hart should be left shifted by (8 * gd->arch.boot_hart), just the same as what is done in riscv_send_ipi(). Signed-off-by: Bin Meng --- It looks there is no datasheet released from Andes that describes how PLICSW works, and its register fields. I can only get an understanding from current U-Boot and OpenSBI PLICSW driver. This requires testing on Andes hardware, which I don't have access to. arch/riscv/lib/andes_plic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/lib/andes_plic.c b/arch/riscv/lib/andes_plic.c index 221a5fe324..5e113ee8c9 100644 --- a/arch/riscv/lib/andes_plic.c +++ b/arch/riscv/lib/andes_plic.c @@ -105,9 +105,11 @@ int riscv_clear_ipi(int hart) int riscv_get_ipi(int hart, int *pending) { + unsigned int ipi = (SEND_IPI_TO_HART(hart) << (8 * gd->arch.boot_hart)); + *pending = readl((void __iomem *)PENDING_REG(gd->arch.plic, gd->arch.boot_hart)); - *pending = !!(*pending & SEND_IPI_TO_HART(hart)); + *pending = !!(*pending & ipi); return 0; } -- 2.25.1