get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/134739/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 134739,
    "url": "http://patches.dpdk.org/api/patches/134739/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231130191844.612699-1-drc@linux.vnet.ibm.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": "<20231130191844.612699-1-drc@linux.vnet.ibm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231130191844.612699-1-drc@linux.vnet.ibm.com",
    "date": "2023-11-30T19:18:44",
    "name": "[v4] eal: verify mmu type for DPDK support (ppc64le)",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3d5f5e7bc0fe2542ec9ab8458834e071a729ff83",
    "submitter": {
        "id": 1256,
        "url": "http://patches.dpdk.org/api/people/1256/?format=api",
        "name": "David Christensen",
        "email": "drc@linux.vnet.ibm.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231130191844.612699-1-drc@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 30426,
            "url": "http://patches.dpdk.org/api/series/30426/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30426",
            "date": "2023-11-30T19:18:44",
            "name": "[v4] eal: verify mmu type for DPDK support (ppc64le)",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/30426/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/134739/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/134739/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 E33AE43414;\n\tThu, 30 Nov 2023 20:19:09 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6E34C42EFD;\n\tThu, 30 Nov 2023 20:19:09 +0100 (CET)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1]) by mails.dpdk.org (Postfix) with ESMTP id 5519942EF9\n for <dev@dpdk.org>; Thu, 30 Nov 2023 20:19:08 +0100 (CET)",
            "from pps.filterd (m0353727.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 3AUIqWjX023712; Thu, 30 Nov 2023 19:19:04 GMT",
            "from pps.reinject (localhost [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uq022rsj5-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 30 Nov 2023 19:19:03 +0000",
            "from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1])\n by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AUIrkX8027480;\n Thu, 30 Nov 2023 19:19:01 GMT",
            "from ppma23.wdc07v.mail.ibm.com\n (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uq022rsft-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 30 Nov 2023 19:19:01 +0000",
            "from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1])\n by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id\n 3AUHJB7m029890; Thu, 30 Nov 2023 19:18:55 GMT",
            "from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9])\n by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ukvrm05h8-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 30 Nov 2023 19:18:55 +0000",
            "from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com\n [10.241.53.103])\n by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 3AUJIsiv44106390\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Thu, 30 Nov 2023 19:18:54 GMT",
            "from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 9525C58072;\n Thu, 30 Nov 2023 19:18:54 +0000 (GMT)",
            "from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 2157858063;\n Thu, 30 Nov 2023 19:18:54 +0000 (GMT)",
            "from ltc19u30.ibm.com (unknown [9.114.224.51])\n by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP;\n Thu, 30 Nov 2023 19:18:54 +0000 (GMT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com;\n h=from : to : cc : subject\n : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding; s=pp1;\n bh=aM5POwScd+RFZ1Fu40k536/va/qVPuodpF8kFUgzc84=;\n b=crZ/T/0+5lNWEEEjuzBHwwqRyd1u8ZQlX/PAdGafqQo6KevhC0XUyXaHqqNmxWSH6nqC\n ofYeb0gpR5wKyqcLwClie0E9G/K3aZWVFzyilJuM7z2NvdNGxpn4nFgfCYG9+xVvguP6\n mAWlzP63eVS5ljvBdYi2EJ+jMaYnrif/ugY1etuaVsoGxvkV8wSY/7RQ8RT3+pVvaa6B\n iJ/pzjRZz3p/ugJSPIFHHpxlflYJFMqbX4ej16itMRH7/5k5uLVOxUwvVZExJOo6G3ON\n reLaf+lA8m26ff5EviYZ2U1RGSoXGL3GauAisGdp/hw8YlNHe5iGxmBLWRwRbI4gmsxK nA==",
        "From": "David Christensen <drc@linux.vnet.ibm.com>",
        "To": "thomas@monjalon.net, Ruifeng Wang <ruifeng.wang@arm.com>,\n Bruce Richardson <bruce.richardson@intel.com>,\n Min Zhou <zhoumin@loongson.cn>, David Christensen <drc@linux.vnet.ibm.com>,\n Stanislaw Kardach <kda@semihalf.com>,\n Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>",
        "Cc": "dev@dpdk.org",
        "Subject": "[PATCH v4] eal: verify mmu type for DPDK support (ppc64le)",
        "Date": "Thu, 30 Nov 2023 14:18:44 -0500",
        "Message-Id": "<20231130191844.612699-1-drc@linux.vnet.ibm.com>",
        "X-Mailer": "git-send-email 2.39.3",
        "In-Reply-To": "<20231024174315.318408-1-drc@linux.vnet.ibm.com>",
        "References": "<20231024174315.318408-1-drc@linux.vnet.ibm.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-GUID": "FQyZ3olMDQH7w_HJaaiogc3PsU0GH_5s",
        "X-Proofpoint-ORIG-GUID": "AhbUuT379fiZTL_m4vl0Cx_dE1wMkDsP",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-11-30_19,2023-11-30_01,2023-05-22_02",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n lowpriorityscore=0\n priorityscore=1501 bulkscore=0 suspectscore=0 clxscore=1011 spamscore=0\n malwarescore=0 adultscore=0 mlxlogscore=908 mlxscore=0 phishscore=0\n impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1\n engine=8.12.0-2311060000 definitions=main-2311300142",
        "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": "IBM POWER systems support more than one type of memory management unit\n(MMU).  The Power ISA 3.0 specification, which applies to P9 and later\nCPUs, defined a new Radix MMU which, among other things, allows an\nanonymous memory page mapping to be converted into a hugepage mapping\nat a specific address. This is a required feature in DPDK so we need\nto test the MMU type when POWER systems are used and provide a more\nuseful error message for the user when running on an unsupported\nsystem.\n\nAll architectures other than ppc64le unconditionally report that the\nMMU is supported.  When running with ppc64le on Linux, the MMU is\ntested and the actual result is returned, while running with ppc64le\non FreeBSD unconditionally reports that the MMU is supported to avoid\nunnecessary breakage until an actual test can be implemented for that\nenvironment.\n\nBugzilla ID: 1221\n\nSuggested-by: Thomas Monjalon <thomas@monjalon.net>\nSigned-off-by: David Christensen <drc@linux.vnet.ibm.com>\n---\n lib/eal/arm/meson.build       |  1 +\n lib/eal/arm/rte_mmu.c         | 11 ++++++\n lib/eal/common/eal_private.h  |  7 ++++\n lib/eal/freebsd/eal.c         |  7 ++++\n lib/eal/linux/eal.c           |  7 ++++\n lib/eal/loongarch/meson.build |  1 +\n lib/eal/loongarch/rte_mmu.c   | 11 ++++++\n lib/eal/ppc/meson.build       |  1 +\n lib/eal/ppc/rte_mmu.c         | 68 +++++++++++++++++++++++++++++++++++\n lib/eal/riscv/meson.build     |  1 +\n lib/eal/riscv/rte_mmu.c       | 11 ++++++\n lib/eal/x86/meson.build       |  1 +\n lib/eal/x86/rte_mmu.c         | 11 ++++++\n 13 files changed, 138 insertions(+)\n create mode 100644 lib/eal/arm/rte_mmu.c\n create mode 100644 lib/eal/loongarch/rte_mmu.c\n create mode 100644 lib/eal/ppc/rte_mmu.c\n create mode 100644 lib/eal/riscv/rte_mmu.c\n create mode 100644 lib/eal/x86/rte_mmu.c",
    "diff": "diff --git a/lib/eal/arm/meson.build b/lib/eal/arm/meson.build\nindex dca1106aaeec..6fba3d6ba7b8 100644\n--- a/lib/eal/arm/meson.build\n+++ b/lib/eal/arm/meson.build\n@@ -7,5 +7,6 @@ sources += files(\n         'rte_cpuflags.c',\n         'rte_cycles.c',\n         'rte_hypervisor.c',\n+        'rte_mmu.c',\n         'rte_power_intrinsics.c',\n )\ndiff --git a/lib/eal/arm/rte_mmu.c b/lib/eal/arm/rte_mmu.c\nnew file mode 100644\nindex 000000000000..3d40bfde386a\n--- /dev/null\n+++ b/lib/eal/arm/rte_mmu.c\n@@ -0,0 +1,11 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) IBM Corporation 2023\n+ */\n+\n+#include \"eal_private.h\"\n+\n+bool\n+eal_mmu_supported(void)\n+{\n+\treturn true;\n+}\ndiff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h\nindex 4d2e80661023..c001c917de1d 100644\n--- a/lib/eal/common/eal_private.h\n+++ b/lib/eal/common/eal_private.h\n@@ -93,6 +93,13 @@ int rte_eal_memzone_init(void);\n  */\n int rte_eal_cpu_init(void);\n \n+/**\n+ * Check for architecture supported MMU.\n+ *\n+ * This function is private to EAL.\n+ */\n+bool eal_mmu_supported(void);\n+\n /**\n  * Create memseg lists\n  *\ndiff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c\nindex 568e06e9ed91..0a6a9edc7213 100644\n--- a/lib/eal/freebsd/eal.c\n+++ b/lib/eal/freebsd/eal.c\n@@ -597,6 +597,13 @@ rte_eal_init(int argc, char **argv)\n \t\treturn -1;\n \t}\n \n+\t/* verify if DPDK supported on architecture MMU */\n+\tif (!eal_mmu_supported()) {\n+\t\trte_eal_init_alert(\"unsupported MMU type.\");\n+\t\trte_errno = ENOTSUP;\n+\t\treturn -1;\n+\t}\n+\n \tif (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_run, 1,\n \t\t\t\t\trte_memory_order_relaxed, rte_memory_order_relaxed)) {\n \t\trte_eal_init_alert(\"already called initialization.\");\ndiff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c\nindex 57da058cec60..b22c19ff0492 100644\n--- a/lib/eal/linux/eal.c\n+++ b/lib/eal/linux/eal.c\n@@ -983,6 +983,13 @@ rte_eal_init(int argc, char **argv)\n \t\treturn -1;\n \t}\n \n+\t/* verify if DPDK supported on architecture MMU */\n+\tif (!eal_mmu_supported()) {\n+\t\trte_eal_init_alert(\"unsupported MMU type.\");\n+\t\trte_errno = ENOTSUP;\n+\t\treturn -1;\n+\t}\n+\n \tif (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_run, 1,\n \t\t\t\t\trte_memory_order_relaxed, rte_memory_order_relaxed)) {\n \t\trte_eal_init_alert(\"already called initialization.\");\ndiff --git a/lib/eal/loongarch/meson.build b/lib/eal/loongarch/meson.build\nindex 4dcc27babb9b..3acfe6c3bd77 100644\n--- a/lib/eal/loongarch/meson.build\n+++ b/lib/eal/loongarch/meson.build\n@@ -7,5 +7,6 @@ sources += files(\n         'rte_cpuflags.c',\n         'rte_cycles.c',\n         'rte_hypervisor.c',\n+        'rte_mmu.c',\n         'rte_power_intrinsics.c',\n )\ndiff --git a/lib/eal/loongarch/rte_mmu.c b/lib/eal/loongarch/rte_mmu.c\nnew file mode 100644\nindex 000000000000..3d40bfde386a\n--- /dev/null\n+++ b/lib/eal/loongarch/rte_mmu.c\n@@ -0,0 +1,11 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) IBM Corporation 2023\n+ */\n+\n+#include \"eal_private.h\"\n+\n+bool\n+eal_mmu_supported(void)\n+{\n+\treturn true;\n+}\ndiff --git a/lib/eal/ppc/meson.build b/lib/eal/ppc/meson.build\nindex 71c7ac870da6..eeeaeee240b7 100644\n--- a/lib/eal/ppc/meson.build\n+++ b/lib/eal/ppc/meson.build\n@@ -7,5 +7,6 @@ sources += files(\n         'rte_cpuflags.c',\n         'rte_cycles.c',\n         'rte_hypervisor.c',\n+        'rte_mmu.c',\n         'rte_power_intrinsics.c',\n )\ndiff --git a/lib/eal/ppc/rte_mmu.c b/lib/eal/ppc/rte_mmu.c\nnew file mode 100644\nindex 000000000000..2d090362e530\n--- /dev/null\n+++ b/lib/eal/ppc/rte_mmu.c\n@@ -0,0 +1,68 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) IBM Corporation 2023\n+ */\n+\n+#include \"stdio.h\"\n+#include \"string.h\"\n+#include \"rte_log.h\"\n+#include \"eal_private.h\"\n+\n+bool\n+eal_mmu_supported(void)\n+{\n+#ifdef RTE_EXEC_ENV_LINUX\n+\tstatic const char proc_cpuinfo[] = \"/proc/cpuinfo\";\n+\tstatic const char str_mmu[] = \"MMU\";\n+\tstatic const char str_radix[] = \"Radix\";\n+\tstatic const char err_msg[] = \"DPDK on PPC64 requires radix-mmu\";\n+\tchar buf[512];\n+\tchar *ret = NULL;\n+\tFILE *f = fopen(proc_cpuinfo, \"r\");\n+\n+\tif (f == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot open %s\\n\", proc_cpuinfo);\n+\t\treturn false;\n+\t}\n+\n+\t/*\n+\t * Example \"MMU\" in /proc/cpuinfo:\n+\t * ...\n+\t * model\t: 8335-GTW\n+\t * machine\t: PowerNV 8335-GTW\n+\t * firmware\t: OPAL\n+\t * MMU\t\t: Radix\n+\t * ... or ...\n+\t * model        : IBM,9009-22A\n+\t * machine      : CHRP IBM,9009-22A\n+\t * MMU          : Hash\n+\t */\n+\twhile (fgets(buf, sizeof(buf), f) != NULL) {\n+\t\tret = strstr(buf, str_mmu);\n+\t\tif (ret == NULL)\n+\t\t\tcontinue;\n+\t\tret += sizeof(str_mmu) - 1;\n+\t\tret = strchr(ret, ':');\n+\t\tif (ret == NULL)\n+\t\t\tcontinue;\n+\t\tret = strstr(ret, str_radix);\n+\t\tbreak;\n+\t}\n+\tfclose(f);\n+\n+\tif (ret == NULL) {\n+\t\tfprintf(stderr, \"EAL: FATAL: %s\\n\", err_msg);\n+\t\tRTE_LOG(ERR, EAL, \"%s\\n\", err_msg);\n+\t}\n+\treturn (ret != NULL);\n+#elif RTE_EXEC_ENV_FREEBSD\n+\t/*\n+\t * Method to detect MMU type in FreeBSD not known\n+\t * by this author.  Return true for now to emulate\n+\t * previous behavior and avoid unnecessary failures.\n+\t */\n+\treturn true;\n+#else\n+\t/* Force false for other execution environments */\n+\treturn false;\n+#endif\n+}\ndiff --git a/lib/eal/riscv/meson.build b/lib/eal/riscv/meson.build\nindex dca1106aaeec..6fba3d6ba7b8 100644\n--- a/lib/eal/riscv/meson.build\n+++ b/lib/eal/riscv/meson.build\n@@ -7,5 +7,6 @@ sources += files(\n         'rte_cpuflags.c',\n         'rte_cycles.c',\n         'rte_hypervisor.c',\n+        'rte_mmu.c',\n         'rte_power_intrinsics.c',\n )\ndiff --git a/lib/eal/riscv/rte_mmu.c b/lib/eal/riscv/rte_mmu.c\nnew file mode 100644\nindex 000000000000..3d40bfde386a\n--- /dev/null\n+++ b/lib/eal/riscv/rte_mmu.c\n@@ -0,0 +1,11 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) IBM Corporation 2023\n+ */\n+\n+#include \"eal_private.h\"\n+\n+bool\n+eal_mmu_supported(void)\n+{\n+\treturn true;\n+}\ndiff --git a/lib/eal/x86/meson.build b/lib/eal/x86/meson.build\nindex d33a240e1a98..e08dffa13dcc 100644\n--- a/lib/eal/x86/meson.build\n+++ b/lib/eal/x86/meson.build\n@@ -7,6 +7,7 @@ sources += files(\n         'rte_cpuflags.c',\n         'rte_cycles.c',\n         'rte_hypervisor.c',\n+        'rte_mmu.c',\n         'rte_spinlock.c',\n         'rte_power_intrinsics.c',\n )\ndiff --git a/lib/eal/x86/rte_mmu.c b/lib/eal/x86/rte_mmu.c\nnew file mode 100644\nindex 000000000000..3d40bfde386a\n--- /dev/null\n+++ b/lib/eal/x86/rte_mmu.c\n@@ -0,0 +1,11 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (C) IBM Corporation 2023\n+ */\n+\n+#include \"eal_private.h\"\n+\n+bool\n+eal_mmu_supported(void)\n+{\n+\treturn true;\n+}\n",
    "prefixes": [
        "v4"
    ]
}