Received: by 10.223.164.200 with SMTP id h8csp933194wrb; Mon, 6 Nov 2017 01:14:08 -0800 (PST) X-Google-Smtp-Source: ABhQp+SJPejSEGUE1yd+SIxPMitNtve51GPFj/0pfwadK+/Mv+y16ZBVTw0bPn4olt+IHwM4DKNm X-Received: by 10.98.4.67 with SMTP id 64mr16009109pfe.214.1509959648454; Mon, 06 Nov 2017 01:14:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509959648; cv=none; d=google.com; s=arc-20160816; b=MZJPUP8I01iKPfjvoH+ZXsnSB+JY0ZBhdFHLJdwhJ8k5bOCewC2KgSZK30yGr6GFRz q0NcFIxkRbx8wzgkn3TCgjv7+s8eKwlbAMUD4uUJJ9wlE+5OwjQP/SlYZr+afumosyMi uAg/3q9KKe8f7/NenSlLGLUIVh1PultvyB3KKfi3Abe5OtsHijWuTghZYuLBadX3ljrN sO9NlIR1h3VeSzg59equm1HtxkmVoBVkG8MGcEow7NOS7wieY7ZhdyNg3dlND142zgNn OEQdWVdHseGQN0UA0IVrqODK1dn8IIX28ae46Q/oo+0QRFa4qz6LVOHR1K3shG92lY/S 9V/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xR8+gu0giAosY4vHxpZm6AnFTeBva8muvcYFI+vmnAc=; b=XW0XgWGoUan8vUjaCPfrznyaYNQlsX8B6VNddLc/sP9tTOBC1R2lSF2MtXCA4bFbh5 AZQdnPpThpIW9RP3cZ1g0InZAPj+XjpuBv1paAikHHaKodkDES1gL5yDt6HsfnNv4nSb 418itj+THXoj5QFgL8Dq+VBF2Qryvzpo11gX8hGJwBREKiMj1e9Zvl0Nq+yNmj9zCWLI bCQjnNS736y8lkG09HK9L1GEU58W+R960GyV76Vihr75Gdg1gYY63ZVKPSmDA7wbMqRe 0nKPTz3WIK3qMmpXujPr9ao4MA9/OU07GaKBKbbXyTeYqzQvFNcZ/c7Bgl1P9C2JIlgs nbKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=SsC4rqNH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n189si10806727pga.205.2017.11.06.01.13.54; Mon, 06 Nov 2017 01:14:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=SsC4rqNH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbdKFJNT (ORCPT + 98 others); Mon, 6 Nov 2017 04:13:19 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:48137 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752379AbdKFI7f (ORCPT ); Mon, 6 Nov 2017 03:59:35 -0500 Received: by mail-qt0-f193.google.com with SMTP id f8so10008977qta.5; Mon, 06 Nov 2017 00:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xR8+gu0giAosY4vHxpZm6AnFTeBva8muvcYFI+vmnAc=; b=SsC4rqNHY9QHc/NWtjPj0Gq07Rb4/u0tHg/erYtc8QGCRJo6JbgA87TE3q3/bXDswq jEZxFOXT4Mto4iVUAj9hlqBkumLs+CZ+ggqJxPiRBt7XHrs9DQl61Gww3Z965NYpXS0R ZWB4wFgyxS5l9qg+2a5A1JTiCHZksWEK8aDljpHO5imQupXCT7pJ35MknvlNYguGN2kx ezTEhtupe/iW1A7viAUJ4uiJLbuqRjmiqTVuLbfVJatQZFXXuxFgyNK0w6Dvhl6Me+qu KTl3vlAbIpX9foItsJkKok4FYfMMTWgXA7l7OooJ0BaxaARflX7IsZcPXpracs+EXR9e 7rBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xR8+gu0giAosY4vHxpZm6AnFTeBva8muvcYFI+vmnAc=; b=RTevG0QuUmIUmWzDcz1/gntvNfkVBkCYl64v/eVNM3QsniL5IOIfk79SYbJ4fmGz59 PLMaGPF5B82hWdDrKS/dh9NzuYw3jFv5ooUNjKHSzd+f8dOSStRTOwuadV+OqpNK59y5 //IUmXLg4StiVcjp0ZgFYj1glnc0NJEpSGIINgHgaeXPx1e2HC51nwUMiTbApa8x/61+ XQ8u6GNdC8ZkPybDq6wH8GGthiJgTQV6IE8890qnu0tnzVWMx3JvVbqRMOXeXvV6hyeZ 7oUYyo88EA1Qpk26Djarl3xcL1khwEBHuaXL7GVhfGXhA/nV1CJ8rceOtseBY123YuUX 89XQ== X-Gm-Message-State: AMCzsaXuBpRawmTGU2SJqvHKlhrQuoyk3igyzjV/U7ltRnpPjmzz00aJ Ug99yOFt/9hN9GgnrYhvXT4= X-Received: by 10.200.52.149 with SMTP id w21mr22003805qtb.75.1509958775117; Mon, 06 Nov 2017 00:59:35 -0800 (PST) Received: from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net. [50.39.103.96]) by smtp.gmail.com with ESMTPSA id r26sm8001094qki.42.2017.11.06.00.59.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 00:59:34 -0800 (PST) From: Ram Pai To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, linuxram@us.ibm.com Subject: [PATCH v9 27/51] mm, x86 : introduce arch_pkeys_enabled() Date: Mon, 6 Nov 2017 00:57:19 -0800 Message-Id: <1509958663-18737-28-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> References: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arch neutral code needs to know if the architecture supports protection keys to display protection key in smaps. Hence introducing arch_pkeys_enabled(). This patch also provides x86 implementation for arch_pkeys_enabled(). Signed-off-by: Ram Pai --- arch/x86/include/asm/pkeys.h | 1 + arch/x86/kernel/fpu/xstate.c | 5 +++++ include/linux/pkeys.h | 5 +++++ 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h index a0ba1ff..f6c287b 100644 --- a/arch/x86/include/asm/pkeys.h +++ b/arch/x86/include/asm/pkeys.h @@ -6,6 +6,7 @@ extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val); +extern bool arch_pkeys_enabled(void); /* * Try to dedicate one of the protection keys to be used as an diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index f1d5476..a43db74 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -942,6 +942,11 @@ int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, return 0; } + +bool arch_pkeys_enabled(void) +{ + return boot_cpu_has(X86_FEATURE_OSPKE); +} #endif /* ! CONFIG_ARCH_HAS_PKEYS */ /* diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h index 0794ca7..3ca2e44 100644 --- a/include/linux/pkeys.h +++ b/include/linux/pkeys.h @@ -35,6 +35,11 @@ static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, return 0; } +static inline bool arch_pkeys_enabled(void) +{ + return false; +} + static inline void copy_init_pkru_to_fpregs(void) { } -- 1.7.1 From 1586132557529833925@xxx Thu Dec 07 13:38:02 +0000 2017 X-GM-THRID: 1586132557529833925 X-Gmail-Labels: Inbox,Category Promotions,HistoricalUnread