From patchwork Thu Feb 25 08:04:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 12103599 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, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 9A349C433E6 for ; Thu, 25 Feb 2021 08:05:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B6B964EBA for ; Thu, 25 Feb 2021 08:05:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B6B964EBA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 680608D0007; Thu, 25 Feb 2021 03:05:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 631B28D0005; Thu, 25 Feb 2021 03:05:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5477B8D0007; Thu, 25 Feb 2021 03:05:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 3E93F8D0005 for ; Thu, 25 Feb 2021 03:05:15 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0C4C11825675E for ; Thu, 25 Feb 2021 08:05:15 +0000 (UTC) X-FDA: 77856054990.26.1BF3D2C Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by imf27.hostedemail.com (Postfix) with ESMTP id 9212780192E4 for ; Thu, 25 Feb 2021 08:05:07 +0000 (UTC) X-Originating-IP: 81.185.161.35 Received: from localhost.localdomain (35.161.185.81.rev.sfr.net [81.185.161.35]) (Authenticated sender: alex@ghiti.fr) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 8449C240013; Thu, 25 Feb 2021 08:05:05 +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 0/3] Move kernel mapping outside the linear mapping Date: Thu, 25 Feb 2021 03:04:50 -0500 Message-Id: <20210225080453.1314-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9212780192E4 X-Stat-Signature: 4dguuk6mb79wby8zsod51izyrdwaasa8 Received-SPF: none (ghiti.fr>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=relay1-d.mail.gandi.net; client-ip=217.70.183.193 X-HE-DKIM-Result: none/none X-HE-Tag: 1614240307-530141 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. 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 | 61 ++++++++++++++++++++++ arch/riscv/boot/loader.lds.S | 3 +- arch/riscv/include/asm/page.h | 18 ++++++- 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 | 3 ++ arch/riscv/kernel/vmlinux.lds.S | 3 +- arch/riscv/mm/fault.c | 13 +++++ arch/riscv/mm/init.c | 81 +++++++++++++++++++++++------ arch/riscv/mm/kasan_init.c | 9 ++++ arch/riscv/mm/physaddr.c | 2 +- arch/riscv/mm/ptdump.c | 67 +++++++++++++++++++----- 15 files changed, 258 insertions(+), 50 deletions(-) create mode 100644 Documentation/riscv/vm-layout.rst