{"id":806582,"url":"http://patchwork.ozlabs.org/api/1.0/patches/806582/?format=json","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.0/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<1503927530-26076-1-git-send-email-sironi@amazon.de>","date":"2017-08-28T13:38:49","name":"[1/2] pci: Cache the VF device ID in the SR-IOV structure","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b570b37f1806396f2acd4d26f538bd362fc7e32b","submitter":{"id":72242,"url":"http://patchwork.ozlabs.org/api/1.0/people/72242/?format=json","name":"Filippo Sironi","email":"sironi@amazon.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/1503927530-26076-1-git-send-email-sironi@amazon.de/mbox/","series":[{"id":171,"url":"http://patchwork.ozlabs.org/api/1.0/series/171/?format=json","date":"2017-08-28T13:38:50","name":"[1/2] pci: Cache the VF device ID in the SR-IOV structure","version":1,"mbox":"http://patchwork.ozlabs.org/series/171/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806582/checks/","tags":{},"headers":{"Return-Path":"<linux-pci-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=amazon.de header.i=@amazon.de\n\theader.b=\"cnmHoREb\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgtDb284Xz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 23:39:59 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751429AbdH1Njw (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 28 Aug 2017 09:39:52 -0400","from smtp-fw-4101.amazon.com ([72.21.198.25]:16001 \"EHLO\n\tsmtp-fw-4101.amazon.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751349AbdH1Njk (ORCPT\n\t<rfc822; linux-pci@vger.kernel.org>); Mon, 28 Aug 2017 09:39:40 -0400","from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO\n\temail-inbound-relay-2a-e7be2041.us-west-2.amazon.com) ([10.43.8.6])\n\tby smtp-border-fw-out-4101.iad4.amazon.com with\n\tESMTP/TLS/DHE-RSA-AES256-SHA; 28 Aug 2017 13:39:18 +0000","from uf8b156e456a5587c9af4.ant.amazon.com\n\t(pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70])\n\tby email-inbound-relay-2a-e7be2041.us-west-2.amazon.com\n\t(8.14.7/8.14.7) with ESMTP id v7SDd89h084216\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tMon, 28 Aug 2017 13:39:09 GMT","from uf8b156e456a5587c9af4.ant.amazon.com (localhost [127.0.0.1])\n\tby uf8b156e456a5587c9af4.ant.amazon.com (8.15.2/8.15.2/Debian-3)\n\twith ESMTP id v7SDd73Q026139; Mon, 28 Aug 2017 15:39:07 +0200","(from sironi@localhost)\n\tby uf8b156e456a5587c9af4.ant.amazon.com (8.15.2/8.15.2/Submit) id\n\tv7SDd7pw026136; Mon, 28 Aug 2017 15:39:07 +0200"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209;\n\tt=1503927580; x=1535463580;\n\th=from:to:cc:subject:date:message-id;\n\tbh=+5zRcAiI4o1mIsNejHvCMdiHEbpqsZI8ORUuhSp4778=;\n\tb=cnmHoREbECuOlqWk9eRUQKtiuGpFmfAh5er7RWCudaHrrYo28PcMgu1d\n\trbRgbWnf9e08hcxgC07Jcn32xtnAvV0DTlEQO7KISETqc8bc1Aof/G+ww\n\tYyFdTZSWnFIFMV7K9HA6ZiuYrJst1K32a9v0TopbdBUiuLRjECAYwMe8M Q=;","X-IronPort-AV":"E=Sophos;i=\"5.41,441,1498521600\"; d=\"scan'208\";a=\"680168834\"","From":"Filippo Sironi <sironi@amazon.de>","To":"linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org","Cc":"Filippo Sironi <sironi@amazon.de>","Subject":"[PATCH 1/2] pci: Cache the VF device ID in the SR-IOV structure","Date":"Mon, 28 Aug 2017 15:38:49 +0200","Message-Id":"<1503927530-26076-1-git-send-email-sironi@amazon.de>","X-Mailer":"git-send-email 2.7.4","Sender":"linux-pci-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-pci.vger.kernel.org>","X-Mailing-List":"linux-pci@vger.kernel.org"},"content":"... and use it instead of reading it over and over from the PF config\nspace capability.\n\nSigned-off-by: Filippo Sironi <sironi@amazon.de>\nCc: linux-pci@vger.kernel.org\nCc: linux-kernel@vger.kernel.org\n---\n drivers/pci/iov.c | 5 +++--\n drivers/pci/pci.h | 1 +\n 2 files changed, 4 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c\nindex 120485d6f352..e8f7eafaba6a 100644\n--- a/drivers/pci/iov.c\n+++ b/drivers/pci/iov.c\n@@ -134,7 +134,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)\n \n \tvirtfn->devfn = pci_iov_virtfn_devfn(dev, id);\n \tvirtfn->vendor = dev->vendor;\n-\tpci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);\n+\tvirtfn->device = iov->vf_did;\n \trc = pci_setup_device(virtfn);\n \tif (rc)\n \t\tgoto failed0;\n@@ -448,6 +448,7 @@ static int sriov_init(struct pci_dev *dev, int pos)\n \tiov->nres = nres;\n \tiov->ctrl = ctrl;\n \tiov->total_VFs = total;\n+\tpci_read_config_word(dev, pos + PCI_SRIOV_VF_DID, &iov->vf_did);\n \tiov->pgsz = pgsz;\n \tiov->self = dev;\n \tiov->drivers_autoprobe = true;\n@@ -723,7 +724,7 @@ int pci_vfs_assigned(struct pci_dev *dev)\n \t * determine the device ID for the VFs, the vendor ID will be the\n \t * same as the PF so there is no need to check for that one\n \t */\n-\tpci_read_config_word(dev, dev->sriov->pos + PCI_SRIOV_VF_DID, &dev_id);\n+\tdev_id = dev->sriov->vf_did;\n \n \t/* loop through all the VFs to see if we own any that are assigned */\n \tvfdev = pci_get_device(dev->vendor, dev_id, NULL);\ndiff --git a/drivers/pci/pci.h b/drivers/pci/pci.h\nindex 22e061738c6f..a7270e11e1ef 100644\n--- a/drivers/pci/pci.h\n+++ b/drivers/pci/pci.h\n@@ -262,6 +262,7 @@ struct pci_sriov {\n \tu16 num_VFs;\t\t/* number of VFs available */\n \tu16 offset;\t\t/* first VF Routing ID offset */\n \tu16 stride;\t\t/* following VF stride */\n+\tu16 vf_did;\t\t/* VF device ID */\n \tu32 pgsz;\t\t/* page size for BAR alignment */\n \tu8 link;\t\t/* Function Dependency Link */\n \tu8 max_VF_buses;\t/* max buses consumed by VFs */\n","prefixes":["1/2"]}