Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp474911rdb; Tue, 19 Sep 2023 00:34:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZzfFS9eB2RiUBQ5ZMvVMJkqda9TjknUJjgkLhyYKTtdL4BckDHgvL/4DGXUyv773pNBM4 X-Received: by 2002:a05:6808:a88:b0:3ac:cf91:9157 with SMTP id q8-20020a0568080a8800b003accf919157mr13235757oij.53.1695108899083; Tue, 19 Sep 2023 00:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695108899; cv=none; d=google.com; s=arc-20160816; b=0RQflt8LavJOQRu4uJdkezRAnLGj6tfRNl+Lxv4039UN0lDMXR+smnBwHw0J7yP8k0 gA4SDQD/ACDqQ9ehC+crbk8/Sli7ufvS7D/+fNicgiHMXHjkWp5te5EesLPXHv2koi/T MdA8RTpwQJIAWeP8/agSpS9rugcDSEQu32mpc5n/BSaz/cWdnTqghiFCMokkok2TUPm0 lwUjPFUPhHjQHNNB9IQ3NQscWawGoatGIg1WYo9ZlNM9y0VRUqZQCJx2kHCmJJbZEU1o 3zI3FqnJ0PVW0WnOIYFT2dGK5m1h47386GmMCAemOWR/Gdw1/ODC45Ur8TPJfhypXUCw dBWA== 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:dkim-signature; bh=HQnS7FctG2YLuNbyM0eAP2FmGjXMTTDkjbSfmET/jkA=; fh=ex77ZS5T6hTYX2gsnmFoW7TnKVqmbypAnFMUW6+l+SA=; b=Z9+n2AtG/cIHdtxF9arsP7uOHKNAE/2onGj+PSQCbbIlhmjszPlDccMHcz2Q7pd+wO nYvExq7s+UpNmC3j2eUszi2QmLoVC6ncJGkioOUQsstEvi9376HSXHLQYdt6bTRf1InZ UEzkbQXr5y4b39vifFdn/Um3ZdsfemXp2fzPx2ZLBbOKF6tde85P7UU79TIFV7WraWQ9 PnTg5JSW72YXq+kKsB7gLI9FVxs++Pnr7Ksk8GypVjSWoRVCXHT7XLONPe/QzcLstkm6 MxrBJL7+S0Hc/Zb/CmrWfZvqYmyrot5Y35ZSgdv3CnND4TMHFb8rEsQLaNzJgW84uq6y mSrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kx/XTJYH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id az1-20020a056a02004100b00565e0624182si9272067pgb.404.2023.09.19.00.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 00:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kx/XTJYH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 3410881197A0; Tue, 19 Sep 2023 00:32:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231744AbjISHce (ORCPT + 99 others); Tue, 19 Sep 2023 03:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbjISHcd (ORCPT ); Tue, 19 Sep 2023 03:32:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A72FFC for ; Tue, 19 Sep 2023 00:32:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0FD5C433C8; Tue, 19 Sep 2023 07:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695108747; bh=5wtVvsi4MOOwa/zGjl9QqTTQdZFChRJ8QtJMGfyACgo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kx/XTJYH5/1D0j8Jnj8HnUYbYnS6D+w4+oPMjYzFAN4R4+QXSXDEL+e2Y8ks5te/e efbqiHeLh+FdGP23PoYVrIx9FeVIkw4i/051z7AbYeglVr8IwXX1Dkv++tVWU3TJbm Tb3wtZOq2tCuTQABI4b1swm44a9IB4+v6cWnpKbU12dHuFzjxZNhO4YMMvhZjC5OYD lSKl5imUrb02es6WeJS+V/iKHnftJkCv0rApl71yZ9c6Qpa3fsRndnaHXNQOgT1aaq xKw0NCSKhw8gcKdVOjXcFlNsnjRH3Q/+myi2E2jIZo7vQQOpRz3qXM0RPkG+3QQgMz 09pklwKMyM20Q== Received: from 82-132-235-111.dab.02.net ([82.132.235.111] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qiVDc-00EEj7-LS; Tue, 19 Sep 2023 08:32:25 +0100 Date: Tue, 19 Sep 2023 08:32:23 +0100 Message-ID: <87ediu4nzs.wl-maz@kernel.org> From: Marc Zyngier To: MD Danish Anwar Cc: Grzegorz Jaszczyk , Suman Anna , David Lechner , Roger Quadros , "Andrew F. Davis" , Thomas Gleixner , , , , Subject: Re: [PATCH 3/3] irqchip/irq-pruss-intc: Fix processing of IEP interrupts In-Reply-To: <20230919061900.369300-4-danishanwar@ti.com> References: <20230919061900.369300-1-danishanwar@ti.com> <20230919061900.369300-4-danishanwar@ti.com> 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/28.2 (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: 82.132.235.111 X-SA-Exim-Rcpt-To: danishanwar@ti.com, grzegorz.jaszczyk@linaro.org, s-anna@ti.com, david@lechnology.com, rogerq@kernel.org, afd@ti.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, srk@ti.com, r-gunasekaran@ti.com, vigneshr@ti.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 19 Sep 2023 00:32:40 -0700 (PDT) On Tue, 19 Sep 2023 07:19:00 +0100, MD Danish Anwar wrote: > > From: Suman Anna > > It was discovered that IEP capture/compare IRQs (event #7 on all SoCs > and event #56 on K3 SoCs) are always triggered twice when PPS is > generated and CMP hit event detected by IEP. > > An example of the problem is: > pruss_intc_irq_handler > generic_handle_irq > handle_level_irq > mask_ack_irq -> IRQ 7 masked and asked in INTC, > but it's not yet cleared on HW level > handle_irq_event() > > icss_iep_cap_cmp_handler() -> IRQ 7 is actually processed in HW > irq_finalize_oneshot() > unmask_irq() > pruss_intc_irq_unmask() -> IRQ 7 status is still observed as set > > The solution is to actually ack these IRQs from pruss_intc_irq_unmask() > after the IRQ source is cleared in HW. What you don't explain is whether the interrupt is level or edge triggered? If it is level, then the "quirk" is that the interrupt controller is slow to recognise that the level has changed. If it is edge, this is a guaranteed recipe to lose interrupts. Even if it is level, what happens if you issue a mask/unmask sequence outside of the interrupt handling and that such an interrupt becomes pending in between? Does this spurious ack have an effect on the now pending interrupt? > > No public errata available for this yet. > > Fixes: 04e2d1e06978 ("irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS interrupts") > > Signed-off-by: Grygorii Strashko Nit: drop the empty line after Fixes:. > Signed-off-by: Suman Anna > Signed-off-by: MD Danish Anwar > --- > drivers/irqchip/irq-pruss-intc.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c > index 3cf684ede564..9907847dbda8 100644 > --- a/drivers/irqchip/irq-pruss-intc.c > +++ b/drivers/irqchip/irq-pruss-intc.c > @@ -70,6 +70,8 @@ > #define MAX_PRU_SYS_EVENTS 160 > #define MAX_PRU_CHANNELS 20 > > +#define MAX_PRU_INT_EVENTS 64 > + > /** > * struct pruss_intc_map_record - keeps track of actual mapping state > * @value: The currently mapped value (channel or host) > @@ -85,10 +87,13 @@ struct pruss_intc_map_record { > * @num_system_events: number of input system events handled by the PRUSS INTC > * @num_host_events: number of host events (which is equal to number of > * channels) supported by the PRUSS INTC > + * @quirky_events: bitmask of events that need quirky IRQ handling (limited to > + * (internal sources only for now, so 64 bits suffice) > */ > struct pruss_intc_match_data { > u8 num_system_events; > u8 num_host_events; > + u64 quirky_events; Why limit this to the first 64 interrupts, while the intc can deal with 160? What makes you confident that this is solely limited to this particular source? And why this source only? M. -- Without deviation from the norm, progress is not possible.