Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/133205/?format=api
https://patches.dpdk.org/api/patches/133205/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20231024020021.116278-1-wenwux.ma@intel.com/", "project": { "id": 1, "url": "https://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": "<20231024020021.116278-1-wenwux.ma@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231024020021.116278-1-wenwux.ma@intel.com", "date": "2023-10-24T02:00:21", "name": "[v5] bus/pci: fix legacy device IO port map in secondary process", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "baebf46c100195dd3d71abea4912c720520b7828", "submitter": { "id": 2163, "url": "https://patches.dpdk.org/api/people/2163/?format=api", "name": "Ma, WenwuX", "email": "wenwux.ma@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20231024020021.116278-1-wenwux.ma@intel.com/mbox/", "series": [ { "id": 29960, "url": "https://patches.dpdk.org/api/series/29960/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29960", "date": "2023-10-24T02:00:21", "name": "[v5] bus/pci: fix legacy device IO port map in secondary process", "version": 5, "mbox": "https://patches.dpdk.org/series/29960/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/133205/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/133205/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 940FD431EB;\n\tTue, 24 Oct 2023 04:00:40 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 21C51402CE;\n\tTue, 24 Oct 2023 04:00:40 +0200 (CEST)", "from mgamail.intel.com (mgamail.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id DF50E40298;\n Tue, 24 Oct 2023 04:00:38 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Oct 2023 19:00:37 -0700", "from unknown (HELO dut220..) ([10.239.252.220])\n by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Oct 2023 19:00:33 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1698112839; x=1729648839;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=kRB9p+M8jALDt+gUYP4jQQHG7sPRbtS6Chhp+8tFXL0=;\n b=hSJESQnqtVZ+AyNrM9AWVtKuTGSM9nGdAOR4qaVtSKtu7pE5GLVL3rqp\n 0R+rTLDcN8MBhimldu6mV8xHCwQmtLlmu2zMvJJ7kuGP0JcULaQ43EsBB\n tOlzMv6Hyss7yK7PcugCCFujQfxDstAToOss28659i281zthBWOzFCBN2\n KEekE+u4iZ1+YgnaXftEGHvo0zIM9OeQqAW6kR/kCKmYj2rrWSgxZKz2E\n RYcUzOk0wZZ01GybYtaPkOLGDl3GWkYmYcOjEsw5TBbQhHRton8pfgD47\n hVok9jLrXNFEpoWwC72dDFadOzTYG6FaunxAj8RL/V7VAbmLP75UZethZ g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10872\"; a=\"389816568\"", "E=Sophos;i=\"6.03,246,1694761200\"; d=\"scan'208\";a=\"389816568\"", "E=McAfee;i=\"6600,9927,10872\"; a=\"761947562\"", "E=Sophos;i=\"6.03,246,1694761200\"; d=\"scan'208\";a=\"761947562\"" ], "X-ExtLoop1": "1", "From": "Wenwu Ma <wenwux.ma@intel.com>", "To": "nipun.gupta@amd.com,\n\tanatoly.burakov@intel.com,\n\tdev@dpdk.org", "Cc": "david.marchand@redhat.com, maxime.coquelin@redhat.com,\n linglix.chen@intel.com, Wenwu Ma <wenwux.ma@intel.com>, stable@dpdk.org", "Subject": "[PATCH v5] bus/pci: fix legacy device IO port map in secondary\n process", "Date": "Tue, 24 Oct 2023 10:00:21 +0800", "Message-Id": "<20231024020021.116278-1-wenwux.ma@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230807015820.1329972-1-wenwux.ma@intel.com>", "References": "<20230807015820.1329972-1-wenwux.ma@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "When doing IO port mapping for legacy device in secondary process, the\nregion information is missing, so, we need to refill it.\n\nFixes: 4b741542ecde (\"bus/pci: avoid depending on private kernel value\")\nCc: stable@dpdk.org\n\nSigned-off-by: Wenwu Ma <wenwux.ma@intel.com>\n---\nv5:\n - adding checks to vfio setup\nv4:\n - adjusting commit log\nv3:\n - adjusting variable settings\nv2:\n - add release of device in pci_vfio_ioport_unmap\n\n---\n drivers/bus/pci/linux/pci_vfio.c | 52 ++++++++++++++++++++++++++++++--\n 1 file changed, 50 insertions(+), 2 deletions(-)", "diff": "diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex 3f3201daf2..a1f7cc2421 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -1230,6 +1230,36 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,\n \t\treturn -1;\n \t}\n \n+\tif (rte_eal_process_type() == RTE_PROC_SECONDARY) {\n+\t\tstruct vfio_device_info device_info = { .argsz = sizeof(device_info) };\n+\t\tchar pci_addr[PATH_MAX];\n+\t\tint vfio_dev_fd;\n+\t\tstruct rte_pci_addr *loc = &dev->addr;\n+\t\t/* store PCI address string */\n+\t\tsnprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,\n+\t\t\t\tloc->domain, loc->bus, loc->devid, loc->function);\n+\n+\t\tvfio_dev_fd = rte_intr_dev_fd_get(dev->intr_handle);\n+\t\tif (vfio_dev_fd < 0)\n+\t\t\treturn -1;\n+\n+\t\tif (vfio_dev_fd == 0) {\n+\t\t\tif (rte_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr,\n+\t\t\t\t\t&vfio_dev_fd, &device_info))\n+\t\t\t\treturn -1;\n+\n+\t\t\t/* we need save vfio_dev_fd, so it can be used during release */\n+\t\t\tif (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd))\n+\t\t\t\treturn -1;\n+\t\t} else {\n+\t\t\tif (ioctl(vfio_dev_fd, VFIO_DEVICE_GET_INFO, &device_info))\n+\t\t\t\treturn -1;\n+\t\t}\n+\n+\t\tif (pci_vfio_fill_regions(dev, vfio_dev_fd, &device_info))\n+\t\t\treturn -1;\n+\t}\n+\n \tif (pci_vfio_get_region(dev, bar, &size, &offset) != 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot get offset of region %d.\\n\", bar);\n \t\treturn -1;\n@@ -1277,8 +1307,26 @@ pci_vfio_ioport_write(struct rte_pci_ioport *p,\n int\n pci_vfio_ioport_unmap(struct rte_pci_ioport *p)\n {\n-\tRTE_SET_USED(p);\n-\treturn -1;\n+\tchar pci_addr[PATH_MAX] = {0};\n+\tstruct rte_pci_addr *loc = &p->dev->addr;\n+\tint ret, vfio_dev_fd;\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+\tvfio_dev_fd = rte_intr_dev_fd_get(p->dev->intr_handle);\n+\tif (vfio_dev_fd < 0)\n+\t\treturn -1;\n+\n+\tret = rte_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,\n+\t\t\t\t vfio_dev_fd);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot release VFIO device\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n }\n \n int\n", "prefixes": [ "v5" ] }{ "id": 133205, "url": "