Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2239734pxm; Fri, 4 Mar 2022 12:06:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwo9wR2L3iNXEvB9T9ds7FFafWC5EwOsrIPRuXIHa5aaJLv/R4R0cOpXILG/ocjW/CINa8V X-Received: by 2002:aa7:9911:0:b0:4e1:3a76:96f8 with SMTP id z17-20020aa79911000000b004e13a7696f8mr294082pff.28.1646424393852; Fri, 04 Mar 2022 12:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646424393; cv=none; d=google.com; s=arc-20160816; b=pFFsswvbm2qMwmDqlEQuhmwx1hImxBrindNy8INRbZPeboGJ9uTBMPlYtU5HgBi/QL uFEex6RX5LMRH59BgM+SXdCP+mfss1F3RY5rm+8RhGLH+rBud/Qmmb6fL7mgZSHOWtng 9EFeSEZkcex/P9/dwsf0z6xQYxXsAWe/QLybaru7KWuw9BC9ng4R95EE+v+JQyhSvXxx sOEU8MxMHUMCcJUMArw5tS+JRPUm4xYZhJvTUuBRYrZ/C4hjrdhp8o0MpN7DqmYr3pkS yyjJJx62z8Ur2j0gsN7EdDJ0a24hoIt5k8OIbjIAmMkePkqzLPdzCy1UJirA4TUYgy3p gNyA== 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=RJcrCvANkhXtRGVtPpWzB3DT2z0dwUTzFaj7JOfRUdc=; b=IgaEZQU7PL0E7FufuKL91+Y9fHpeQ8EXYFnlhkP/ZRnMX/kIKxSPft5f1wkb1LWukj N7OVGNHy+B1H+RT/6rdzNVpamBeMM5n6g3PM/lVs3UIU4xBswBHvCe1ZaE2UGNr0FvkC oA6qe8gk7iwUV0mOeBFQjPtQM8ye0yMIYX4yFs/oqKA9XEz86ikiRdFNu+84L0Sem40g ADRft6nD9gRCmDMx9Slq8xQN802DkCW+TGHABbxMOscOVGXnmavU9OfdglJMX6ButWTp 1tAYsFBbjlTF2ID+aGnCpq+m8dMULZqDN0+otew0hP1GpszJC0FyaMdXZdK7eUjfgUQN mP8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pp8TLvH/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c18-20020a056a000ad200b004f40144cf75si6160601pfl.136.2022.03.04.12.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:06:33 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pp8TLvH/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4D852E857D; Fri, 4 Mar 2022 11:26:35 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238297AbiCDPZi (ORCPT + 99 others); Fri, 4 Mar 2022 10:25:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbiCDPZg (ORCPT ); Fri, 4 Mar 2022 10:25:36 -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 983DF1C4B1E; Fri, 4 Mar 2022 07:24:48 -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 318B8B829FA; Fri, 4 Mar 2022 15:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB397C340E9; Fri, 4 Mar 2022 15:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646407485; bh=Ugh1vrX5vQzasJmQI5hX7hdAPEuwOmRL+sYJJ6nVIrg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pp8TLvH/baKbl4BMBfu0G+pCaCAbcC5v1jqEuXOk9fwwlWOwP7GE2mIIBdFGZBqyy as7i/yXY0WxscdIpvlhztFxmcjmkxPBCLLqHVWO/7LQ0Nwpnsqa/eLm3TUeEXHtGr1 FdF2HEpZD9Cd1NGtWG3w0kma1NGAhWRV5RHdXUBYW6e7J60T8OZSPHMuu5+Ponclop KQUjQIlGRjZ/V/ISzCzVTz8iRoyB6XNVCXsfQP8Ylxm1EbuTgbqhxtafwBNOcVe0gi NpLAXgWHkPdF2U+SyrGiwnue9+UzYPklmXLMFE72lAqdx/eUDimB6LMcnfxq30bRZo xAVIpmMZTcvCg== 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 1nQ9nP-00CFyk-EZ; Fri, 04 Mar 2022 15:24:43 +0000 Date: Fri, 04 Mar 2022 15:24:43 +0000 Message-ID: <87lexp211g.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: <20220304082342.GO269879@dragon> References: <20220301062414.2987591-1-shawn.guo@linaro.org> <20220301062414.2987591-3-shawn.guo@linaro.org> <87ee3m2aed.wl-maz@kernel.org> <20220302084028.GL269879@dragon> <877d9c3b2u.wl-maz@kernel.org> <20220302133441.GM269879@dragon> <875yow31a0.wl-maz@kernel.org> <20220303040229.GN269879@dragon> <87fsnytagc.wl-maz@kernel.org> <20220304082342.GO269879@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=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Fri, 04 Mar 2022 08:23:42 +0000, Shawn Guo wrote: > > On Fri, Mar 04, 2022 at 07:59:15AM +0000, Marc Zyngier wrote: > > On Thu, 03 Mar 2022 04:02:29 +0000, > > Shawn Guo wrote: > > > > > > On Wed, Mar 02, 2022 at 01:57:27PM +0000, Marc Zyngier wrote: > > > > This code actually makes me ask more questions. Why is it programming > > > > 2 'pins' for each IRQ? > > > > > > The mapping between MPM pin and GIC IRQ is not strictly 1-1. There are > > > some rare case that up to 2 MPM pins map to a single GIC IRQ, for > > > example the last two in QC2290 'qcom,mpm-pin-map' below. > > > > > > qcom,mpm-pin-map = <2 275>, /* tsens0_tsens_upper_lower_int */ > > > <5 296>, /* lpass_irq_out_sdc */ > > > <12 422>, /* b3_lfps_rxterm_irq */ > > > <24 79>, /* bi_px_lpi_1_aoss_mx */ > > > <86 183>, /* mpm_wake,spmi_m */ > > > <90 260>, /* eud_p0_dpse_int_mx */ > > > <91 260>; /* eud_p0_dmse_int_mx */ > > > > > > > > > The downstream uses a DT bindings that specifies GIC hwirq number in > > > client device nodes. In that case, d->hwirq in the driver is GIC IRQ > > > number, and the driver will need to query mapping table, find out the > > > possible 2 MPM pins, and set them up. > > > > > > The patches I'm posting here use a different bindings that specifies MPM > > > pin instead in client device nodes. Thus the driver can simply get the > > > MPM pin from d->hwirq, so that the whole look-up procedure can be saved. > > > > It still remains that there is no 1:1 mapping between input and > > output, which is the rule #1 to be able to use a hierarchical setup. > > For direction of MPM pin -> GIC interrupt, it's a 1:1 mapping, i.e. for > given MPM pin, there is only one GIC interrupt. And that's the > mapping MPM driver relies on. For GIC interrupt -> MPM pin, it's not > a strict 1:1 mapping. Then this isn't a 1:1 mapping *AT ALL*. The hierarchical setup mandates that the mapping is a bijective function, and that's exactly what 1:1 means. There is no such thing a 1:1 in a single direction. When you take an interrupt, all you see is the GIC interrupt. How do you know which of the *two* pins interrupted you? Oh wait, you *can't* know. You end-up never servicing one of the two interrupts (and I suspect this results in memory corruption if you tear a hierarchy down). This HW deals with 2:1 mappings, i.e. it is a mux. So all the time spent on this driver is totally lost, because you have the wrong abstraction. And the QC driver is just as bad. M. -- Without deviation from the norm, progress is not possible.