Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2323822imu; Sun, 27 Jan 2019 02:23:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Byx3J74UeJiLuUtsWHCHVDGrBkX6tBc2PtEnL9REZm7RoHHROaL3WWwyuJjmIxeoZaGsA X-Received: by 2002:a63:f444:: with SMTP id p4mr15885427pgk.124.1548584616505; Sun, 27 Jan 2019 02:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548584616; cv=none; d=google.com; s=arc-20160816; b=aDYSuuTRjsnHOeQU5ADPMDrsP7RDhiifWq9lq5t4c4Jll/O4YUapD9cq85ldVlbFVB YtZgDPXyq9iMhIGk6NT3Pi7DEg3UljAThzyLmmJy3dckgR3MYLsl7TwGVfl2bMxq4T8j I2J7eYqqs3OfOiawKaUGyjM/OHnjpX5czYo+dzWwh46VyN6lJKXWbEhjVhOIBVWkmrJL Ey0XyOwVlitTHW6Vyrv683t9FETR99qWhlptZoN5J884sp3yjLS7/i/+elEGlLmJXbRj twQme7AlYnACdTvvCDAGyrC0y3Iy9EBsa/JqSvq9SKpgdbpL5sGOwcPkrq6Ycge5LCW4 qaLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date; bh=u6phtXbIODX/3s5okuHy9RxbORL98DqjiBNivn7hZCQ=; b=aqS2FEHS83gD3tKDJkp2IhXoSafbncp+FsPjm3gFDiPLQ8TCSz0y3T+cD9BhcmEOx/ 3AEgwQPYpJderVTPlPeXRN1V65elUXwnKE7k6InC9Qb+xY4v93lgOXbsSoaI/Zow6tXX FaiYdZHdwtveA2gvJLZWDqyekTSMfp542tXa9xlTRinAYfZqpEQYqRw3hHRaSlqgnTtc rQ3hIm1dqXgWncOKqy7rZ4F+xYFyykVbnezun9+qP0i6NDMIojHiMJ6Z450htH/uvpGV 70r9Z2ZTmUvX0oZRLzBo7Xz+9AOhfZT6I21POkgfGxKmq+vrvBvXSkAj0MI84NOmljKH /yWw== 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 33si5293620plu.169.2019.01.27.02.23.19; Sun, 27 Jan 2019 02:23:36 -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; 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 S1726774AbfA0KVq (ORCPT + 99 others); Sun, 27 Jan 2019 05:21:46 -0500 Received: from foss.arm.com ([217.140.101.70]:34736 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726516AbfA0KVp (ORCPT ); Sun, 27 Jan 2019 05:21:45 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1346BA78; Sun, 27 Jan 2019 02:21:45 -0800 (PST) Received: from big-swifty.misterjones.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E73A23F237; Sun, 27 Jan 2019 02:21:41 -0800 (PST) Date: Sun, 27 Jan 2019 10:21:40 +0000 Message-ID: <86o982wgcr.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Zhou Yanjie Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, paul.burton@mips.com, mark.rutland@arm.com, jason@lakedaemon.net, tglx@linutronix.de, syq@debian.org, jiaxun.yang@flygoat.com, 772753199@qq.com Subject: Re: [PATCH 1/4] Irqchip: Ingenic: Change interrupt handling form cascade to chained_irq. In-Reply-To: <1548517123-60058-2-git-send-email-zhouyanjie@zoho.com> References: <1548517123-60058-1-git-send-email-zhouyanjie@zoho.com> <1548517123-60058-2-git-send-email-zhouyanjie@zoho.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 26 Jan 2019 15:38:40 +0000, Zhou Yanjie wrote: > > The interrupt handling method is changed from old-style cascade to > chained_irq which is more appropriate. Also, it can process the > corner situation that more than one irq is coming to a single > chip at the same time. > > Signed-off-by: Zhou Yanjie > --- > drivers/irqchip/irq-ingenic.c | 49 ++++++++++++++++++++++--------------------- > 1 file changed, 25 insertions(+), 24 deletions(-) > > diff --git a/drivers/irqchip/irq-ingenic.c b/drivers/irqchip/irq-ingenic.c > index 2ff0898..2713ec4 100644 > --- a/drivers/irqchip/irq-ingenic.c > +++ b/drivers/irqchip/irq-ingenic.c > @@ -1,16 +1,7 @@ > +// SPDX-License-Identifier: GPL-2.0 > /* > * Copyright (C) 2009-2010, Lars-Peter Clausen > - * JZ4740 platform IRQ support > - * > - * This program is free software; you can redistribute it and/or modify it > - * under the terms of the GNU General Public License as published by the > - * Free Software Foundation; either version 2 of the License, or (at your > - * option) any later version. > - * > - * You should have received a copy of the GNU General Public License along > - * with this program; if not, write to the Free Software Foundation, Inc., > - * 675 Mass Ave, Cambridge, MA 02139, USA. > - * > + * Ingenic XBurst platform IRQ support > */ > > #include > @@ -19,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -41,22 +33,35 @@ struct ingenic_intc_data { > #define JZ_REG_INTC_PENDING 0x10 > #define CHIP_SIZE 0x20 > > -static irqreturn_t intc_cascade(int irq, void *data) > +static void ingenic_chained_handle_irq(struct irq_desc *desc) > { > - struct ingenic_intc_data *intc = irq_get_handler_data(irq); > - uint32_t irq_reg; > + struct ingenic_intc_data *intc = irq_desc_get_handler_data(desc); > + struct irq_chip *chip = irq_desc_get_chip(desc); > + bool have_irq = false; > + u32 pending; > unsigned i; > > + chained_irq_enter(chip, desc); > for (i = 0; i < intc->num_chips; i++) { > - irq_reg = readl(intc->base + (i * CHIP_SIZE) + > + pending = readl(intc->base + (i * CHIP_SIZE) + > JZ_REG_INTC_PENDING); > - if (!irq_reg) > + if (!pending) > continue; > > - generic_handle_irq(__fls(irq_reg) + (i * 32) + JZ4740_IRQ_BASE); > + have_irq = true; > + while (pending) { > + int bit = __ffs(pending); So 'bit' is the least significant bit in the pending word, > + > + generic_handle_irq(__fls(pending) + (i * 32) + and here you handle the *most significant* bit, > + JZ4740_IRQ_BASE); > + pending &= ~BIT(bit); yet it is the least significant bit that you clear. I am tempted to say that you have never tested this code with more than a single interrupt. Thanks, M. -- Jazz is not dead, it just smell funny.