From patchwork Wed May 20 09:11:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 24875 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4K9BU0x014514 for ; Wed, 20 May 2009 09:11:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753735AbZETJL1 (ORCPT ); Wed, 20 May 2009 05:11:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754167AbZETJL1 (ORCPT ); Wed, 20 May 2009 05:11:27 -0400 Received: from mga14.intel.com ([143.182.124.37]:64421 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753735AbZETJL1 (ORCPT ); Wed, 20 May 2009 05:11:27 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 20 May 2009 02:11:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.41,220,1241420400"; d="scan'208";a="144888527" Received: from yzhao-otc.sh.intel.com ([10.239.48.165]) by azsmga001.ch.intel.com with ESMTP; 20 May 2009 02:11:17 -0700 From: Yu Zhao To: jbarnes@virtuousgeek.org Cc: linux-pci@vger.kernel.org, Yu Zhao Subject: [PATCH] PCI: fix SR-IOV function dependency link problem Date: Wed, 20 May 2009 17:11:57 +0800 Message-Id: <1242810717-1436-1-git-send-email-yu.zhao@intel.com> X-Mailer: git-send-email 1.6.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org PCIe root complex integrated endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number plus the value from function dependency link register. Normal endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software's perspective). Signed-off-by: Yu Zhao --- drivers/pci/iov.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b497daa..e87fe95 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -487,6 +487,8 @@ found: iov->self = dev; pci_read_config_dword(dev, pos + PCI_SRIOV_CAP, &iov->cap); pci_read_config_byte(dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link); + if (dev->pcie_type == PCI_EXP_TYPE_RC_END) + iov->link = PCI_DEVFN(PCI_SLOT(dev->devfn), iov->link); if (pdev) iov->dev = pci_dev_get(pdev);