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=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 584D3C433ED for ; Sun, 11 Apr 2021 16:42:16 +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 D3656601FC for ; Sun, 11 Apr 2021 16:42:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3656601FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=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: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:In-Reply-To:References:List-Owner; bh=uqLsTA1gDaBIVfvbvVuG86SRO1dpB/Sga2ZdByN8bWA=; b=KvE8IG+aqPUncL04bEHEvD30TH oYosP4AI/zlFOfPU1eeFTmui8dmrwk6E3J6mWm8fn3G2tF7YxOCk3v2NEOqfOOESLctqiWAyTvUZu QGyKuPIz6SuHJXAeLuECiUd6JnxWy6jo7oP5fRGhbYGfalY2LAJoo84LUDW9eEml/JVc/R+UUjeMp AscZN9iHH6V9/02RCQ5aqBANHLwHNc4XFF9XExoJiBb969GGhrifUrlv3Hv8MChKHO1RyfnAMqcdb DwBj0iT1I65NBkVSyq+vZSdiMyHUxQ0zu/dg76gPZvmh1ftzFEdsB94aYWsXsb+pUwbdUFgI7El5D BZNS/ZHw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVd9v-004m7T-Oa; Sun, 11 Apr 2021 16:42:03 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVd9t-004m7F-Qe for linux-riscv@desiato.infradead.org; Sun, 11 Apr 2021 16:42:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Ch/IfGD5PGyjnqwG0mYAKGWiVWhbCS/KfAIOn22xtx8=; b=II8WMrOaYb4Msi2hVEKaXBZ6X+ upKyXLjQb32u88ZhQSkPcQltrtRt/yP844Tru2ljJ6horemruHrBBlLqCxS7agEF8T8pIe6fk7W39 x3Uv1z3H03kD8dtVVKdxDHjJsI4Pns3xDbg2NdXXFgOU7RpszQErNEwQXLAF1TmNPirnnI0ABYFh1 qnGCrdAQeDpeEnMV5DELgyYaxMv//PnI2wt5qnbblnmBTQN2sfOPMVdiSPHndTpL0wWCOLBpupGMp DREyz22KL0rEnbe8/LdKvQUjMHW80jiyeAiozkMZ+XdSjHu1GYUhEuAIu2+hxXC7tS77nf7h1jya3 0wNVgN6Q==; Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVd9q-005bRe-Ih for linux-riscv@lists.infradead.org; Sun, 11 Apr 2021 16:42:00 +0000 X-Originating-IP: 2.7.49.219 Received: from debian.home (lfbn-lyo-1-457-219.w2-7.abo.wanadoo.fr [2.7.49.219]) (Authenticated sender: alex@ghiti.fr) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 4736C240012; Sun, 11 Apr 2021 16:41:47 +0000 (UTC) From: Alexandre Ghiti To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Alexandre Ghiti Subject: [PATCH v5 0/3] Move kernel mapping outside the linear mapping Date: Sun, 11 Apr 2021 12:41:43 -0400 Message-Id: <20210411164146.20232-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210411_094158_894020_74B3A768 X-CRM114-Status: GOOD ( 15.88 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org I decided to split sv48 support in small series to ease the review. This patchset pushes the kernel mapping (modules and BPF too) to the last 4GB of the 64bit address space, this allows to: - implement relocatable kernel (that will come later in another patchset) that requires to move the kernel mapping out of the linear mapping to avoid to copy the kernel at a different physical address. - have a single kernel that is not relocatable (and then that avoids the performance penalty imposed by PIC kernel) for both sv39 and sv48. The first patch implements this behaviour, the second patch introduces a documentation that describes the virtual address space layout of the 64bit kernel and the last patch is taken from my sv48 series where I simply added the dump of the modules/kernel/BPF mapping. I removed the Reviewed-by on the first patch since it changed enough from last time and deserves a second look. Changes in v5: - Fix 32BIT build that failed because MODULE_VADDR does not exist as modules lie in the vmalloc zone in 32BIT, reported by kernel test robot. Changes in v4: - Fix BUILTIN_DTB since we used __va to obtain the virtual address of the builtin DTB which returns a linear mapping address, and then we use this address before setup_vm_final installs the linear mapping: this is not possible anymore since the kernel does not lie inside the linear mapping anymore. Changes in v3: - Fix broken nommu build as reported by kernel test robot by protecting the kernel mapping only in 64BIT and MMU configs, by reverting the introduction of load_sz_pmd and by not exporting load_sz/load_pa anymore since they were not initialized in nommu config. Changes in v2: - Fix documentation about direct mapping size which is 124GB instead of 126GB. - Fix SPDX missing header in documentation. - Fix another checkpatch warning about EXPORT_SYMBOL which was not directly below variable declaration. Alexandre Ghiti (3): riscv: Move kernel mapping outside of linear mapping Documentation: riscv: Add documentation that describes the VM layout riscv: Prepare ptdump for vm layout dynamic addresses Documentation/riscv/index.rst | 1 + Documentation/riscv/vm-layout.rst | 63 +++++++++++++++++++++ arch/riscv/boot/loader.lds.S | 3 +- arch/riscv/include/asm/page.h | 17 +++++- arch/riscv/include/asm/pgtable.h | 37 ++++++++---- arch/riscv/include/asm/set_memory.h | 1 + arch/riscv/kernel/head.S | 3 +- arch/riscv/kernel/module.c | 6 +- arch/riscv/kernel/setup.c | 5 ++ arch/riscv/kernel/vmlinux.lds.S | 3 +- arch/riscv/mm/fault.c | 13 +++++ arch/riscv/mm/init.c | 87 ++++++++++++++++++++++------- arch/riscv/mm/kasan_init.c | 9 +++ arch/riscv/mm/physaddr.c | 2 +- arch/riscv/mm/ptdump.c | 73 ++++++++++++++++++++---- 15 files changed, 271 insertions(+), 52 deletions(-) create mode 100644 Documentation/riscv/vm-layout.rst -- 2.20.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv