Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2494023ybe; Sat, 14 Sep 2019 16:34:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0yc78kzxp1YmnHsALkMwCM+Y1rvtu70hOzR8wYPovbKInOJTDqrHRDkermEP3ncwKzkrf X-Received: by 2002:a50:e005:: with SMTP id e5mr54405141edl.279.1568504050880; Sat, 14 Sep 2019 16:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568504050; cv=none; d=google.com; s=arc-20160816; b=El71KQ0OxpFlRpEz2zz+OdNEJvHTFAQlgQrMRHJahU0gASzwf7XbYw4qRsYJZpq6mB 61CC6FbkgFPMvqyGw7OsEdfzkVAJWMrJf5UjhSXKdGwJrrnkTmjvcseBHmS1cw6cijsQ D4sZulQlkVUXMj5h55uIbkQQJXjVKzvjZH/xqWthaQIXYu/UOvOg4I7WMHqMky0K9BW1 8weVZv8EHWhnlqw+B21qlhNAb7qJ1/XzM5S4SOf7Jc5KZBU9G2umHEETfykcR1wrw+E4 Qp+Q7ZPUePCJX65Q3pVQe1E64shhvzL2l2Dxghf4eQ2L2JC+xYiDKmyCX5Bz5tPVJmEf jsGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date; bh=8/82Z+AFS9yEFav5otNjqZZTLkl6BS+MrGSlNauY50Q=; b=vSfoJReeCpYKkdozB2HwlrhAU82lRL8O/MNf6Ic1uZr9fLvJk7dK2pGze5sD5Y2DKN whhyOTrX4ujNjRuCWABYw/Vue7wYFB0SkB6P4Iv4zaIsBGPd9YeqV+B5EtGVnhOzX//z QJZsKgcgbK5Mi4GlOToxrkOSeujw6qULZE4It+8GbEa3JQDu2FsJndJAdVPMBLpQAESw mS04xIlArnHpVnqb08HI/gssPPQAcYe0BxmCMGbXVKco+UsWWmtdFtsFxzX4CXHCOdn2 CIj06R7NK+ljtyNJVhKhycDDawRHZohGyPqPUmnkcL19Up0N5zsTfYdoXjQ0uHUcXXqo FoOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si13623677edq.250.2019.09.14.16.33.47; Sat, 14 Sep 2019 16:34:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730690AbfINTvY (ORCPT + 99 others); Sat, 14 Sep 2019 15:51:24 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41648 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728576AbfINTvY (ORCPT ); Sat, 14 Sep 2019 15:51:24 -0400 Received: by mail-pl1-f193.google.com with SMTP id m9so14763627pls.8 for ; Sat, 14 Sep 2019 12:51:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=8/82Z+AFS9yEFav5otNjqZZTLkl6BS+MrGSlNauY50Q=; b=TnQukNEL6N8lgVIPqp4CJ4OcYQKejchIukyLEvyW3n7bqGqElPvDneJEVEKTu/paXe VFGnsNDZJ6kItyFVeumu3qt08PB+eILYNrMqiuxh8qNv2itZ1K3d4n7JAcEp7PRoEOtj yEwtUlNwVYPByCsyzqMLON1zHJolkp6DjKBLiSHxEIoerX/RtfkGVyeu6sTyYOUcgQ2U UYyshXl8+G51H6KiFhT4UCcGJkw/Xtst50k8tKY1ZjuioABr5mCfw7m/zmUV24CPBJIu uUMb+OlDyzycppl19XHSRyLkvr9cE5vT4i2TsAAhajR/elN3gKh2dGDNsEO63ISkFXGu gxyA== X-Gm-Message-State: APjAAAVed9kDuHTWHrmngUY561qH9FOy0yAmhdIqtFhkW/jU1TV8cujc Wf6xhGSIp0xzksBkOPcdsvnWNA== X-Received: by 2002:a17:902:4a:: with SMTP id 68mr50794588pla.196.1568490683065; Sat, 14 Sep 2019 12:51:23 -0700 (PDT) Received: from localhost (amx-tls3.starhub.net.sg. [203.116.164.13]) by smtp.gmail.com with ESMTPSA id x13sm34425177pfm.157.2019.09.14.12.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Sep 2019 12:51:22 -0700 (PDT) Date: Sat, 14 Sep 2019 12:51:22 -0700 (PDT) X-Google-Original-Date: Sat, 14 Sep 2019 12:50:08 PDT (-0700) Subject: Re: [PATCH] irqchip/sifive-plic: add irq_mask and irq_unmask In-Reply-To: CC: Darius Rad , jason@lakedaemon.net, maz@kernel.org, linux-kernel@vger.kernel.org, Paul Walmsley , linux-riscv@lists.infradead.org, tglx@linutronix.de From: Palmer Dabbelt To: charles.papon.90@gmail.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 14 Sep 2019 12:42:32 PDT (-0700), charles.papon.90@gmail.com wrote: > I had issues with that plic driver. The current implementation wasn't > usable with driver using level sensitive interrupt together with the > IRQF_ONESHOT flag. > > Those null were producing crashes in the chained_irq_enter function. > Filling them with dummy function fixed the issue. I'm not arguing it fixes a crash, the code Darius pointed to obviously doesn't check for NULL before calling these functions and will therefor crash. There is a bunch of other code that does check, though, so I guess my question is really: is the bug in the PLIC driver, or in this header? If we're not allowed to have these as NULL and there's nothing to do, then this is a reasonable patch. I'm just not capable of answering that question, as I'm not an irqchip maintainer :) > On Sat, Sep 14, 2019 at 9:00 PM Palmer Dabbelt wrote: >> >> On Thu, 12 Sep 2019 14:40:34 PDT (-0700), Darius Rad wrote: >> > As per the existing comment, irq_mask and irq_unmask do not need >> > to do anything for the PLIC. However, the functions must exist >> > (the pointers cannot be NULL) as they are not optional, based on >> > the documentation (Documentation/core-api/genericirq.rst) as well >> > as existing usage (e.g., include/linux/irqchip/chained_irq.h). >> > >> > Signed-off-by: Darius Rad >> > --- >> > drivers/irqchip/irq-sifive-plic.c | 13 +++++++++---- >> > 1 file changed, 9 insertions(+), 4 deletions(-) >> > >> > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c >> > index cf755964f2f8..52d5169f924f 100644 >> > --- a/drivers/irqchip/irq-sifive-plic.c >> > +++ b/drivers/irqchip/irq-sifive-plic.c >> > @@ -111,6 +111,13 @@ static void plic_irq_disable(struct irq_data *d) >> > plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); >> > } >> > >> > +/* >> > + * There is no need to mask/unmask PLIC interrupts. They are "masked" >> > + * by reading claim and "unmasked" when writing it back. >> > + */ >> > +static void plic_irq_mask(struct irq_data *d) { } >> > +static void plic_irq_unmask(struct irq_data *d) { } >> > + >> > #ifdef CONFIG_SMP >> > static int plic_set_affinity(struct irq_data *d, >> > const struct cpumask *mask_val, bool force) >> > @@ -138,12 +145,10 @@ static int plic_set_affinity(struct irq_data *d, >> > >> > static struct irq_chip plic_chip = { >> > .name = "SiFive PLIC", >> > - /* >> > - * There is no need to mask/unmask PLIC interrupts. They are "masked" >> > - * by reading claim and "unmasked" when writing it back. >> > - */ >> > .irq_enable = plic_irq_enable, >> > .irq_disable = plic_irq_disable, >> > + .irq_mask = plic_irq_mask, >> > + .irq_unmask = plic_irq_unmask, >> > #ifdef CONFIG_SMP >> > .irq_set_affinity = plic_set_affinity, >> > #endif >> >> I can't find any other drivers in irqchip with empty irq_mask/irq_unmask. I'm >> not well versed in irqchip stuff, so I'll leave it up to the irqchip >> maintainers to comment on if this is the right way to do this. Either way, I'm >> assuming it'll go in through some the irqchip tree so >> >> Acked-by: Palmer Dabbelt >> >> just to make sure I don't get in the way if it is the right way to do it :). >> >> _______________________________________________ >> linux-riscv mailing list >> linux-riscv@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-riscv