From patchwork Wed Sep 25 21:06:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13812427 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 D298ACCF9F7 for ; Wed, 25 Sep 2024 21:07:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 329AA6B00B2; Wed, 25 Sep 2024 17:07:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D8BE6B00B4; Wed, 25 Sep 2024 17:07:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 152A06B00B5; Wed, 25 Sep 2024 17:07:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E6E5C6B00B2 for ; Wed, 25 Sep 2024 17:07:00 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7A9EAC0426 for ; Wed, 25 Sep 2024 21:07:00 +0000 (UTC) X-FDA: 82604495400.15.0E17B02 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf30.hostedemail.com (Postfix) with ESMTP id C60168000A for ; Wed, 25 Sep 2024 21:06:58 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CRpxihM2; spf=pass (imf30.hostedemail.com: domain of arnd@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727298382; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LZWgvSs8WYd5k0d0lYjKx0d8XJrjDOoCZi+hv931QmQ=; b=7jvw5dibV5U4qAtRJ1E3BK1+6wqscWXbG5qvqQm3n/K8AB203iveQLRu8jmKwxpxOPLzEh UqWX9PXrzo1S/zu2QDY7WQepS0u22LGq/GfDe9Z6j+vrp90c0y756l2tAqD/mzDrKinnwN wjDuAFim9Xe+MI7XL15JvIR/J3JpNh0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CRpxihM2; spf=pass (imf30.hostedemail.com: domain of arnd@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727298382; a=rsa-sha256; cv=none; b=xIRQtjZbNRmQqUehi65RGJ9ZrVLX+j3UC8QAppZVqGte0XxSV3h0mFHuxPFjMbpOBDTqYX 9baj1zciN78bwpHwHy4vkdpxoA82DhTpv5DA/8A0/wfP0scydd8GAaqJdzqbIXUVoYDo91 mBkgG0ySE9EYbcr+OTZBFvIlreybXBM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B3466A44891; Wed, 25 Sep 2024 21:06:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E531C4CED0; Wed, 25 Sep 2024 21:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727298417; bh=aDTBkkmG/d5Qp4dQ7xLc1aEeqRGIp1tx3y3paI2l9us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRpxihM2e75tM0Bh7zwLgE2iWB1Q2C6WpoDxjva8iJOMC6oBQya5HroXk55JEfyL6 LhjXW/qeEZjcui5rJxrOXW/tJdtmU5D2uxIw05LxKdH12WAJXUQPIdWZx6zFsptgmp 9joJA1ZZdNbpONn+zIm4gbqFyJdy0QZIFDugku4mPLkjRJ25aOdb+/1/nuVpPb4jSK AGPijvaPFQ2Md/TDhVdXCRs4LeLobDmZpuYYLQsHtn19s+mGW9Dy41pZhjWzY8BlhR TOovGap+DgQ3DclxvFnyhOOd29bwhFogwsWqcvNyjLBk8WZgYvncO9pF0QaPo4U+On 6ud7LUq7AR7ZA== From: Arnd Bergmann To: linux-mm@kvack.org Cc: Arnd Bergmann , "Jason A. Donenfeld" , Alexander Viro , Alexandre Torgue , Andreas Larsson , Andrew Morton , Ard Biesheuvel , Christian Brauner , Christoph Hellwig , Christophe Leroy , Damien Le Moal , David Hildenbrand , Greg Ungerer , Helge Deller , Kees Cook , "Liam R . Howlett" , Lorenzo Stoakes , Matt Turner , Max Filippov , Michael Ellerman , Michal Hocko , Nicholas Piggin , Richard Henderson , Thomas Bogendoerfer , Vladimir Murzin , Vlastimil Babka , linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org Subject: [PATCH 2/5] asm-generic: move MAP_* flags from mman-common.h to mman.h Date: Wed, 25 Sep 2024 21:06:12 +0000 Message-Id: <20240925210615.2572360-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240925210615.2572360-1-arnd@kernel.org> References: <20240925210615.2572360-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9tbuu3doxg3jbjphmnsh1smtm7dce7eb X-Rspamd-Queue-Id: C60168000A X-Rspamd-Server: rspam11 X-HE-Tag: 1727298418-31255 X-HE-Meta: U2FsdGVkX1+4x2Z4a+cJpaWsrq87msJy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ns6zZbsvwdtlmWk8ZklPokOJyu5x1C4mO0FjwkDjaUsAgts+HsTlT0v1MvMSOcTex87qivOyDgjlId7oIbvudhrepF4E9HV73YZWupz+7r439Ceoi2qLIPZ3tXuYoHhD+Hlr X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Arnd Bergmann powerpc and sparc include asm-generic/mman-common.h to get the MAP_* flags 0x008000 through 0x4000000, but those flags are all different on alpha, mips, parisc and xtensa. Add duplicate definitions for these along with the MAP_* flags for 0x100 through 0x4000 that are already different on powerpc and sparc, as a preparation for actually sharing mman-common.h with all architectures. Signed-off-by: Arnd Bergmann --- arch/powerpc/include/uapi/asm/mman.h | 16 ++++++++++++++++ arch/sparc/include/uapi/asm/mman.h | 15 +++++++++++++++ include/uapi/asm-generic/mman-common.h | 16 ---------------- include/uapi/asm-generic/mman.h | 21 +++++++++++++++++++++ include/uapi/linux/mman.h | 5 +++++ 5 files changed, 57 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h index c0c737215b00..d57b347c37fe 100644 --- a/arch/powerpc/include/uapi/asm/mman.h +++ b/arch/powerpc/include/uapi/asm/mman.h @@ -13,6 +13,11 @@ #define PROT_SAO 0x10 /* Strong Access Ordering */ +/* 0x01 - 0x03 are defined in linux/mman.h */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ + #define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ #define MAP_NORESERVE 0x40 /* don't reserve swap pages */ #define MAP_LOCKED 0x80 @@ -21,6 +26,17 @@ #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x010000 /* do not block on IO */ +#define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */ +#define MAP_HUGETLB 0x040000 /* create a huge page mapping */ +#define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */ +#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ + +#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be + * uninitialized */ + + #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ #define MCL_FUTURE 0x4000 /* lock all additions to address space */ diff --git a/arch/sparc/include/uapi/asm/mman.h b/arch/sparc/include/uapi/asm/mman.h index cec9f4109687..afb86698cdb1 100644 --- a/arch/sparc/include/uapi/asm/mman.h +++ b/arch/sparc/include/uapi/asm/mman.h @@ -8,6 +8,11 @@ #define PROT_ADI 0x10 /* ADI enabled */ +/* 0x01 - 0x03 are defined in linux/mman.h */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ + #define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ #define MAP_NORESERVE 0x40 /* don't reserve swap pages */ #define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */ @@ -18,6 +23,16 @@ #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x010000 /* do not block on IO */ +#define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */ +#define MAP_HUGETLB 0x040000 /* create a huge page mapping */ +#define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */ +#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ + +#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be + * uninitialized */ + #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ #define MCL_FUTURE 0x4000 /* lock all additions to address space */ #define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */ diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h index 792ad5599d9c..8d66d2dabaa8 100644 --- a/include/uapi/asm-generic/mman-common.h +++ b/include/uapi/asm-generic/mman-common.h @@ -17,22 +17,6 @@ #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ -/* 0x01 - 0x03 are defined in linux/mman.h */ -#define MAP_TYPE 0x0f /* Mask for type of mapping */ -#define MAP_FIXED 0x10 /* Interpret addr exactly */ -#define MAP_ANONYMOUS 0x20 /* don't use a file */ - -/* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */ -#define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x010000 /* do not block on IO */ -#define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */ -#define MAP_HUGETLB 0x040000 /* create a huge page mapping */ -#define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */ -#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ - -#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be - * uninitialized */ - /* * Flags for mlock */ diff --git a/include/uapi/asm-generic/mman.h b/include/uapi/asm-generic/mman.h index 57e8195d0b53..f26f9b4c03e1 100644 --- a/include/uapi/asm-generic/mman.h +++ b/include/uapi/asm-generic/mman.h @@ -4,12 +4,33 @@ #include +/* + * 0x01 - 0x03 are defined in linux/mman.h + * 0x04 - 0x200000 are architecture specific + * 0x200000 - 0x2000000 are available for common assignments in linux/mman.h + * 0x4000000 - 0x80000000 are used for hugepage encodings + */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ + #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ #define MAP_LOCKED 0x2000 /* pages are locked */ #define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x010000 /* do not block on IO */ +#define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */ +#define MAP_HUGETLB 0x040000 /* create a huge page mapping */ +#define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */ +#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ + +#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be + * uninitialized */ + + /* * Bits [26:31] are reserved, see asm-generic/hugetlb_encode.h * for MAP_HUGETLB usage diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h index e89d00528f2f..b70cb06dd7ef 100644 --- a/include/uapi/linux/mman.h +++ b/include/uapi/linux/mman.h @@ -18,6 +18,11 @@ #define MAP_PRIVATE 0x02 /* Changes are private */ #define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */ #define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ +/* + * 0x10 through 0x200000 are used for architecture specific definitions + * in asm/mman.h, numbers 0x400000 through 0x2000000 are currently + * available on all architectures. + */ /* * Huge page size encoding when MAP_HUGETLB is specified, and a huge page