Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1664163pxb; Wed, 20 Oct 2021 09:23:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydzkKxBh26r1GimT2qEoJ1bcB+mex1HANeVJGOTlqzm79RaFTABbPGm0wcZ9p3p3PnSvG/ X-Received: by 2002:a17:906:5950:: with SMTP id g16mr337061ejr.149.1634747034719; Wed, 20 Oct 2021 09:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634747034; cv=none; d=google.com; s=arc-20160816; b=L5IC/xYbfxK9eDNBAsKnp6baaRpbRoz37cAMTFNKIfSHG/p3/3QritOw+qh7NSXOwJ 9CwWnj+r/iNCa8QG9R9vJWIk/urYeIWNKcp4pep1kwERLqLJYTonDx9vptfYUvSRcPDn TDxu3rmFJaWuEeOGYUqcCiYfXtreqC7HqKklxrjZuDPCmxIhLWYefwKRUbegsSU078dM SPSb2PRiqloHj7BFI8S2YiYklVfHStwZW7FzWovgbap+SRoFY/RsPbC6VJjXCga9frIK nUh+5H93i5To0n6fgbcVppuqjoP3rlp8a6ESSMlFCk8t1q6HMDt9z2TB9SL7egKREJOO Yqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RpDaphKaULN4/89C8L4bD1DcIqBybhRsQBUxIBBeNZg=; b=YsSpLryuPZ86MlTalWfhnz5drFV1ck/rqoC1rv5kQSAhSwmYoJ7dnqhhuncn5fXrgo VS8+gELaGSN1Xgekzpiu8aVD8ghhCWUI3LBiQoHuKYFS2zc8POpnCo3htVcc6XGDZ8uJ 4Hzi1i2w26BLaxQc7qwMrdX0JK+Sa9gTy0VJN2jbxcaoqalGzNbIGv+FbLWybKNHi+j0 DnKeMbH8qdIrmNyl6VtCJU9JOf5GDhAR9ib/zP0ulBDSW0ySMhI9sW0KePOTBn8DnSgF kkVHk0PfdBoiret9SmZoMQGxAqPNjXPBW4jUTvg4/y1Lfovj5zUhaW1Gf3bqWcWhsaJl GpMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=kUprcAR2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 5si3998079ejq.512.2021.10.20.09.23.28; Wed, 20 Oct 2021 09:23:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=kUprcAR2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbhJTQVW (ORCPT + 99 others); Wed, 20 Oct 2021 12:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbhJTQVH (ORCPT ); Wed, 20 Oct 2021 12:21:07 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C571CC06161C for ; Wed, 20 Oct 2021 09:18:49 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id s198-20020a1ca9cf000000b0030d6986ea9fso11492007wme.1 for ; Wed, 20 Oct 2021 09:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=RpDaphKaULN4/89C8L4bD1DcIqBybhRsQBUxIBBeNZg=; b=kUprcAR2htHrBKfjlDZ75+0TfgTGJ7mUB2W2QoT1ebBXuZD6CgaBOHQ0sskcNqyspB Ce+zCkoQFhHtOwwsxQ/jWh91yCUs2nHQfdFUsX54h+heArdNsQ1Wi1ldGyoC3/L0IHpb /GwAowqyK7TbukDad86HgttnmD+4wS91cVvUsf9gplFAeUCzC0Yom30tl6QRAX6wGULq 0O/SjmaEXWNmktVuNeSyXNmT5n4QuKYGlIgjY+F5Qqm7YJA0W1Z4xBwXdQjXdB7fSCRR ZdAl8702GCr07s39QjoOwUmNmHduGyLNBH7hD9GF4YzhvkS3imn038m5AeEXmW3ZWLeH b7cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=RpDaphKaULN4/89C8L4bD1DcIqBybhRsQBUxIBBeNZg=; b=0+dUBjQFsW5dpBNx7QS0DvQm8MX7I9T032I+GzgAeEWriF9RSAKHf4iNsEN8w3KieI E0tl+gie+LpVBorZjVkQHImMAfq7oQPCm9j+ly7a1YQT7CfmJcdVGhfFGyzKyUEmTn7v 9LKFic6pgGl0tk1qONZ23J2D6cRBGrShJVlliexxY029cn6604j12vLV5F1Jf7CKgEJh RRAo/obEzWHy3USufdj3R2mo95O6PiRVYJH1YA19KkDgHlA7sg+K9PMDcFV7bI2cep8a mG0HpdH7mr3uM00brl5FzdKweWWR3GPqxp64uKGOupB6/O18kX2VTMJSGG0BO8Qn+xM5 AVkw== X-Gm-Message-State: AOAM530tgRxUqN7ddJe9CMPiHHnRs986nv4Y+98lrqve2BOLDa2CwrLd El01Ihd/UH07QzybUM20mBc2v+3gkK4JkPxKmtlcng== X-Received: by 2002:a5d:5849:: with SMTP id i9mr167911wrf.331.1634746728173; Wed, 20 Oct 2021 09:18:48 -0700 (PDT) MIME-Version: 1.0 References: <20211016032200.2869998-1-guoren@kernel.org> <20211016032200.2869998-2-guoren@kernel.org> <8be1bdbd-365d-cd28-79d7-b924908f9e39@sholland.org> <8735oxuxlq.wl-maz@kernel.org> <875ytrddma.wl-maz@kernel.org> In-Reply-To: From: Anup Patel Date: Wed, 20 Oct 2021 21:48:36 +0530 Message-ID: Subject: Re: [PATCH V4 1/3] irqchip/sifive-plic: Add thead,c900-plic support To: Guo Ren , Marc Zyngier , Samuel Holland , Anup Patel , Atish Patra , Thomas Gleixner , Palmer Dabbelt , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Rob Herring , Linux Kernel Mailing List , linux-riscv , Guo Ren Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 8:29 PM Darius Rad wrote: > > On Wed, Oct 20, 2021 at 10:19:06PM +0800, Guo Ren wrote: > > On Wed, Oct 20, 2021 at 9:34 PM Marc Zyngier wrote: > > > > > > On Tue, 19 Oct 2021 14:27:02 +0100, > > > Guo Ren wrote: > > > > > > > > On Tue, Oct 19, 2021 at 6:18 PM Marc Zyngier wrote: > > > > > > > > > > On Tue, 19 Oct 2021 10:33:49 +0100, > > > > > Guo Ren wrote: > > > > > > > > > > > > If you have an 'automask' behavior and yet the HW doesn't record this > > > > > > > in a separate bit, then you need to track this by yourself in the > > > > > > > irq_eoi() callback instead. I guess that you would skip the write to > > > > > > > the CLAIM register in this case, though I have no idea whether this > > > > > > > breaks > > > > > > > the HW interrupt state or not. > > > > > > The problem is when enable bit is 0 for that irq_number, > > > > > > "writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM)" wouldn't affect > > > > > > the hw state machine. Then this irq would enter in ack state and no > > > > > > continues irqs could come in. > > > > > > > > > > Really? This means that you cannot mask an interrupt while it is being > > > > > handled? How great... > > > > If the completion ID does not match an interrupt source that is > > > > currently enabled for the target, the completion is silently ignored. > > > > So, C9xx completion depends on enable-bit. > > > > > > Is that what the PLIC spec says? Or what your implementation does? I > > > can understand that one implementation would be broken, but if the > > > PLIC architecture itself is broken, that's far more concerning. > > > > Here is the description of Interrupt Completion in PLIC spec [1]: > > > > The PLIC signals it has completed executing an interrupt handler by > > writing the interrupt ID it received from the claim to the claim/complete > > register. The PLIC does not check whether the completion ID is the same > > as the last claim ID for that target. If the completion ID does not match > > an interrupt source that is currently enabled for the target, the > > ^^ ^^^^^^^^^ ^^^^^^^ > > completion is silently ignored. > > > > [1] https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc > > > > Did we misunderstand the PLIC spec? > > > > That clause sounds to me like it is due to the SiFive implementation, which > the RISC-V PLIC specification is based on. Since the PLIC spec is still a > draft I would expect it to change before release. The SiFive PLIC has been adopted by various RISC-V platforms (including SiFive themselves). Almost all existing RISC-V boards have PLIC as the interrupt controller. Considering the wide usage of PLIC across existing platforms, the RISC-V International has adopted it as an official RISC-V non-ISA spec. Of course, the RISC-V PLIC spec needs to follow the process for RISC-V non-ISA spec but changing the RISC-V PLIC spec now would mean all existing RISC-V platforms will become non-compliant. The RISC-V AIA spec is intended to replace the RISC-V PLIC spec as the new interrupt controller spec for future RISC-V platforms. Regards, Anup