Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4647412pxv; Tue, 6 Jul 2021 06:07:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkbQGl9K8+WUYXYHulcb7j2X9owSNzWCc1yNBynzx+C7EKkkohIZMJu8zODZhMgETFcGHf X-Received: by 2002:a05:6402:51c9:: with SMTP id r9mr22531560edd.326.1625576859930; Tue, 06 Jul 2021 06:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625576859; cv=none; d=google.com; s=arc-20160816; b=Z9auNUqVFxd9orap5jSEHbr7opRSOe9T0QAigR6yynhTwV376C5UE/r8xp1y8JnERk oVLqs+4jlcmFDxV1DqsAFriplaGOr08r0dZpiaE+nvE/U2ozN0ROmURF3IPuFbW+G3Mp xL4itrxlLhIQXV2JVMheVXn47+fuohRhP44xzDbHzDsLM6JJiECw9DhMWxgP7YpM+t2W ww9BhTPg1gc12Uot6wygEl5vNLDVE6ARd5qZxEz3+eBOw5xB11p4m4fF3S3tc9H+1nYd IURkDCRRuUq+lQ95rUX3y5WbMBThnjvc22G1lOuEluoqFvDrMAsHlJXCD9bN2Ph5CR9X mgrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=740LMK/fdJ5RB7Z+53Euh17goePV018D9dPDjmdT0jQ=; b=aDzlOT42hH/qFRoYBjZb9Qg4qwdixGt4G1JmBs6t3Q3lo79pace9ZHBhoZ/ZMVNEmQ 5qJo7rQkehTZPKqvy9RGTO1Dh2eEPKANM7s6wDBjtv4q1dyQRt1WA7lszu4BqhyjF3sQ eBxN3OPjkPwuBY4e2bBblvv3nFXGBK8XoNuDdzhpXxf+k5QDMUHF4kWF8HjpWPGolQ5R zzUNCoTZeSb7tk7+PT2//5XPePP8cQho0ddgce6OVqyAr/ov9EP7KA5H2Q+zXsbED9Vd hNllaXHdU1M4ONM9z9K6WkqnCHwc8T932qIwg/d2amwqCVC1LU2uU+usUhp8tLF2r8yj rEvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si9955473edp.82.2021.07.06.06.07.16; Tue, 06 Jul 2021 06:07:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231344AbhGFNIn (ORCPT + 99 others); Tue, 6 Jul 2021 09:08:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:59026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbhGFNIl (ORCPT ); Tue, 6 Jul 2021 09:08:41 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F1E961C69; Tue, 6 Jul 2021 13:06:03 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m0km1-00Bjd3-FY; Tue, 06 Jul 2021 14:06:01 +0100 Date: Tue, 06 Jul 2021 14:06:01 +0100 Message-ID: <878s2j8udi.wl-maz@kernel.org> From: Marc Zyngier To: Huacai Chen Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Chen Zhu Subject: Re: [PATCH 2/9] irqchip/loongson-pch-pic: Improve edge triggered interrupt support In-Reply-To: <20210706030904.1411775-3-chenhuacai@loongson.cn> References: <20210706030904.1411775-1-chenhuacai@loongson.cn> <20210706030904.1411775-3-chenhuacai@loongson.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: chenhuacai@loongson.cn, tglx@linutronix.de, linux-kernel@vger.kernel.org, lixuefeng@loongson.cn, chenhuacai@gmail.com, jiaxun.yang@flygoat.com, zhuchen@loongson.cn X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 06 Jul 2021 04:08:57 +0100, Huacai Chen wrote: > > Edge-triggered mode and level-triggered mode need different handlers, > and edge-triggered mode need a specific ack operation. So improve it. > Is this a fix? How does it work currently? > Signed-off-by: Chen Zhu > Signed-off-by: Huacai Chen > --- > drivers/irqchip/irq-loongson-pch-pic.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c > index f790ca6d78aa..a4eb8a2181c7 100644 > --- a/drivers/irqchip/irq-loongson-pch-pic.c > +++ b/drivers/irqchip/irq-loongson-pch-pic.c > @@ -92,18 +92,22 @@ static int pch_pic_set_type(struct irq_data *d, unsigned int type) > case IRQ_TYPE_EDGE_RISING: > pch_pic_bitset(priv, PCH_PIC_EDGE, d->hwirq); > pch_pic_bitclr(priv, PCH_PIC_POL, d->hwirq); > + irq_set_handler_locked(d, handle_edge_irq); > break; > case IRQ_TYPE_EDGE_FALLING: > pch_pic_bitset(priv, PCH_PIC_EDGE, d->hwirq); > pch_pic_bitset(priv, PCH_PIC_POL, d->hwirq); > + irq_set_handler_locked(d, handle_edge_irq); > break; > case IRQ_TYPE_LEVEL_HIGH: > pch_pic_bitclr(priv, PCH_PIC_EDGE, d->hwirq); > pch_pic_bitclr(priv, PCH_PIC_POL, d->hwirq); > + irq_set_handler_locked(d, handle_level_irq); > break; > case IRQ_TYPE_LEVEL_LOW: > pch_pic_bitclr(priv, PCH_PIC_EDGE, d->hwirq); > pch_pic_bitset(priv, PCH_PIC_POL, d->hwirq); > + irq_set_handler_locked(d, handle_level_irq); You are changing the flow for the whole hierarchy. Are all the irqchips in the stack supporting this? > break; > default: > ret = -EINVAL; > @@ -113,11 +117,24 @@ static int pch_pic_set_type(struct irq_data *d, unsigned int type) > return ret; > } > > +static void pch_pic_ack_irq(struct irq_data *d) > +{ > + unsigned int reg; > + struct pch_pic *priv = irq_data_get_irq_chip_data(d); > + > + reg = readl(priv->base + PCH_PIC_EDGE + PIC_REG_IDX(d->hwirq) * 4); > + if (reg & BIT(PIC_REG_BIT(d->hwirq))) { > + writel(BIT(PIC_REG_BIT(d->hwirq)), > + priv->base + PCH_PIC_CLR + PIC_REG_IDX(d->hwirq) * 4); > + } > + irq_chip_ack_parent(d); > +} > + > static struct irq_chip pch_pic_irq_chip = { > .name = "PCH PIC", > .irq_mask = pch_pic_mask_irq, > .irq_unmask = pch_pic_unmask_irq, > - .irq_ack = irq_chip_ack_parent, > + .irq_ack = pch_pic_ack_irq, > .irq_set_affinity = irq_chip_set_affinity_parent, > .irq_set_type = pch_pic_set_type, > }; Thanks, M. -- Without deviation from the norm, progress is not possible.