Received: by 10.223.185.116 with SMTP id b49csp2557937wrg; Thu, 15 Feb 2018 13:36:44 -0800 (PST) X-Google-Smtp-Source: AH8x225lLE2yItQRNecnBUG5kpPx5IerF++t8sit4xvE7H7nELihi9X45lh2jiPmVg9JWvGuPjuU X-Received: by 10.101.86.73 with SMTP id m9mr3372270pgs.70.1518730604285; Thu, 15 Feb 2018 13:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518730604; cv=none; d=google.com; s=arc-20160816; b=S20VXfDF+6/PAj31P/Ge6Q7IUSmjqy7uGqSEOhPcb7NboB5uv61MlD7rRgjpxMWUNI py/cUpenmHqWxI2IhEFDHk26jzgRtovDsHHopxcR4Z7VD5O6dfBKTovNAS9iaQeJhNpi +4isNU/+UqHasJkpK/Xvd7lfe+Idk7k/SZQGK55RslKkDCSSCu05ckNQK/zxulBpEi8+ 9VL3JMXxLdKIz8DKy+iYsYKjtXEQkbAAMUb/x3te4DRCR1h7rp4rWdK2WDnauIPQCZk0 3sCloD5KNkRmC/OQ6qeGqxKcCykdj4PjUqyhkHq2Ad1/W7s65TDK1eLk1CUFuxDpCDLq P/pA== 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=4IO7XPB6p9zLYkEeU+cOBWJWLkcxKeqKo0KjuHw5Pjc=; b=LWMmYgec5F9yE+6JAlRngoIS+NZUXK0xIReR0oHysifxD8qZSHQOS0UOSt5TLkTgTc sjniQm4dR/UzDrz1KxGXTjOlP94cJ7GH1wzjOYJ+qrTaNd57ccJYPlsimR2NExADM0hi nJBiROO26j1Wkq/QDn+lbdkuj5tw+9AQqxxcumuuL4IrSaY3xr7RFlPwfEY/5p3dh5df ZGVZMHuTW9HIRkyTXrLPruCVZuOueq3tHNKYl1RSTgTnmvOkjkHKz14ArfAzSQeyfzQE lb8q2QMlQuVrN5I3uV8fIsmOnsOGQVMz3lY5+ZI3x6ld/VKSk7i+JtAHy8BMLeFeOtfn nJ9w== 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 i67si586584pfj.212.2018.02.15.13.36.29; Thu, 15 Feb 2018 13:36:44 -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 S1164299AbeBOPax (ORCPT + 99 others); Thu, 15 Feb 2018 10:30:53 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55246 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164268AbeBOPav (ORCPT ); Thu, 15 Feb 2018 10:30:51 -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 95C501124; Thu, 15 Feb 2018 15:30:50 +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 , Ard Biesheuvel Subject: [PATCH 4.14 030/195] [Variant 3/Meltdown] arm64: mm: Add arm64_kernel_unmapped_at_el0 helper Date: Thu, 15 Feb 2018 16:15:21 +0100 Message-Id: <20180215151707.264336550@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon Commit fc0e1299da54 upstream. In order for code such as TLB invalidation to operate efficiently when the decision to map the kernel at EL0 is determined at runtime, this patch introduces a helper function, arm64_kernel_unmapped_at_el0, to determine whether or not the kernel is mapped whilst running in userspace. Currently, this just reports the value of CONFIG_UNMAP_KERNEL_AT_EL0, but will later be hooked up to a fake CPU capability using a static key. Reviewed-by: Mark Rutland Tested-by: Laura Abbott Tested-by: Shanker Donthineni Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/mmu.h | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -19,6 +19,8 @@ #define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */ #define USER_ASID_FLAG (UL(1) << 48) +#ifndef __ASSEMBLY__ + typedef struct { atomic64_t id; void *vdso; @@ -32,6 +34,11 @@ typedef struct { */ #define ASID(mm) ((mm)->context.id.counter & 0xffff) +static inline bool arm64_kernel_unmapped_at_el0(void) +{ + return IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0); +} + extern void paging_init(void); extern void bootmem_init(void); extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt); @@ -42,4 +49,5 @@ extern void create_pgd_mapping(struct mm extern void *fixmap_remap_fdt(phys_addr_t dt_phys); extern void mark_linear_text_alias_ro(void); +#endif /* !__ASSEMBLY__ */ #endif