From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29B9EC433DB for ; Wed, 10 Mar 2021 17:17:05 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFED964FC8 for ; Wed, 10 Mar 2021 17:17:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFED964FC8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M6ENYYjDi+j4qE+FwAjkBiU85xkd9+y+YW1OM2WbjC4=; b=Z/61+l7L8/knQrsqwSgFhQBza jZx/wwoGwyVHGM2FzxEfPML2o2QMrac/ByKhJNnZA0PYOhROUxTJpPTH9jIf3QkgBPdB87USLuzn5 wttkMM0hN3TIRgZQVGt+rvCNcO/8An7FyXjE6jNOuvXv5791qHO6rz3sFcrY2VKElXaEpXLPI9i21 RG6nCW3M44DEJCw53b9logM8G3mhRaZrRuCUpwMucaXRgLMHzF/IuHbxqEHD+XFB4hpKgmy+s+f+9 it6cijVPFNvMHJ2Nchjxorf4cIBfzXI1HxTF+RELeicBqtzBQ6SjzQqdkxVrzr8pC35LlGxg9QT2M kjurRaxmw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lK2R3-007J8x-2q; Wed, 10 Mar 2021 17:15:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lK2Ql-007J5d-7u for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 17:15:33 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id F060864FC6; Wed, 10 Mar 2021 17:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615396530; bh=86RlU0e1UOzDPd83WNEKi/uhQEIp5TGYgL2qEhSd+vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gOODUXQS6ovsSSaT7aE4mjkBBfE49yLozibrXyM+jlC/DmtUXfQQUKmmh0vRogtnr WtWD55UzRUh50LcFI/nDhO4IC8iz2iI+80pboURqQNRoPE7GgKjReCRerw1z9yu8D2 eRHH43gu+QVeootQwkCmlLtOcnD2J9U8wNH2kbvuM0LRjOXbrcEzWDTmahRINGWSwV EMuvOe/UzxhYy0zyksZbIHhjVupNn2IWk+gvUtAXpugtbHFgTVEXOpdjM1Q81FpkVU /PxYAkYYuoAXc1IGE4RBd3b+veOEU2WkoBK5WBejmdwf76EUbf3OK/s/EHOLgfDSOh g7zrwds8wxeMg== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Mark Salter , Will Deacon , James Morse , Catalin Marinas , Mark Rutland , Steve Capper , Anshuman Khandual Subject: [PATCH 3/5] arm64: mm: use a compile time constant for vabits_actual when possible Date: Wed, 10 Mar 2021 18:15:13 +0100 Message-Id: <20210310171515.416643-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210310171515.416643-1-ardb@kernel.org> References: <20210310171515.416643-1-ardb@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_171531_460221_B4C6B05A X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The size of the kernel VA space is a compile time constant unless the kernel is built to support 52-bit virtual addressing, which today is only supported on 64k page size kernels (although this has recently changed in the architecture). This means that in many configurations, vabits_actual can never deviate from its build time default, making it rather pointless to carry this value in a variable. So use a compile time constant for vabits_actual unless it can really assume different values. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 4 ++++ arch/arm64/kernel/head.S | 12 ++++++------ arch/arm64/mm/mmu.c | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index c759faf7a1ff..501c5c87ec0a 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -179,7 +179,11 @@ #include #include +#ifdef CONFIG_ARM64_VA_BITS_52 extern u64 vabits_actual; +#else +#define vabits_actual ((u64)VA_BITS) +#endif extern s64 memstart_addr; /* PHYS_OFFSET - the physical address of the start of memory. */ diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 0b0387644dc0..f65d17a90204 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -294,16 +294,16 @@ SYM_FUNC_START_LOCAL(__create_page_tables) #ifdef CONFIG_ARM64_VA_BITS_52 mrs_s x6, SYS_ID_AA64MMFR2_EL1 - and x6, x6, #(0xf << ID_AA64MMFR2_LVA_SHIFT) - mov x5, #52 - cbnz x6, 1f -#endif - mov x5, #VA_BITS_MIN -1: + tst x6, #(0xf << ID_AA64MMFR2_LVA_SHIFT) + mov x5, #VA_BITS + mov x6, #VA_BITS_MIN + csel x5, x5, x6, ne + adr_l x6, vabits_actual str x5, [x6] dmb sy dc ivac, x6 // Invalidate potentially stale cache line +#endif /* * VA_BITS may be too small to allow for an ID mapping to be created diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 4c5603c41870..338658cd1bea 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -43,8 +43,10 @@ u64 idmap_t0sz = TCR_T0SZ(VA_BITS_MIN); u64 idmap_ptrs_per_pgd = PTRS_PER_PGD; +#ifdef CONFIG_ARM64_VA_BITS_52 u64 __section(".mmuoff.data.write") vabits_actual; EXPORT_SYMBOL(vabits_actual); +#endif u64 kimage_voffset __ro_after_init; EXPORT_SYMBOL(kimage_voffset); -- 2.30.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel