Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/818311/?format=api
{ "id": 818311, "url": "http://patchwork.ozlabs.org/api/patches/818311/?format=api", "web_url": "http://patchwork.ozlabs.org/project/sparclinux/patch/1402f8485b86fe8124e665102ec64771ea9ff16d.1506089472.git.khalid.aziz@oracle.com/", "project": { "id": 10, "url": "http://patchwork.ozlabs.org/api/projects/10/?format=api", "name": "Linux SPARC Development ", "link_name": "sparclinux", "list_id": "sparclinux.vger.kernel.org", "list_email": "sparclinux@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1402f8485b86fe8124e665102ec64771ea9ff16d.1506089472.git.khalid.aziz@oracle.com>", "list_archive_url": null, "date": "2017-09-25T16:48:57", "name": "[v8,6/9] sparc64: Add auxiliary vectors to report platform ADI properties", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "ffb3219bb6962320025fe1a72daed73818111b55", "submitter": { "id": 42386, "url": "http://patchwork.ozlabs.org/api/people/42386/?format=api", "name": "Khalid Aziz", "email": "khalid.aziz@oracle.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/sparclinux/patch/1402f8485b86fe8124e665102ec64771ea9ff16d.1506089472.git.khalid.aziz@oracle.com/mbox/", "series": [ { "id": 4990, "url": "http://patchwork.ozlabs.org/api/series/4990/?format=api", "web_url": "http://patchwork.ozlabs.org/project/sparclinux/list/?series=4990", "date": "2017-09-25T16:48:55", "name": "Application Data Integrity feature introduced by SPARC M7", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/4990/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/818311/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/818311/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<sparclinux-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@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=sparclinux-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y198h01yyz9t62\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 26 Sep 2017 02:51:32 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754103AbdIYQvV (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 25 Sep 2017 12:51:21 -0400", "from aserp1040.oracle.com ([141.146.126.69]:40441 \"EHLO\n\taserp1040.oracle.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1754093AbdIYQvS (ORCPT\n\t<rfc822; sparclinux@vger.kernel.org>); Mon, 25 Sep 2017 12:51:18 -0400", "from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2)\n\twith ESMTP id v8PGpAk1021169\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Mon, 25 Sep 2017 16:51:10 GMT", "from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])\n\tby aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v8PGp9A3018680\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Mon, 25 Sep 2017 16:51:10 GMT", "from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25])\n\tby userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id\n\tv8PGp8rZ008182; Mon, 25 Sep 2017 16:51:09 GMT", "from concerto.us.oracle.com (/24.9.64.241)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Mon, 25 Sep 2017 09:51:08 -0700" ], "From": "Khalid Aziz <khalid.aziz@oracle.com>", "To": "davem@davemloft.net, dave.hansen@linux.intel.com", "Cc": "Khalid Aziz <khalid.aziz@oracle.com>, viro@zeniv.linux.org.uk,\n\teric.saint.etienne@oracle.com, allen.pais@oracle.com,\n\tjag.raman@oracle.com, shannon.nelson@oracle.com,\n\tliam.merwick@oracle.com, atish.patra@oracle.com, mhocko@suse.com,\n\tsparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tKhalid Aziz <khalid@gonehiking.org>", "Subject": "[PATCH v8 6/9] sparc64: Add auxiliary vectors to report platform\n\tADI properties", "Date": "Mon, 25 Sep 2017 10:48:57 -0600", "Message-Id": "<1402f8485b86fe8124e665102ec64771ea9ff16d.1506089472.git.khalid.aziz@oracle.com>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": [ "<cover.1506089472.git.khalid.aziz@oracle.com>", "<cover.1506089472.git.khalid.aziz@oracle.com>" ], "References": [ "<cover.1506089472.git.khalid.aziz@oracle.com>", "<cover.1506089472.git.khalid.aziz@oracle.com>" ], "X-Source-IP": "aserv0022.oracle.com [141.146.126.234]", "Sender": "sparclinux-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<sparclinux.vger.kernel.org>", "X-Mailing-List": "sparclinux@vger.kernel.org" }, "content": "ADI feature on M7 and newer processors has three important properties\nrelevant to userspace apps using ADI capabilities - (1) Size of block of\nmemory an ADI version tag applies to, (2) Number of uppermost bits in\nvirtual address used to encode ADI tag, and (3) The value M7 processor\nwill force the ADI tags to if it detects uncorrectable error in an ADI\ntagged cacheline. Kernel can retrieve these properties for a platform\nthrough machine description provided by the firmware. This patch adds\ncode to retrieve these properties and report them to userspace through\nauxiliary vectors.\n\nSigned-off-by: Khalid Aziz <khalid.aziz@oracle.com>\nCc: Khalid Aziz <khalid@gonehiking.org>\n---\nv8:\n\t- Added AT_ADI_UEONADI back\nv7:\n\t- new patch split off from patch 4/4 in v6\n\n arch/sparc/include/asm/adi.h | 6 +++\n arch/sparc/include/asm/adi_64.h | 46 +++++++++++++++++\n arch/sparc/include/asm/elf_64.h | 9 ++++\n arch/sparc/include/uapi/asm/auxvec.h | 11 +++++\n arch/sparc/kernel/Makefile | 1 +\n arch/sparc/kernel/adi_64.c | 95 ++++++++++++++++++++++++++++++++++++\n arch/sparc/kernel/mdesc.c | 2 +\n 7 files changed, 170 insertions(+)\n create mode 100644 arch/sparc/include/asm/adi.h\n create mode 100644 arch/sparc/include/asm/adi_64.h\n create mode 100644 arch/sparc/kernel/adi_64.c", "diff": "diff --git a/arch/sparc/include/asm/adi.h b/arch/sparc/include/asm/adi.h\nnew file mode 100644\nindex 000000000000..acad0d04e4c6\n--- /dev/null\n+++ b/arch/sparc/include/asm/adi.h\n@@ -0,0 +1,6 @@\n+#ifndef ___ASM_SPARC_ADI_H\n+#define ___ASM_SPARC_ADI_H\n+#if defined(__sparc__) && defined(__arch64__)\n+#include <asm/adi_64.h>\n+#endif\n+#endif\ndiff --git a/arch/sparc/include/asm/adi_64.h b/arch/sparc/include/asm/adi_64.h\nnew file mode 100644\nindex 000000000000..24fe52fe9e8f\n--- /dev/null\n+++ b/arch/sparc/include/asm/adi_64.h\n@@ -0,0 +1,46 @@\n+/* adi_64.h: ADI related data structures\n+ *\n+ * Copyright (C) 2016 Khalid Aziz (khalid.aziz@oracle.com)\n+ *\n+ * This work is licensed under the terms of the GNU GPL, version 2.\n+ */\n+#ifndef __ASM_SPARC64_ADI_H\n+#define __ASM_SPARC64_ADI_H\n+\n+#include <linux/types.h>\n+\n+#ifndef __ASSEMBLY__\n+\n+struct adi_caps {\n+\t__u64 blksz;\n+\t__u64 nbits;\n+\t__u64 ue_on_adi;\n+};\n+\n+struct adi_config {\n+\tbool enabled;\n+\tstruct adi_caps caps;\n+};\n+\n+extern struct adi_config adi_state;\n+\n+extern void mdesc_adi_init(void);\n+\n+static inline bool adi_capable(void)\n+{\n+\treturn adi_state.enabled;\n+}\n+\n+static inline unsigned long adi_blksize(void)\n+{\n+\treturn adi_state.caps.blksz;\n+}\n+\n+static inline unsigned long adi_nbits(void)\n+{\n+\treturn adi_state.caps.nbits;\n+}\n+\n+#endif\t/* __ASSEMBLY__ */\n+\n+#endif\t/* !(__ASM_SPARC64_ADI_H) */\ndiff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h\nindex 3f2d403873bd..6371d7e0330e 100644\n--- a/arch/sparc/include/asm/elf_64.h\n+++ b/arch/sparc/include/asm/elf_64.h\n@@ -9,6 +9,7 @@\n #include <asm/processor.h>\n #include <asm/extable_64.h>\n #include <asm/spitfire.h>\n+#include <asm/adi.h>\n \n /*\n * Sparc section types\n@@ -210,4 +211,12 @@ do {\tif ((ex).e_ident[EI_CLASS] == ELFCLASS32)\t\\\n \t\t\t(current->personality & (~PER_MASK)));\t\\\n } while (0)\n \n+#define ARCH_DLINFO\t\t\t\t\t\t\\\n+do {\t\t\t\t\t\t\t\t\\\n+\textern struct adi_config adi_state;\t\t\t\\\n+\tNEW_AUX_ENT(AT_ADI_BLKSZ, adi_state.caps.blksz);\t\\\n+\tNEW_AUX_ENT(AT_ADI_NBITS, adi_state.caps.nbits);\t\\\n+\tNEW_AUX_ENT(AT_ADI_UEONADI, adi_state.caps.ue_on_adi);\t\\\n+} while (0)\n+\n #endif /* !(__ASM_SPARC64_ELF_H) */\ndiff --git a/arch/sparc/include/uapi/asm/auxvec.h b/arch/sparc/include/uapi/asm/auxvec.h\nindex ad6f360261f6..9ab8b10e85d7 100644\n--- a/arch/sparc/include/uapi/asm/auxvec.h\n+++ b/arch/sparc/include/uapi/asm/auxvec.h\n@@ -1,4 +1,15 @@\n #ifndef __ASMSPARC_AUXVEC_H\n #define __ASMSPARC_AUXVEC_H\n \n+#ifdef CONFIG_SPARC64\n+/* Avoid overlap with other AT_* values since they are consolidated in\n+ * glibc and any overlaps can cause problems\n+ */\n+#define AT_ADI_BLKSZ\t48\n+#define AT_ADI_NBITS\t49\n+#define AT_ADI_UEONADI\t50\n+\n+#define AT_VECTOR_SIZE_ARCH\t3\n+#endif\n+\n #endif /* !(__ASMSPARC_AUXVEC_H) */\ndiff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile\nindex aac609889ee4..8149e175e899 100644\n--- a/arch/sparc/kernel/Makefile\n+++ b/arch/sparc/kernel/Makefile\n@@ -67,6 +67,7 @@ obj-$(CONFIG_SPARC64) += visemul.o\n obj-$(CONFIG_SPARC64) += hvapi.o\n obj-$(CONFIG_SPARC64) += sstate.o\n obj-$(CONFIG_SPARC64) += mdesc.o\n+obj-$(CONFIG_SPARC64) += adi_64.o\n obj-$(CONFIG_SPARC64)\t+= pcr.o\n obj-$(CONFIG_SPARC64)\t+= nmi.o\n obj-$(CONFIG_SPARC64_SMP) += cpumap.o\ndiff --git a/arch/sparc/kernel/adi_64.c b/arch/sparc/kernel/adi_64.c\nnew file mode 100644\nindex 000000000000..9abf7ea815fd\n--- /dev/null\n+++ b/arch/sparc/kernel/adi_64.c\n@@ -0,0 +1,95 @@\n+/* adi_64.c: support for ADI (Application Data Integrity) feature on\n+ * sparc m7 and newer processors. This feature is also known as\n+ * SSM (Silicon Secured Memory).\n+ *\n+ * Copyright (C) 2016 Khalid Aziz (khalid.aziz@oracle.com)\n+ *\n+ * This work is licensed under the terms of the GNU GPL, version 2.\n+ */\n+#include <linux/init.h>\n+#include <asm/mdesc.h>\n+#include <asm/adi_64.h>\n+\n+struct adi_config adi_state;\n+\n+/* mdesc_adi_init() : Parse machine description provided by the\n+ *\thypervisor to detect ADI capabilities\n+ *\n+ * Hypervisor reports ADI capabilities of platform in \"hwcap-list\" property\n+ * for \"cpu\" node. If the platform supports ADI, \"hwcap-list\" property\n+ * contains the keyword \"adp\". If the platform supports ADI, \"platform\"\n+ * node will contain \"adp-blksz\", \"adp-nbits\" and \"ue-on-adp\" properties\n+ * to describe the ADI capabilities.\n+ */\n+void __init mdesc_adi_init(void)\n+{\n+\tstruct mdesc_handle *hp = mdesc_grab();\n+\tconst char *prop;\n+\tu64 pn, *val;\n+\tint len;\n+\n+\tif (!hp)\n+\t\tgoto adi_not_found;\n+\n+\tpn = mdesc_node_by_name(hp, MDESC_NODE_NULL, \"cpu\");\n+\tif (pn == MDESC_NODE_NULL)\n+\t\tgoto adi_not_found;\n+\n+\tprop = mdesc_get_property(hp, pn, \"hwcap-list\", &len);\n+\tif (!prop)\n+\t\tgoto adi_not_found;\n+\n+\t/*\n+\t * Look for \"adp\" keyword in hwcap-list which would indicate\n+\t * ADI support\n+\t */\n+\tadi_state.enabled = false;\n+\twhile (len) {\n+\t\tint plen;\n+\n+\t\tif (!strcmp(prop, \"adp\")) {\n+\t\t\tadi_state.enabled = true;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tplen = strlen(prop) + 1;\n+\t\tprop += plen;\n+\t\tlen -= plen;\n+\t}\n+\n+\tif (!adi_state.enabled)\n+\t\tgoto adi_not_found;\n+\n+\t/* Find the ADI properties in \"platform\" node. If all ADI\n+\t * properties are not found, ADI support is incomplete and\n+\t * do not enable ADI in the kernel.\n+\t */\n+\tpn = mdesc_node_by_name(hp, MDESC_NODE_NULL, \"platform\");\n+\tif (pn == MDESC_NODE_NULL)\n+\t\tgoto adi_not_found;\n+\n+\tval = (u64 *) mdesc_get_property(hp, pn, \"adp-blksz\", &len);\n+\tif (!val)\n+\t\tgoto adi_not_found;\n+\tadi_state.caps.blksz = *val;\n+\n+\tval = (u64 *) mdesc_get_property(hp, pn, \"adp-nbits\", &len);\n+\tif (!val)\n+\t\tgoto adi_not_found;\n+\tadi_state.caps.nbits = *val;\n+\n+\tval = (u64 *) mdesc_get_property(hp, pn, \"ue-on-adp\", &len);\n+\tif (!val)\n+\t\tgoto adi_not_found;\n+\tadi_state.caps.ue_on_adi = *val;\n+\n+\tmdesc_release(hp);\n+\treturn;\n+\n+adi_not_found:\n+\tadi_state.enabled = false;\n+\tadi_state.caps.blksz = 0;\n+\tadi_state.caps.nbits = 0;\n+\tif (hp)\n+\t\tmdesc_release(hp);\n+}\ndiff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c\nindex fa466ce45bc9..d008e74da638 100644\n--- a/arch/sparc/kernel/mdesc.c\n+++ b/arch/sparc/kernel/mdesc.c\n@@ -20,6 +20,7 @@\n #include <linux/uaccess.h>\n #include <asm/oplib.h>\n #include <asm/smp.h>\n+#include <asm/adi.h>\n \n /* Unlike the OBP device tree, the machine description is a full-on\n * DAG. An arbitrary number of ARCs are possible from one\n@@ -1343,5 +1344,6 @@ void __init sun4v_mdesc_init(void)\n \n \tcur_mdesc = hp;\n \n+\tmdesc_adi_init();\n \treport_platform_properties();\n }\n", "prefixes": [ "v8", "6/9" ] }