Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1854824ybp; Fri, 11 Oct 2019 23:00:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqx31jiWMYau3GcbEN+Jj1ETw13I2sVoc/czpvKtv5OQZMV7zPy/bQskORCXDgUUI1/Sskeq X-Received: by 2002:a50:f152:: with SMTP id z18mr17137646edl.263.1570860019015; Fri, 11 Oct 2019 23:00:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570860019; cv=pass; d=google.com; s=arc-20160816; b=AunNFVYGJQssmpjrW23I3EOcipBjA4k/LH5FV2AOP24Vx8gMNcSOuVheZg8oMhaRHS jpI8uNa6rs7l3rylsWV+XdMSRSMqJiV8fh04YzHCB9naeCQ4xDqBQr49u1xqKsNrSZiH T1fpq0gENkgkvl/Q5wmVlmZ0FbaOiWLXfdhin0l7DX3FMm8jFS2OPsomabCHG+Ft0Xqm 6Jnseh1lS2qzhpm0TlKbLUr7nERQVAoPXDr3OcmeQwszwh5FFZ6KmWt1++AatmDaBNg5 OQlvP+s6iyifEJRm3knuFH4LmKvc60G3+SQPRVEwtnoo0/LTt3KVgMlf4Z4ZfhG1s5JK Mx1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:domainkey-signature; bh=9AsoSpojO4C74zbA2M3vz9rPBC36KFYTB+2fQ9Vp4gI=; b=QJSJXeE9gi18P6COL+YwL531ZG/fLIRHDF3qRx9ZnQzzpmYGRh91iOGIkLVa0kBdP3 ARFNb2buyODFOvLzrziM2ccu4i0e0VzxKm0G29LZMg/uMOe4FQ+JmSeaBI2Cn++mDCzr 16iuKvDH7fGlH3MXyWCdSv6fPbU0wbaKIG6gKI24Q2TMT58UIT2DUZP3xGQ+dCgmS+QD RzJQX7I0yVvEHTBChOQK7LYDxxOT/5ezjA7h23gxJIKfVS7AkqZ86ANlUIr/QZ6FLPEX 5H8QxUGALyjSL/1fY1sXs//NWNRYXNbaz6ut5LKUdjJ61j6FKti+EUoHoIyoVjSf02uG 3wwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2019 header.b="f2/7j/pn"; arc=pass (i=1 spf=pass spfdomain=zoho.com dkim=pass dkdomain=zoho.com dmarc=pass fromdomain=zoho.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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=zoho.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si6828420edg.339.2019.10.11.22.59.56; Fri, 11 Oct 2019 23:00:19 -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; dkim=pass header.i=@zoho.com header.s=zm2019 header.b="f2/7j/pn"; arc=pass (i=1 spf=pass spfdomain=zoho.com dkim=pass dkdomain=zoho.com dmarc=pass fromdomain=zoho.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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=zoho.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728942AbfJLF4t (ORCPT + 99 others); Sat, 12 Oct 2019 01:56:49 -0400 Received: from sender4-pp-o94.zoho.com ([136.143.188.94]:25499 "EHLO sender4-pp-o94.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727014AbfJLF4s (ORCPT ); Sat, 12 Oct 2019 01:56:48 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1570859698; cv=none; d=zoho.com; s=zohoarc; b=fbrsZxm+7TKVtfBaI9CgHN2IBxrQUnWVjVt1g208sqHAQL2H8pESojcxSzJTs9AGL9n4cNYZ/UguOymBnEoWnSymKk38/tEh94q6jtCt+v+qPGuThT+IjV73jyvmkLA0yHCh/C4hLPifLizIA2S0c+v8Q5pkANWx72dCd1q5Mu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570859698; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To; bh=9AsoSpojO4C74zbA2M3vz9rPBC36KFYTB+2fQ9Vp4gI=; b=RCCLWEjvhiN06MZySYEkaXh3Ytov+nuI07mag5pBuWn5L9qPkre0VOLclXinMggGOkpO02uwZxI1+HCrsq1gNLnWV5Wx254qtJJD1YqF47tzBjfZefy/EWwFY0hSr8sL//EFE4pjOb6TEF1n0GIbwpRg0KF4yksyOCNlMWBjZ9k= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=zhouyanjie@zoho.com; dmarc=pass header.from= header.from= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=mNl1coxyT/xrBFcEUlhANEY+31SZf5sG9wBRrdRm1JFVU4i/+SFhuXS65DKOkNokmR6b6nKn/haQ 3+OnysTj0tldCIkEgdXdkx5MFYqmSod0c3tdKrx0Y4h9th3AnH1I DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1570859698; s=zm2019; d=zoho.com; i=zhouyanjie@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=2326; bh=9AsoSpojO4C74zbA2M3vz9rPBC36KFYTB+2fQ9Vp4gI=; b=f2/7j/pnXvy/3Ewx3yOsWePr6AFOZYJ5jo45oCm/jLU7s5Xy0TlH8NHuCGGJo7MD d14zx0DgPbG+rHpbJvZ11PwUPBVjUPipnQ5FEp9c0UKqFftsD/JE9XMzMf3B5ucV+MS I1fRPcc5blwWscfRVfl2EkZ5lCWzmOizODyni25c= Received: from zhouyanjie-virtual-machine.localdomain (182.148.156.27 [182.148.156.27]) by mx.zohomail.com with SMTPS id 1570859696276279.0728945796534; Fri, 11 Oct 2019 22:54:56 -0700 (PDT) From: Zhou Yanjie To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jason@lakedaemon.net, paul.burton@mips.com, allison@lohutok.net, syq@debian.org, rfontana@redhat.com, tglx@linutronix.de, paul@crapouillou.net, maz@kernel.org Subject: [PATCH 5/5 v6] irqchip: Ingenic: Add process for more than one irq at the same time. Date: Sat, 12 Oct 2019 13:53:50 +0800 Message-Id: <1570859630-50942-6-git-send-email-zhouyanjie@zoho.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570859630-50942-1-git-send-email-zhouyanjie@zoho.com> References: <1548517123-60058-1-git-send-email-zhouyanjie@zoho.com> <1570859630-50942-1-git-send-email-zhouyanjie@zoho.com> X-ZohoMailClient: External Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add process for the situation that more than one irq is coming to a single chip at the same time. The original code will only respond to the lowest setted bit in JZ_REG_INTC_PENDING, and then exit the interrupt dispatch function. After exiting the interrupt dispatch function, since the second interrupt has not yet responded, the interrupt dispatch function is again entered to process the second interrupt. This creates additional unnecessary overhead, and the more interrupts that occur at the same time, the more overhead is added. The improved method in this patch is to check whether there are still unresponsive interrupts after processing the lowest setted bit interrupt. If there are any, the processing will be processed according to the bit in JZ_REG_INTC_PENDING, and the interrupt dispatch function will be exited until all processing is completed. Signed-off-by: Zhou Yanjie Reviewed-by: Paul Cercueil --- drivers/irqchip/irq-ingenic.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-ingenic.c b/drivers/irqchip/irq-ingenic.c index 06ab3ad..01d18b3 100644 --- a/drivers/irqchip/irq-ingenic.c +++ b/drivers/irqchip/irq-ingenic.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2009-2010, Lars-Peter Clausen - * JZ4740 platform IRQ support + * Ingenic XBurst platform IRQ support */ #include @@ -37,18 +37,23 @@ static irqreturn_t intc_cascade(int irq, void *data) struct ingenic_intc_data *intc = irq_get_handler_data(irq); struct irq_domain *domain = intc->domain; struct irq_chip_generic *gc; - uint32_t irq_reg; + uint32_t pending; unsigned i; for (i = 0; i < intc->num_chips; i++) { gc = irq_get_domain_generic_chip(domain, i * 32); - irq_reg = irq_reg_readl(gc, JZ_REG_INTC_PENDING); - if (!irq_reg) + pending = irq_reg_readl(gc, JZ_REG_INTC_PENDING); + if (!pending) continue; - irq = irq_find_mapping(domain, __fls(irq_reg) + (i * 32)); - generic_handle_irq(irq); + while (pending) { + int bit = __fls(pending); + + irq = irq_find_mapping(domain, bit + (i * 32)); + generic_handle_irq(irq); + pending &= ~BIT(bit); + } } return IRQ_HANDLED; -- 2.7.4