Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp801986pxb; Wed, 29 Sep 2021 09:57:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLmpOsdyg8nnapeDdAIrLg3aysRLsQuV9sg4BVowMyem6aX/B4TQPoXZQKltZPI3GJDiba X-Received: by 2002:a62:15c3:0:b0:43d:e6be:156a with SMTP id 186-20020a6215c3000000b0043de6be156amr762777pfv.1.1632934645757; Wed, 29 Sep 2021 09:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632934645; cv=none; d=google.com; s=arc-20160816; b=SipE7MhnONGuGlZJALx1jA/N/iqxiwmpxiOE+AxDstnbZlbrEDrjcxezdRDIka1dK6 7klEiUU6gsPzbUFuNDkHYe5xdFWn1m+7RlahUKQglt1AYaPhpKXIHdZz7jY3uQ+K/4ns hKXeAMmeNPRDx3PkoCkimaRNXIFrXLA4wGKZWShHGbwxJN8jrT1wPPogVh4C8yg00dlY k80js9POgKyf5zZGi/5ZXsmwBV7PAs20eUkctt/tV3ow6cXmq4HZT6Xt8v2c8J77KB33 P7KaYlSfJh+wg/ptUKzNVixHlB0KA77FA1l09Y7QvLGkqL0cI63aTvRJIYFAT3Ic6A92 HcYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OQKNU2zsWxm9Jo/LuBgWw8xEdpf0SBZ+oU39CLxAstw=; b=GgM/+uQRveY0rGGVlc2lCEFxScAWqGyO3Ajt5JyPVrz+X33bUqk5Rvqskti5CDPN7s +Oad/BIWWyaC23MoAiBC5b6GAIawsssuLoZ+YD5ye0QSMNxp5t1pwiVFjPLWjlW89frD kfgr1W3ghpIqBgBYuChb15E+WyxZKruwUwFAjvykCM3oksbHVK6caWrJ++Q/o/c4IMf5 JwHXlSafWDMUmHT6y3oRyIXiguPCkrTBLXzAcUrRRRiIovksmUeypS4bAmURJIzr6HWS RGCAmAajwPW9lmogJiolS6firMR1wx+KA9y3IJ+U4vi3lFZtpLzfrp8lbASRitv9lrcH pxxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Efdf0ixd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f63si403374pgc.495.2021.09.29.09.57.12; Wed, 29 Sep 2021 09:57:25 -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; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Efdf0ixd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344874AbhI2O70 (ORCPT + 99 others); Wed, 29 Sep 2021 10:59:26 -0400 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]:60404 "EHLO smtp-relay-internal-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344800AbhI2O7Z (ORCPT ); Wed, 29 Sep 2021 10:59:25 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 3F6F640605 for ; Wed, 29 Sep 2021 14:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632927463; bh=OQKNU2zsWxm9Jo/LuBgWw8xEdpf0SBZ+oU39CLxAstw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Efdf0ixdBezoNZH6rdVsJR1NZPjs5HRENkR71h6pI7bGNZ5qhPrur4JNGQhsl9ft5 lBb6Lmjsx6yyGpbfp9p1jwA52lSdtfXu4hJoKxHMLjMtWyq2WY+a2iol2c6XOj2fos nsY1GpHBmuLr0EQ+ajKS0HW+45WCdzZ5uEw1IhzHqzQ/u8yfjYZ5s6ry/NliNkiXQT 5PAKDDAE7jYyqsTwyCAuPXFrZhPWSG86ybNjsLN1JFIYv3yG5hZnDcOTb6aWRP8S9f k1nBlKodOLVNXDIo3OrAlJ0lrFpSYLrcLja5uNgcdUwv4GHj0MwLxWSayafX9eGxpq ObcSOtwZj5Waw== Received: by mail-wm1-f70.google.com with SMTP id p25-20020a1c5459000000b0030cac3d9db1so1337935wmi.6 for ; Wed, 29 Sep 2021 07:57:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OQKNU2zsWxm9Jo/LuBgWw8xEdpf0SBZ+oU39CLxAstw=; b=6l7hg6AhKk4Y7aHDCrz1uJwDhcAJKvd5nZjw1k+8xRzsG8c7B/Sb9ofUJBV7ihZCpN GommHN00zWyYwCIGwGdHX1XtRIt9fWYuCZ9vsvnGfrP2PvYSByMX1I55vrGSvf25f0Nw r6cmrMaKPUttYTwrjkuUMqbFVeOHa4/HtxFcwBIKT+UhfYS0tJWqg6rzkwTF8FEftfly Ug7uyrej8bcKIcEbvUYPKdrjXjX3o0cVVPi2eGUpLHpW88qc7vC0Hy5Kl4tHFsEMyp4Q 02kUEZ2g+eQEq7sFSPVFwtYkrT41YY6TNgXne9i40dxXjmCsAI3aE5tQTz6/Zn1lLneZ Cv4A== X-Gm-Message-State: AOAM533dU5zmbLrZQ6KQszyACoA/nsU36Xqhhihgk7P3as4A8ycyDQRt Maksl7EkWqDvCtvCvRFjqyjk6xqZ2Ue8My4Jvip9iGUdzRUOvexeS3zI5A2HluYSg7LJbcr6s7w ojU4CRnS/PRo5i83a5AdH1NiTkysX46qMd6enNNomXA== X-Received: by 2002:adf:a4cf:: with SMTP id h15mr370302wrb.56.1632927462556; Wed, 29 Sep 2021 07:57:42 -0700 (PDT) X-Received: by 2002:adf:a4cf:: with SMTP id h15mr370287wrb.56.1632927462418; Wed, 29 Sep 2021 07:57:42 -0700 (PDT) Received: from alex.home (lfbn-lyo-1-470-249.w2-7.abo.wanadoo.fr. [2.7.60.249]) by smtp.gmail.com with ESMTPSA id a25sm1888009wmj.34.2021.09.29.07.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 07:57:42 -0700 (PDT) From: Alexandre Ghiti To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Zong Li , Anup Patel , Atish Patra , Christoph Hellwig , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Ard Biesheuvel , Arnd Bergmann , Kees Cook , Guo Ren , Heinrich Schuchardt , Mayuresh Chitale , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-efi@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti , Palmer Dabbelt Subject: [PATCH v2 06/10] riscv: Explicit comment about user virtual address space size Date: Wed, 29 Sep 2021 16:51:09 +0200 Message-Id: <20210929145113.1935778-7-alexandre.ghiti@canonical.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210929145113.1935778-1-alexandre.ghiti@canonical.com> References: <20210929145113.1935778-1-alexandre.ghiti@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 2f92d61237b4..fd37cc45ef2a 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -664,6 +664,15 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma, /* * 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.30.2