Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/42578/?format=api
http://patches.dpdk.org/api/patches/42578/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180709033706.27858-4-qi.z.zhang@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20180709033706.27858-4-qi.z.zhang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180709033706.27858-4-qi.z.zhang@intel.com", "date": "2018-07-09T03:36:50", "name": "[v10,03/19] bus/pci: enable vfio unmap resource for secondary", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "38b9f1095eebb617666e96a7cab179e6f3e49567", "submitter": { "id": 504, "url": "http://patches.dpdk.org/api/people/504/?format=api", "name": "Qi Zhang", "email": "qi.z.zhang@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180709033706.27858-4-qi.z.zhang@intel.com/mbox/", "series": [ { "id": 467, "url": "http://patches.dpdk.org/api/series/467/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=467", "date": "2018-07-09T03:36:47", "name": "enable hotplug on multi-process", "version": 10, "mbox": "http://patches.dpdk.org/series/467/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/42578/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/42578/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E4ABF1B1ED;\n\tMon, 9 Jul 2018 05:36:45 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id CAF351B05B\n\tfor <dev@dpdk.org>; Mon, 9 Jul 2018 05:36:39 +0200 (CEST)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Jul 2018 20:36:37 -0700", "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby fmsmga005.fm.intel.com with ESMTP; 08 Jul 2018 20:36:33 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,328,1526367600\"; d=\"scan'208\";a=\"243632712\"", "From": "Qi Zhang <qi.z.zhang@intel.com>", "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com", "Cc": "konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, \n\tferruh.yigit@intel.com, benjamin.h.shelton@intel.com,\n\tnarender.vangati@intel.com, Qi Zhang <qi.z.zhang@intel.com>", "Date": "Mon, 9 Jul 2018 11:36:50 +0800", "Message-Id": "<20180709033706.27858-4-qi.z.zhang@intel.com>", "X-Mailer": "git-send-email 2.13.6", "In-Reply-To": "<20180709033706.27858-1-qi.z.zhang@intel.com>", "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180709033706.27858-1-qi.z.zhang@intel.com>", "Subject": "[dpdk-dev] [PATCH v10 03/19] bus/pci: enable vfio unmap resource\n\tfor secondary", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Subroutine to unmap VFIO resource is shared by secondary and\nprimary, and it does not work on the secondary process.\nThe patch adds a dedicate function to handle the situation\nwhen a device is unmapped on a secondary process.\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n drivers/bus/pci/linux/pci_vfio.c | 75 ++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 73 insertions(+), 2 deletions(-)", "diff": "diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex dd25c3542..72481ac45 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -595,6 +595,9 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)\n \t\tdev->mem_resource[i].addr = maps[i].addr;\n \t}\n \n+\t/* we need save vfio_dev_fd, so it can be used during release */\n+\tdev->intr_handle.vfio_dev_fd = vfio_dev_fd;\n+\n \treturn 0;\n err_vfio_dev_fd:\n \tclose(vfio_dev_fd);\n@@ -614,8 +617,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev)\n \t\treturn pci_vfio_map_resource_secondary(dev);\n }\n \n-int\n-pci_vfio_unmap_resource(struct rte_pci_device *dev)\n+static int\n+pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)\n {\n \tchar pci_addr[PATH_MAX] = {0};\n \tstruct rte_pci_addr *loc = &dev->addr;\n@@ -687,6 +690,74 @@ pci_vfio_unmap_resource(struct rte_pci_device *dev)\n \treturn 0;\n }\n \n+static int\n+pci_vfio_unmap_resource_secondary(struct rte_pci_device *dev)\n+{\n+\tchar pci_addr[PATH_MAX] = {0};\n+\tstruct rte_pci_addr *loc = &dev->addr;\n+\tint i, ret;\n+\tstruct mapped_pci_resource *vfio_res = NULL;\n+\tstruct mapped_pci_res_list *vfio_res_list;\n+\n+\tstruct pci_map *maps;\n+\n+\t/* store PCI address string */\n+\tsnprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,\n+\t\t\tloc->domain, loc->bus, loc->devid, loc->function);\n+\n+\tret = rte_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,\n+\t\t\t\t dev->intr_handle.vfio_dev_fd);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\"%s(): cannot release device\\n\", __func__);\n+\t\treturn ret;\n+\t}\n+\n+\tvfio_res_list =\n+\t\tRTE_TAILQ_CAST(rte_vfio_tailq.head, mapped_pci_res_list);\n+\t/* Get vfio_res */\n+\tTAILQ_FOREACH(vfio_res, vfio_res_list, next) {\n+\t\tif (pci_addr_cmp(&vfio_res->pci_addr, &dev->addr))\n+\t\t\tcontinue;\n+\t\tbreak;\n+\t}\n+\t/* if we haven't found our tailq entry, something's wrong */\n+\tif (vfio_res == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \" %s cannot find TAILQ entry for PCI device!\\n\",\n+\t\t\t\tpci_addr);\n+\t\treturn -1;\n+\t}\n+\n+\t/* unmap BARs */\n+\tmaps = vfio_res->maps;\n+\n+\tRTE_LOG(INFO, EAL, \"Releasing pci mapped resource for %s\\n\",\n+\t\tpci_addr);\n+\tfor (i = 0; i < (int) vfio_res->nb_maps; i++) {\n+\n+\t\t/*\n+\t\t * We do not need to be aware of MSI-X table BAR mappings as\n+\t\t * when mapping. Just using current maps array is enough\n+\t\t */\n+\t\tif (maps[i].addr) {\n+\t\t\tRTE_LOG(INFO, EAL, \"Calling pci_unmap_resource for %s at %p\\n\",\n+\t\t\t\tpci_addr, maps[i].addr);\n+\t\t\tpci_unmap_resource(maps[i].addr, maps[i].size);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+pci_vfio_unmap_resource(struct rte_pci_device *dev)\n+{\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\treturn pci_vfio_unmap_resource_primary(dev);\n+\telse\n+\t\treturn pci_vfio_unmap_resource_secondary(dev);\n+}\n+\n int\n pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,\n \t\t struct rte_pci_ioport *p)\n", "prefixes": [ "v10", "03/19" ] }{ "id": 42578, "url": "