Message ID | 1509958663-18737-8-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 [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVnX65PLcz9s5L for <patchwork-incoming@ozlabs.org>; Mon, 6 Nov 2017 20:37:10 +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="e3wfR5v7"; 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 3yVnX64BvZzDrJr for <patchwork-incoming@ozlabs.org>; Mon, 6 Nov 2017 20:37:10 +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="e3wfR5v7"; 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::241; helo=mail-qt0-x241.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="e3wfR5v7"; dkim-atps=neutral Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) (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 3yVmgj4BKWzDr8P for <linuxppc-dev@lists.ozlabs.org>; Mon, 6 Nov 2017 19:58:41 +1100 (AEDT) Received: by mail-qt0-x241.google.com with SMTP id z28so9973201qtz.13 for <linuxppc-dev@lists.ozlabs.org>; Mon, 06 Nov 2017 00:58:41 -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=/NGprG9bGGXGmcHehfemklX7xYliFAGm0AG06j+g1oI=; b=e3wfR5v7fUiFTyrLJLR19PUI5/2eTwktQ4Oj6qV9l3m/4+eJK+EiPt5LTfV8NQLznn mJ+hZM3eR+Uwqbawt1m1D5ZjVWr0SX0ctNomWZacJNasAcickfVZJ/o81+XjhJo9c0qG CUCJ5ZzjrAU9VddU0rnA71tMJyC64VDbztWD67aBdbwghBtnnyqM3wZrA9cXFg5/uBLQ JycSLpZUQR3BG8NZOTbcihuCgdpMS/RvZlPQIAgJMASmMUjfe+pYqqDrItzNPJjgskJf oCQj/WAoHN+8A5RHIXGUk5Bq+bhs5CVsgn1Z2VT+/zIxg6mQb782/hRD7wVTT4t3o/3k 3B6A== 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=/NGprG9bGGXGmcHehfemklX7xYliFAGm0AG06j+g1oI=; b=mlaIb7o4KrZ6h3URziW/WRHbr4aZbWN7AlPNxl2YTTNUy6Rx5uJkH16PU8zXAx0C6e dk5P6Hp5XrwXidKpjYULiw9kbuOOh3+KZdSVuuXmJGf7HiUhGu1FeGAlGkIArBr8Ao1E aTLITnqJme+AzyABv7inB9ryrO7fv5phsUvDvicHhk+M0QUo+qEBK1NQU3czy6Y6p3Bm 0hnXONJeiWzS1/KIAtO/kU4SmFC7vMS0qtOEigm2VHsOJTHLO8C7o6Re8L0dyUNaTPYe teaQaCWGioNy2yXLuF7G52yXDDAt4Oe++QPsRwP3VTDmmW+qi42oX7vYC6ZuEwvAhlNl 3ICA== X-Gm-Message-State: AMCzsaXCcrzBarKgvnQu69QwV6scDYOHWDihNUhfPmZqbTQGNHo6Rlwa SO7AK4VV8I3CXRxFZFqTAKk= X-Google-Smtp-Source: ABhQp+SBUX/sKjysDYd2UNMDzeV6MFUHXVYg+GjbkGB8uvo7wAk1b/lL8a2COXw+aUIl0wW1STYTOg== X-Received: by 10.200.46.132 with SMTP id h4mr21967185qta.88.1509958719706; Mon, 06 Nov 2017 00:58:39 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 00:58:39 -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 07/51] powerpc: cleanup AMR, IAMR when a key is allocated or freed Date: Mon, 6 Nov 2017 00:56:59 -0800 Message-Id: <1509958663-18737-8-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/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h index e5deac7..0d00a54 100644 --- a/arch/powerpc/include/asm/pkeys.h +++ b/arch/powerpc/include/asm/pkeys.h @@ -69,6 +69,8 @@ static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) __mm_pkey_is_allocated(mm, pkey)); } +extern void __arch_activate_pkey(int pkey); +extern void __arch_deactivate_pkey(int pkey); /* * Returns a positive, 5-bit key on success, or -1 on failure. * Relies on the mmap_sem to protect against concurrency in mm_pkey_alloc() and @@ -96,6 +98,12 @@ static inline int mm_pkey_alloc(struct mm_struct *mm) ret = ffz((u32)mm_pkey_allocation_map(mm)); __mm_pkey_allocated(mm, ret); + + /* + * Enable the key in the hardware + */ + if (ret > 0) + __arch_activate_pkey(ret); return ret; } @@ -107,6 +115,10 @@ static inline int mm_pkey_free(struct mm_struct *mm, int pkey) if (!mm_pkey_is_allocated(mm, pkey)) return -EINVAL; + /* + * Disable the key in the hardware + */ + __arch_deactivate_pkey(pkey); __mm_pkey_free(mm, pkey); return 0;