Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3901645imu; Fri, 18 Jan 2019 21:08:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN5aX2RPoCOWmMibJrpMcCsgIBHQ9DAiUa3NePJQDtDoV1PkYe/9jxOZYBOL3SaGmd9kNHIn X-Received: by 2002:a17:902:583:: with SMTP id f3mr22284758plf.202.1547874485363; Fri, 18 Jan 2019 21:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547874485; cv=none; d=google.com; s=arc-20160816; b=duTlxrbE+gS9bdLZXGhoH0FPoLt21g3vRJgY84/6Ah/e7WkqdZGBI3XGTQ0stSRckV hBG2ixO4Tq88O3VPjjPfB4JhyIzRxs1IbyfonTxxviY27AmXnAo3G/ApY4pV+Y8a5JHj yiXkuJErWEnl2/ev2g4WD2GWmi1f+meSTEm9Dn7m6b/GVpbztc770VHg/9C/IYRQ/hZf 7ZxDsR2PiPxEyXpQjKhozftKDSuYErowpEOno4qWLlSwqd6O0M3rdzd/omCg85+krA0p beVXPvW4ft+KGtGOBZG0ow/MKQV2/ZCVXHpQeAbgw83Srp693NahL9BvsK7Db1pehPnZ ukfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+9OqQUiReqIQ8YZUpta0SOLU8AXMnOYWaBGRv3HmoIA=; b=AvfsNLocA1YLotUKxcgTTronjbtxTnkRp8nVumKcGBK7zY1Kx4oWxSYV1c+HUZy9ut 4utO4KEJ8GyKRPcrBDLKCeYE2U58CGUlv/URXcExi5j/VsdJ4Zft46HyAllTx7BsJTvm /X6c3b4nBEHkhyRaIzff+OwiR78WiAmRujW0PnBK2/Dk5up7O41HoalrFL/iRjXrAJGf 3/6xSMfTZZASFrV8yhAXn+bCuBWGJh0L8Tl/5vLNMJhjiYVMaR60nTddBPvShF1qnVI/ VzmxWbPGQ2EXyqAKS4KLSKOMHL4TuGukMlF2BRHan4sTmxi23HoP6XLy0wQaWPp0JmxN X9ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=ej3A4cbV; 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 v4si6260977pfm.71.2019.01.18.21.07.11; Fri, 18 Jan 2019 21:08:05 -0800 (PST) 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; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=ej3A4cbV; 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 S1727444AbfASFEI (ORCPT + 99 others); Sat, 19 Jan 2019 00:04:08 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45741 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbfASFEI (ORCPT ); Sat, 19 Jan 2019 00:04:08 -0500 Received: by mail-wr1-f66.google.com with SMTP id t6so17397149wrr.12 for ; Fri, 18 Jan 2019 21:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+9OqQUiReqIQ8YZUpta0SOLU8AXMnOYWaBGRv3HmoIA=; b=ej3A4cbVNw+WNEQRTqo4RQQTaDkUvo4lgXKqPYvJTPYt421Q+RMaDbVLxlZtJxHudm xigS9+qb1mi0V+nPUQ2Q8IdLQP1ADUqolewkmoLyWaASC+zPAa0xzlViJJZ0TrYfiZyr aF2aAWRKsSFoZ9a0VIaNPTc1p1diZLz0ynrn0u550LXBaWBewtf7PyI9DJElfKzEGdCJ m+62gjZ5N0FPtUwJloGjGv9r3jxehZh3v6gmaUxQGarDrO556NIdH7l2PNT9Ma2jygZn 459lBhI1eLXbgjXBaAeEO2WhhXVDXvG8qY0ASPhirPF4YW3sCTTUsF0TmTQhLCvxiZ// 2b5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+9OqQUiReqIQ8YZUpta0SOLU8AXMnOYWaBGRv3HmoIA=; b=HevcDgSyds8WLGMcPMXJnShXprHaAthtn0OrUKNI8TGM7oUU0AK3RJQUEHqRPKXL4T cP++WKskOfDChiziHXofdC/+HvjfmRrujzmt2pUHt0NSnSr0tDDhP1TfFBI3qu5mX+br BH9iiwVxsSNgYqa8DJeIztINlMWSscNd3MTXN6pn/jco5VoQfd47AJkurRcMdkO+r3GV dlBRVkvuQOpyFUeEzXumVJ2SeuJyvoKn1zNijYqJBXgSud0rPmdjTdmaxkRYLnJbU/hv drXkDBH7bQ9GdN2geajR2eLACSPHuZ7vHtqlTcPG4HqAZhO0lh1VXXKkxlu6oN6ELG5N RTdA== X-Gm-Message-State: AJcUukf3erWt/6XIc8EoRaRAo4tN/FnLi/OggPjcJCrA545gtrUHDj10 a6Be0vk1MULh5S7o2i7U+Fz9EAWTQzGaDosPPkvrZg== X-Received: by 2002:adf:ee07:: with SMTP id y7mr19817841wrn.187.1547874246381; Fri, 18 Jan 2019 21:04:06 -0800 (PST) MIME-Version: 1.0 References: <20181227111821.80908-1-anup@brainfault.org> <20181227111821.80908-4-anup@brainfault.org> <20190115155453.GB13095@infradead.org> In-Reply-To: <20190115155453.GB13095@infradead.org> From: Anup Patel Date: Sat, 19 Jan 2019 10:33:55 +0530 Message-ID: Subject: Re: [PATCH v4 3/5] irqchip: sifive-plic: Add warning in plic_init() if handler already present To: Christoph Hellwig Cc: Palmer Dabbelt , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Atish Patra , linux-riscv@lists.infradead.org, "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 15, 2019 at 9:24 PM Christoph Hellwig wrote: > > On Thu, Dec 27, 2018 at 04:48:19PM +0530, Anup Patel wrote: > > We have two enteries (one for M-mode and another for S-mode) in the > > interrupts-extended DT property of PLIC DT node for each HART. It is > > expected that firmware/bootloader will set M-mode HWIRQ line of each > > HART to 0xffffffff (i.e. -1) in interrupts-extended DT property > > because Linux runs in S-mode only. > > > > If firmware/bootloader is buggy then it will not correctly update > > interrupts-extended DT property which might result in a plic_handler > > configured twice. This patch adds a warning in plic_init() if a > > plic_handler is already marked present. This warning provides us > > a hint about incorrectly updated interrupts-extended DT property. > > > > Signed-off-by: Anup Patel > > Reviewed-by: Christoph Hellwig > > --- > > drivers/irqchip/irq-sifive-plic.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c > > index 01bbbbffbcae..b9a0bcefe426 100644 > > --- a/drivers/irqchip/irq-sifive-plic.c > > +++ b/drivers/irqchip/irq-sifive-plic.c > > @@ -229,6 +229,11 @@ static int __init plic_init(struct device_node *node, > > > > cpu = riscv_hartid_to_cpuid(hartid); > > handler = per_cpu_ptr(&plic_handlers, cpu); > > + if (handler->present) { > > + pr_warn("handler already present for context %d.\n", i); > > + continue; > > + } > > + > > Just use WARN_ON_ONCE? WARN_ON_ONCE() is not suitable here because we want know all the context IDs for which handler is already present. Regards, Anup