From patchwork Tue Mar 11 20:15:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 3814101 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F77BBF540 for ; Tue, 11 Mar 2014 20:16:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A90120260 for ; Tue, 11 Mar 2014 20:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A397B201FD for ; Tue, 11 Mar 2014 20:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755540AbaCKUQI (ORCPT ); Tue, 11 Mar 2014 16:16:08 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:53408 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755423AbaCKUQG (ORCPT ); Tue, 11 Mar 2014 16:16:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=FZjjDQAPm7NJAJeZllstZpll+lCTL0GcjoRfrMH5kdc=; b=ZGYABnonNMM1emjwwAc9aBmn3aVUJ25KiWwBNcEvLTVJcSldeWu6K+CDmLAqwErqFRL8+64XGSYAtKoElCyrk4skQJq0cftmSCLpJRVADexRVBURGA1eumOxJMiDpbZ4rc3QCKRUGSpIbc0AxJl0reK62DMZHdNF3viXDSKFTlI=; Received: from [10.0.0.161] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1WNT5J-0003iU-PW; Tue, 11 Mar 2014 14:15:33 -0600 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.80) (envelope-from ) id 1WNT5J-0000YL-C4; Tue, 11 Mar 2014 14:15:33 -0600 Date: Tue, 11 Mar 2014 14:15:33 -0600 From: Jason Gunthorpe To: Tim Harvey Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Jingoo Han , Lucas Stach , Mark Rutland , linux-samsung-soc , Richard Zhu , Sascha Hauer , Arnd Bergmann , Stephen Warren , Bjorn Helgaas , Simon Horman , Thierry Reding , Ben Dooks , linux-tegra , Kukjin Kim , Shawn Guo , Grant Likely Subject: Re: [PATCH 1/2] of/irq: Fix irq-mapping in of_irq_parse_raw() Message-ID: <20140311201533.GF31835@obsidianresearch.com> References: <1393944864-28113-1-git-send-email-tharvey@gateworks.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1393944864-28113-1-git-send-email-tharvey@gateworks.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.161 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Mar 04, 2014 at 06:54:24AM -0800, Tim Harvey wrote: > When an interrupt-map contains multiple entries an imap pointer arithmetic > bug can cause only the first entry to be properly evaluated and causes > the out_irq parameters to be incorrect depending on the #interrupt-cells > and #address-cells of the parent interrupt controller. Tim, I took a bit closer look at this for you, and I suspect the root fix is this: (plus the corresponding purge from the .dt files) It looks like the implementation does follow the OF specification: Each mapping entry consists of a 3-tuple of (child-interrupt, interrupt-parent, parent-interrupt). The number of cells for the child-interrupt specifier is determined by the "#address-cells" and "#interrupt-cells"property of this node. The number of cells for the parent-interrupt value is determined by the "#address-cells"and "#interrupt-cells"property values of this node's interrupt-parent. So by specifying interrupt-cells = 3, address-cells = 1, the GIC is requiring 4 DWs for its interrupt specifier. I see no reason why it doesn't have an address-cells = 0 like other interrupt controllers.. Setting #address-cells to 0 in the GIC node should be functionally equivalent to your patch below, since newaddrsize will == 0. Regards, Jason > diff --git a/drivers/of/irq.c b/drivers/of/irq.c > index 9bcf2cf..8829197 100644 > +++ b/drivers/of/irq.c > @@ -237,11 +237,11 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) > /* Check for malformed properties */ > if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS)) > goto fail; > - if (imaplen < (newaddrsize + newintsize)) > + if (imaplen < newintsize) > goto fail; > > - imap += newaddrsize + newintsize; > - imaplen -= newaddrsize + newintsize; > + imap += newintsize; > + imaplen -= newintsize; > > pr_debug(" -> imaplen=%d\n", imaplen); > } --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/Documentation/devicetree/bindings/arm/gic.txt +++ b/Documentation/devicetree/bindings/arm/gic.txt @@ -55,7 +55,6 @@ Example: intc: interrupt-controller@fff11000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <3>; - #address-cells = <1>; interrupt-controller; reg = <0xfff11000 0x1000>, <0xfff10100 0x100>;