Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp725472ybn; Wed, 2 Oct 2019 05:19:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPX01UovjydYxaq+BuRMjSiG+9j0v/+7S8V9tkGEe9B8LVa6Xk88x64q/rxcUXKFkJcG4a X-Received: by 2002:a17:906:ccd6:: with SMTP id ot22mr2790277ejb.1.1570018753128; Wed, 02 Oct 2019 05:19:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570018753; cv=pass; d=google.com; s=arc-20160816; b=0A+AoX9VC0rxKGr8SZK1bWZHtTwEX6csWg5+U2NZFoEa1JG6Nv1ajlXwO6M+zwobPZ tWO/4a7/g5/lOPj87etIxRwCQMmQnW4kQNLOemDo0KP7H4T2QWjANP5MTFVxyIRaKfIX wU11Xecqns5dYaOz8fZ+cTyXt7XZzblhzYy1GZx570BmpnP4LcDjhdP3rWX7WKP02UM5 6CmJyPFHX/L4yiY/yQ3oQftqHSLwhvRtT9pmO6HaWmy5UR+vgyDPU/Ot59nC2oqmo2dM 8VF0iO7Ue7073d1u0Otd6clwDLlfwBQgp4/5dvGmwAd0qJ4hc57DfnP3Z53rDuucPIBO lA3A== 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=eeeCKiM3IXSUywHWZMkuZdPCtxOgvU9X1AipnfM1nB0=; b=jZZGbS8nMQH8z1OXu1ocMgohvk8WAfDAXBKcLUz/oZ4YBEhG9C/gPXJ8rVTFniTSWo l7m44LMFJx4NIXj8IquHh072cUqH+Dpk4Bngi+0Rz/hGGcUgrated+nex0BreG2UTm7d /m9wgYfg2K8ypzsFr8gZnMGqbuHDnSyZof1Ngo3TMe6wmTJ02C3nE42pFh1dYbpTZjue 4lOtwq69NwH3SryTH+MDvA6lhKu/eiOhJTWRM0X/jbNdB5qxHll8dM6kBNc5FznR4WmF XmTN/Xe4k+R9PGsb+ugTkBmUguk3vVl2huHBp3UO+ifPtIpAfuW/iN2sVX3JIk8JYhm/ sCiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2019 header.b=MugC4L9H; 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 i56si11728949eda.19.2019.10.02.05.18.49; Wed, 02 Oct 2019 05:19:13 -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=MugC4L9H; 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 S1726289AbfJBL2U (ORCPT + 99 others); Wed, 2 Oct 2019 07:28:20 -0400 Received: from sender4-pp-o94.zoho.com ([136.143.188.94]:25461 "EHLO sender4-pp-o94.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbfJBL2T (ORCPT ); Wed, 2 Oct 2019 07:28:19 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1570015567; cv=none; d=zoho.com; s=zohoarc; b=C0eQva+jMB+Nw5w9KYTzh4UdJLoPfzQKPfp/X06fitsXZ0y15IaTG88+uaiiT6/k/HI3YHkm81k5u1Rs3cF1NNWnJIZ6g+ooFp5hRuA+QEVCGf9CLlzVbmpho647BTc4k4tpeAMbjJ9i+nBGJv0QK73/dxDXDW85g88fsPrOC4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570015567; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=eeeCKiM3IXSUywHWZMkuZdPCtxOgvU9X1AipnfM1nB0=; b=dx3oAMXDQRP0SUbGfli5wBEGHJtqrgCjNfMJ3tYrYBWIBFGr91M1vftbZwyWowsIyXMv8LKmsLYgxaRDMThoH8p8pxk8Y5yzX9O5tL3TMmjSrdDbQ6X5yuYXHQj7HsqHVBOh6zlYwAbbyJ2jD3xsfS404CBn+Omlb+HrtK/pyrA= 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=UdcQap6U/7QfvHXSuSsc7qvHYCVpJmC6JV2Y+brfxtCAYWP7AOBb1bXmlkbwgM622BU/vksASMWH 6hwUkJLSqh/fGtduAVPglm79sorvs49Bzk+OBbHnYm+tnFFhWPN/ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1570015567; s=zm2019; d=zoho.com; i=zhouyanjie@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=2275; bh=eeeCKiM3IXSUywHWZMkuZdPCtxOgvU9X1AipnfM1nB0=; b=MugC4L9HPgwp0qqRGcntvU0KrqTnc9oLHrWSO+bksJ96UxV2XgPwV9Ci1Q9RoxOV Nn+8r60xb8NtCvC/YajNaMB2q17IOkFtz1GkN65hlVzpz9Pv9fviEWooayK9Rt3C4jw BfCugmNEVS4uM2G2c/synkP2P2Sj9iauQQfLve8M= Received: from zhouyanjie-virtual-machine.localdomain (171.221.113.164 [171.221.113.164]) by mx.zohomail.com with SMTPS id 157001556560418.841606277967458; Wed, 2 Oct 2019 04:26:05 -0700 (PDT) From: Zhou Yanjie To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, paul.burton@mips.com, gregkh@linuxfoundation.org, jason@lakedaemon.net, syq@debian.org, marc.zyngier@arm.com, rfontana@redhat.com, armijn@tjaldur.nl, allison@lohutok.net, paul@crapouillou.net Subject: [PATCH 5/5 v5] irqchip: Ingenic: Add process for more than one irq at the same time. Date: Wed, 2 Oct 2019 19:25:25 +0800 Message-Id: <1570015525-27018-6-git-send-email-zhouyanjie@zoho.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570015525-27018-1-git-send-email-zhouyanjie@zoho.com> References: <1548517123-60058-1-git-send-email-zhouyanjie@zoho.com> <1570015525-27018-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 --- 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..c1be3d5 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