Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1101288pxf; Thu, 8 Apr 2021 23:16:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZTMXA7gzWnOuJpf+7ac329IBgPMREupVzfKQlaKZtk2xkYbi2JhIm9N3fb6OTSR1MkWal X-Received: by 2002:aa7:c950:: with SMTP id h16mr15683649edt.381.1617948995757; Thu, 08 Apr 2021 23:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617948995; cv=none; d=google.com; s=arc-20160816; b=jse0QqRBEQy6jwXf0j9LuWILMSDuyZOp1oUxhlALpL7c+2aprYEKLgUrQI/KByuKVX KbykielkyLTSmvNyrBg3RMP4Alf2+BT6MLOiOjFxWz1VbDm+BQEs/tz6Mt9ZUmrGybEr pHa74gigLTL0SEIjZsr479JKqSk70Lmfh9Of0R0j+giEcIdmMreYZBbEzWFkUNnKtYni LX7qtG4ubsjicNyxbagk2ZhAHcpgSr5kOiXRsaHu4hZxoDiahZgaa1J2L+0S11kJWl7T 0u+4uM8ZeAgwMx8iK1ps+ucARsfAiiSHZQ5bIG3o86OkRTvFzZyne/7JenrCj+GbDezx AIDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=t1XDqrfettaMHMldrJ1+jyYUR3sNWfGpqVm046M5KdA=; b=Pg3v62LXrFp78XmkzVMw5As0k56aRIw299jtlGe+cXklbDfeLs179Ki+jvx5p1GTpm xkSlyBuEAr8HizX7fCt5hQ11/t43GOHX0M5c2tqfClbT1Ge/H3IINgMPSCq/ccnV+mR/ uoAMifLJxJ7+yr0N9cMfqjBeYTDXYdUD0T/H7zYDt7yqlD9PAWLXQblDpbGgG2Tsmo3Y oVLBHIyw6Hw4yQ+I/QDfb02+3U6rGgen+gcJ9DmJsU85cbrV8rhNCXnC208HY7MR1x33 CmX2CCz0kf9+WzmhjCHPAiIJ/pttyS0pcs0gh4/HPQYIr+DyOTs6F1xlB4NBnyAfwCY/ QS7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si1473715edw.445.2021.04.08.23.16.12; Thu, 08 Apr 2021 23:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233332AbhDIGPb (ORCPT + 99 others); Fri, 9 Apr 2021 02:15:31 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:60715 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhDIGPa (ORCPT ); Fri, 9 Apr 2021 02:15:30 -0400 Received: from localhost.localdomain (105.169.185.81.rev.sfr.net [81.185.169.105]) (Authenticated sender: alex@ghiti.fr) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 8D27D10000B; Fri, 9 Apr 2021 06:15:12 +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 v4 0/3] Move kernel mapping outside the linear mapping Date: Fri, 9 Apr 2021 02:14:57 -0400 Message-Id: <20210409061500.14673-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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 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 | 67 ++++++++++++++++++---- 15 files changed, 265 insertions(+), 52 deletions(-) create mode 100644 Documentation/riscv/vm-layout.rst -- 2.20.1