Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2626400ybb; Sun, 22 Mar 2020 04:02:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs4tMEqFUO90KX6J15g0a0kV3YRPjJOUsOZHQ8ZBDV8+dnHSbT8ZCqzaKFjyX6KWmTF+Sn0 X-Received: by 2002:aca:bd0b:: with SMTP id n11mr12763590oif.90.1584874942399; Sun, 22 Mar 2020 04:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584874942; cv=none; d=google.com; s=arc-20160816; b=LQVw57XU9hb4+2M1PMZZMKf91/TKtsP37l5dIyp26u87Gy7u6IZ5fXDkijuLIunqVt MSbTMEg2wgYAJC84hSi1eFWd5wLcY8US86+JA2bvvm2uMDM6wIvO4QvVyrKJYTnSup5p lp1aC3PSP8J5kr69Qh0V1N9CIwFkPVg3/NfIGFSbnR0OdNltUpLILocnvV1gS5fJmzNe 3FKaWerjQPpfCuUYFFrWFmfZCXNpur9g9KwOnOIj3YegT+gaUF6kjpGlBicQyuFtJh4Z 3mp1pbTwIoBfBRD9j8zK0RN/+bMfma/Vui3ygtA4IyEvG7jBEyWGmqpxbDprOEEFSQyo K64Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PD45gpLQprj+XyLjSdUELKM6avVVVmzAswmUhXyeh+4=; b=0z+eg7ebElQV94rGvNE8/m3JwX3kNojeyv7rcbPR6VMAJ3C8z/vMgcJUAcVtw8Aeqn YxP5a4Tl0NoRIFUuYAI4nuFicLfvg0LHV+TOqJs45ArpGGAavZuA6weJwzvF1V4b+7ja Jku4GKUyJ7Ptzx692RNbMLeRRj1DwLJsmfz0iN1T1uWhK/AQ23wyYeimr8qxpoAGH2Vg uL0wX6Xvt+QhxWWbxrNamgtf/WEXkg8keAH0Nx8BQwul5WICZhOVxMQ9rMFQUmXDsHBo WDqen8wJU2cv6jTxcdvilekOHK52uJ/8G9lVPIfL+oilZbQnUMbXeNQHran/FPEFKyCH oKLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u66si3541094oib.159.2020.03.22.04.01.56; Sun, 22 Mar 2020 04:02:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726979AbgCVLAh (ORCPT + 99 others); Sun, 22 Mar 2020 07:00:37 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:37813 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgCVLAh (ORCPT ); Sun, 22 Mar 2020 07:00:37 -0400 Received: from localhost.localdomain (lfbn-lyo-1-453-25.w2-7.abo.wanadoo.fr [2.7.45.25]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id DD5E224000A; Sun, 22 Mar 2020 11:00:32 +0000 (UTC) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Zong Li , Anup Patel , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [RFC PATCH 0/7] Introduce sv48 support Date: Sun, 22 Mar 2020 07:00:21 -0400 Message-Id: <20200322110028.18279-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset implements sv48 support at runtime. The kernel will try to boot with 4-level page table and will fallback to 3-level if the HW does not support it. The biggest advantage is that we only have one kernel for 64bit, which is way easier to maintain. Folding the 4th level into a 3-level page table has almost no cost at runtime. At the moment, there is no way to enforce 3-level if the HW supports 4-level page table: early parameters are parsed after the choice must be made. It is based on my relocatable patchset v3 that I have not posted yet, you can try the sv48 support by using the branch int/alex/riscv_sv48_runtime_v1 here: https://github.com/AlexGhiti/riscv-linux Any feedback appreciated, Thanks, Alexandre Ghiti (7): riscv: Get rid of compile time logic with MAX_EARLY_MAPPING_SIZE riscv: Allow to dynamically define VA_BITS riscv: Simplify MAXPHYSMEM config riscv: Implement sv48 support riscv: Use pgtable_l4_enabled to output mmu type in cpuinfo dt-bindings: riscv: Remove "riscv,svXX" property from device-tree riscv: Explicit comment about user virtual address space size .../devicetree/bindings/riscv/cpus.yaml | 13 -- arch/riscv/Kconfig | 34 ++--- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 4 - arch/riscv/include/asm/csr.h | 3 +- arch/riscv/include/asm/fixmap.h | 1 + arch/riscv/include/asm/page.h | 15 +- arch/riscv/include/asm/pgalloc.h | 36 +++++ arch/riscv/include/asm/pgtable-64.h | 98 +++++++++++- arch/riscv/include/asm/pgtable.h | 24 ++- arch/riscv/include/asm/sparsemem.h | 2 +- arch/riscv/kernel/cpu.c | 24 +-- arch/riscv/kernel/head.S | 37 ++++- arch/riscv/mm/context.c | 4 +- arch/riscv/mm/init.c | 142 +++++++++++++++--- 14 files changed, 341 insertions(+), 96 deletions(-) -- 2.20.1