Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp587643pxm; Wed, 2 Mar 2022 04:54:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJySomN/DGJWLZOPkA0qXmZzG0SpPnizN2y+5u541Q00f2JFnwYO8VyXOYaW1Af+Zy5I6GFZ X-Received: by 2002:a17:907:1c81:b0:6da:626c:b789 with SMTP id nb1-20020a1709071c8100b006da626cb789mr2136984ejc.607.1646225673355; Wed, 02 Mar 2022 04:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646225673; cv=none; d=google.com; s=arc-20160816; b=lY32zfeeDgtzoque8Xler1dyM0vO4m54//ZDO5CW91I5vQ3Skai2lWkcvfGPK6RQRo FWhyJI52XbqaeVCElzjl/LUwBZfEZuVmsBaeAGZLjiIr5QHlUdUlfz8jgd+qURPPLctu dXRofe1EMxDf1vti/Qphl57eGyhqsWpHREFcU7k3oWL4KU4y0fnG6LLtLk3TYn+DNtVn XagSfskCrrRdBN9kQx5GNbGkKb1I+XLqd8milojh1xKa2AQiy6exG6RCUvElplF8tSSv ZcSl04WC3e9zvJH6hsXZeO4gtkTysoFSpIyVTtWENKaLqawDKwjhSwuNipyC+nUgahnG SQ3w== 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=IRtHJc1fgHN9qKeSuN8AeRt3jH5l8szcr/WyYCxh6JM=; b=lo3L7dOuAqWh6Eve2on231BG5ZHEZO0CYLfvM79RX7SbfQf5AnAkYmmG0VSbKIKgnK XtdvAeNQlg+EO20wjDZ972s126kJ+eDE43V+X7InLRuD/sqRidqKRqAfq3AicKemRIbT JM0OTav7Cs/qxXqnd7c1kfTIpdfhk67lZ7VEcobor0yqgiiwADsWopvacIOGeYRaQ+5Y 74WECoJXP+bMT3XBhtO0ydo5SLWqbI9Hn0orXEQd6nw/rRdcaNteXtG5cU9duMbDOLOZ VQ79LWhl18BnQHdSct1tXUJKpFqFICZIMfgJz1OiOTdlvUCHdnPSO6zO4+s575Gnv29R QEmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=boMjGCPX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gc22-20020a1709072b1600b006d09b8b1942si8450875ejc.495.2022.03.02.04.53.46; Wed, 02 Mar 2022 04:54:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=boMjGCPX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240981AbiCBK0i (ORCPT + 99 others); Wed, 2 Mar 2022 05:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240979AbiCBK0e (ORCPT ); Wed, 2 Mar 2022 05:26:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D614BE1E1; Wed, 2 Mar 2022 02:25:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0D5FB81F61; Wed, 2 Mar 2022 10:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8667AC004E1; Wed, 2 Mar 2022 10:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646216748; bh=Rx6BK3yEyjhunkFOjdoBpPskNNZoXkPwCC5NrzfuBVI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=boMjGCPXsNFGILP20rRGUBff+Ww8a79Y1VcW2gc8PbsskhnE3Yrub3QjSQO0uhLjq ssneieFqCHD6C44q3Sok9DgbpFBBvU8DBFwXCanOeR6a6eAwuuh2YKaB0kiDUi7j1y YLDNIDWy31YSMb2nu5PMALi8MI9755iEVV2uinYMkFg1QqeQtRi1OZJPynybl9fSih WQ4mgjpWHIOwGeqaj/YUKfsoa+Y8asWj+js+fU2A7EUaio4WT0EQC8myIebvmCrYTD PF/rs3OANJgAGT62tLHxcWvvZJbp5HVE26ftMpx0bjdBCbwLuGntlR/7XLAey2j7BS Q7OlyOwcC2GPg== 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 1nPMB0-00Be3p-50; Wed, 02 Mar 2022 10:25:46 +0000 Date: Wed, 02 Mar 2022 10:25:45 +0000 Message-ID: <877d9c3b2u.wl-maz@kernel.org> From: Marc Zyngier To: Shawn Guo Cc: Thomas Gleixner , Maulik Shah , Bjorn Andersson , Sudeep Holla , Rob Herring , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 2/2] irqchip: Add Qualcomm MPM controller driver In-Reply-To: <20220302084028.GL269879@dragon> References: <20220301062414.2987591-1-shawn.guo@linaro.org> <20220301062414.2987591-3-shawn.guo@linaro.org> <87ee3m2aed.wl-maz@kernel.org> <20220302084028.GL269879@dragon> 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: shawn.guo@linaro.org, tglx@linutronix.de, quic_mkshah@quicinc.com, bjorn.andersson@linaro.org, sudeep.holla@arm.com, robh+dt@kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org 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=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 02 Mar 2022 08:40:28 +0000, Shawn Guo wrote: > > Hi Marc, > > On Tue, Mar 01, 2022 at 11:13:30AM +0000, Marc Zyngier wrote: > > Hi Shawn, [...] > > > > > +static int qcom_mpm_set_type(struct irq_data *d, unsigned int type) > > > +{ > > > + struct qcom_mpm_priv *priv = d->chip_data; > > > + int pin = d->hwirq; > > > + unsigned int index = pin / 32; > > > + unsigned int shift = pin % 32; > > > + > > > + switch (type & IRQ_TYPE_SENSE_MASK) { > > > + case IRQ_TYPE_EDGE_RISING: > > > + mpm_set_type(priv, !!(type & IRQ_TYPE_EDGE_RISING), > > > + MPM_REG_RISING_EDGE, index, shift); > > > + break; > > > + case IRQ_TYPE_EDGE_FALLING: > > > + mpm_set_type(priv, !!(type & IRQ_TYPE_EDGE_FALLING), > > > + MPM_REG_FALLING_EDGE, index, shift); > > > + break; > > > + case IRQ_TYPE_LEVEL_HIGH: > > > + mpm_set_type(priv, !!(type & IRQ_TYPE_LEVEL_HIGH), > > > + MPM_REG_POLARITY, index, shift); > > > + break; > > > + } > > > > All these '!!(type & BLAH)' are totally superfluous, as they all expand > > to 'true' by construction. > > Yes, you are right! > > > And this leads to a few questions: > > > > - Shouldn't a rising interrupt clear the falling detection? > > - Shouldn't a level-low clear the polarity? > > - How do you handle IRQ_TYPE_EDGE_BOTH? > > - How is MPM_REG_POLARITY evaluated for edge interrupts (resp the EDGE > > registers for level interrupts), as you never seem to be configuring > > a type here? > > Honestly, qcom_mpm_set_type() was mostly taken from downstream without > too much thinking. I trusted it as a "good" reference as I have no > document to verify the code. These questions are great and resulted the > code changes are pretty sensible to me. I don't think these changes are enough. For example, an interrupt being switched from level to edge is likely to misbehave (how do you distinguish the two?). If that's what the downstream driver does, then it is terminally broken. As I asked before, we need some actual specs, or at least someone to paraphrase it for us. There are a number of QC folks on Cc, and I expect them to chime in and explain how MPM works here. > > > - What initialises the MPM trigger types at boot time? > > I dumped the vMPM region and it's all zeros. My understanding is if > vMPM needs any sort of initialization, it should be done by RPM firmware > before APSS gets booting. What about kexec? We can't rely on this memory region to always be 0-initialised, nor do we know what that means. Thanks, M. -- Without deviation from the norm, progress is not possible.