Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4021288ybb; Mon, 6 Apr 2020 22:15:55 -0700 (PDT) X-Google-Smtp-Source: APiQypIr0/KCuv8vkZ+QyX+d1EKRJHGJjcAgzn/0uOUa1KMuHMKHLtSOVpcGt1PZfUUWLfgVsv3/ X-Received: by 2002:a9d:6e02:: with SMTP id e2mr186780otr.317.1586236555219; Mon, 06 Apr 2020 22:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586236555; cv=none; d=google.com; s=arc-20160816; b=mFV5u/VKwGga/Wsu8iiPPgza0JH/Vsj/VIUm95+o7igDbsnYn+EvNwJDJlRySLW7PP 3uuhEi3luDkEhrFdMy3zA0Asj34KIlsMvPYEDvn2m3l5JQ/u/I/8f2F+0JWJTmsCNoJL kdaja5QTa0CJOVOKVGrjOcUMKKlVgyuW3RDmch/E3ADG3oJzKUYk8gRgNo4+5r2CYq5R qdeoHwiY+Rw0xu7p47c+W3b6D+00+wMWBSy3qX1Fj2UEhwUACHzzwz9H571Od6mmfNzL ZYSB4Xgyj+zIuaL7SI1mhEciBTQ9WISpmlmDu151zzENk4TufEZrxSuwws8siSvpFAjk sCQg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=dkMqS7o7so/I8B5e4CmOHgpG2yB3ZF+HcBpx1dqcVG8=; b=mziMfEfe8JE7EHHiiUuOEfeaN4GyUIJRPvwjBxelqRFkrt8m4uMcN7Pg0R+rFPr00e tz1krfvzF7eEix8YtQROH2sn6KIAXsE6ewyrYfEb8Q5CMqp7ZGNSgC1/uznsrXKWEknB kWDvAH/IGxK5GQCbHQOpvBxlwZSdoIEWQ9WEQatQIyYrvTCzOVi/+HFIjRIlA8QmvxU2 pzyC7xwq1Co7q7sZrud/vmzLzots7/DkoiKueG1OE+hh2d96Dc8D1Y6yxf/Kqss5dquY jln/FJl0PSbSei6PF9Qg791rAGS5ErYmUvak6DXqi9hLiQywPOCQ6virOawFUe/pSO2A Fsug== 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 a185si219912oii.252.2020.04.06.22.15.43; Mon, 06 Apr 2020 22:15:55 -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 S1726901AbgDGFPJ (ORCPT + 99 others); Tue, 7 Apr 2020 01:15:09 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:54099 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgDGFPI (ORCPT ); Tue, 7 Apr 2020 01:15:08 -0400 Received: from [192.168.1.101] (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 5AEB0240006; Tue, 7 Apr 2020 05:15:05 +0000 (UTC) From: Alex Ghiti Subject: Re: [RFC PATCH 7/7] riscv: Explicit comment about user virtual address space size To: Palmer Dabbelt Cc: Paul Walmsley , zong.li@sifive.com, anup@brainfault.org, Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: Message-ID: <29eb893f-1432-e75a-cf4a-7b97037dc50b@ghiti.fr> Date: Tue, 7 Apr 2020 01:15:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/3/20 11:53 AM, Palmer Dabbelt wrote: > On Sun, 22 Mar 2020 04:00:28 PDT (-0700), alex@ghiti.fr wrote: >> 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) > > Reviewed-by: Palmer Dabbelt Thanks, Alex