Received: by 10.223.164.202 with SMTP id h10csp19337wrb; Mon, 6 Nov 2017 01:41:40 -0800 (PST) X-Google-Smtp-Source: ABhQp+SDXT6+1mAj4hbwg8QpcgNVDkNGbLvvTJM8Kj8dLZjDYIAFIllbTcn8niurWHgpRgFVdMl7 X-Received: by 10.84.128.99 with SMTP id 90mr14033543pla.171.1509961300273; Mon, 06 Nov 2017 01:41:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509961300; cv=none; d=google.com; s=arc-20160816; b=xGUpG/kSISYg8dfibo50FzPh0F5arEcACQWkE5+nMAdAdlYu0QHECT6xXFu26+iKeR i2pVE+myBxa1k7i3lyabCIg/fIbrgmynkIESJWZzkRyxvkytvFLdlNBmKtA+oaY4OZ7n 0Hw3BNsiROaWbSNAjJOWWJhGRu7ccUYNGjFU7v70Nzhgz+YOBKYEhQE4PAQMUgYMEFnt ohidQBKbeGwmk4BlcrgRoLR1l7avYsFAgszpqAXtVG579cwy9q1ppsKckzVuKLnMy9ER j96q4QHDsEjCtwk7fu2X0MCgUOIhEt15BP0UvPFxSQHNWsxSPm/tL6cNgbcwOwv2qgT+ 5dRQ== 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=Yy09kdvbtwjxAWsFZANwseSdoxGckL4DWFpPUWkTYeA=; b=wcS8nWJHkxwqacuAGQvrh51ITpATI+nub23wXhi+IFuwxSREUhyJZ7LiBZlB1MlePN Ke9tBpoKkyYwFKHz4FoHDN9ykRTSzaGzPPNLkCt6gXuulZFNEPPHp01J7q2tbbIO8hbW x1/NiGo9+QVOwNPr1r8aYzvaA7yAMVYM8D+wNhSQ/vhAdRuvNRKEbiEN3pBDY3MXwiWR LM95JQuxbyXXHpULMuQQJjQ7MTcROhVQCMAjNsnBNutDRlAy7vrgJebjW5xhzDJj2rLD wSeiVm2FWXqBMqoRCPxs0toUQAhr/67wuS3g/FX58uv95Q2iPqWV++bX6a03mPmtIlU2 RfaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=edM9ChX3; 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 k185si11136950pgc.527.2017.11.06.01.41.26; Mon, 06 Nov 2017 01:41:40 -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=edM9ChX3; 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 S1751694AbdKFJjo (ORCPT + 99 others); Mon, 6 Nov 2017 04:39:44 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:49632 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbdKFI6f (ORCPT ); Mon, 6 Nov 2017 03:58:35 -0500 Received: by mail-qt0-f194.google.com with SMTP id k31so9997576qta.6; Mon, 06 Nov 2017 00:58:34 -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=Yy09kdvbtwjxAWsFZANwseSdoxGckL4DWFpPUWkTYeA=; b=edM9ChX3SspVRVCxBH00otVNLka/Q6av3dfJPGjq8fEb8zlfB5bVIjO3D4S2/41zcK 1PLZQMF9bONdyyg6yOxChG2w53KVk6AVXxBJo0qpDVolQSLZwLFFmCH33vJIL0LKHEVY drTonhQUNNUQ2VNd82pRmdeXQdk2ak/Abopz00m4b3dEwx/6Q5kHKeoyndRNVEuNgxDC BXOZj+HEsZqY+ySvzj5ObDKY6m2H83NleQlXlhlGl4IhxC34cWVqIOTh1GkoRLfdDJw3 LlxjeJNZzZk2GCLAH0H+vYWYYOMQs2AhSpV1dsHT6Nbz3o6Y2mhK3sv4xDjkk/BCmlWw Rxuw== 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=Yy09kdvbtwjxAWsFZANwseSdoxGckL4DWFpPUWkTYeA=; b=TXKNz3F8iuywnHASFB6aaTWFSamNGYNfdmF8XNvSnLPKIxxE8OyhJl1jNB07xP6el9 WT0SslUnO2xvzAHh8jpQXxbaoV1ncUj9bH3q+Bhk8NBbwtyBCtGDMq9vrvxoKf8JtA4c hAIZCEx4lQfAQKIM5ENBS6N4Az/iMgre6a9qj9+W84ppF5XQ9h9l/vF0UBbF5cKcv/69 MBJ69P2h+s0/SwWNIZTkfPaxoLoYKng5eT6hKipCps6KAK0z6bveqzo6ip6BPao6fRaH p7hDUZm7FuPDfLyJyRwjZ2VZ7WQIXEaAI8n7F5uKxijUHIOK6F/bYqlKsjvijBdggNjK Z1nw== X-Gm-Message-State: AMCzsaX0fIfFhfwXFmbdNAQ4VlskVvaj315dq/T9jrUqQBl8pDrfIv4t dLcy3RInwgr7arYuKvwJ6+Q= X-Received: by 10.200.17.1 with SMTP id c1mr20218575qtj.252.1509958714189; Mon, 06 Nov 2017 00:58:34 -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.58.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 00:58:33 -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 05/51] powerpc: helper function to read,write AMR,IAMR,UAMOR registers Date: Mon, 6 Nov 2017 00:56:57 -0800 Message-Id: <1509958663-18737-6-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 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 512bdf2..b6bdfdf 100644 --- a/arch/powerpc/mm/pkeys.c +++ b/arch/powerpc/mm/pkeys.c @@ -61,3 +61,39 @@ void __init pkey_initialize(void) for (i = 2; i < (pkeys_total - os_reserved); i++) initial_allocation_mask &= ~(0x1 << i); } + +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 From 1583309458835695531@xxx Mon Nov 06 09:46:05 +0000 2017 X-GM-THRID: 1583307505196060866 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread