{"id":814447,"url":"http://patchwork.ozlabs.org/api/patches/814447/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1505524870-4783-3-git-send-email-linuxram@us.ibm.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<1505524870-4783-3-git-send-email-linuxram@us.ibm.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/1505524870-4783-3-git-send-email-linuxram@us.ibm.com/","date":"2017-09-16T01:21:06","name":"[2/6] mm, x86 : introduce arch_pkeys_enabled()","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"c4226e149fcbc88388f7435ef6d222b9b94bce88","submitter":{"id":2667,"url":"http://patchwork.ozlabs.org/api/people/2667/?format=json","name":"Ram Pai","email":"linuxram@us.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1505524870-4783-3-git-send-email-linuxram@us.ibm.com/mbox/","series":[{"id":3406,"url":"http://patchwork.ozlabs.org/api/series/3406/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=3406","date":"2017-09-16T01:21:04","name":"mm, x86, powerpc: Memory Protection Keys enhancement","version":1,"mbox":"http://patchwork.ozlabs.org/series/3406/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814447/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814447/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xvF4H2CVTz9t16\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 11:27:11 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xvF4H0tR7zDqYV\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 11:27:11 +1000 (AEST)","from mail-qk0-x244.google.com (mail-qk0-x244.google.com\n\t[IPv6:2607:f8b0:400d:c09::244])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xvDxt60k1zDrbr\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 16 Sep 2017 11:21:38 +1000 (AEST)","by mail-qk0-x244.google.com with SMTP id g128so2445544qke.0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 15 Sep 2017 18:21:38 -0700 (PDT)","from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net.\n\t[50.39.103.96]) by smtp.gmail.com with ESMTPSA id\n\tv11sm1493189qkl.45.2017.09.15.18.21.33\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 15 Sep 2017 18:21:35 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jZ/OOpP7\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jZ/OOpP7\"; dkim-atps=neutral","ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400d:c09::244; helo=mail-qk0-x244.google.com;\n\tenvelope-from=ram.n.pai@gmail.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jZ/OOpP7\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=31DVbvQnwMmnVQl4iYbZjp1mHgiBu+JCFh3cgx6u00k=;\n\tb=jZ/OOpP7bwjAcXCwhD0xnfzAnQjRL/sAq2pwZV50Xhr3pL1il/1LneSI4BFdRZdWK1\n\taek+ws6KLib4ijknxDmHAtFYPxfR2SMGGgidDe6ONwDNs+CORGymik/jBVKf3tHpAWMu\n\taNoIB4V3DoHHU8AU3VVUkh7/wz+QJyns9wNSRymosZgZFolJ0DL20UGyDoT6/Gy2v79H\n\tSodnZnWTMmmJ00WeOpWMzJGCFEvOQEDm81HTHJ+NDmzEr+zseKYopiDGpLiFOPrdJ2pQ\n\trYszzWy1aQuToEX0AqDUzyKHFMyptB0MRa/dtt7bWP69jDSnbUhQivoOzL51rMhjyFtT\n\tiwdQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=31DVbvQnwMmnVQl4iYbZjp1mHgiBu+JCFh3cgx6u00k=;\n\tb=dq3sTw/tzTOTMKG7n5n2i3axoC4/4PbTCQA/BGGR70QpvAZNxGinEdGLK0NswaGnzm\n\tdyulBFkaVfsq5uNBqT7LJi/QgFnwkq6kc5ruA09ORscUqifPGtYVCOwwcVcgU61bOwUp\n\tV8Gc0u4Pa3P4g4h8eV+DbLSdncJr10t3O0uX2MpUXpTzsmcbV8iQ9sVwlUn6y8Nq6f0m\n\tuSuENtJE3P987ms5tJsAs2cWi0vajhI/TWJOL4urb3VkwMhY+KR1eaO+d63hh4UesOhe\n\tvHlGPJDIzyeqLemfMV35NsFKinp0Do4mu/luIbKIOZ5AwKpwPFSrhENDeED18nKStQ6j\n\tGpOw==","X-Gm-Message-State":"AHPjjUieWcUJlwheCUy6sVVDLJgjsdQRwhka0BCfRFgv2Lc+bHBQGOWt\n\t7DwGtKfaqL9C1g==","X-Google-Smtp-Source":"AOwi7QD84pKN3UIEm1CclPFN7IlQR7MMoBtTFsKMRDA+T9SmlRhRp9FIr8+LQjEkXzwNZ7eS8VP+8A==","X-Received":"by 10.55.20.204 with SMTP id 73mr6649959qku.11.1505524895553;\n\tFri, 15 Sep 2017 18:21:35 -0700 (PDT)","From":"Ram Pai <linuxram@us.ibm.com>","To":"mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,\n\tlinux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,\n\tlinux-mm@kvack.org, x86@kernel.org, linux-doc@vger.kernel.org","Subject":"[PATCH 2/6] mm, x86 : introduce arch_pkeys_enabled()","Date":"Fri, 15 Sep 2017 18:21:06 -0700","Message-Id":"<1505524870-4783-3-git-send-email-linuxram@us.ibm.com>","X-Mailer":"git-send-email 1.7.1","In-Reply-To":"<1505524870-4783-1-git-send-email-linuxram@us.ibm.com>","References":"<1505524870-4783-1-git-send-email-linuxram@us.ibm.com>","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"ebiederm@xmission.com, arnd@arndb.de, corbet@lwn.net, linuxram@us.ibm.com,\n\tmhocko@kernel.org, mingo@redhat.com, paulus@samba.org,\n\taneesh.kumar@linux.vnet.ibm.com, bauerman@linux.vnet.ibm.com,\n\takpm@linux-foundation.org, khandual@linux.vnet.ibm.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"Arch neutral code needs to know if the architecture supports\nprotection  keys  to  display protection key in smaps. Hence\nintroducing arch_pkeys_enabled().\n\nThis patch also provides x86 implementation for\narch_pkeys_enabled().\n\nSigned-off-by: Ram Pai <linuxram@us.ibm.com>\n---\n arch/x86/include/asm/pkeys.h |    1 +\n arch/x86/kernel/fpu/xstate.c |    5 +++++\n include/linux/pkeys.h        |    5 +++++\n 3 files changed, 11 insertions(+), 0 deletions(-)","diff":"diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h\nindex b3b09b9..fa82799 100644\n--- a/arch/x86/include/asm/pkeys.h\n+++ b/arch/x86/include/asm/pkeys.h\n@@ -5,6 +5,7 @@\n \n extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,\n \t\tunsigned long init_val);\n+extern bool arch_pkeys_enabled(void);\n \n /*\n  * Try to dedicate one of the protection keys to be used as an\ndiff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c\nindex c24ac1e..df594b8 100644\n--- a/arch/x86/kernel/fpu/xstate.c\n+++ b/arch/x86/kernel/fpu/xstate.c\n@@ -918,6 +918,11 @@ int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,\n \n \treturn 0;\n }\n+\n+bool arch_pkeys_enabled(void)\n+{\n+\treturn boot_cpu_has(X86_FEATURE_OSPKE);\n+}\n #endif /* ! CONFIG_ARCH_HAS_PKEYS */\n \n /*\ndiff --git a/include/linux/pkeys.h b/include/linux/pkeys.h\nindex a1bacf1..d120810 100644\n--- a/include/linux/pkeys.h\n+++ b/include/linux/pkeys.h\n@@ -34,6 +34,11 @@ static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,\n \treturn 0;\n }\n \n+static inline bool arch_pkeys_enabled(void)\n+{\n+\treturn false;\n+}\n+\n static inline void copy_init_pkru_to_fpregs(void)\n {\n }\n","prefixes":["2/6"]}