Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp193792ybs; Sun, 24 May 2020 02:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjKN1hCZsJ/soi0/YJmf7/sNLwDsAjBbSTKKfXQaiT/IBZXIbwPs5FybXroXkRnMEDSelm X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr14399786eje.242.1590312144865; Sun, 24 May 2020 02:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590312144; cv=none; d=google.com; s=arc-20160816; b=cbYJlIWj46UX0PmmJ9jsvbl1BL1a6K7tjoGSsTyNACtO9tMbdd7kag+8krCZI/DdEQ j/nrmvdqartq3HFmqGF37T03oY6s2OFwhX/G+8+C+Oxgpks+ltCoxPyxov/DX/WdEQYk OPjWRPdaAmZCHo9M7+P85mekIM9bdgH/AATYZGoAma/114a+SUeTfjQGIu4aTB6+oDTQ e3NusetNWtxF3LyIU3FLvvZGiGzuhOapWoVlUiGuoblU5MN/cvLO2NCCJnRd4x1aGKvd C4qh768Z9ioUWionI7Bfgsig8iyJjlulRcXzXEsnlL6yE20niqlUcCXzsdpVKIscoyN+ Mu4g== 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=0JpV0PJd+fLmEFfIiHS9XX3+z39slBXMkKmxWhwmA5U=; b=syJc9IwP0ODK3kpPiYj62+qgBCmMcHarIB098ZO46dtL5JRr5VbYGxyXjfayxZyjGF AeRdhsjgQUOUxtXrCEA9f6/I1v+aw1ejnGLpXX7XId4+8/RIre6fCh1STPfgARwLFoWJ +pzbO6G+vW0kblKIHJF7Ve+/Uab8uMCAo7xDjbuh7pY9DoaRO2QSJ4uLKTyxJdu6EHxb 1VDpMjOJI+KxrwI9wH3KnB0GmV6or43tchKe0kq94Dds+4TKd213IkwDO7fg7fAAu17v ocy2fE7OATxZSUWjWrx7gJ982hM6QuF+okfr69sggZsz36bYqNU4Gdbuwqkljaabw4uN CNGQ== 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 q12si7662220edn.500.2020.05.24.02.22.02; Sun, 24 May 2020 02:22:24 -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 S2387565AbgEXJS2 (ORCPT + 99 others); Sun, 24 May 2020 05:18:28 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:51203 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbgEXJS2 (ORCPT ); Sun, 24 May 2020 05:18:28 -0400 Received: from localhost.localdomain (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 21CD6240002; Sun, 24 May 2020 09:18:24 +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 8/8] riscv: Explicit comment about user virtual address space size Date: Sun, 24 May 2020 05:10:08 -0400 Message-Id: <20200524091008.25587-9-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200524091008.25587-1-alex@ghiti.fr> References: <20200524091008.25587-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 b8a8ba69d0a2..0c7d07f614b3 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -481,8 +481,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