Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1368835rdb; Tue, 30 Jan 2024 17:08:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtbT3Nmt43Pzq9JVCLC5iTYMW6OgZvpvHXTgxVJks9dzDhJUSHbK0AT9R+FZVhP7oUyeFg X-Received: by 2002:a17:90a:757:b0:295:b9c1:f7df with SMTP id s23-20020a17090a075700b00295b9c1f7dfmr354635pje.40.1706663294799; Tue, 30 Jan 2024 17:08:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706663294; cv=pass; d=google.com; s=arc-20160816; b=D8O2I5uuhyPXNIEJfbldJNpkPb8PXQgFed4VqezkUJm/UmtokEb0VfsjPjYfgOusOF zKhAeXIb6BoZKZe35jPectxXeuNZymbuv14Qxw5kisZ56MbvNe1tI6ZOYVdyis5otfvI yY/DVaUXdqFwkDg95v6uuM3zFtgo8IHsabEx4XUAzGdk5iV9v1B/La1b7B9rb5VkJCs+ ok9WdqANg0xSFD7/OEZYDxu/63NNtLz/OzV1SwOS+LhJiHRt3w5l9eEw/gF9YnlyGR7v acKKQ/j8CmjbEMeC90wwMcm6rqAOurx5SKLPGqwXUeVGVwVbLp3mTljKkIn11HvJ60zj AOeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; fh=b2c9ly+uSIgAVB14UKVV6q4uulmlmY6xIIR5OkL0R4k=; b=yKv0GJZou8Ygzzbba/w5CgPTo1UgZoiNXjBR2qwlGh1R+U4kmmaChDp2AXLBVL7lcI iaebWwSTUlV62gccMlyvuaJI97cXUeV/nUJmGKJwSvYV7/dV4s+IIbVcH8DDJgEn/X/P VBrNBe5uiKf6za45uXfs47tv7t4PhLcRHz6hYtD9VY0qPqMA1Ga7AofqkFAwWiJoa5Xe 67bHA2VtCmaNjSIztSQMKC9m3NDJVbWDRUrDr3iZq73tfysNVwJB/EJBV/pAZxZEEHn7 o/GbVs7bUpaTjg39TRoLVNmllh3dfw8HopBdwhV6sgfK8ZwcCCQfrFF+9ZxQGy/F6Yzm PN9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Yu4dJrGi; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-45570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45570-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVap4OvB0vX/Cp2zTfFHyzU6IGKktXgTdt/l+uyVjWaLb+uHoM7ftdfDm93BkeFzHsGhZzfZEWi7suDBR7HehYurpym/3Z3KaY8T/qM7A== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x17-20020a17090a8a9100b0028e88453568si32261pjn.161.2024.01.30.17.08.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 17:08:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Yu4dJrGi; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-45570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45570-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 854B3B23406 for ; Wed, 31 Jan 2024 01:08:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D7AE53B8; Wed, 31 Jan 2024 01:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="Yu4dJrGi" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E09F0185E for ; Wed, 31 Jan 2024 01:07:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706663230; cv=none; b=tDyne3nrH4u2iKIEohmK8+JPF88FfdJelL7HTa2eNcuSs3SUTg1bWtLPra2TPMC5Es2skjFiU6E/sCrxVJH0klPW+xG51jo1jJEXhNqCpa5cnNMMbu6GxlKcJ5PR/zCu6WpSwP8jP6XVfgdmY5TLI+QaTkRWhLlzC5X+xL92sS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706663230; c=relaxed/simple; bh=2lxtSNzBMdkYqwC90W41TvLPqjzE8CkjIf8iMq/P7L4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U2224qoxsb8OVoG5dk9xFQTg783CsxhAjZJqB8MS82MToJAvoHbLyQ87ypaAzU1JrPYnxgik0uvL8myPbse2DUAmwsu1rD62tnQ9dd/BGVEDp9U03PQWe9PmgFsy56MIlj2wPk6bqrAKb9XQics7KaIf1pRzI/eXWp/YIYnqT0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=Yu4dJrGi; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d746ce7d13so38370105ad.0 for ; Tue, 30 Jan 2024 17:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706663228; x=1707268028; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; b=Yu4dJrGi0IiDCFrpiqOLpDobeO92AFXkezCwPWsw/oaztxOemXJY57rq0+tk6HeDWn SMvK/q+uW8H416VONvYwknTIiUxb0L5Qo9OiGr8lO9mbrg6SjjZI11XDWqgoqLBPZOJk Y0j/tlIPvwlzRjCUi7biS6r2pECwzg3YEeYZelC1RW6rG0p87fpYpfd8qKKcccHKl/7P CvBiJ2CdsTudiTl3Z4M+QRRtB+EIXCAzmX8shU8OEka5yt3oTfpBC6KZj5ZWUyfshFlu ppMexHdpGFXYccRrCFTH5kfjt9sE2sX7hgORhXC8DyRjnI2tc3dfAaf/OH1wx6q6kRxG NvQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706663228; x=1707268028; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; b=bX1q1FHnKuL/PDWWT/KHya4ovuFNaOqlXvwpx3aSmRrU0yk8tjX/jUCoFK7w9AeUdR i36EOpDymS/T/BQp85sfWow7diuVA55o8zICenUQaKBHrYbEoQO0XP6gUW/joLphCtwR qR0QfPbZ2uuEkViytSoNb8tafMN/YsPs1Kb82J6ail1D3O9JwhmQzLxvWIfBzXNo0iCx 1o6aeOEsksxPKp2c5LbXfpsRfdgyFTqmsd+QtfZcnev4aNwENufOC+raX3eySrghd5mf /GghnmCapKaZcquIsvBtUNKv0xbmPBSTPdIHql/kKUZVXtKLzyH5Pkeplv00UWUFOfIK PnSQ== X-Gm-Message-State: AOJu0YxOucO1JehRDN5BPeNBB0YaCL0HVj4DWekW1NZRDhTDPrHih/Gg 5zx8nOKHIjtqrHEAlVEoiWBCMScO8Ox26oJxjbRfrtNNrafafzT/q5cial+YFco= X-Received: by 2002:a17:902:ed94:b0:1d7:310e:1e0d with SMTP id e20-20020a170902ed9400b001d7310e1e0dmr263865plj.32.1706663228198; Tue, 30 Jan 2024 17:07:08 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id r12-20020a170903410c00b001d8d3c276c4sm4970822pld.35.2024.01.30.17.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 17:07:07 -0800 (PST) From: Charlie Jenkins Date: Tue, 30 Jan 2024 17:07:02 -0800 Subject: [PATCH v3 3/3] docs: riscv: Define behavior of mmap Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240130-use_mmap_hint_address-v3-3-8a655cfa8bcb@rivosinc.com> References: <20240130-use_mmap_hint_address-v3-0-8a655cfa8bcb@rivosinc.com> In-Reply-To: <20240130-use_mmap_hint_address-v3-0-8a655cfa8bcb@rivosinc.com> To: Alexandre Ghiti , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan , Jonathan Corbet , Yangyu Chen Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706663222; l=1848; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=2lxtSNzBMdkYqwC90W41TvLPqjzE8CkjIf8iMq/P7L4=; b=VULcNJMPaGSSibunnHmdY8O6pSGdUfVoHdHqVkSZ/6IDh4hPdQyOg/2Va726eHw2pMLSxc0cG 87Fixe/YDGPCXhl08WlTq3vxGBa82+KW2s0J79eiJ6OVp8GW8Fgr/ii X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= Define mmap on riscv to not provide an address that uses more bits than the hint address, if provided. Signed-off-by: Charlie Jenkins --- Documentation/arch/riscv/vm-layout.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Documentation/arch/riscv/vm-layout.rst b/Documentation/arch/riscv/vm-layout.rst index 69ff6da1dbf8..e476b4386bd9 100644 --- a/Documentation/arch/riscv/vm-layout.rst +++ b/Documentation/arch/riscv/vm-layout.rst @@ -144,14 +144,8 @@ passing 0 into the hint address parameter of mmap. On CPUs with an address space smaller than sv48, the CPU maximum supported address space will be the default. Software can "opt-in" to receiving VAs from another VA space by providing -a hint address to mmap. A hint address passed to mmap will cause the largest -address space that fits entirely into the hint to be used, unless there is no -space left in the address space. If there is no space available in the requested -address space, an address in the next smallest available address space will be -returned. - -For example, in order to obtain 48-bit VA space, a hint address greater than -:code:`1 << 47` must be provided. Note that this is 47 due to sv48 userspace -ending at :code:`1 << 47` and the addresses beyond this are reserved for the -kernel. Similarly, to obtain 57-bit VA space addresses, a hint address greater -than or equal to :code:`1 << 56` must be provided. +a hint address to mmap. When a hint address is passed to mmap, the returned +address will never use more bits than the hint address. For example, if a hint +address of `1 << 40` is passed to mmap, a valid returned address will never use +bits 41 through 63. If no mappable addresses are available in that range, mmap +will return `MAP_FAILED`. -- 2.43.0