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=-7.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 5A6EFC4363C for ; Wed, 7 Oct 2020 08:41:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 E96F320797 for ; Wed, 7 Oct 2020 08:41:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="i59kuq/4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ruxkH5eZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E96F320797 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=BoYemaIYkjvw8X6nkZqcjph7M/iUWfjaVeylLw+ZnzM=; b=i59kuq/4QzdTLzcuIqHl48cIsl 81KPagHgb65R2R/0EpPCruAeQvSYiI2bRaPi+rCBLi2PC2/oVEde3U3VWEGLZ0oOeNttquCs9xDJg Z2SXHql5ou5YLofwjz9nRLlCqXMaeYT9rgSpI6Af+Dp/JO2AHo0yNokFi6pWkl3/Crrr7trRj/tKP hV9NVu3HIhd9X+K62L8p/HbWsfa3acsKtbLKvtfJFkW5ReKlZvjjj5B3JnrgZDGkSziG2RHngsVa9 6qO6dklwNtBwUdW09TIQr7ZqVyNRNoSMgVMkkwNUKnJ6N6rn8SyUnyfEO0ir9EIMUF1ObY5ix168h /b6NAP2w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQ4zN-00051W-5x; Wed, 07 Oct 2020 08:39:57 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQ4zK-00050b-4B for linux-arm-kernel@lists.infradead.org; Wed, 07 Oct 2020 08:39:55 +0000 Received: from e123331-lin.nice.arm.com (lfbn-nic-1-188-42.w2-15.abo.wanadoo.fr [2.15.37.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0632520797; Wed, 7 Oct 2020 08:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602059992; bh=So9BaTfkr2hWSPzSBYYsqLUFDnDQ26JUN1Ta5wkmpFo=; h=From:To:Cc:Subject:Date:From; b=ruxkH5eZo9oqwHE1phKWgIjlsvwYZLlresFMJO+OpxXFRM2qWQU2ZXeQTL7SIgHBG bZ+Dqyy5q1P5v7wdABtZAI1lWPmlI6S0yGUJWEBGtbo5t21CqkGJDnpDgGpELCdGRo UWdB3ZMlxZJTR1s/1TCWtA0fiGiqu8al2AsodDWM= From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 0/2] ARM: move FDT mapping out of linear region Date: Wed, 7 Oct 2020 10:39:42 +0200 Message-Id: <20201007083944.27910-1-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201007_043954_327270_7A40492F X-CRM114-Status: GOOD ( 21.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Nicolas Pitre , Linus Walleij , Russell King , Rob Herring , Ard Biesheuvel MIME-Version: 1.0 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 For the ARM kernel, setting up the kernel's virtual address space at boot is tricky, given the risk of collision between 1:1 mapped regions and virtually remapped regions. There is also a concern regarding the exact mapping attributes that are needed for each region, which differs between ARM architecture revisions, UP vs SMP etc For this reason, the kernel VA space is set up in two stages: at early boot, only the kernel itself and the DT are mapped using section mappings and later on, all existing mappings are torn down except the one covering the first memblock covering the kernel, and remapped again using the full fledged mapping routines that can map at page granularity and use all the right mapping attributes. There are cases where this may result in the DT getting unmapped at this point, and not remapped again. For instance, if the first memblock is not PMD aligned, we will align it up, and mark the memory below it as MEMBLOCK_NOMAP, to avoid having to allocate page tables to create the mapping before we have a mapped memblock to allocate from. If the DT happens to reside in this region, it will not be mapped at all when the permanent kernel VA mappings are in place, resulting in crashes. As we happen to have a 4 MB hole in the kernel VA space (between the end of the VMALLOC space and the start of the FIXMAP region), let's use it to create a permanent, read-only mapping of the DT that is not affected by any such issues. Changes since v1: - bump the start of the fixmap region by 512 KB so we still have a full guard region even on LPAE builds, which will use the entire 4 MB window for the read-only mapping of the DT - update Documentation/arm/memory.rst accordingly - add Linus's ack Cc: Linus Walleij Cc: Florian Fainelli Cc: Russell King Cc: Nicolas Pitre Cc: Rob Herring Ard Biesheuvel (2): ARM: centralize phys-to-virt conversion of DT/ATAGS address ARM: move device tree mapping out of linear region Documentation/arm/memory.rst | 7 ++++++- arch/arm/include/asm/fixmap.h | 2 +- arch/arm/include/asm/memory.h | 5 +++++ arch/arm/include/asm/prom.h | 4 ++-- arch/arm/kernel/atags.h | 4 ++-- arch/arm/kernel/atags_parse.c | 6 +++--- arch/arm/kernel/devtree.c | 6 +++--- arch/arm/kernel/head.S | 5 ++--- arch/arm/kernel/setup.c | 19 ++++++++++++++----- arch/arm/mm/init.c | 1 - arch/arm/mm/mmu.c | 20 ++++++++++++++------ arch/arm/mm/pv-fixup-asm.S | 4 ++-- 12 files changed, 54 insertions(+), 29 deletions(-) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel