Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3008399rwd; Mon, 22 May 2023 07:27:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vKl0kBC+oihf882p7iZEDcqu15x5t2YwAD5glieuy+IT096+bxV/BLfI6leIDjEoSMhak X-Received: by 2002:a17:902:d4d0:b0:1ac:3d1c:83c9 with SMTP id o16-20020a170902d4d000b001ac3d1c83c9mr15632853plg.13.1684765640661; Mon, 22 May 2023 07:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684765640; cv=none; d=google.com; s=arc-20160816; b=QrTukOIGI4ssMQrk3p1zQ4reQiuIl3GEXruQQzjkxkCR5bFR4QCqaPtJyfMSi56fiz yAea+jARlVU4vLEH5gb+s4kJKGTWlxE3Gvt5g0CeHGVXLPzSXOTJLvuVTxBIx+RDZYTX sfRaWMQpjaDbSJEbH79qmkNNxT67LfU4D5ytpXR+DDNvsMzmZ/4cexKJuYhAMgfieN5O 1zvw139sIfZCkcB0KkyR0wWy9NAeo5g3YOR9eLWlLJfEVWKGiPB+vMb3z87mtGAt0mi7 Mojyu3GIxDzK1Rr8Y9IJs7Xzip24sHq2ykab/JeDIELGjrWtSlKUte8njLD5yoWwyssE 4i7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=gEFrgqz+gYLalhKQzChWX9y13gBECThZx9rK3oKXttA=; b=OAoV2d/8s0Qlm/VyH1ombT41QA1Y4NPcn5/EIq6C76cECKTFWqA4kOVeEgzxQjlXeS USLTwX1W4AIirKVWSazidl6Ocv9j44Z713TdVwtkA6JSPuubNAZunGn9um1jgQNg3pOk 9vLiyytRWpuhshr2bn1bYyLCPAsEAOD/9cKRX19g217MYlL2lT2R6slPqu3DVdp2/zjV JTuSfZzn6QviGcFtSafn0nHqTsVfD5Ses2Ir8tWn0OeunnuHgly/xOdNnxGmokqvYki9 BQvTPiqjRCgrFjutTkZeeSRznEJGIcYM/oEABc4vpJlU6DQx5znAMsCzpY38tdI9tadz WVcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cnxOpR90; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=BFafzFgx; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji9-20020a170903324900b001a64b2dc495si4509996plb.462.2023.05.22.07.27.05; Mon, 22 May 2023 07:27:20 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=cnxOpR90; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=BFafzFgx; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233582AbjEVOTo (ORCPT + 99 others); Mon, 22 May 2023 10:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjEVOTm (ORCPT ); Mon, 22 May 2023 10:19:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CAE5A3; Mon, 22 May 2023 07:19:41 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684765179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gEFrgqz+gYLalhKQzChWX9y13gBECThZx9rK3oKXttA=; b=cnxOpR90o7b9DdKZbimSkvnr6JHqdXf3oOrsG7QcyoV1Ac/DwCRI9RFkgWd5l6vSJdDUk7 QH/p5gkBaJyHXeV+852Ii+nXe9WRHtdyUzbOlrVfKOxGHby46cx/h49HYyCs0GetKzD9im RkI3ASIiJGTYXWJ9iPSrGXHLl+7eaorVZdIIlTZomc0ukCC7M9J3RwI6Nu4JluhNCfWmO7 KpU9eCs+zB9b205s3ptRyp1JwGsg1+arE+KtcPp/d3dHs1S4jjoWHGlfML9ROMtTFdvE30 rVsx2WYi0+Gf4iNo+Omb98a3p6dXimbGks+lHQmepIoxUd2oGwPQarrqrE1yDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684765179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gEFrgqz+gYLalhKQzChWX9y13gBECThZx9rK3oKXttA=; b=BFafzFgxgWxPaKO3wZOg+17eqARUJiZ13GDJnVawb4dyxmDJRqxJB6hjPwQB0txXX1fh8h 6J/LXx4rHUjl4hDQ== To: Marc Zyngier Cc: LKML , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Greg Kroah-Hartman , Jason Gunthorpe , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Ammar Faizi , Robin Murphy , Lorenzo Pieralisi , Nishanth Menon , Tero Kristo , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, Vinod Koul , Sinan Kaya , Andy Gross , Bjorn Andersson , Mark Rutland , Shameerali Kolothum Thodi , Zenghui Yu , Shawn Guo , Sascha Hauer , Fabio Estevam , Anna-Maria Behnsen Subject: Re: [patch V2 06/40] PCI/MSI: Provide static key for parent mask/unmask In-Reply-To: <87v8n3c2qy.ffs@tglx> References: <20221121135653.208611233@linutronix.de> <20221121140048.659849460@linutronix.de> <8635a8o65q.wl-maz@kernel.org> <87bkowcx0z.ffs@tglx> <86zgcgmpzl.wl-maz@kernel.org> <87v8n3c2qy.ffs@tglx> Date: Mon, 22 May 2023 16:19:39 +0200 Message-ID: <87ttw4wiro.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Fri, Nov 25 2022 at 01:11, Thomas Gleixner wrote: > On Thu, Nov 24 2022 at 13:38, Marc Zyngier wrote: >> On Thu, 24 Nov 2022 13:17:00 +0000, >> Thomas Gleixner wrote: >>> > I find this a bit odd. If anything, I'd rather drop the masking at the >>> > PCI level and keep it local to the interrupt controller, because this >>> > is likely to be more universal than the equivalent PCI operation >>> > (think multi-MSI, for example, which cannot masks individual MSIs). >>> > >>> > Another thing is that the static key is a global state. Nothing says >>> > that masking one way or the other is a universal thing, specially when >>> > you have multiple interrupt controllers dealing with MSIs in different >>> > ways. For example, GICv3 can use both the ITS and the GICv3-MBI frame >>> > at the same time for different PCI RC. OK, they happen to deal with >>> > MSIs in the same way, but you hopefully get my point. >>> >>> I'm fine with dropping that. I did this because basically all of the >>> various ARM PCI/MSI domain implementation have a copy of the same >>> functions. Some of them have pointlessly the wrong order because copy & >>> pasta is so wonderful.... >>> >>> So the alternative solution is to provide _ONE_ set of correct callbacks >>> and let the domain initialization code override the irq chip callbacks >>> of the default PCI/MSI template. >> >> If the various irqchips can tell the core code whether they want >> things to be masked at the PCI level or at the irqchip level, this >> would be a move in the right direction. For the GIC, I'd definitely >> want things masked locally. >> >> What I'd like to get rid off is the double masking, as I agree it is >> on the "pretty dumb" side of things. > > Not necessarily. It mitigates the problem of MSI interrupts which can't > be masked because the implementers decided to spare the gates. MSI > allows that as masking is opt-in... > > Let me think about it. That really took a while to think about it :) We have the following cases on the PCI/MSI side: 1) The MSI[X] entry can be masked 2) The MSI[X] entry cannot be masked because hardware did not implement it, masking is globally disabled due to XEN, masking does not exist for this horrible virtual MSI hackery Now you said: "For the GIC, I'd definitely want things masked locally." I decoded this, that you want to have these interrupts masked at the GIC level too independent of #1 or #2 above. And then: "What I'd like to get rid off is the double masking." But relying on the GIC alone is not really a good thing IMO. There is no point to let some confused device send unwanted MSI messages around without a way to shut it up from the generic code via the regular mask/unmask callbacks. On the other hand for PCI/MSI[x] the mask/unmask operations are not in the hot path as PCI/MSI[x] are strictly edge. Mask/unmask is only happening on startup, shutdown and when an interrupt arrives after disable_irq() incremented the lazy disable counter. For regular interrupt handling mask/unmask is not involved. So to avoid that global key we can let the parent domain set a new flag, e.g. MSI_FLAG_PCI_MSI_MASK_PARENT, in msi_parent_ops::supported_flags and let the PCI/MSI core code query that information when the per device domain is created and select the appropriate template or fixup the callbacks after the domain is created. Does that address your concerns? Thanks, tglx