Received: by 10.223.185.116 with SMTP id b49csp2258258wrg; Thu, 15 Feb 2018 08:53:29 -0800 (PST) X-Google-Smtp-Source: AH8x2263jFfclFbMHQHxQhjEnVqnS3gPMZ26oOURv7Yogu3P1O44PZanFPNPuuL+BTmFSHe72mQZ X-Received: by 10.99.126.84 with SMTP id o20mr2680358pgn.188.1518713609464; Thu, 15 Feb 2018 08:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518713609; cv=none; d=google.com; s=arc-20160816; b=sOE4kQzUjSxL41P2Qn9ZOE1qFWzsf8QDUkxv9VlloAizGCM/Y/FoGxkw7tYpXhw/vE 7wZ4GM79/SYreOGPUP8JceVW8Dx+ItM+cTbuq9zFwcSuYhDywJw7GLw+S6cD6xK5hK11 98I5CJMJLTzoLrfqHJE7nCEy6+HLfLZcazKiByBCNp/9P7sASduanfPKNKGvjJCNVp+k aDmD+/VtDDT/WMZ82nXXN2cFAbn0uMh9r5R1OMTypSEhUoZYuFO0N9uQlQnZhUnmgUaG xnA1Z/ok/Vq0F853fO7iYfJCaHNwFwJ9q5P+YDd1EvK0TZ588/AP0uyQiWlJUohe88SM jx7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=C827VtmxOL28cRzTC+/FfZzCxAArgFD75qYXfKyecGM=; b=wa3D9h2vu3vGw/4TR4g08B8hEgQ48TsdLPiPhLlNMeCmV8roE689A6R0r1yjA18Ns6 g5hh1as6HSlk6W2O7ID9Gc+f6Qlh+dpOqP7LGA1uRZSarIE9TMkLC+y7chXT+KvqVHra KTQ4TaBzHUTkEBAd10ioofpubI/u3mVCxh5uCCkGUeu7WTdGTXwDg4lOorcaYzQKMKCB uWIyZOUrRG8cqgTF2PGfpq0ba4yJIEg4T6jWWP6NW3vLPQdAfa4bcNQ9+w6b97ntO52v UQ42vBBU3MbUKttSmkw++ZPtG7jyQiSKwEVtf/7bZCYCCDnHAX7xNydHmMWalvtu0xt4 KFHw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si3261396plh.764.2018.02.15.08.53.14; Thu, 15 Feb 2018 08:53:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426568AbeBOQv5 (ORCPT + 99 others); Thu, 15 Feb 2018 11:51:57 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60054 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423696AbeBOPkS (ORCPT ); Thu, 15 Feb 2018 10:40:18 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A61AE1141; Thu, 15 Feb 2018 15:40:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Laura Abbott , Shanker Donthineni , Will Deacon Subject: [PATCH 4.15 038/202] [Variant 3/Meltdown] arm64: mm: Introduce TTBR_ASID_MASK for getting at the ASID in the TTBR Date: Thu, 15 Feb 2018 16:15:38 +0100 Message-Id: <20180215151715.075650355@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon Commit b519538dfefc upstream. There are now a handful of open-coded masks to extract the ASID from a TTBR value, so introduce a TTBR_ASID_MASK and use that instead. Suggested-by: Mark Rutland Reviewed-by: Mark Rutland Tested-by: Laura Abbott Tested-by: Shanker Donthineni Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/asm-uaccess.h | 3 ++- arch/arm64/include/asm/mmu.h | 1 + arch/arm64/include/asm/uaccess.h | 4 ++-- arch/arm64/kernel/entry.S | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) --- a/arch/arm64/include/asm/asm-uaccess.h +++ b/arch/arm64/include/asm/asm-uaccess.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -17,7 +18,7 @@ msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 isb sub \tmp1, \tmp1, #SWAPPER_DIR_SIZE - bic \tmp1, \tmp1, #(0xffff << 48) + bic \tmp1, \tmp1, #TTBR_ASID_MASK msr ttbr1_el1, \tmp1 // set reserved ASID isb .endm --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -18,6 +18,7 @@ #define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */ #define USER_ASID_FLAG (UL(1) << 48) +#define TTBR_ASID_MASK (UL(0xffff) << 48) #ifndef __ASSEMBLY__ --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -112,7 +112,7 @@ static inline void __uaccess_ttbr0_disab write_sysreg(ttbr + SWAPPER_DIR_SIZE, ttbr0_el1); isb(); /* Set reserved ASID */ - ttbr &= ~(0xffffUL << 48); + ttbr &= ~TTBR_ASID_MASK; write_sysreg(ttbr, ttbr1_el1); isb(); } @@ -131,7 +131,7 @@ static inline void __uaccess_ttbr0_enabl /* Restore active ASID */ ttbr1 = read_sysreg(ttbr1_el1); - ttbr1 |= ttbr0 & (0xffffUL << 48); + ttbr1 |= ttbr0 & TTBR_ASID_MASK; write_sysreg(ttbr1, ttbr1_el1); isb(); --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -205,7 +205,7 @@ alternative_else_nop_endif .if \el != 0 mrs x21, ttbr1_el1 - tst x21, #0xffff << 48 // Check for the reserved ASID + tst x21, #TTBR_ASID_MASK // Check for the reserved ASID orr x23, x23, #PSR_PAN_BIT // Set the emulated PAN in the saved SPSR b.eq 1f // TTBR0 access already disabled and x23, x23, #~PSR_PAN_BIT // Clear the emulated PAN in the saved SPSR