From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0D3FC433F5 for ; Mon, 20 Dec 2021 13:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z7Jrcbn6W/5WjnxUSQMgs3Q5zghldkIp0m2I8iMo7J4=; b=ymf0m4t55uqzxj qDb+kyA4lQK219lMP+1Vp2ttof3jLbxb3NLT1f8BTOmghybIGxpfm8SHbF1shxmindDo/dPXy+ljZ hv0SoyErcrHoewA/Wgnwgl/BoWRFYVOrD5GM+59T8ECcHZhEaV0z3QK8Fkyy10SAlJeSgpBnG291Q z8lM2srEW0hKnKRHecstx5MNpxctt3wFP0wYCj58T8qiph0MhgbIhFU8IaUgheRG8cCGtT5v0qB56 QLSj6aPpGxC3DGQ3fuJCFqF2mZPg+sLpKl4elxs4hbcXEKPR2/9ax7BmO8a3dKb8bWk0dtRc5HlZs rdos+jzCuMQl2TpEz9QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzIs1-002ZOy-CS; Mon, 20 Dec 2021 13:38:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzIrr-002ZMN-T1 for linux-arm-kernel@lists.infradead.org; Mon, 20 Dec 2021 13:38:21 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id 6141A61123; Mon, 20 Dec 2021 13:38:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33A8BC36AE7; Mon, 20 Dec 2021 13:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640007499; bh=ryGUhJ/xAmArVAIl6FINczOMNdKbaJ7SW5D/3rb6rFk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ddEkUh2A2yObszUqn4ugcrlJZQaZIx5A1o1MT9kZWk4rQfQdcAyLVjtEEicZ8+84A ygqwL5eiTSL2gW5/2WdBDVM/BCns6Mae5ygrC0gj7QZF/s3FG5yiJD1+9ceIiopqgf YkwJPBNDYy4ERpqTDVJI+K2gqazVszzvewZVhCSEhep/yvvtYX0pUkqfiBYSr9KFQQ 54P2Ch9ayc/By87F+dUyn5qIdwkXXs4GC8YomRh7ieXkeneJH5EObpiT8uWlqVhTsI Z3xQLduSpWdnY6PWT/ewM6iMKfEFfcMzJmxo2drG3QSXF20sQHDmiT1Y9IEt3AO4yq eeBdy/BZaeMGg== Received: from cfbb000407.r.cam.camfibre.uk ([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 1mzIrp-00DIED-45; Mon, 20 Dec 2021 13:38:17 +0000 Date: Mon, 20 Dec 2021 13:38:16 +0000 Message-ID: <878rwfwg53.wl-maz@kernel.org> From: Marc Zyngier To: Hector Martin Cc: Thomas Gleixner , Rob Herring , Sven Peter , Alyssa Rosenzweig , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 5/6] irqchip/apple-aic: Support multiple dies In-Reply-To: References: <20211209043249.65474-1-marcan@marcan.st> <20211209043249.65474-6-marcan@marcan.st> <87mtl4jxjt.wl-maz@kernel.org> 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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: marcan@marcan.st, tglx@linutronix.de, robh+dt@kernel.org, sven@svenpeter.dev, alyssa@rosenzweig.io, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211220_053820_048263_E6ED37F8 X-CRM114-Status: GOOD ( 25.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 18 Dec 2021 05:39:04 +0000, Hector Martin wrote: > > On 14/12/2021 01.10, Marc Zyngier wrote: > >> switch (fwspec->param[0]) { > >> case AIC_IRQ: > >> - if (fwspec->param[1] >= ic->nr_irq) > >> + if (die >= ic->nr_die) > >> + return -EINVAL; > >> + if (args[0] >= ic->nr_irq) > >> return -EINVAL; > >> - *hwirq = (FIELD_PREP(AIC_EVENT_TYPE, AIC_EVENT_TYPE_HW) | > >> - FIELD_PREP(AIC_EVENT_NUM, fwspec->param[1])); > >> + *hwirq = AIC_IRQ_HWIRQ(die, args[0]); > >> break; > > > > A side issue with this is that it breaks MSIs, due to the way we > > construct the intspec (I did hit that when upgrading the M1 intspec to > > 4 cells for the PMU). I have the following hack locally: > > > > diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c > > index b090924b41fe..f7b4a67b13cf 100644 > > --- a/drivers/pci/controller/pcie-apple.c > > +++ b/drivers/pci/controller/pcie-apple.c > > @@ -218,7 +218,7 @@ static int apple_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, > > if (hwirq < 0) > > return -ENOSPC; > > > > - fwspec.param[1] += hwirq; > > + fwspec.param[1 + (fwspec.param_count == 4)] += hwirq; > > > > ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &fwspec); > > if (ret) > > > > Heh, I never noticed; probably because I guess the SD card reader on the > machine I've been testing this on doesn't use MSIs, and I haven't tried > WiFi yet. > > Perhaps (fwspec.param_count - 2)? It's probably a safer long-term > assumption that the last two cells will always be leaf IRQ number and type. Yup, that'd work as well, as long as we make this assumption explicit. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel