Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp316724ybg; Wed, 3 Jun 2020 01:21:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHS/qN3fXYLho2Salnv5noIAymy9EDqqmdhMIBn/W2Jxfz19Q2ySYQKs8kR4DUXN4Y5wh4 X-Received: by 2002:a17:906:4ada:: with SMTP id u26mr24745691ejt.368.1591172506111; Wed, 03 Jun 2020 01:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591172506; cv=none; d=google.com; s=arc-20160816; b=hbpHiFEp+DIJWkc21/xw5tzPMLER3gNxathRYBhK9e038vNv10A+X/dWW9Vl9NANo+ uOR9RQOGIoqfeEnvE3PQpyeNOd7AK/bC/giRChWbI0HKd6v4vjjyYg51qlxOYZe7N/a1 3aLwT4bnOhlOLEzj+EgBdt+8cSbDDzdRiycX58uKmKpYNqOJRXMbcXGCxXsy8Ey4eW7z p8cIYf6CwhsSH5uzm3eONKTksOSB61TTE11r3hNiPE6yT7/IF8Ktl4Nik9PR+5Td/tX4 fdJUO2HeXlFbveT//tsZwzZPfxNoS0Ub3OIIrvbnH/lHtGGEiW44kbI9GEZGGovhcBFS MdiQ== 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=7NbDsnQU7reD7HeNMoq3jU70lsGaZZjekHUGZIzIMRk=; b=ra0PiTjojAsPXakxcZuPzYb3G+9VXWkW8mnnZX8sQufx5hQMkdNPfPhaal8qTUWouC Rpnnp6DiB0WBYMdrHTO+HXcv+OB1bQ0szCX4mL4F0K1ocFj+jaqVkNSI45JAktd0Gk+S RuSFsij8uAhZ/3adqSKPgsVBWAHKYPhyuHWNuezVt/sjBagyzpXN7wuEoKZ0CEFTVJni vilKt6h4jr4LD+8XpUk/IQ0lK10jzHBm5BRQD+SkTeX/LsWRjdEZrHlEOwCahmyUIyqb qb14K+zSZ9O9CuL3SHr1rVmE5dGW6oYM53DKe21PlsD4XQVbjlXv684ZOBWUWp06SVbU yk/A== 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 u21si699654edx.269.2020.06.03.01.21.22; Wed, 03 Jun 2020 01:21:46 -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 S1726123AbgFCITa (ORCPT + 99 others); Wed, 3 Jun 2020 04:19:30 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:53637 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgFCITa (ORCPT ); Wed, 3 Jun 2020 04:19:30 -0400 X-Originating-IP: 90.112.45.105 Received: from debian.home (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 1680D2000D; Wed, 3 Jun 2020 08:19:26 +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 , Palmer Dabbelt Subject: [PATCH v2 8/8] riscv: Explicit comment about user virtual address space size Date: Wed, 3 Jun 2020 04:11:04 -0400 Message-Id: <20200603081104.14004-9-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200603081104.14004-1-alex@ghiti.fr> References: <20200603081104.14004-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 Reviewed-by: Anup Patel Reviewed-by: Palmer Dabbelt --- 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 cb8c6863266b..86bbc2ed1cdd 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -480,8 +480,15 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, #endif /* - * 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