From patchwork Tue May 14 02:28:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 2562551 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 EA9DFDF2E5 for ; Tue, 14 May 2013 02:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756023Ab3ENC3S (ORCPT ); Mon, 13 May 2013 22:29:18 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:50351 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756175Ab3ENC2y (ORCPT ); Mon, 13 May 2013 22:28:54 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r4E2Sldp008848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 May 2013 02:28:48 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4E2SlcX012824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 14 May 2013 02:28:48 GMT Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4E2Sl6b014901; Tue, 14 May 2013 02:28:47 GMT Received: from linux-siqj.site (/75.36.254.174) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 13 May 2013 19:28:47 -0700 From: Yinghai Lu To: Bjorn Helgaas Cc: Gu Zheng , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH 5/7] PCI, ACPI: Don't glue ACPI dev with pci VFs Date: Mon, 13 May 2013 19:28:24 -0700 Message-Id: <1368498506-25857-6-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1368498506-25857-1-git-send-email-yinghai@kernel.org> References: <1368498506-25857-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When sriov is enabled, VF could just start after PF in pci tree. like c1:00.0 will be PF, and c1:00.1 and after will be VF. acpi do have dev with same ADR. that will make them get glued wrongly. Skip that if it is virtfn. Also need to set is_virtfn before pci_device_add(), as gluing is triggered by device_add(). Signed-off-by: Yinghai Lu --- drivers/pci/iov.c | 6 +++--- drivers/pci/pci-acpi.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) -- 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/iov.c =================================================================== --- linux-2.6.orig/drivers/pci/iov.c +++ linux-2.6/drivers/pci/iov.c @@ -110,12 +110,12 @@ static int virtfn_add(struct pci_dev *de if (reset) __pci_reset_function(virtfn); - pci_device_add(virtfn, virtfn->bus); - mutex_unlock(&iov->dev->sriov->lock); - virtfn->physfn = pci_dev_get(dev); virtfn->is_virtfn = 1; + pci_device_add(virtfn, virtfn->bus); + mutex_unlock(&iov->dev->sriov->lock); + rc = pci_bus_add_device(virtfn); sprintf(buf, "virtfn%u", id); rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf); Index: linux-2.6/drivers/pci/pci-acpi.c =================================================================== --- linux-2.6.orig/drivers/pci/pci-acpi.c +++ linux-2.6/drivers/pci/pci-acpi.c @@ -321,6 +321,10 @@ static int acpi_pci_find_device(struct d u64 addr; pci_dev = to_pci_dev(dev); + /* don't mix vf with real pci device */ + if (pci_dev->is_virtfn) + return -ENODEV; + /* Please ref to ACPI spec for the syntax of _ADR */ addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr);