Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1698776rdb; Thu, 25 Jan 2024 03:39:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEm5S69HNwQkw9fJPqXZyjpCbb6VbjPJF3XaHtKdu8hCyDBxcQ6epjNS71ywaVFyMSyDsbT X-Received: by 2002:a05:620a:b8f:b0:781:c142:8cd0 with SMTP id k15-20020a05620a0b8f00b00781c1428cd0mr889454qkh.77.1706182774616; Thu, 25 Jan 2024 03:39:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706182774; cv=pass; d=google.com; s=arc-20160816; b=uhrMVkIibEEeZUtkAPlg5PfonIYjYnd7VgD57RTwiu5cDh+FtHwWM2oiqzxNlXEsyN wmLZhfD+uXQLF5rme/Df1ngkAeJdSDpT/Hj2/4JLNvfvzbaud1t0/WEt6jZujJardbZC nmnI4/Ru14xCXiuj3Rvrg5Ufe1P/4znPHdqgGPTBKViH+VNOsqTLf9/ksVmHEBVO6U6H kWXnouvr33x891B8FXy833Rb4J6rWjHrZF7tH2qm9UNwne04TvEZxIBmHbk7wF69lPu3 5E1s7t2lYauS2Q5/JKbqogoWDTIIOCail3909YjSfUVZ5+6WOz+G0nL5Zko+uQp39FgI bUuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=BO0FZckxeV1GIuX+onbFn68lCC8j+zzeMp03L6njx8k=; fh=rbFYAv07PhikhFHWvkiHAr3yiNFaCDNIldWI9m9KKF0=; b=oha9bNDtD9CbdcqHIsi/Q9KQenMJ4Zqc/bk2S+yCvkeGknHBzPPZhF5Rk3VaonUZOp cpboOaEPavblMTRX1IYfN45QF74rdqmUuytoJPn7Wq636lIYYxAyd9CxX7fAWFfsd4kY Xw2ydC9nO3m/bCiDIZ0qSquNAstVsxeBJWXsjczUfuaGAzoPXJj04N36P/2tDDbIyu5y kv/Yh2PkdvNkD/Ua0t1OWeIWYXrZKU4Bh36H2T/7frptfoqJieKyZ6zFRuODUxFzKipw hquanfsRJpgcpA0mE+zxO8+1bqdS8LmpTOgMFKgdE2Y30rALQaDQ5IEBZDF3HnlIIMx8 pUsQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-38529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38529-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v16-20020a05620a0f1000b00781784aa6b4si13976164qkl.303.2024.01.25.03.39.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:39:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-38529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38529-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5F5F41C243C0 for ; Thu, 25 Jan 2024 11:39:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5A9753819; Thu, 25 Jan 2024 11:36:38 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BBB250A61; Thu, 25 Jan 2024 11:36:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182598; cv=none; b=AI2cSpvW0VEGs30N+rrzvdq1W5ZBvMsUo2u9JXsP/DQJZQOA5K0JC0vberxfAab3RjOBIbo/+lPj2EqxnBx0wTj4UYYGSzOcZsJjqzDYF/zrvnKf6JMtTWuMFbaxD99EAFJV9UQYmtv1yVtn9/fyMYQNTV/RorJ/msJ5H5cGXEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182598; c=relaxed/simple; bh=00Z2S3GoRqMs6kJlJwUD2K5UmqztGq72aME+yGRXoGA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u1tjEtCxDPf7hbVvGWQ6rswzOBrWTOx1nyG1AamY41oU/G6g9va/usMAxCponQ+4ci2olGSw1fjfXVcDHmQsxV0oMJN6uV0X97f458liBiJnJxY4S1i9my9nvCIGKnqr6K01ULv/6IiL3IM1fpEv0MKjm6c2xD1isCSLyMURGcg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8CxF+i8R7Jl7JcFAA--.1239S3; Thu, 25 Jan 2024 19:36:28 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxXs23R7Jl9W0ZAA--.41879S4; Thu, 25 Jan 2024 19:36:28 +0800 (CST) From: Bibo Mao To: Huacai Chen , Jiaxun Yang , Thomas Gleixner Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Shtylyov , lvjianmin@loongson.cn Subject: [PATCH v4 2/3] irqchip/loongson-eiointc: Skip handling if there is no pending irq Date: Thu, 25 Jan 2024 19:36:22 +0800 Message-Id: <20240125113623.2043061-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240125113623.2043061-1-maobibo@loongson.cn> References: <20240125113623.2043061-1-maobibo@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8BxXs23R7Jl9W0ZAA--.41879S4 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7tr13CryxZF13Gw15JryktFc_yoW8GrW3p3 yUC3Z0kr45GayjyFy3Kr4UJF1YvwnYgFZFka95Gay3Zrn8J3s0kF4rJF1qvrs2kr4fGa12 9F45WF4rCa15CrbCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Fb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU tVWrXwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r4j6ryUMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2 KfnxnUUI43ZEXa7IU8EeHDUUUUU== It is one simple optimization in the interrupt dispatch function eiointc_irq_dispatch. There are 256 IRQs supported for eiointc on 3A5000 and 2K2000 platform, 128 IRQS on 2K0500 platform, eiointc irq handler reads the bitmap and find pending irqs when irq happens. So there are several consecutive iocsr_read64 operations for the all bits to find all pending irqs. If the pending bitmap is zero, it means that there is no pending irq for the this irq bitmap range, we can skip handling to avoid some useless operations such as clearing hw ISR. Signed-off-by: Bibo Mao --- drivers/irqchip/irq-loongson-eiointc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c index b3736bdd4b9f..6a71a8c29ac7 100644 --- a/drivers/irqchip/irq-loongson-eiointc.c +++ b/drivers/irqchip/irq-loongson-eiointc.c @@ -198,6 +198,12 @@ static void eiointc_irq_dispatch(struct irq_desc *desc) for (i = 0; i < eiointc_priv[0]->vec_count / VEC_COUNT_PER_REG; i++) { pending = iocsr_read64(EIOINTC_REG_ISR + (i << 3)); + + /* Skip handling if pending bitmap is zero */ + if (!pending) + continue; + + /* Clear the IRQs */ iocsr_write64(pending, EIOINTC_REG_ISR + (i << 3)); while (pending) { int bit = __ffs(pending); -- 2.39.3