Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2632568ybb; Sun, 22 Mar 2020 04:09:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvAcORY9iqvf+lFKDoAm+xmYKUJn3nupITShqZHjU4RTbO5BLU5niCNKqbbyjTm4fD+B5jq X-Received: by 2002:aca:57d6:: with SMTP id l205mr12856751oib.20.1584875391745; Sun, 22 Mar 2020 04:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584875391; cv=none; d=google.com; s=arc-20160816; b=qxEZYra4RaEHucFBtFPNe46+1a6+pJSpZG2PXJZTn9WOJ2nlCix+/ON29yoEq3ZV5M 2VbqdJEFiFFNXq0BtDAbr3GHek9BKOOSkGYJpCvH+J8jVLSoBtrxJWWAA5N7Dg6Y/tuw NY99zXL0OXeKHglJgnn3irJCFh3PVTabJGPCuKep9wIE0YznIWgeXALYf80A8SlExvPH EKm96YmApRQwjKwWfKAGtY0wh7hLclPTmckPuDxOVGvo2A7df5cwipd4BgRK5uwh0j/u 2R+RjcLt1wjpoF4f6vML7ADuh4234vf5vCJzzDOYfMPEum3uv/OsGAQg4wNT09SHZhh6 4y8w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cMNEg3KGsTOtln22J6DC1lXE5+E5SXEYXJKCK9yDu9U=; b=u67Tm5zIuNesyCi2AzQ4loftp4Cwr6ua2OrlbZLAN2y4vZ2BQqBTyEpIbyEknv6ZpF jKhwcfuVnDMTLrmcwkjuk32rXa1geyNPQylB/GBGEEr+2yzdlf/qYPS8J9g7Ozn4BGcz RIJibxVqZm5BT0/DIqCPzuMPsg0izjY2xO6JTI0XckMd13y4QCMOnjE3/pazMRHunEGq 9kQavyeqAQ9SZR600hpcDnphbyBXG2/LpFnMtuUps/XWtC2kY46EYZmXo/Q+9JYwN00r qZyD7V+C3DkK7z9/w2b+LIG7R3d2UdS/VxUVjS5lD9xjNUpvHJOlXv0t7Qx34J4748WQ +n+Q== 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 z5si449104oiz.209.2020.03.22.04.09.40; Sun, 22 Mar 2020 04:09:51 -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 S1727005AbgCVLIA (ORCPT + 99 others); Sun, 22 Mar 2020 07:08:00 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:36677 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726936AbgCVLIA (ORCPT ); Sun, 22 Mar 2020 07:08:00 -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 relay11.mail.gandi.net (Postfix) with ESMTPSA id 05D5610000F; Sun, 22 Mar 2020 11:07:56 +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 7/7] riscv: Explicit comment about user virtual address space size Date: Sun, 22 Mar 2020 07:00:28 -0400 Message-Id: <20200322110028.18279-8-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200322110028.18279-1-alex@ghiti.fr> References: <20200322110028.18279-1-alex@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Define precisely the size of the user accessible virtual space size for sv32/39/48 mmu types and explain why the whole virtual address space is split into 2 equal chunks between kernel and user space. Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/pgtable.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 06361db3f486..be117a0b4ea1 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -456,8 +456,15 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) /* - * Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32. - * Note that PGDIR_SIZE must evenly divide TASK_SIZE. + * Task size is: + * - 0x9fc00000 (~2.5GB) for RV32. + * - 0x4000000000 ( 256GB) for RV64 using SV39 mmu + * - 0x800000000000 ( 128TB) for RV64 using SV48 mmu + * + * Note that PGDIR_SIZE must evenly divide TASK_SIZE since "RISC-V + * Instruction Set Manual Volume II: Privileged Architecture" states that + * "load and store effective addresses, which are 64bits, must have bits + * 63–48 all equal to bit 47, or else a page-fault exception will occur." */ #ifdef CONFIG_64BIT #define TASK_SIZE (PGDIR_SIZE * PTRS_PER_PGD / 2) -- 2.20.1