Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1567297pxb; Wed, 20 Oct 2021 07:36:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtMNlgeSWti9CJ1Ttvto7yZmGDIjs2ljJUtWFkA/1YhVoxvkuWB4p1RN6GE9rLz5kA7Iuo X-Received: by 2002:a17:902:f691:b0:13f:2034:7613 with SMTP id l17-20020a170902f69100b0013f20347613mr39651729plg.81.1634740597229; Wed, 20 Oct 2021 07:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634740597; cv=none; d=google.com; s=arc-20160816; b=RdIpEi5aGGBB2Qui1aYv08m94yhdBczSXmCaOsNyRgSdMdMVui7CyCTptuQh/wwELK X43xK/+UKG7nfN+89rPb6H6/kNr5AogxrH2/lUjLpGTTfSn0MSBeEmTrP83n8RofvSRH OwrhjgLx0ZpHN5+g+HBJUkZ+mUOCsLN+NHnc0mNAFx0P2T6SqKJNgdwWs55P1SvixSbZ oLAnfLOocVpA6eR1ojvJd6QezOybhz2avk6yeHpyDQuYX5jufpJotFvDzr3H6u1jO294 uCFelH/bmYGdWAmlk6749+0OvG1eEgo2syXMy8yw+MOVj2dnVeWCRSnTyiG4VFyAutVG F3hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2cFhehtw2gzRQk7Qa6LrKMw4p/s424MMljllyART0OQ=; b=dsI0bI4JxCIgp04utBjqjhwAXDCQ+/yHMlEONieK/k7Ifv0od19aUDOC+2aJAKKHlP AOA/C4I6Ikg549Az8+BoM4XF/Q+NfIfMzZtERHqYKuR2DTwDLLGhuY9PMvE0LAoMqUZS sfPA9Bdonwtn/QVtkYYoPATLeY5f42xchUEpsua5VkX3SXv6UewVu88Dx5RqnTxY8Dza datgi2zJzNf9gtqOKzv0eLVSEtxeKqtGzxqmrPTPgTN6lJVZws/yYS4tErxzqjbkE7yW 0t6VF9keXuAZqoNGEQBAOpn/e/1/8qd/w3jQBOhxMXDkC5e4nXLdm31EarRrA3gVmcEo ZxBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=AozxwGNX; 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 l63si1513928pgd.583.2021.10.20.07.36.21; Wed, 20 Oct 2021 07:36:37 -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=AozxwGNX; 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 S229842AbhJTOgS (ORCPT + 99 others); Wed, 20 Oct 2021 10:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhJTOgR (ORCPT ); Wed, 20 Oct 2021 10:36:17 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC56C06161C for ; Wed, 20 Oct 2021 07:34:02 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id b189-20020a1c1bc6000000b0030da052dd4fso10756047wmb.3 for ; Wed, 20 Oct 2021 07:34:02 -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 :cc; bh=2cFhehtw2gzRQk7Qa6LrKMw4p/s424MMljllyART0OQ=; b=AozxwGNX1yZicLViDzo3g9qk+ZLtZUTbsDbPza3yuLLX0exN8SQocXpMAs82x0J2Fj ShRocDJEA4dvWf4HAr6z48A1cFOCacAAw5fAaIlnUSK4yzz2tkBKJmmM9b7VrNFkV+PL lqGheu4GzqpDpXsz4JXS9FZexzPqvdbukqLcPf4+k/HhevODyvG6P70pGICcWnIRQozY PolO+6ZnHvvvEBw6ADvUY///dRLh0dXNmoK3BX+xl4e7VSgS0U4mbrNq3d5BkCMxyCJD flpOopZQDSR/xkCf3HoxX4DhyDvhfYEmU8ipxoq0pPanRXNzG+UdRbOHrBxxryfOhWBj NzqQ== 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:cc; bh=2cFhehtw2gzRQk7Qa6LrKMw4p/s424MMljllyART0OQ=; b=m+DD6vTlrfjRC/yTOzSmTpTsiQDgK00gLIBwXB6DeqP7xAUOWpjg+uiJUOKCmzm9Ok yQoONecuzhT6dsOPDjuOW3L2e3Y22ZvD5Gt85vAeRucpN486A1UeBYfW3Dh2Q4Bg6mvf N/kX19tOmAGZQLMWtsAQB8jcr+xFVTRXritNhs6Om29LiN8H9f46NeRt9l2cinXT6m1i /lvZjpb+RE6KoUQ6ixC66i59WBuve9YBmppN3r63NerMpdAbNT1MQvNQOrdQtf4HvgYu CmJa6cQy6oCIB0KIWlCI5Ox6xBcf15kNmt2FirbYXgaoLcXmxNppbAaOqVW4tlngxLbI bKBw== X-Gm-Message-State: AOAM533voFfza3OvvwXdIY+uXv5xeAWDZsMPpeHhDZl6zmv9GkbbEiKh 03crFwalYyaKu9S4M7REpPI0rDv7HstDg63K+oENdA== X-Received: by 2002:adf:f60e:: with SMTP id t14mr68513wrp.199.1634740441250; Wed, 20 Oct 2021 07:34:01 -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: <875ytrddma.wl-maz@kernel.org> From: Anup Patel Date: Wed, 20 Oct 2021 20:03:49 +0530 Message-ID: Subject: Re: [PATCH V4 1/3] irqchip/sifive-plic: Add thead,c900-plic support To: Marc Zyngier Cc: Guo Ren , Samuel Holland , 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 7:04 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. Yes, we are dealing with a broken/non-compliant PLIC implementation. The RISC-V PLIC spec defines a very different behaviour for the interrupt claim (i.e. readl(claim)) and interrupt completion (i.e. writel(claim)). The T-HEAD PLIC implementation does things different from what the RISC-V PLIC spec says because it will mask an interrupt upon interrupt claim whereas PLIC spec says it should only clear the interrupt pending bit (not mask the interrupt). Quoting interrupt claim process (chapter 9) from PLIC spec: "The PLIC can perform an interrupt claim by reading the claim/complete register, which returns the ID of the highest priority pending interrupt or zero if there is no pending interrupt. A successful claim will also atomically clear the corresponding pending bit on the interrupt source." Refer, https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc Regards, Anup > > M. > > -- > Without deviation from the norm, progress is not possible.