Received: by 10.223.176.46 with SMTP id f43csp306184wra; Thu, 18 Jan 2018 17:53:40 -0800 (PST) X-Google-Smtp-Source: ACJfBovL2fntZwsnFWuS/gmKtJi3hK1UsYGeWftWxXWMZ9AAxMPkkEcWY5pDPGc8fVd7Ov+LhGHS X-Received: by 10.101.85.138 with SMTP id j10mr26594070pgs.144.1516326820024; Thu, 18 Jan 2018 17:53:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516326819; cv=none; d=google.com; s=arc-20160816; b=hoHnk3wel7U5Z8spFK6LUCSEWFhHXsgqvzDWAm7LEORPb84OWCLYuXWSl3L8+ueCV/ sGO2RegBLIERqa4WrmZ4M7z/55uXI6gc7vNpghcaTfABdwQE9fgXEsRcb8BsvPI2tphh +SlHUaooHFmP545krK+omruqI5KhqPwW8VeDlGrOZliCSNRh9NQ4bACvZpTMRQ6vbJEY aHAVhEBbdq3/HenLpCtScRgVpiokKixZpymvaDqy09snJrgh6CsYfUx1u3EEyqnmfeSO PTxB4jSQadIcR0hbnABkS2LO9FDrA/QEjx/hDmfhFkw/K6EkJk9ygi9vThg6CfUxq+KA WR9A== 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=1uF75o45nO9CaDIwFBEYPROLioOOI9W40pdIjeWXoyQ=; b=UEWIbEualeoPiDr6AUkd+rageBhnzFcTMOhy4Z7AKUsz6ilbgXRtUu1RI/pUgaYW1c PcTXP3tyoIMDWZ6ObKlSVMGh69/6oG0vbve1PMihG5+ILS1BGxqkqSb6hEYEkjcUTD8g nVmZo6A92Y4Z2TstFE3MeppfDYitFqahDzoMitHrxAlAkTG8axdSCkmhN4xIPWLRb115 NLjiWgj63DW4Y7sCU0weTDjUxdiLpfrDUnEhEJ7+6lbc3mw/1PS/edrfuaNPd9qrqSP1 Js4NN4F40E/g7TktYb4FpiilEcAevvSOXgwFSTiM3qvhn4ayK8hMcfaz/Xke2FWyNCEi YGHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YS/0RcTa; 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 c5-v6si400747pls.500.2018.01.18.17.53.26; Thu, 18 Jan 2018 17:53:39 -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=YS/0RcTa; 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 S1755861AbeASBxB (ORCPT + 99 others); Thu, 18 Jan 2018 20:53:01 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:37172 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755465AbeASBvz (ORCPT ); Thu, 18 Jan 2018 20:51:55 -0500 Received: by mail-qt0-f194.google.com with SMTP id d54so447558qtd.4; Thu, 18 Jan 2018 17:51:54 -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=1uF75o45nO9CaDIwFBEYPROLioOOI9W40pdIjeWXoyQ=; b=YS/0RcTaNefMMtjfI42eYiGJc/xxbhblV7UNwBca1HhzjvvYZ8DYTpSj2eUbBtCFay ulta1JH84shAEe7q6a3hPBLGNkIPxxi5NeiKx9wKylVDIyyBD03idGkzxGUQP3kd1d74 6Y0cwuqW4T2MsuSqTZ4QEF0yrE1WmkGtQ6521hYD+7cGStbJqaPhL2ET6AuD4KsinUtM tKPFcAdUtJQ64KKVwYgjGYCHdaumwVOVK09BwGESWl12NdgjvLXIia5NfD4Nweetvcye VGWX1g5yeQ91ca0c3B3/UpLGeds6uIjU0nNmUbqoJ/CA1GY26wvKvpomg2vl1bU7EqBN N5tg== 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=1uF75o45nO9CaDIwFBEYPROLioOOI9W40pdIjeWXoyQ=; b=CN44fiNFTfA9xh7gEeGxB8RpP8D3hX0cdxZnQPa9sNXZ/LSLHKjlaFAcUuGmzRoQHh ddsTYh6XKSTqaAA2YFh2bPMSfel1R2jL1bhEQPN0aH/7AQMg9N6ewZF2O1+nzIySu9C2 L4sStTvbvUCaCPjFXPlpHEDNs09YS42A0z65w6l67av4vxdtrLLArwnK2Fj1kEUrgnw4 1/HHOY+0x+Sm3udJWtrLvMKi2APbVZYHOyYHeh4taoKidy/YCvG7i25zJ6EJ0zRJwJQD ulb7HchVMjXWTKz5QIYn1L7HYYbOtMNfruHSx0xTTu9TTuR/BmOb9Ghll5LK4aWyavRv ecmQ== X-Gm-Message-State: AKwxyteO31TWMbc1PiXqZGLzKFdbQYx7iL+fqpOoCtVIfZRUFFfp6cwG sFryhh2sF12cS67wYS48C1E= X-Received: by 10.237.38.132 with SMTP id q4mr28628041qtd.134.1516326713866; Thu, 18 Jan 2018 17:51:53 -0800 (PST) Received: from localhost.localdomain (50-39-100-161.bvtn.or.frontiernet.net. [50.39.100.161]) by smtp.gmail.com with ESMTPSA id c127sm5483161qke.78.2018.01.18.17.51.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 17:51:53 -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 v10 05/27] powerpc: helper function to read,write AMR,IAMR,UAMOR registers Date: Thu, 18 Jan 2018 17:50:26 -0800 Message-Id: <1516326648-22775-6-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1516326648-22775-1-git-send-email-linuxram@us.ibm.com> References: <1516326648-22775-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 Implements helper functions to read and write the key related registers; AMR, IAMR, UAMOR. AMR register tracks the read,write permission of a key IAMR register tracks the execute permission of a key UAMOR register enables and disables a key Acked-by: Balbir Singh Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerpc/mm/pkeys.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c index e2f3992..6e8df6e 100644 --- a/arch/powerpc/mm/pkeys.c +++ b/arch/powerpc/mm/pkeys.c @@ -71,3 +71,39 @@ void pkey_mm_init(struct mm_struct *mm) return; mm_pkey_allocation_map(mm) = initial_allocation_mask; } + +static inline u64 read_amr(void) +{ + return mfspr(SPRN_AMR); +} + +static inline void write_amr(u64 value) +{ + mtspr(SPRN_AMR, value); +} + +static inline u64 read_iamr(void) +{ + if (!likely(pkey_execute_disable_supported)) + return 0x0UL; + + return mfspr(SPRN_IAMR); +} + +static inline void write_iamr(u64 value) +{ + if (!likely(pkey_execute_disable_supported)) + return; + + mtspr(SPRN_IAMR, value); +} + +static inline u64 read_uamor(void) +{ + return mfspr(SPRN_UAMOR); +} + +static inline void write_uamor(u64 value) +{ + mtspr(SPRN_UAMOR, value); +} -- 1.7.1