From patchwork Fri Apr 26 01:47:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 2490591 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AF331DF5B1 for ; Fri, 26 Apr 2013 01:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759908Ab3DZBrv (ORCPT ); Thu, 25 Apr 2013 21:47:51 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:33573 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759807Ab3DZBrH (ORCPT ); Thu, 25 Apr 2013 21:47:07 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3Q1l1xP004069 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Apr 2013 01:47:02 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3Q1l1D4015743 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 26 Apr 2013 01:47:02 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3Q1l1RN019155; Fri, 26 Apr 2013 01:47:01 GMT Received: from linux-siqj.site (/10.132.126.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 25 Apr 2013 18:47:00 -0700 From: Yinghai Lu To: Bjorn Helgaas Cc: David Bulkow , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH] PCI: move down pci_fixup_final for hotplug path Date: Thu, 25 Apr 2013 18:47:07 -0700 Message-Id: <1366940827-15336-1-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <5AA430FFE4486C448003201AC83BC85E03DEA379@EXHQ.corp.stratus.com> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org David found some resource conflict issue after | PCI: Put pci_dev in device tree as early as possible | commit 4f535093cf8f6da8cfda7c36c2c1ecd2e9586ee4 and | USB: Fix handoff when BIOS disables host PCI device | commit: cab928ee1f221c9cc48d6615070fefe2e444384a for usb qirks for hotplug path. After checking pci_fixup_device() with pci_fixup_final, now we have different path for boot path and hotadd path. Boot path: because pci_apply_fix_final_quirks is not set yet, so pci_fixup_device(pci_fixup_final) will be skipped from pci_device_add(). And later pci_apply_final_quirks will be called for all pci devices via fs_initcall. That is after pci_assign_unassign resource. In that case quirk could use bars with problem. Hotadd path: pci_fixup_device(pci_fixup_final) will be executed via pci_device_add(), and that is too early for hotplug path, as pci bar for hot add devices is not assigned yet after commit 4f535093. So we need to move down that for hotplug path, call that in pci_bus_add_devices instead, as at that time just before drivers get attached. And that is simliar calling place for pci_device_add before commit 4f535093 is applied. We should apply this fix for v3.9, but is too late now. so get it into v3.10 and could get into v3.9 stable instead. Reported-by: David Bulkow Tested-by: David Bulkow Signed-off-by: Yinghai Lu --- drivers/pci/bus.c | 1 + drivers/pci/probe.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) -- 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 Index: linux-2.6/drivers/pci/bus.c =================================================================== --- linux-2.6.orig/drivers/pci/bus.c +++ linux-2.6/drivers/pci/bus.c @@ -201,6 +201,7 @@ void pci_bus_add_devices(const struct pc /* Skip already-added devices */ if (dev->is_added) continue; + pci_fixup_device(pci_fixup_final, dev); retval = pci_bus_add_device(dev); if (retval) dev_err(&dev->dev, "Error adding device (%d)\n", Index: linux-2.6/drivers/pci/probe.c =================================================================== --- linux-2.6.orig/drivers/pci/probe.c +++ linux-2.6/drivers/pci/probe.c @@ -1341,7 +1341,6 @@ void pci_device_add(struct pci_dev *dev, list_add_tail(&dev->bus_list, &bus->devices); up_write(&pci_bus_sem); - pci_fixup_device(pci_fixup_final, dev); ret = pcibios_add_device(dev); WARN_ON(ret < 0);