Message ID | 1509958663-18737-28-git-send-email-linuxram@us.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org> X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVpcT53KQz9s7c for <patchwork-incoming@ozlabs.org>; Mon, 6 Nov 2017 21:26:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SsC4rqNH"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yVpcT3qPjzDrJs for <patchwork-incoming@ozlabs.org>; Mon, 6 Nov 2017 21:26:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SsC4rqNH"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c0d::242; helo=mail-qt0-x242.google.com; envelope-from=ram.n.pai@gmail.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SsC4rqNH"; dkim-atps=neutral Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yVmhm6ytQzDrJr for <linuxppc-dev@lists.ozlabs.org>; Mon, 6 Nov 2017 19:59:36 +1100 (AEDT) Received: by mail-qt0-x242.google.com with SMTP id p1so10029367qtg.2 for <linuxppc-dev@lists.ozlabs.org>; Mon, 06 Nov 2017 00:59:36 -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=tJxOktWlsDWIY8xlDaDS2BKSkKNBls76HP+KF+AefSNDzBhyzzhqRnZcNJcQm+Im6s ineBQhbeOS16UT1qzIXBkFBrThiSY9TNZeHRDLNqCGhyboZWUfli5c1vNVy7YH7erdSu w/+2B/dpjIpFRxt4TN2CYE3O+4lr4yc3DJh7qrVc6yRX4pgKwmmp5aFGMK6paPmH00os JCvc0tS6n2tw45O2IoVfcPjgF+HJ2lYb++6OElDyEEvsGWvR6RTmuYWmIGumbXdRfltd A2gyjEYurx7Pco2aFIzDSu6yo8l9Q+55/NAJjBNU/JmUlTdp5clJvCXCWG4e4/2jnU5k T2mw== X-Gm-Message-State: AMCzsaVGgdxMVwfiLA18Q0hduW8ba6Jk2WAvbbIlaVLKNN58V74DMkj4 PoimA/gRRsRlPHT9INWpHgc= X-Google-Smtp-Source: ABhQp+SwrQ2zPL68SAW6zu3yzZai4rKIzcVEbwaA4/5prRxkBNwpZ5ycMqrkalpGNS5AdtHecaRYTg== 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 <linuxram@us.ibm.com> To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de 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> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/linuxppc-dev>, <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>, <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe> Cc: linux-arch@vger.kernel.org, ebiederm@xmission.com, linux-doc@vger.kernel.org, x86@kernel.org, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, linux-kselftest@vger.kernel.org, bauerman@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, khandual@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org> |
Series |
powerpc, mm: Memory Protection Keys
|
expand
|
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) { }
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 <linuxram@us.ibm.com> --- 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(-)