From patchwork Mon Mar 3 23:14:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Inamdar X-Patchwork-Id: 3757751 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 0E236BF13A for ; Mon, 3 Mar 2014 23:14:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 139CE203EB for ; Mon, 3 Mar 2014 23:14:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9891320394 for ; Mon, 3 Mar 2014 23:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755286AbaCCXOu (ORCPT ); Mon, 3 Mar 2014 18:14:50 -0500 Received: from exprod5og117.obsmtp.com ([64.18.0.149]:39779 "HELO exprod5og117.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755436AbaCCXOs (ORCPT ); Mon, 3 Mar 2014 18:14:48 -0500 Received: from mail-ve0-f174.google.com ([209.85.128.174]) (using TLSv1) by exprod5ob117.postini.com ([64.18.4.12]) with SMTP ID DSNKUxUM518RPv7nF26mB2Q39PQ72vlEGasW@postini.com; Mon, 03 Mar 2014 15:14:48 PST Received: by mail-ve0-f174.google.com with SMTP id oz11so3450955veb.19 for ; Mon, 03 Mar 2014 15:14:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=YFESV8ExZ6xv1Dyv5OJ56+KyHbhseJs2vkseCJzUbY8=; b=eHbGOHEqvGPEBK28g5DEckZ1Ee0Cpq4okER2RBrX958EFNk3Nc3Lp73N35AjWzQ0gi LzmMN+dJS2o7GzPyUmxo3UOR6Wvt8yGUgROttzpIqetwUZUwcJLNPNuq3l4Z7J4Rc2Fg ncUJLh1ML+Kd4f6z8jx0a7DkvxRWYrGDFkIDwN0msFoH7adrVkdqZpEje/JFyfNMitES U4DmHFM6h67nSqYGcrYWTwUsp92d8c2DOs3QdFT3GJRTl9hueXzMj2c5A0iuv4hIbG5v HX9P4gj3LMXVmNP5RDx9fD/HyqT+2jja27nJ1fFyrUBEhV6Qghswb/oEmFbGswW4Z+rz EtZA== X-Gm-Message-State: ALoCoQnj5goLqEVtuzYL6J66uAzq04Ll/LK9fbqFu+0/Zx0I8+J0kLMf3ZlbtSbkrt/5ucAvmNUTV/9/cUJPcNY1Du0EysKyurx6Eio/0wbToeBNBQ2qylrfbbQTXsUxyEsf+zWGOLXjEgQ1nnuSxzokfAJeorUjFyWwDYzzkQQt/1N5vE6OYFE= X-Received: by 10.58.178.238 with SMTP id db14mr19047705vec.25.1393888487407; Mon, 03 Mar 2014 15:14:47 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.58.178.238 with SMTP id db14mr19047701vec.25.1393888487301; Mon, 03 Mar 2014 15:14:47 -0800 (PST) Received: by 10.58.66.134 with HTTP; Mon, 3 Mar 2014 15:14:47 -0800 (PST) In-Reply-To: <1393867996-32299-6-git-send-email-Liviu.Dudau@arm.com> References: <1393867996-32299-1-git-send-email-Liviu.Dudau@arm.com> <1393867996-32299-6-git-send-email-Liviu.Dudau@arm.com> Date: Mon, 3 Mar 2014 15:14:47 -0800 Message-ID: Subject: Re: [PATCH v4 5/6] pci: Use parent domain number when allocating child busses. From: Tanmay Inamdar To: Liviu Dudau Cc: linux-pci , Bjorn Helgaas , Catalin Marinas , Will Deacon , linaro-kernel , Benjamin Herrenschmidt , LKML , "devicetree@vger.kernel.org" , LAKML 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Hello Liviu, Thanks for fixing up domain_nr. Now I have moved on further to a new domain_nr related warning dump :-) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- xgene-pcie 1f500000.pcie: (rc) x8 gen-3 link up pci_bus 0001:00: scanning bus pci_setup_device:1101 domain_nr = 1 pci 0001:00:00.0: [e008:e004] type 01 class 0x060400 pci 0001:00:00.0: reg 0x10: [mem 0x4000000000-0x7fffffffff 64bit] pci 0001:00:00.0: calling xgene_pcie_fixup_bridge+0x0/0x80 pci 0001:00:00.0: Hiding X-Gene pci host bridge resources 0001:00:00.0 pci 0001:00:00.0: supports D1 D2 pci_bus 0001:00: fixups for bus pci 0001:00:00.0: scanning [bus 03-03] behind bridge, pass 0 pci 0001:00:00.0: bridge configuration invalid ([bus 03-03]), reconfiguring pci 0001:00:00.0: scanning [bus 00-00] behind bridge, pass 1 ** pci_scan_bridge:855 pci_domain_nr(bus) = 1 ** pci_alloc_child_bus:681 pci_domain_nr(bus) = 1 pci_bus 0001:01: scanning bus pci_setup_device:1101 domain_nr = 0 pci 0000:01:00.0: [15b3:1003] type 00 class 0x020000 pci 0000:01:00.0: reg 0x10: [mem 0x00100000-0x001fffff 64bit] pci 0000:01:00.0: reg 0x18: [mem 0x00800000-0x00ffffff 64bit pref] pci 0000:01:00.0: reg 0x30: [mem 0x01000000-0x010fffff pref] ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at /home/tinamdar/work/open-source/linux/fs/sysfs/dir.c:52 sysfs_warn_dup+0x80/0xc0() sysfs: cannot create duplicate filename '/bus/pci/devices/0000:01:00.0' Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc5+ #40 Call trace: [] dump_backtrace+0x0/0x140 [] show_stack+0x10/0x20 [] dump_stack+0x74/0xc4 [] warn_slowpath_common+0x84/0xc0 [] warn_slowpath_fmt+0x4c/0x60 [] sysfs_warn_dup+0x7c/0xc0 [] sysfs_do_create_link_sd.isra.2+0xf4/0x100 [] sysfs_create_link+0x1c/0x40 [] bus_add_device+0x110/0x1c0 [] device_add+0x31c/0x520 [] pci_device_add+0xec/0x140 [] pci_scan_single_device+0x98/0xe0 [] pci_scan_slot+0x48/0x120 [] pci_scan_child_bus+0x48/0x140 [] pci_scan_bridge+0x4ec/0x5e0 [] pci_scan_child_bus+0xa8/0x140 [] pci_rescan_bus+0x10/0x40 [] xgene_pcie_probe_bridge+0x660/0x72c [] platform_drv_probe+0x20/0x60 [] really_probe+0xf0/0x220 [] __driver_attach+0xa0/0xc0 [] bus_for_each_dev+0x54/0xa0 [] driver_attach+0x1c/0x40 [] bus_add_driver+0x14c/0x220 [] driver_register+0x5c/0x120 [] __platform_driver_register+0x5c/0x80 [] xgene_pcie_driver_init+0x14/0x20 [] do_one_initcall+0xe0/0x160 [] kernel_init_freeable+0x134/0x1d8 [] kernel_init+0xc/0xe0 ---[ end trace 3ee052d463aab7f3 ]--- ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at /home/tinamdar/work/open-source/linux/drivers/pci/probe.c:1380 pci_device_add+0x128/0x140() ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I have made a small fix above your patch. After the fix is applied, dumps are gone and the enumeration finishes up smoothly for all the ports. Since the change is small, just pasting it here. Please review and apply if it's clean. pci_set_bus_speed(child); Thanks, Tanmay On Mon, Mar 3, 2014 at 9:33 AM, Liviu Dudau wrote: > pci_alloc_child_bus() uses the newly allocated child bus to figure > out the domain number that is going to use for setting the device > name. A better option is to use the parent bus domain number. > > Signed-off-by: Liviu Dudau > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 26237a0..a12cda5 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -677,7 +677,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, > * now as the parent is not properly set up yet. > */ > child->dev.class = &pcibus_class; > - dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr); > + dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(parent), busnr); > > /* > * Set up the primary, secondary and subordinate > -- > 1.9.0 > --- 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 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a12cda5..aac8366 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -693,7 +693,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, } child->self = bridge; - child->bridge = get_device(&bridge->dev); + child->bridge = get_device(parent->bridge); child->dev.parent = child->bridge; pci_set_bus_of_node(child);