Received: by 10.213.65.68 with SMTP id h4csp100894imn; Thu, 15 Mar 2018 10:45:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELtb/KOWEtkOoPBZTdu1cIFxD/IXYXdyBrdWBcwt/+7ASZq70ZafVBP/ZSL/nxSWyYR0bRmm X-Received: by 2002:a17:902:4201:: with SMTP id g1-v6mr9134335pld.62.1521135957990; Thu, 15 Mar 2018 10:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521135957; cv=none; d=google.com; s=arc-20160816; b=YlPmwC5ZgjPQCYoTm5PrMIy9urEp8hgOQLgOhpGwIQfiMLMaP6GCtqt7rVR3ec9D20 WUOOJERjT2SpKRso2dNq0WJIJsKOHD7R1LTshOhZ7m5Co65bRMWOLjrM039K2t0eeIrg 7qXGkQWIcxUpLk4XvRQpKAERPO4kUPAiba5caBnskGZkyneM3nn7CLH9TwtDWKjUfwKm RKy8Co65ki3HBG1myZ8XIIDF7WTMNUkltyLzTiJXHU6rxMaz9yROBWQQ4zvt6mxwhpcu NEOGtpgxAfQZF3Zwsya3LbWijL95vYHpAwttnCHlKvq0ZT2DEu1AJ1m0AmU/678LAAz3 XlZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Z3x7e0ZTSfrsUFkhP2+KNx1xzhGS81LL4Y1HSouoqWM=; b=TUDwqCfQ//IsoXkwWCHQ8E/aiwda2xVDhkgKFsOWs5i4lc0PBvzNzdikMyWZxO0Cgw o6mUDeE7jXxsMa0ofYoHk/bs0T5SP9uPzPx3qeHLt9M6/rlYJe3Igtq9xLj4ZwCCihDC 3ZK4v8gFTf5dXQt3Li0RXyFSvxIEkCThSjsX9RaB5nviIXHEEP7AbyEGORoLtHPCe0lb 9tbp1P6Llc1IM6DWBEEw9nub+ETjhui9gCziA1BtfMZYR+2t85WZPV6jyWRSuz1+N1yL JEI1T96uuPAF/+web4EPJMq5lYykICfxdBHOkbU/n7eSRGBrd8UqFRMjMFcwBLm4mpcc BB7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10-v6si4396371plk.730.2018.03.15.10.45.41; Thu, 15 Mar 2018 10:45:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752078AbeCORni (ORCPT + 99 others); Thu, 15 Mar 2018 13:43:38 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45008 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbeCORng (ORCPT ); Thu, 15 Mar 2018 13:43:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7A0931435; Thu, 15 Mar 2018 10:43:36 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 89D4B3F25D; Thu, 15 Mar 2018 10:43:34 -0700 (PDT) Date: Thu, 15 Mar 2018 17:43:29 +0000 From: Lorenzo Pieralisi To: Ryder Lee Cc: Arnd Bergmann , Rob Herring , Bjorn Helgaas , Frank Rowand , Benjamin Herrenschmidt , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 1/2] of_pci_irq: add a check to fallback to standard device tree parsing Message-ID: <20180315174329.GB22176@e107981-ln.cambridge.arm.com> References: <31c765c53e85e41bfc001d110d69e46c9967f4e7.1516961656.git.ryder.lee@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31c765c53e85e41bfc001d110d69e46c9967f4e7.1516961656.git.ryder.lee@mediatek.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 31, 2018 at 03:41:49PM +0800, Ryder Lee wrote: > A root complex usually consist of a host bridge and multiple P2P bridges, > and someone may express that in the form of a root node with many subnodes > and list all four interrupts for each slot (child node) in the root node > like this: > > pcie-controller { > ... > interrupt-map-mask = <0xf800 0 0 7>; > interrupt-map = <0x0000 0 0 {INTx} &{interrupt parent} ...> > 0x0800 0 0 {INTx} &{interrupt parent} ...>; > > pcie@0,0 { > reg = <0x0000 0 0 0 0>; > ... > }; > > pcie@1,0 { > reg = <0x0800 0 0 0 0>; > ... > }; > }; > > As shown above, we'd like to propagate IRQs from a root port to the devices > in the hierarchy below it in this way. However, it seems that the current > parser couldn't handle such cases and will get something unexpected below: > > pcieport 0000:00:01.0: assign IRQ: got 213 > igb 0000:01:00.0: assign IRQ: got 212 > > There is a device which is connected to 2nd slot, but the port doesn't share > the same IRQ with its downstream devices. The problem here is that, if the > loop found a P2P bridge, it wouldn't check whether the reg property exists > in ppnode or not but just pass the subordinate devfn to of_irq_parse_raw(), > thus the subsequent flow couldn't correctly resolve them. > > Fix this by adding a check to fallback to standard device tree parsing. > > Signed-off-by: Ryder Lee > --- > Please refer to the previous discussion thread: https://patchwork.ozlabs.org/patch/829108/ > --- > drivers/of/of_pci_irq.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) Hi Ryder, from the thread discussion I gather I can drop this series from the PCI queue and you will update the DT as agreed with Ben, that looks like the most reasonable solution to the problem you are facing, please let me know if there is anything I am missing. Thanks, Lorenzo > diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c > index 3a05568..e445866 100644 > --- a/drivers/of/of_pci_irq.c > +++ b/drivers/of/of_pci_irq.c > @@ -86,8 +86,18 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq > out_irq->np = ppnode; > out_irq->args_count = 1; > out_irq->args[0] = pin; > - laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); > - laddr[1] = laddr[2] = cpu_to_be32(0); > + > + if (!dn && ppnode) { > + const __be32 *addr; > + > + addr = of_get_property(ppnode, "reg", NULL); > + if (addr) > + memcpy(laddr, addr, 3); > + } else { > + laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); > + laddr[1] = laddr[2] = cpu_to_be32(0); > + } > + > rc = of_irq_parse_raw(laddr, out_irq); > if (rc) > goto err; > -- > 1.9.1 >