Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1911489pxf; Sat, 13 Mar 2021 01:27:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR7jmQf0CHpA1TtCby+jp1Dlk/gLtcGef+b/7WdxJ7LDWYFfvV3dmaetrqtVSxXywC1XDy X-Received: by 2002:a50:82c5:: with SMTP id 63mr18844024edg.97.1615627672023; Sat, 13 Mar 2021 01:27:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615627672; cv=none; d=google.com; s=arc-20160816; b=A16BK40S9xFcYvgfU2dQRW2yqfry0VRJ/47gjph580GX/crwLWznPgOdHKVSN3dkPi aFuVSEwpgTeYsfFOo+2fjpn2aruJj5d2nVMe7oRpf7lbpj76MLcg79XSkbp1CqOzdw+7 V3ngoPwZ2NbiUHsPUT42kektKfHA4nzzErOES5l+gb4f6JzGXI2m0TosStwLGoTxiIgB U5p1FfbzGR9b98o1xnHQFctsiPMhsi94RvbDqI0583O8Kzo7BxL8oOmZGTmrCHMfAie/ jLN9cZyZZA5gfUWvObUiMDx3por12njLd18JtCtc3uV3TIrIZh3rUVbZMVBqpxb+eBe+ X/Cw== 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=cgF/cnTR5pivoHaP9SYs3dcV7ZI5KyrACSoleu8IMlA=; b=pEAAyrFHVnrNOuTZ0otQYaTJrs3j29BK1uXGps8qQ9ZKdupJkFj8db7zE/lPSYF0GS kXOQiAY/1kuwLix8ojMqADXXXancc9A0gv7Wa91WJbjZKeioJdrQzzv7pk6Zaml0ub55 bmB8by2gJCa1jZlhOu9p4/6txrdzvGGGXoPvG2cyYENvc1SU02tb6RQQpSz8Q9ydnAaE SyAETo/6zvnoTdYOh0rv7SZWHQzmLYLFmr/K6MR9XLUJsKgHT1JPBKBhvSO1hTi1wOS3 DWVdEWsc/lWJhe8F9DGGxdZ1xAf5v7CVNpmjhWz+T4WbzrqpoAmvuBp/WnsDrrfPHNyD BtzQ== 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 l23si6193495ejb.431.2021.03.13.01.27.27; Sat, 13 Mar 2021 01:27:52 -0800 (PST) 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 S231383AbhCMJZe (ORCPT + 99 others); Sat, 13 Mar 2021 04:25:34 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50447 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbhCMJZR (ORCPT ); Sat, 13 Mar 2021 04:25:17 -0500 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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 32F551C0003; Sat, 13 Mar 2021 09:25:10 +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 v2 0/3] Move kernel mapping outside the linear mapping Date: Sat, 13 Mar 2021 04:25:06 -0500 Message-Id: <20210313092509.4918-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 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 | 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 | 83 +++++++++++++++++++++++------ arch/riscv/mm/kasan_init.c | 9 ++++ arch/riscv/mm/physaddr.c | 2 +- arch/riscv/mm/ptdump.c | 67 ++++++++++++++++++----- 15 files changed, 262 insertions(+), 50 deletions(-) create mode 100644 Documentation/riscv/vm-layout.rst -- 2.20.1