Received: by 10.223.185.116 with SMTP id b49csp480090wrg; Fri, 16 Feb 2018 02:10:17 -0800 (PST) X-Google-Smtp-Source: AH8x224au8cKah9lVvp0L0BNOFYDrkkGm79cdZb68GHA7z7dtdWolgEOfC5w/Tm1tqnxIQZY1rsH X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr5440461plm.183.1518775817737; Fri, 16 Feb 2018 02:10:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518775817; cv=none; d=google.com; s=arc-20160816; b=oUfPV16jtX+gVe/eycZ1a30duUUpcU8Dyav594h3feI1OSVya8fBNEy30AQhwjpHaw PsEcAJ+GJ9wx99jh+RRcScCXpBx/prg44pejEjCuBEwDu3tjMGot2pmhNeClo5ZjO4lt enkfRivixMqYwKZqAgiayncKGqF6N+/lPxIz8IWz4d4GDs7M1rPSwzHZprL9kPtuPE1R zROZ4avyaMBWm2NHvMe1CcgVABUwHc/JIXAY1W0iWd6vKxjcKq+V17XCUaQf/UVeTBXb oX+Ta6x8IxxJ+ctl6b5V+uVDuiiLEvwPmo0cLzkgX2qTWrhJP0TIEQ1c9Z3bSZlrvyGt uh2A== 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=rMPH2i7DuX8+uT21mEDoezp0o2wH46f/sEUnnoEyxHk=; b=fGloAEicZ3fhzDq5XepTClziFJiGLngDwsLzVczNiaTgsKHdsi4hx7DoUvn7rR8ukc Oe6IGNbgnskR0JPCrHqp2pIGyX3Mi615yHPRfv8YY9v7OeG/wzNe3DTZ2i3UNDbxC0CP /WU6uTaHixW52cPM1PlyJYsNTdhdiyqIlwxxk26q4ZrtXDepmxrbqi0ksh0McoqtkN3u fd6354t0XwyE+PkMRIselOBmKnVxyMasmLEOulwBSdrWLM7be4WBUbGpd6GLrAUX2Isi OMPMHzjKDvWPyqQdSrENaZEQz0GaYEWygcbJ9ha+O9zfK1X0EMM1GkcDnk/uTv5hAeFT p90w== 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 p20si578655pfh.247.2018.02.16.02.10.03; Fri, 16 Feb 2018 02:10:17 -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 S1426741AbeBOQ6B (ORCPT + 99 others); Thu, 15 Feb 2018 11:58:01 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59770 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423530AbeBOPj3 (ORCPT ); Thu, 15 Feb 2018 10:39:29 -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 45CFC10FE; Thu, 15 Feb 2018 15:39:28 +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 022/202] [Variant 3/Meltdown] arm64: mm: Add arm64_kernel_unmapped_at_el0 helper Date: Thu, 15 Feb 2018 16:15:22 +0100 Message-Id: <20180215151714.063533844@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 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: 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