Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/57390/?format=api
http://patches.dpdk.org/api/patches/57390/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1564740872-27225-1-git-send-email-david.marchand@redhat.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": "<1564740872-27225-1-git-send-email-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1564740872-27225-1-git-send-email-david.marchand@redhat.com", "date": "2019-08-02T10:14:32", "name": "bus/pci: always check IOMMU capabilities", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "316e9cef6d13a4727907b727558ed1d03889f413", "submitter": { "id": 1173, "url": "http://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.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/1564740872-27225-1-git-send-email-david.marchand@redhat.com/mbox/", "series": [ { "id": 5892, "url": "http://patches.dpdk.org/api/series/5892/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5892", "date": "2019-08-02T10:14:32", "name": "bus/pci: always check IOMMU capabilities", "version": 1, "mbox": "http://patches.dpdk.org/series/5892/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/57390/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/57390/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 DF8F31C236;\n\tFri, 2 Aug 2019 12:14:42 +0200 (CEST)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id 0DD6D1C234\n\tfor <dev@dpdk.org>; Fri, 2 Aug 2019 12:14:42 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5D3CC3082A6C;\n\tFri, 2 Aug 2019 10:14:41 +0000 (UTC)", "from dmarchan.remote.csb (ovpn-204-235.brq.redhat.com\n\t[10.40.204.235])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id EA8795D712;\n\tFri, 2 Aug 2019 10:14:39 +0000 (UTC)" ], "From": "David Marchand <david.marchand@redhat.com>", "To": "dev@dpdk.org", "Cc": "anatoly.burakov@intel.com,\n\ttyos@jp.ibm.com,\n\tdrc@linux.vnet.ibm.com", "Date": "Fri, 2 Aug 2019 12:14:32 +0200", "Message-Id": "<1564740872-27225-1-git-send-email-david.marchand@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.45]); Fri, 02 Aug 2019 10:14:41 +0000 (UTC)", "Subject": "[dpdk-dev] [PATCH] bus/pci: always check IOMMU capabilities", "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": "IOMMU capabilities won't change and must be checked even if no PCI device\nseem to be supported yet when EAL initialised.\n\nThis is to accommodate with SPDK that registers its drivers after\nrte_eal_init(), especially on PPC platform where the IOMMU does not\nsupport VA.\n\nFixes: 703458e19c16 (\"bus/pci: consider only usable devices for IOVA mode\")\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n drivers/bus/pci/bsd/pci.c | 6 ++++++\n drivers/bus/pci/linux/pci.c | 25 ++++++-------------------\n drivers/bus/pci/pci_common.c | 16 +++++++++++++++-\n drivers/bus/pci/private.h | 5 ++++-\n 4 files changed, 31 insertions(+), 21 deletions(-)", "diff": "diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c\nindex a2de709..8f07ed9 100644\n--- a/drivers/bus/pci/bsd/pci.c\n+++ b/drivers/bus/pci/bsd/pci.c\n@@ -376,6 +376,12 @@ error:\n \treturn -1;\n }\n \n+bool\n+pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)\n+{\n+\treturn false;\n+}\n+\n enum rte_iova_mode\n pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,\n \t\t const struct rte_pci_device *pdev)\ndiff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c\nindex f4fb742..43debaa 100644\n--- a/drivers/bus/pci/linux/pci.c\n+++ b/drivers/bus/pci/linux/pci.c\n@@ -498,8 +498,8 @@ error:\n }\n \n #if defined(RTE_ARCH_X86)\n-static bool\n-pci_one_device_iommu_support_va(const struct rte_pci_device *dev)\n+bool\n+pci_device_iommu_support_va(const struct rte_pci_device *dev)\n {\n #define VTD_CAP_MGAW_SHIFT\t16\n #define VTD_CAP_MGAW_MASK\t(0x3fULL << VTD_CAP_MGAW_SHIFT)\n@@ -546,14 +546,14 @@ pci_one_device_iommu_support_va(const struct rte_pci_device *dev)\n \treturn true;\n }\n #elif defined(RTE_ARCH_PPC_64)\n-static bool\n-pci_one_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)\n+bool\n+pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)\n {\n \treturn false;\n }\n #else\n-static bool\n-pci_one_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)\n+bool\n+pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)\n {\n \treturn true;\n }\n@@ -564,7 +564,6 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,\n \t\t const struct rte_pci_device *pdev)\n {\n \tenum rte_iova_mode iova_mode = RTE_IOVA_DC;\n-\tstatic int iommu_no_va = -1;\n \n \tswitch (pdev->kdrv) {\n \tcase RTE_KDRV_VFIO: {\n@@ -595,18 +594,6 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,\n \t\t\tiova_mode = RTE_IOVA_VA;\n \t\tbreak;\n \t}\n-\n-\tif (iova_mode != RTE_IOVA_PA) {\n-\t\t/*\n-\t\t * We can check this only once, because the IOMMU hardware is\n-\t\t * the same for all of them.\n-\t\t */\n-\t\tif (iommu_no_va == -1)\n-\t\t\tiommu_no_va = pci_one_device_iommu_support_va(pdev)\n-\t\t\t\t\t? 0 : 1;\n-\t\tif (iommu_no_va != 0)\n-\t\t\tiova_mode = RTE_IOVA_PA;\n-\t}\n \treturn iova_mode;\n }\n \ndiff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex 9794552..8d1d6ab 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -616,8 +616,16 @@ rte_pci_get_iommu_class(void)\n \tconst struct rte_pci_driver *drv;\n \tbool devices_want_va = false;\n \tbool devices_want_pa = false;\n+\tstatic int iommu_no_va = -1;\n \n \tFOREACH_DEVICE_ON_PCIBUS(dev) {\n+\t\t/*\n+\t\t * We can check this only once, because the IOMMU hardware is\n+\t\t * the same for all of them.\n+\t\t */\n+\t\tif (iommu_no_va == -1)\n+\t\t\tiommu_no_va = pci_device_iommu_support_va(dev)\n+\t\t\t\t\t? 0 : 1;\n \t\tif (pci_ignore_device(dev))\n \t\t\tcontinue;\n \t\tif (dev->kdrv == RTE_KDRV_UNKNOWN ||\n@@ -643,7 +651,13 @@ rte_pci_get_iommu_class(void)\n \t\t\t\tdevices_want_va = true;\n \t\t}\n \t}\n-\tif (devices_want_va && !devices_want_pa) {\n+\tif (iommu_no_va == 1) {\n+\t\tiova_mode = RTE_IOVA_PA;\n+\t\tif (devices_want_va) {\n+\t\t\tRTE_LOG(WARNING, EAL, \"Some devices want 'VA' but because IOMMU does not support 'VA'.\\n\");\n+\t\t\tRTE_LOG(WARNING, EAL, \"The devices that want 'VA' won't initialize.\\n\");\n+\t\t}\n+\t} else if (devices_want_va && !devices_want_pa) {\n \t\tiova_mode = RTE_IOVA_VA;\n \t} else if (devices_want_pa && !devices_want_va) {\n \t\tiova_mode = RTE_IOVA_PA;\ndiff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h\nindex 8a55240..a205d4d 100644\n--- a/drivers/bus/pci/private.h\n+++ b/drivers/bus/pci/private.h\n@@ -173,9 +173,12 @@ rte_pci_match(const struct rte_pci_driver *pci_drv,\n \t const struct rte_pci_device *pci_dev);\n \n /**\n- * OS specific callback for rte_pci_get_iommu_class\n+ * OS specific callbacks for rte_pci_get_iommu_class\n *\n */\n+bool\n+pci_device_iommu_support_va(const struct rte_pci_device *dev);\n+\n enum rte_iova_mode\n pci_device_iova_mode(const struct rte_pci_driver *pci_drv,\n \t\t const struct rte_pci_device *pci_dev);\n", "prefixes": [] }{ "id": 57390, "url": "