Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14075472pxu; Mon, 4 Jan 2021 12:12:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9FKzWizqHajcJtoF8g/V7IUgPJJxZYBVhw0abDFnembbpEsCYnNh3sA/F4ipf8b5+RIM1 X-Received: by 2002:a50:875b:: with SMTP id 27mr73715125edv.24.1609791178929; Mon, 04 Jan 2021 12:12:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609791178; cv=none; d=google.com; s=arc-20160816; b=gKag9/S4jC4WE3JkLN48dRkxe35DA6OlAX6Oh2Hi8b8IZpCrN/Q2I6bQOOhqsAocN6 bsSTzSyTgK7ip1kknEtWzG6pJwnwMx4xTMFIOgw3v1pna0t6IQG3sMjpmsbYRyzGPUqC FA8FIC2l+XRZ7qDI/t24AvB00UGOLltuF1rIrJX2EAVCLjdthlOIuyo6zu2fSijOrVOW cd1X2H4TSrCBEl5CThS6z9l16PILxWcMxnbCoxONH0HGVrHtWakpX1MSSL0hb8Ga0FSz tHOeAKfVOLC/5iOnfOw970tgoxp79eHyTelkhgBT4h/CR68BrWkOHbK4QQ8wSEn2FiVe Knjg== 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; bh=Jlgd2Gu2ZftQMT96o4X0vty7vVClWbA434kUSIejqdA=; b=Qc3U8vjZze4/dCyFbEe6+nndafqozXRGUR3p5PaKVf7rZGBBby/mfh0sykNZWO+sDV 3EocCsS+Oqye5ZM4XSR4+lPOaaxV0uurMatDw8FBw/gFzyDlAKQ0hgsDKVvysFMekyw9 JHzWzXXQp586ydjwI4AXBEB6EKGCZLaH3ZcVEcpOiaC1JGBx+lwZKne+652IAGLZla9R FHsk8ZpaARD38ZHjoSDkykgS8iCws2dMcV88t6l5UivvlF2kbqhYocnzNlAbC1kRQSAA FE4vBFZkPZuWid6t6nq+mLBYdL6vX19E/sGBBuyHmOIB4S63sFrvMG4cV4K4zHA+oQWZ V3Og== 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 si15si29613915ejb.394.2021.01.04.12.12.35; Mon, 04 Jan 2021 12:12:58 -0800 (PST) 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 S1728088AbhADULJ (ORCPT + 99 others); Mon, 4 Jan 2021 15:11:09 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:45607 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728011AbhADULJ (ORCPT ); Mon, 4 Jan 2021 15:11:09 -0500 X-Originating-IP: 90.112.190.212 Received: from debian.home (lfbn-gre-1-231-212.w90-112.abo.wanadoo.fr [90.112.190.212]) (Authenticated sender: alex@ghiti.fr) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 756C5E0008; Mon, 4 Jan 2021 20:10:25 +0000 (UTC) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Zong Li , Anup Patel , Christoph Hellwig , Ard Biesheuvel , Arnd Bergmann , linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Palmer Dabbelt Subject: [RFC PATCH 11/12] riscv: Explicit comment about user virtual address space size Date: Mon, 4 Jan 2021 14:58:39 -0500 Message-Id: <20210104195840.1593-12-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210104195840.1593-1-alex@ghiti.fr> References: <20210104195840.1593-1-alex@ghiti.fr> 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 | 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 95721016049d..360858cdbfdd 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -465,8 +465,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