Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752173AbbKIRYQ (ORCPT ); Mon, 9 Nov 2015 12:24:16 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:56057 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751587AbbKIRYL convert rfc822-to-8bit (ORCPT ); Mon, 9 Nov 2015 12:24:11 -0500 X-IronPort-AV: E=Sophos;i="5.20,266,1444662000"; d="scan'208";a="199396259" From: Phil Edworthy To: Thierry Reding CC: Bjorn Helgaas , Wolfram Sang , Geert Uytterhoeven , Simon Horman , "linux-pci@vger.kernel.org" , "linux-sh@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ley Foon Tan , Jingoo Han Subject: RE: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Thread-Topic: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Thread-Index: AQHRFhpazS7O4def1E+1x+YbvdM7WJ6T04kggAASxwCAABC7IA== Date: Mon, 9 Nov 2015 17:24:06 +0000 Message-ID: References: <1446542899-25137-1-git-send-email-phil.edworthy@renesas.com> <20151109161115.GA13870@ulmo.nvidia.com> In-Reply-To: <20151109161115.GA13870@ulmo.nvidia.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=phil.edworthy@renesas.com; x-originating-ip: [193.141.220.21] x-microsoft-exchange-diagnostics: 1;PS1PR06MB1179;5:ZNVmDOP1giPqZR9e0B7WrCTDFQgBjZiZexzIHTu6StDxuqDiay804sEkrWCBoPUGSuN9lTkPjRUYBTzo5b/6EvcDP/h013EUwgHf2fII1hclvI/F/BVbV/pruk7rMQUaY0mTmvABUE3oCMv8dJ/0Hw==;24:lIt8UILXKPiCHUI3VpqQJFozI05EX+IT1XiK1C99U1nuuKCRzpkdpBYlJB4e8aWWxMZuagwkCEqvgbeGkoGSOskCVW0HaGHcTBKTda5U9mY=;20:iD0DbNj5qOjmd+PjLrVBii/EWGXQ6VNXborTZtDdzWTCh1eTMCgKMKJKFvVtU4DCDhPiiVl7scKcr3uQr695loviDomYgupw1zHvp0ZwPYXVRVo3mG8V1xGZUuzWHJypAZ5FeJj1r2YsBbkFrkaxtpwklX8a4C++ZDpXGTVnjjU= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1179; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(85106069007906); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046);SRVR:PS1PR06MB1179;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1179; x-forefront-prvs: 0755F54DD9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(189002)(24454002)(122556002)(189998001)(5008740100001)(33656002)(110136002)(5007970100001)(76576001)(2900100001)(5001920100001)(81156007)(19580395003)(11100500001)(2950100001)(101416001)(10400500002)(102836002)(5004730100002)(76176999)(54356999)(77096005)(74316001)(50986999)(5001960100002)(87936001)(5002640100001)(92566002)(5003600100002)(40100003)(105586002)(86362001)(66066001)(106356001)(106116001)(97736004)(19580405001)(575784001)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR06MB1179;H:PS1PR06MB1180.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2015 17:24:06.5494 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1179 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2577 Lines: 59 Hi Thierry, On 09 November 2015 16:11, Thierry wrote: > On Mon, Nov 09, 2015 at 03:20:24PM +0000, Phil Edworthy wrote: > > cc'ing others (Tegra, Altera, Designware) who may have the same bug > > > > On 03 November 2015 09:28, Phil Edworthy wrote: > > > The OF node passed to irq_domain_add_linear() should be a > > > pointer to interrupt controller's device tree node, or NULL, > > > but not the PCI controller's node. > > > > > > This fixes an oops in msi_domain_alloc_irqs() when it tries > > > to call msi_check(). > > > > > > Signed-off-by: Phil Edworthy > > > --- > > > drivers/pci/host/pcie-rcar.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c > > > index 2377bf0..c6fa562 100644 > > > --- a/drivers/pci/host/pcie-rcar.c > > > +++ b/drivers/pci/host/pcie-rcar.c > > > @@ -709,7 +709,7 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) > > > msi->chip.setup_irq = rcar_msi_setup_irq; > > > msi->chip.teardown_irq = rcar_msi_teardown_irq; > > > > > > - msi->domain = irq_domain_add_linear(pcie->dev->of_node, > > > INT_PCI_MSI_NR, > > > + msi->domain = irq_domain_add_linear(NULL, INT_PCI_MSI_NR, > > > &msi_domain_ops, &msi->chip); > > > if (!msi->domain) { > > > dev_err(&pdev->dev, "failed to create IRQ domain\n"); > > On Tegra the PCI controller is in fact the interrupt controller for > MSIs. And looking at the code here it seems like the same would apply to > RCAR. Yes you are correct here. > I'm also slightly confused as to why this would cause ->msi_check() to > fail. The default implementation (msi_domain_ops_check()) doesn't do > anything. > > Also, how is passing in NULL instead of a valid struct device_node * > going to prevent an oops? Perhaps this is one of those reference count > imbalance bugs that have recently been showing up? On arm64 (previously I didn't realise this just affects arm64, not arm), the changes in commit f075915ac0b11 ("PCI/MSI: Drop domain field from msi_controller") and d8a1cb757550 ("PCI/MSI: Let pci_msi_get_domain use struct device::msi_domain") return an uninitialized msi domain that leads to the oops. It appears that these changes assume that msi interrupt controller is separate from the PCI controller. Phil -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/