Received: by 10.213.65.68 with SMTP id h4csp712074imn; Fri, 6 Apr 2018 07:41:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx48aCiSyku+BdnVNrC1R89TUUxHwATKtZD0y1cbYMpLjfSK1WjE2YR2lwOMlx3TiRQI/yDtL X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr17855852plb.36.1523025671094; Fri, 06 Apr 2018 07:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523025671; cv=none; d=google.com; s=arc-20160816; b=in7gqqRDtW2sp2/afcfw/cShbr+gdL8+YAdo7PiCNmERbKxPBbszB/vpEK5vyCSo3n kpuBESFl88aGRTBpGlaslC9sTsdsYsvQkV0Ws6P/pf5AFyEu8vtbOUp1rwENTw/rmURw E12OTOrGlGcV+KoY06tIBfD2JByLln02G1BR/5f05pVitLlwWsY37ZlDF9UX0Grmo9nD 913SI0JMIURv+z5hWUX5FBn0I37Ws79o+/HqYfBBt/+Y8stuLjk2JgQ80BzdK2AqODr2 U4+xhZfVuuH+MWTGFoKxRO4VEeZ36CxBRPcftl9V0Ojf+SZrzBC2Tk8Bs3o5gdDmwaqn xrAg== 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=YoR7v9WYHEodkRO1BWlGXpl+q3v0aGp8Q+uuWx5EkII=; b=ovxhae04v8hN2qB0kfsywNygVEwYA2nPG4SnFkx6FRgAjX900iOcHvKn3QRCYyPSrC rdVWqjBnYEi56IwryJ6meweEax2SZ541u/AYfZcBn5csz08zc9vtw+LwDAKEGfC9ByoD zoB3Q/ae6/C8yZWqTm/KQcbbL3FQUszhXBDr5YxizURBEhB/SGJLDIQ61fXadLiBkQ6y ndHMUHG3tv7FpeOcFowvWwR0Tc7iOeA1ZwsW/5Hr9e3uoaCYnivXY9cY+MZCIqoFBYep Ja1soz05A3x+RxTCIzodiaJwZ4+5B20N725/V6CRywXE1T9M/kW8HXHu5Gz8zY1LiqGo FAVA== 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 a123si1391860pgc.43.2018.04.06.07.40.57; Fri, 06 Apr 2018 07:41:11 -0700 (PDT) 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 S1755921AbeDFNet (ORCPT + 99 others); Fri, 6 Apr 2018 09:34:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58472 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753046AbeDFNep (ORCPT ); Fri, 6 Apr 2018 09:34:45 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 617EDDBE; Fri, 6 Apr 2018 13:34:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Mark Rutland , Laura Abbott , Shanker Donthineni , Will Deacon , Greg Hackmann , Alex Shi Subject: [PATCH 4.9 053/102] arm64: mm: Add arm64_kernel_unmapped_at_el0 helper Date: Fri, 6 Apr 2018 15:23:34 +0200 Message-Id: <20180406084339.098378750@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.9-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: Alex Shi [v4.9 backport] Signed-off-by: Mark Rutland [v4.9 backport] Tested-by: Will Deacon Tested-by: Greg Hackmann 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 @@ -18,6 +18,8 @@ #define USER_ASID_FLAG (UL(1) << 48) +#ifndef __ASSEMBLY__ + typedef struct { atomic64_t id; void *vdso; @@ -30,6 +32,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); @@ -39,4 +46,5 @@ extern void create_pgd_mapping(struct mm pgprot_t prot, bool allow_block_mappings); extern void *fixmap_remap_fdt(phys_addr_t dt_phys); +#endif /* !__ASSEMBLY__ */ #endif