Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp773564rdb; Mon, 29 Jan 2024 19:23:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2Pm4TFB8M0uTVQE7CVU1HIxU6aj+9NUdVpK84RcvCHt3nFEFR5XAkcDINGhoVQZBcSuYk X-Received: by 2002:a05:622a:13c8:b0:42a:a88c:77f1 with SMTP id p8-20020a05622a13c800b0042aa88c77f1mr3481786qtk.127.1706585022618; Mon, 29 Jan 2024 19:23:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706585022; cv=pass; d=google.com; s=arc-20160816; b=W3eAFPt6yL59ry5xfMymR7jzJOxlbrxPxWQGjERNAq27empyaIsq1DBpqbg+C/mC0j 7gNWvHpj/ahxpN+RzD63frhF0A7kc1E8Ba6Dbng74AAy94gojR5U0YHtEu/JvGoduB/g HFqxlHKKSlDLEKbN1lkpupI0+vT0KyYPJ3gE+hhlEOVhuV3NaYSDG+9/63/geIdYq87w 3pVklCvAdKtVQphZQ7OAgJTpIIqMI9h8KTSKVpxRchUYzr4X+eXLwQJFqPf/Y1a4DV61 ErGEW1NHXanPPkwT8GwOq6OyoGzSyp0KGPkSgCduDi2+EYX5LJvNTFTwy6+8tsKDpEzi FMOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=ZsjMp/rFLLUCGVrR9O3VE1J++c/wO5/lwwOGR3pT/8Q=; fh=pnjf7cAFB0eq/xQyBeQTj3mESYNiUT+qhK3qJDR7xOA=; b=wW2b5sLRo27Iia8QWA5dMbW10OhKL//quZDkGGtAQQMehQbRKehUnLs7ibIuWFI+H3 tznnbGaV8bRhJLxKImrFhQoAJrhjATnZUwb4B1CUxYZf+qshPuElAZ9wV4CNv4guuYib N4/2EC9hPCe36Z+wURJiedRFmHRdyw3bVGn3pFoljbPu+pUooOn7uP7wQQQUNr759A8P Fo2ddxD/ESCjHjgmOA0XDVaNfw+gWkoO9+VrzYIzmzB6IMi84gXqqZeVuD7Qb+U0mP3J AdoO4+UlMcd6Fw7HZFphTkvP4qK4y9Sb4tLf4+xHkUc0Uh46OVuAy+syzgI1fgn1Lsa8 idZA== 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-43893-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43893-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 z15-20020a05622a060f00b0042a9a92fe06si5250103qta.396.2024.01.29.19.23.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 19:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43893-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-43893-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43893-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 627D41C21D57 for ; Tue, 30 Jan 2024 03:23:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA45D374D2; Tue, 30 Jan 2024 03:23:35 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EE0337171; Tue, 30 Jan 2024 03:23:32 +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=1706585015; cv=none; b=EO5BTrYfqQyrVQYvfXlQmTSNlKnkOdafk2v97Wiv5H83jWx2vfqtGlqreScwdwMks9zq50QSnoYw7YeK5yQg8DnI/AYOoeECEdB61+u/6C1IsmB8OrX9dUeg0A8LqfzgVQ+xQs5RrFr3/xRLMzpP/nvgYWVkEojFXBDm1zbKy3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706585015; c=relaxed/simple; bh=JixfZLRBAcL76btxusE3CiEUz0Lzxhmpuqg1wOtqKLQ=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=WFF9y2ISgVrOMmJ66UoVKp1rEdGV2lTFNlsfIOxK3xQdE3+6+4Lq7YYEmIeg9NCZWLapNueYSvLFcBxsTcJYn7fVIBmj1dDOhNoxesnKYgMmYwPItBHXLo1uOvKAbYXB8NvqigzYlVvjvB+y+EWDoOuDtinNZExeKNvnBrSB0R4= 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.20.42.173]) by gateway (Coremail) with SMTP id _____8CxifCza7hlNyoIAA--.25382S3; Tue, 30 Jan 2024 11:23:31 +0800 (CST) Received: from [10.20.42.173] (unknown [10.20.42.173]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxZMyxa7hlQzsnAA--.28908S3; Tue, 30 Jan 2024 11:23:29 +0800 (CST) Subject: Re: [PATCH v4 2/3] irqchip/loongson-eiointc: Skip handling if there is no pending irq To: Huacai Chen Cc: Jiaxun Yang , Thomas Gleixner , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Shtylyov , lvjianmin@loongson.cn References: <20240125113623.2043061-1-maobibo@loongson.cn> <20240125113623.2043061-3-maobibo@loongson.cn> From: maobibo Message-ID: <3d8cdc3a-415c-0f5a-d8d5-3fd2084926fc@loongson.cn> Date: Tue, 30 Jan 2024 11:23:29 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8CxZMyxa7hlQzsnAA--.28908S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7Kw1rWr15JrWrXFWkKw4Utrc_yoW8Zw18p3 yUCa1qkF4DJryUCFnIqr18JF1YvwsYgFWDCa1kG3y3Z3s8JwnYkF4Fk3Wqvrs7Cr1fGa12 vF4YgF1Uua15C3cCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUB2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU tVWrXwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI4 8JMxk0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_ Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E 14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU4AhLUUUUU On 2024/1/29 下午8:27, Huacai Chen wrote: > Hi, Bibo, > > As commented in another patch, you can use eiointc_irq_dispatch(), > iocsr_read64() to describe functions, and it is better to use > Loongson-3A5000, Loongson-2K2000, Loongson-2K0500 rather than 3A5000, > 2K2000, 2K0500. Besides, please always use IRQs rather than IRQS. Huacai, Thanks for reviewing. Will do in next patch. Regards Bibo Mao > > With these modifications, > > Acked-by: Huacai Chen > > On Thu, Jan 25, 2024 at 7:36 PM Bibo Mao wrote: >> >> 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 >>