Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp459191pxb; Tue, 19 Oct 2021 06:28:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6ORN+BZiHiSi7D5btoVtyT8fmccLeI4U7nfMrI+h9/h7xREyP5+8LjoI8EBZIKnGlK9/p X-Received: by 2002:a17:90a:f415:: with SMTP id ch21mr6496634pjb.235.1634650129730; Tue, 19 Oct 2021 06:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634650129; cv=none; d=google.com; s=arc-20160816; b=Vn37DqI8BupSLoDfT4ye1M2G1Y3H95ph14+nBsUY5gFSEqsI1LAp/O2snY46n9j3/E cyNsUI3pL3GUQ4Ng4T/kKCKG3OLRXnLbYQ2PxFT/g6H4Nh8mtbEcC2FA8dZE4gTSEJrh ciNBTpdyVvR1KN6nIyIGebRbrItAaVbISHJBxaSJBX2pWxxGczKVOVBRgj2A6QIfL3Hq WkQQlnL0nZu6t7LROyl5p58834WT1ns7H+2ogSzCBMs4wIHkCjTpRIGBQEVK9jJLqbHS UWB1ojduJgk0QBHo5bHqKc/83/SY6UQ2ZGps0XmyABkx8IJsjDeRyCi8gFdp2YY9AMTt oOYQ== 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=BGEYba/c21AjMV1xG3Y9Pk91Hs9ukl0FvNRXyWKKLFg=; b=RR+C9M/3/Nh0gnur2DbVHGo8FDo2s2rLw0U3PVu54JtK8k4gQQFmEaTGio2SeZv2C+ fVvw/XGHmJqMdg55vwy9+YJQ0LC/6WhHMDrBIq3QJb3osVJchBMwgYL2BFoaqgW0BfU7 BhfnUJMkSqqh6TsWyW22y6Mba2WaY3jYr0LI1rNzv3fRg1+1MMO3hpkpinZ/lW+mfwNB iqofPKLavoMa8z+/O61TPdxwQwSaTr6vSan0kwggMlB+HvAeztwo0ew/qO0F66SfdVU/ 8x2cIXcOJzX4mueowjkeXGauQ5NOJ56wc42iDp3u/N3+aOka6TKU2Tp2mNp4GV5KcjfC dr9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEfX81Bf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 29si3574786pjj.38.2021.10.19.06.28.37; Tue, 19 Oct 2021 06:28:49 -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=@kernel.org header.s=k20201202 header.b=CEfX81Bf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235863AbhJSN31 (ORCPT + 99 others); Tue, 19 Oct 2021 09:29:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235557AbhJSN30 (ORCPT ); Tue, 19 Oct 2021 09:29:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F51761038 for ; Tue, 19 Oct 2021 13:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634650034; bh=XwT+O/puqIO9BVfJ+yLseMkazHGtskDQhP43nI3oppI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CEfX81BfCRk2mEwUgwZbVCdkLh9u7Ef0w0Pc8fcOmUzsWgiaUWT16G26XXz2JoFeS GY0my/BtI2nl/OeTlf/yC82pAfK5m/OvihOcjxc44jhYsyY/OoUQldMSg0ygo/1DGu AUViooEqtFueY88yOpVH4r/dBhQatnV45M7TagJsmzIM3H1z7Gr1XvWc+OtyTpo81O wRu9D4YN6yfsC6jgSkP9zu9MIVjN44UooFwYSpia0nJIr6L0ND/V85P7R/0oMmW3hk 2DseVbsVxLL3fEq+HMoh2tiEY8L0R01aw6Xobmo8tVEU1yAY8ozP9pbNtwVpEo9O2p BxkSCmXVVI76w== Received: by mail-ua1-f50.google.com with SMTP id h4so11174919uaw.1 for ; Tue, 19 Oct 2021 06:27:14 -0700 (PDT) X-Gm-Message-State: AOAM533C1iMlrQruLVAyOPmKAR6cdPstpxhWHhd0RpTmzP7WWeVK9Yix TmuVnpT2MZRelufJCkFTeQzDYkx7NH2/y2zrM78= X-Received: by 2002:a05:6102:537:: with SMTP id m23mr34557525vsa.43.1634650033178; Tue, 19 Oct 2021 06:27:13 -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> In-Reply-To: <8735oxuxlq.wl-maz@kernel.org> From: Guo Ren Date: Tue, 19 Oct 2021 21:27:02 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V4 1/3] irqchip/sifive-plic: Add thead,c900-plic support To: Marc Zyngier Cc: 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 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. > > > > > > > There is an example of this in the Apple AIC driver. > > Thx for the tip, I think your suggestion is: > > +++ b/drivers/irqchip/irq-sifive-plic.c > > @@ -163,7 +163,12 @@ static void plic_irq_eoi(struct irq_data *d) > > { > > struct plic_handler *handler = this_cpu_ptr(&plic_handlers); > > > > - writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); > > + if (irqd_irq_masked(d)) { > > + plic_irq_unmask(d); > > + writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); > > + plic_irq_mask(d); > > This looks pretty dodgy. You are relying on interrupts being globally > masked on the CPU, I guess. It probably works today, but man, what a > terrible HW implementation. > > You'll definitely have to move this into a c900-specific callback. Yes, it's an errata. > > M. > > -- > Without deviation from the norm, progress is not possible. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/