From patchwork Tue Jan 30 19:04:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Jenkins X-Patchwork-Id: 13537855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1CE2C47DA9 for ; Tue, 30 Jan 2024 19:04:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E95228D0003; Tue, 30 Jan 2024 14:04:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DCFE18D0001; Tue, 30 Jan 2024 14:04:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD4678D0003; Tue, 30 Jan 2024 14:04:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A9EEA8D0001 for ; Tue, 30 Jan 2024 14:04:39 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7CE021A0403 for ; Tue, 30 Jan 2024 19:04:39 +0000 (UTC) X-FDA: 81736903878.15.0CD21BB Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf13.hostedemail.com (Postfix) with ESMTP id 741992000B for ; Tue, 30 Jan 2024 19:04:37 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=tnjIE9TO; dmarc=none; spf=pass (imf13.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=charlie@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706641477; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; b=ma9gQlZhmeHTLvUNNM9YPdwHU9gRx+tA5obewIDFkmDiZ3LVrcFdCDt+pVPgx4RziZE7Iw KkuS++W/wY2yafeSkbFoOzNQ1FukxOICZFTVeJHhLcAhbC6qc7IBLqrSG0OdpK448Kg2Qo yNxvLwAvdFtFGCcrvkVUNwzDppy0h3w= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=tnjIE9TO; dmarc=none; spf=pass (imf13.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=charlie@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706641477; a=rsa-sha256; cv=none; b=H5gCKEG/bwj7vibXoSE0wDNLEVIzRz5cSsSXcBXYxD+PlPH6f97A+92/q9GKZ36+aNVO9q fNyfw0Icd5aedRaCOfb2PKqCATbPRIUOG+3eUXgFa+9iTt9k6xWUPLK9r3e4kxxZhQ0Uxw nfB2ja3JQCtzjY1cqAa9oCGM8kaGlt8= Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d8f3966982so12580055ad.2 for ; Tue, 30 Jan 2024 11:04:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706641476; x=1707246276; darn=kvack.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=tnjIE9TOBaoII8LqEUs3D6a7QyF6UlvTZCnnxn095JwlnK2QU/DhqBzlXlvMwbVQuj uPPmChYtUW1Vt3ccoq9j7QKyiTYrMba88SI2w7SlR8Zl4s1Ho4iCcs9mKoTEORXw+GO3 W0TLW9TsN+LPhhZx2JJqwHulGdfgGRiWcoydccg0aWUfyAY6Mxyz38YkJfBZqElXwpfF Ek1HOEI/GN1ixRzxCV5iqHUCXa1BXSZNcHlfPsJIOqoHYSD8xhI95AlxmSdpyvelHXrw bJ13AdMV6pMVqvqVtt8ZraZdrPwBCH43FLYS0YAlWB2ovvD66+dgeyGTw2QLWLii616I u5HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706641476; x=1707246276; 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=s9DmfDnrOwB3hFtQ9Q0DXMvMErTgjSZ3gCORspYGRKxCMBewinQHbZGlRVZ5u1wcl2 uI7AT6lKuTdab27rdSLaSdJcyO5QkOqcrVNiiNg8Fqua7iTSGhug7DI4yEo9zfVKCrj5 xKshjN2Ls/1b0kKvEIAmVWQfQdTvf5ze808MQo+hKoh2vXwk9J8BfYbzAWj1+dDjMUX1 agDzxcmIYMo7KT0y+eeJSX5y/vplYOhWlSLECkDdQEfOVaxzbxq+FY6FXyNV+QHTGsuP nBS+3qSwg+8doKaNzCgLRl9HqGlZ2LrmldL4BSgHkc7m7s6uzrroa44pGRe8T7GTqHOd kYKA== X-Gm-Message-State: AOJu0Yx2mICTVYC/WsWYRlyvngebavwR4jOrBolkhWGMUozgBsUQErnK /Q86xDdaetZU/ol/IOkWyKZZ2JB6rje2apzbbnlQ2Gq3Kb+R3BU0DQ092q7wBA0= X-Google-Smtp-Source: AGHT+IEVbIgYt6XNaKR6BtdW5/KffpCVH/pv+Lo7pyQOi/0UoKVRKbnu4oD2c+g6OjEIw8FcF7U3LQ== X-Received: by 2002:a17:90a:3dc3:b0:290:6878:db67 with SMTP id i61-20020a17090a3dc300b002906878db67mr5117026pjc.9.1706641476461; Tue, 30 Jan 2024 11:04:36 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id f6-20020a17090aec8600b00295c3bb9318sm1196541pjy.54.2024.01.30.11.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:04:35 -0800 (PST) From: Charlie Jenkins Date: Tue, 30 Jan 2024 11:04:32 -0800 Subject: [PATCH v2 3/3] docs: riscv: Define behavior of mmap MIME-Version: 1.0 Message-Id: <20240130-use_mmap_hint_address-v2-3-f34ebfd33053@rivosinc.com> References: <20240130-use_mmap_hint_address-v2-0-f34ebfd33053@rivosinc.com> In-Reply-To: <20240130-use_mmap_hint_address-v2-0-f34ebfd33053@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=1706641471; l=1848; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=2lxtSNzBMdkYqwC90W41TvLPqjzE8CkjIf8iMq/P7L4=; b=94N9u6Dy7xw5qCDQS+0vjMBDMNCSUN+BRd4o21tz6vC6lNovWVUFsgXKvGka/gJHpv0qpikoL uaW/c0J2VbkCXqP7svfJ7tYuinSlvY7wIe5t7X3qvAN/WmnM2V6JlUj X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= X-Rspamd-Queue-Id: 741992000B X-Rspam-User: X-Rspamd-Server: r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R+yLp6mN5rLKHj5dYJpndY3u+D8BYNdA6ih5DSl8aLN6fKCpjGadaRaRMDL9x+iiLv/CSxy9uoTLi4cJRQa/+xDqRX54x+E34Hq3NBMgW+U/W9WrwgvYIIBJuD/Ww77sw1agnhXujRiAfkS52L39XqeLAvt+McnW8nEcFDftbGyn6PL6u/S5sg+mvs9YLL9HxD5/96l+YpAa9envSi9Y6T9NqxFUPbYVsIo84XoifRLk36hsTgegT4FulCzx1wcfpo1nsZjovrd4qR/2w4nDGSkgQButgnX5sjdlKnXJ4SVflUzIGq5kwkkD3M3vAaaSGae9xqC4nOpfRLOgzb5Fb+Ifq4qJq5pBFT3Vb6qxOL/IWE4Wfp9eQ4OnDWgTA/7oq00CeySTu9cOGOcDOGy8gUVrR5XfUDcv4u6GmgTII+DZJEIBJfcVWI4i5Kn3dOQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.216725, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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`.