From patchwork Sun Jan 29 12:42:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13120101 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 18403C636D0 for ; Sun, 29 Jan 2023 12:43:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6E016B0073; Sun, 29 Jan 2023 07:43:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A451D6B0074; Sun, 29 Jan 2023 07:43:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E6876B0075; Sun, 29 Jan 2023 07:43:11 -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 8006D6B0073 for ; Sun, 29 Jan 2023 07:43:11 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 53D59A62EB for ; Sun, 29 Jan 2023 12:43:11 +0000 (UTC) X-FDA: 80407801782.23.F608CA5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id A60D040006 for ; Sun, 29 Jan 2023 12:43:09 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UOlDKwso; spf=pass (imf07.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674996189; 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=hn4uqFnw1MpNZhoSRz5qWAvlShkpLY3aict1kuPnWDk=; b=O7wdAt8Yg7rt2HqH5CNUddYP9C/Py/veSYWjKBig9YPx25xmJCbCek8i3RSuV7LLkU/NoH R1H/XQ6aqqIHKS4pbZEX7BqEX1xvUAaPoWdk5fevELE1JNBFeAjIuWg4ur4FUX7tJotHg5 YlalY161WzCKy0i/6lvpzz+OKjaZmyM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UOlDKwso; spf=pass (imf07.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674996189; a=rsa-sha256; cv=none; b=fR3ef4sAks79j3xtMzIlWlkv2EYdv1D/TgSGjNijGxpLidgfcwhRzh5pS08qJa5ba2SkXG gBTYrtoCXLi58ZTN6Y5vfbpVTEjrb8lxmzaEXnjzUqvuZc34vSiqhb5ihmB5KjAZAJZHiG wspfhVNIZghgzldQNVR6HyUqspMtnOw= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6AB160D3D; Sun, 29 Jan 2023 12:43:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52C73C433A7; Sun, 29 Jan 2023 12:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674996188; bh=cgWDMwNotrvgtwLOXkxr022OhYpC4uBm5qKZZMTCdc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOlDKwso6wRfZVylh618GS0Ouplr5vx0EbZPPHD3xUb+8QoPpiFEHadR57onqorCd YVV0X4T7n8gLAlDCcDoHkjHy+WzsJoiwhi5dfYlZ0/SJbhBTB4CLpq8O6xDe8ABdAj ibLF/6hCOLr13VOj/azi035hOFFfeFmuDXjRvCo9nQzUAZ1DneDknyLVqg+z3u91Hb JSM0yS+mjSe2REo/FRs3DbdIX7npqpWYBVELIqlPxuJWRXDIEj2eP/ud0TKhe2R7e/ shdVeHbLA/9GwBZjKAbCX1zbNI+chUKkqGr1E/I9bnpduDb0l68n12sXR48UTQjqrn 2HPElfopuZj9Q== From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Brian Cain , "David S. Miller" , Dinh Nguyen , Geert Uytterhoeven , Greg Ungerer , Guo Ren , Helge Deller , Huacai Chen , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Palmer Dabbelt , Rich Felker , Richard Weinberger , Russell King , Stafford Horne , Thomas Bogendoerfer , Vineet Gupta , WANG Xuerui , Yoshinori Sato , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, x86@kernel.org, "Mike Rapoport (IBM)" Subject: [PATCH v2 1/4] arm: include asm-generic/memory_model.h from page.h rather than memory.h Date: Sun, 29 Jan 2023 14:42:32 +0200 Message-Id: <20230129124235.209895-2-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230129124235.209895-1-rppt@kernel.org> References: <20230129124235.209895-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A60D040006 X-Stat-Signature: rbdztezuf6ux9xw1gsg4ogysj8afe1o9 X-Rspam-User: X-HE-Tag: 1674996189-548044 X-HE-Meta: U2FsdGVkX18yrnFecWCA8VMOvwKSHAU92Z8u1pJCVKrT52QFB5ZfgiOtl/c1cVRwhztEDCqIcO/uic22FF14BbPjveb/eE6hwnQxA+OHzvpWXJTItzrce/t2wxHHIMzMpmCrjKwNbgfYsWsgOoOyF5j6ATeBnd3Mt70iJj119AnVc1N4avKn4KBfy4O219ycTdZnKKtL7rriw6MTYG00wlpNe7on3+kDRuwkSwwMqARaBhFhIizaDxvNGqjxS6nOvhuxfVv4sW4Px/GPwEKd9JFvQTQp6f5kLNmMweTTWk9O/Nu+WmQyAxdiHNaqXgSxfXbY72qLik9+0yZDc1fvuxZXRmgStqR67/soIOoArs5mKdvnvA7u52+/yXsWOwC86SR3oIoGZgWgSxdgpNs1/teED7oOdDjLaiC6aCSu5kmzE09uTMixmqBmNi1nnyH8bovYVV/SRQ/Tu4nnOq0ENFj8NYWWUla883uR7IFE1e4IY5dg13dC+2kztT82/vpzzFczFIxLdwqQqdIqmnRWWKaaplti1kz3ag16HNPjjo71FBPjW1BupSi+QVppQlux4gqlJSNHSVo5LiRWZOA60x3YnF9CJvYQvhzdahJso0fkQblmasWp811pd+LO5OJVhJyLLaK3hte10yzgauam/HudPUneVsApKQdvqbKzh6+bMQzfozK3/21RDHHcCMEPtu30q80XjuE86y7L4mZTezXhGQjnw4SQllfvH0pRHPfRBWVzIbAS1EO6NJ0eyvzbxOLhPmZmqG7R6CXiUnzIDUGGDnF1LmSOBMAVdaI/GqhtN7iFUL4BcQqjpeDc1aYqsHHO5f3MZ7LmI4aYJQsLNniEalqEqs6Q6SFxYsD+4Rq3wtOx8ZpzHNvQlqyAzqD7DergRpSpW+3OPRlvdO7UWS4FNZKEXbDBMSNisR9Q5v6l4rRhyrKIL7PU5VKhcW9Qnfg+mQZVE7O8dcnlYm+ MPdhKyaL prnvjRnKuh9sO/MVzXRQj+vDe8wG5eWnYnBEJm+D7Yz2I7H3gK1Tk6EMUYfEL+iNeSDaqgkfTnfQmcEdNAoVM3lVkA9fWtnOPuYIaSBEIvJpr5D9lRaaBBpdiz+nQMZfA9V3C8gotaJDHCEsyxPJEZ59w1DDc9EeYWZQkoZ5k0veqRpa332lqRVShSbq9TLZxahqn4boSAGNJtD6MVZER3q1HdAFf1j9l0vRB9ADySRKLXaQP470CFdBycCjePVBKnQKivovWTMNvl6uzXbqpCKcamc/6wC+vCT4/+mCPk3VNUvM8EU/nEUGFxRIeVd1JFE/AE9K29BVQ8muyeClIos2AUBxn3iofF+VIWo61E/sBwfpY0OJTcZ/6CtMameCgBgkgaNWQASLHFWgK9DWKznh1ykKvy/J8lr415ubyKCkzgPRN7GG0+92jTkm4cqOFmT5LBSgWWd9EXFElrGD/h2YS+USA+2DcjH1c 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: From: "Mike Rapoport (IBM)" Makes it consistent with other architectures and allows for generic definition of pfn_valid() in asm-generic/memory_model.h with clear override in arch/arm/include/asm/page.h Signed-off-by: Mike Rapoport (IBM) Reviewed-by: David Hildenbrand --- arch/arm/include/asm/memory.h | 2 -- arch/arm/include/asm/page.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index d8eef4bd8c71..62e9df024445 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -386,6 +386,4 @@ static inline unsigned long __virt_to_idmap(unsigned long x) #endif -#include - #endif diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 5fcc8a600e36..74bb5947b387 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h @@ -158,6 +158,7 @@ typedef struct page *pgtable_t; #ifdef CONFIG_HAVE_ARCH_PFN_VALID extern int pfn_valid(unsigned long); +#define pfn_valid pfn_valid #endif #include @@ -167,5 +168,6 @@ extern int pfn_valid(unsigned long); #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC #include +#include #endif From patchwork Sun Jan 29 12:42:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13120102 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 155B4C636CB for ; Sun, 29 Jan 2023 12:43:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AF146B0074; Sun, 29 Jan 2023 07:43:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 785A86B0075; Sun, 29 Jan 2023 07:43:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 626C66B0078; Sun, 29 Jan 2023 07:43:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 55EAF6B0074 for ; Sun, 29 Jan 2023 07:43:22 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3B4254051A for ; Sun, 29 Jan 2023 12:43:22 +0000 (UTC) X-FDA: 80407802244.02.E1D184C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 851D3140002 for ; Sun, 29 Jan 2023 12:43:20 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R0nQr0pB; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674996200; 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=xy1AuSmU3UO2Hyg7uQ5E9d+be8U5EAeeGv5ON7bkL+E=; b=UV2A3hsbeQNV5VygAOv7sqfWfxKXiJjJRiT2vBb6G1AYWXa+neS2OD49kmmafNMV+VbuFt TM+2AxpH26fFMwvbpARru+p8dUpjfKhh5cYlOVSJhPXjv9C2h+OvB/7DzowJugId5e5Vtt vY7VYAwUUtlkvZLYN/2pGRHLutIle/U= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R0nQr0pB; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674996200; a=rsa-sha256; cv=none; b=2cLaRW85rY0xmtUrIzwA/1BjulPKRArw7SAgTItpaY4mZx/is9f9sY7uJ0BrbmcJfRY9QP Z7PNQrUSDjkFhSkTxjS0Go3I08D9GgOkRFoSq2oeBdlLBf3cMnhvQ+RDJZUgEpIhrlOD9r Wmi++k4yKOeZkXYymrwZBiNlU1anPZE= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ABFF360D42; Sun, 29 Jan 2023 12:43:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB863C433A8; Sun, 29 Jan 2023 12:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674996199; bh=LN+b67L2GuYmW7NwwfmoYPOQn6/pUneVShVCsQXwAMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0nQr0pB/ARk6wpI1wApVcVwgzvL3nJvZL0d1rEEnUQjWCN8tFtMC8RLAoPrMcWp2 RDTPNMDGCtYLZKrFtqYc+unayS8BpfmpBREVaITviVkY9SQqoa9DIPak7ZMaylUoNU XkEUMVMunXKWmZPR9BcpXjNlA5vQUkeeuQZo5bDTV+GIseFI+xGOGnl6U0jF878itf mh/e6H0Y33/zTuC21r/0CJPhnc1+7P3/Qqea7El3CYfWpYJrYLN7QObiWb+sV322Md 3wRUSA/Myj0DO5A4pbRCW2jOQFtmwI9nGJsN3Q1ij2VEBYnaXPWn8lukuSf+C48vvu mJ0VjB6iJLE0w== From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Brian Cain , "David S. Miller" , Dinh Nguyen , Geert Uytterhoeven , Greg Ungerer , Guo Ren , Helge Deller , Huacai Chen , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Palmer Dabbelt , Rich Felker , Richard Weinberger , Russell King , Stafford Horne , Thomas Bogendoerfer , Vineet Gupta , WANG Xuerui , Yoshinori Sato , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, x86@kernel.org, "Mike Rapoport (IBM)" Subject: [PATCH v2 2/4] m68k: use asm-generic/memory_model.h for both MMU and !MMU Date: Sun, 29 Jan 2023 14:42:33 +0200 Message-Id: <20230129124235.209895-3-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230129124235.209895-1-rppt@kernel.org> References: <20230129124235.209895-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 851D3140002 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: k8ozsnrzcwtqu5u8jj7cqe6n9crpbx7n X-HE-Tag: 1674996200-255408 X-HE-Meta: U2FsdGVkX1+oYD4RRRDi0oKXID9VsHeTyPVWqFvVOpagTDMHYG1i2RgxmMSEHmiq8aGauCdGokGFJ+wCmoe0MxOXiO1CjA7BA3K1hHXiMHljq+lPCE5SD8NXGw3SH+Dd7k9aieggB02ThRFXQdNLeSwzNRmlqmXBzj8B+zLxiOciTEuC0gwS+vA/gUanoqLZ8q5hdVwN0iIJz6j0zWGk1bF0Z1HJexoZ8mKuL2NIBbxrh7Pz6OX6YDVKcxIRRumoDYl91tZVrGmqwm86n8fMJAi1SBMgWH2r6pPZ/Wy3XbFmWsKZTWqW0PTSTYw5sUXgvD3yYuNrYplaUiXkchROjbykQoiEA5kiyAIsqRtB2Kze6qCoYlS/ZEayDwOYt9x++2J7WujVctofe79vG6n7X9yi7TCXDLXKX6wfRfIvDU5H9Mb/pA1+6yVQZBjbR0FWcwjpBCLCJFa2ACWrCBRbxSo/Y8o1VFuHKgEV3eSeQIRsYuute9yL+yiBX837AytAYJiTKICX/PkGF4HFO6731d4ebpjYDetirbO3swNn25pQhn7ZeHR9P/mRDG62BSqeWCeGHs0NawNvFadh1I/ZXavz4uPnn8TpScNQ1Up6CXP23VAEUCIycObxqXTSYvYw4E+TLDsWMUKrcG6p7PCBnCEYkzLXDCfn6wwuznAuadPZQZkbg3p392bFvKtHEYLGo5DGoNfqCgv20tPl0UWiUJLz/jLBbO8BdMn3DuaCg+YoS+BjOZ0RHnm71J+6PsWNXrFYyr4HJ5ry5k2bh8DI/dWietroVVHbTdQGymRQchw0omwIkHNkyw9vT8WOZbLfm3/UZmzD5e26dCd1MXDTU6gdyQ3UA1/doguXXj2b+lTRNUNMVVke3Efchddfs9Y6f6UKJwD+czJFdR/wXV5TEwFLC23VAmJ3oQ/Kqrmh9tTR7DX/i2nPJ4Wpkg7WT9cQWRLsSoFYkOZ9XKhnRFc Db6xmb6u dz0DGK6+WmfifyvJziCwBzyFzKs05BLlNonrFgDYF1MsUN5jtD0ua05OyItlYuudRGSEYrkfWswrcteqCUq2BjncGMXpnqLBBa+8NtHoRB2/VlQiG9feI3OQ+ISGvsE2gyok+kom4HlFasbjZjoL8XzFiP5Qg3vDr4vtBjWpAueBDfLfNnbj0L/IIw2cjXN4W7bojpnUNhg3tRWj1l4RKRh+F2pSxgNSDrHqSLJfqfFU1TnsgvBx08OXH3QO6wrQOIWc73yzpWxKqZch67IwqnNGBpb1J0IRzJlQTwR1ztdlnOZd/GPQJ0NK1OPyUgs18a0qHtpIz4jBP3vtL+9x/7JNzNSs4n+qbL/y27xOAk+MwXuG03aeZyDkOELIq/+O/KoeuS493Iof9R9O22Bvu5rZcMw1iXHFetMqQqQg6LeCYekNZCohvKM+pTWT27qJ2zJiJEhmA/unM1142q6K7EbbFTCAsOMHAMJ+uz35eQcCWAVpMjPFAiZk1jSMp/TyPPF1fGaFJEq/sN3FPOQ3Y+dKuEzVnIE6oeEjj7phDZyiy/Hc= 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: From: "Mike Rapoport (IBM)" The MMU variant uses generic definitions of page_to_pfn() and pfn_to_page(), but !MMU defines them in include/asm/page_no.h for no good reason. Include asm-generic/memory_model.h in the common include/asm/page.h and drop redundant definitions. Signed-off-by: Mike Rapoport (IBM) Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven Reviewed-by: David Hildenbrand --- arch/m68k/include/asm/page.h | 6 +----- arch/m68k/include/asm/page_mm.h | 1 - arch/m68k/include/asm/page_no.h | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/m68k/include/asm/page.h b/arch/m68k/include/asm/page.h index 2f1c54e4725d..a5993ad83ed8 100644 --- a/arch/m68k/include/asm/page.h +++ b/arch/m68k/include/asm/page.h @@ -62,11 +62,7 @@ extern unsigned long _ramend; #include #endif -#ifndef CONFIG_MMU -#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT)) -#define __pfn_to_phys(pfn) PFN_PHYS(pfn) -#endif - #include +#include #endif /* _M68K_PAGE_H */ diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h index a5b459bcb7d8..3903db2e8da7 100644 --- a/arch/m68k/include/asm/page_mm.h +++ b/arch/m68k/include/asm/page_mm.h @@ -134,7 +134,6 @@ extern int m68k_virt_to_node_shift; }) #define ARCH_PFN_OFFSET (m68k_memory[0].addr >> PAGE_SHIFT) -#include #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h index c9d0d84158a4..0a8ccef777fd 100644 --- a/arch/m68k/include/asm/page_no.h +++ b/arch/m68k/include/asm/page_no.h @@ -26,8 +26,6 @@ extern unsigned long memory_end; #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) #define page_to_virt(page) __va(((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)) -#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) -#define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) #define pfn_valid(pfn) ((pfn) < max_mapnr) #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET) && \ From patchwork Sun Jan 29 12:42:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13120103 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 57BD4C636CB for ; Sun, 29 Jan 2023 12:43:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA3576B0075; Sun, 29 Jan 2023 07:43:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D52736B0078; Sun, 29 Jan 2023 07:43:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF3026B007B; Sun, 29 Jan 2023 07:43:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B2BDB6B0075 for ; Sun, 29 Jan 2023 07:43:33 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 89BFB1602CD for ; Sun, 29 Jan 2023 12:43:33 +0000 (UTC) X-FDA: 80407802706.17.6725761 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id D972840011 for ; Sun, 29 Jan 2023 12:43:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kHOqK+fk; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674996212; 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=5Zt7ZxpHybkBwEx2qiHDDQ63acJkzkg2BBP3/SGx/KA=; b=y2NKXyL7PgjWFTlLlXFnLZAGv0/aFTARpxSnc5S8ezEvKjVA/uQIUX42GgKvB+B0l5qmrj Fkw52Jd04TT5vpT0gPhPh11lBOp7HCy4ewJoEEXEOw0+kVWlkycWHPUx1q/2c0Vv73AMek y0KhxE0DHABiFxpINHvS69qa8oqvGsE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kHOqK+fk; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674996212; a=rsa-sha256; cv=none; b=YMYMvckoJyHmNtYA5vI0xXwisRZD9+OreFx9jr72CDceV13gEkn7Y1bwcgwka4hs3g1CJG IBme3yNVTbeBZJPxTrHU2oPmmApsK9/0pHeHxgaOyi9uAl709M2xMavRDpyJJssKVnB4Hh qM1T7r5q/A4BsedgcC/3UVTX4tfrcbg= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13E1C60D32; Sun, 29 Jan 2023 12:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11014C4339C; Sun, 29 Jan 2023 12:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674996210; bh=TNKTwe+UR0ceH94DVHkVlPLs1JCpp400iKAUs+FXrEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHOqK+fkBQfue2/LgvXT5/OFdAT2H2FDvjblZicbNXbJBXdpPk6eRh5KAzlpLxCYr +ZshLmihJgfk3B+zAwo730+puTcbIc8k+mnQeD2+zmdUjKYXlyfsgcn6GYvHDuUc19 AOHGXLEYgfNJeOc530SeCns3uW1t7x0orjihKEYEIIT5GQHR6IqYB/gEFrjidz/2dv f0dKfcsUeo0xUm2dYF+qX8c/XDVdQtMrsNcKx4lXhoiKAIFdyDDeO7DFDI10MnLJsj Zihs3LV7jZdAazuy4Qto4ScBNLLuXUWDyHAfB37wPKFgGicdZknfE+MkdxncDSrEh9 WkpxoaJlG/GPw== From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Brian Cain , "David S. Miller" , Dinh Nguyen , Geert Uytterhoeven , Greg Ungerer , Guo Ren , Helge Deller , Huacai Chen , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Palmer Dabbelt , Rich Felker , Richard Weinberger , Russell King , Stafford Horne , Thomas Bogendoerfer , Vineet Gupta , WANG Xuerui , Yoshinori Sato , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, x86@kernel.org, "Mike Rapoport (IBM)" Subject: [PATCH v2 3/4] mips: drop definition of pfn_valid() for DISCONTIGMEM Date: Sun, 29 Jan 2023 14:42:34 +0200 Message-Id: <20230129124235.209895-4-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230129124235.209895-1-rppt@kernel.org> References: <20230129124235.209895-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: D972840011 X-Stat-Signature: wt3jgtthq3ea414p1wpdz8zcrpmajn11 X-HE-Tag: 1674996211-269306 X-HE-Meta: U2FsdGVkX18y33rf11WpRUkrYmGkU34guStmDc0uJhhwvT1LaZo4ASd0gscJUiUzFfPcAKECX0vYuKcUriS8zXVMAg0pBuQuH9AV03Uenpv2Dw9SNFS0DrH0G413ivaM/6ghpxBkVLC4iUFQN0wmNnw2BSn5gtSNsuHkMApJOFIRv0kKwaiQyw+PPaHQaT6b39+XiENZ3PFgZhLKeUjW5M/lD2LL3nzTLHsOVd2N+z2wHaQr1aiH44Nt+/yBEg+p1uedagZtaZd8I16JL52f9+Bo7f8A6j6QqkLogA9U5i7B9nDTBgx1nLM80fjkDAHy8+aNT2p49tC03UC2X3bw2Mo+upb6TivSB8WHBXeZDlqSKLVV6ug2aq2ZzRhgAbECP6+45h8hR5F55Z6GeCFG8oVyVZoHsBXUdpct8Cn8t1B0F4eb2vcJQ9sYKe/LvoNfPfa7bJERMeEgJnZEQ9RAe/u9HK7dvYjBDmehxm5s2pCn6DH6tC9pTSIPIVKTAbQsbMR7W4fYN1RXmOBd/4Qy93MOkPx97xc69kprlaaM2N3Fm+lr+SWxJguNjmaofPG6I3ZZzTh48fPEbr3Mb4nyDpZTKLFoI7RsGXnscGR+x/DSW+8H0f4rxjp86ud8TuXmLP3tnQ7zZVm6QU3Qiz5xXYpJsHw0FfCaVZqwQ7Gr5lTIZYOGkwK/P6M2uxoKlj1jCGHDOdC6HpOnosau0TecQUWcjx0Tso9dvIgfZsWh4y1lf+x0sX8hcXlIyoIkzNrGVdNw4Cu4zCqUdHQUc3+rY2pjfV5O22wbsxFYnWD1e+yvw4tsTMi2zuDsoBbp4LQkiAQ7Bsp1bmTyHr5B2HsySYWFbE+Sx4LaKASpVHfqYfx+oE1C1995kZ27giacGm/MO2EK8GeemY3oztrE8O+l+ewA8H7JJKKMiSK9l6qJAWKu1txSjxkUrx5GCtZ0JxJjs8j9IlUnsBDw5aagN/5 OhyMLR34 OupVh2DzCXRfZg8aFPvxV6VV1SQbtqgBkmrXtZAmsBCjWwl3pIgdsylWPlYp0klZ4zafF21JN11rGsAG3nL5MND8YDj/dJrIDe9ajagDxi1mlr+Ovf3934MRapgSTS17WfjItMcJM0AS1K+eWc+oGBVGtDP5Byq6Ro3tKYX+1cxRZWmTitQB0e9IrwBhdh/S1Q+tR2V7i22x8Z5c7M17nTgJ1GeTu0mGlwzGuWgK1aC4E0CysMEkh5Dn42qsL0jVb2vrZezwwDcE2Z5PKDH1plj8lJzGJNrp1qTfPiBX8eNrjRTXXzTluwXFMrKBimePb/719x0sWRJmcWLFyo4oFVF9/Z1jWlIrMkF9qP1wy13E7kEvDyVmbZxzhmzmnXFx7o7yt0lu6bb1s2vAhjIzCXDkLYcJbb7Ue6ochp2Z5xajb9xS6+5eef54yNyXVWQwfwSri9iCDWX1gWudKYOKN9aMbfhOFVmRvG2Ks 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: From: "Mike Rapoport (IBM)" There is stale definition of pfn_valid() for DISCONTINGMEM memory model guarded !FLATMEM && !SPARSEMEM && NUMA ifdefery. Remove everything but definition of pfn_valid() for FLATMEM. Signed-off-by: Mike Rapoport (IBM) Reviewed-by: David Hildenbrand --- arch/mips/include/asm/page.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 96bc798c1ec1..9286f11ff6ad 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h @@ -235,21 +235,6 @@ static inline int pfn_valid(unsigned long pfn) return pfn >= pfn_offset && pfn < max_mapnr; } -#elif defined(CONFIG_SPARSEMEM) - -/* pfn_valid is defined in linux/mmzone.h */ - -#elif defined(CONFIG_NUMA) - -#define pfn_valid(pfn) \ -({ \ - unsigned long __pfn = (pfn); \ - int __n = pfn_to_nid(__pfn); \ - ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \ - NODE_DATA(__n)->node_spanned_pages) \ - : 0); \ -}) - #endif #define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr))) From patchwork Sun Jan 29 12:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13120104 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 A79F7C05027 for ; Sun, 29 Jan 2023 12:43:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42C316B0078; Sun, 29 Jan 2023 07:43:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 403126B007B; Sun, 29 Jan 2023 07:43:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27D926B007D; Sun, 29 Jan 2023 07:43:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 175ED6B0078 for ; Sun, 29 Jan 2023 07:43:46 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E9B321C5C2F for ; Sun, 29 Jan 2023 12:43:45 +0000 (UTC) X-FDA: 80407803210.24.FCBD02A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 3E58E140019 for ; Sun, 29 Jan 2023 12:43:44 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=njDRT8r1; spf=pass (imf23.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674996224; 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=dRGKYTr1AhDhV1rtNY59GKIerLPHEwwWdoSUSvwgUsA=; b=WOl79OYrh6J/0lpbLPIcpAxf5erSpzLGW922hVfO3966CW299t01UAz62kSCpn4G8uVEc1 YaA0FfrToVRN2PA2bb1f4gStBLmeDt3O5jgCjRRsj7zdw3XJt9ToBK4JtB4vmQQ49BhP5n adshpKFn/MN0fw1kuZZJzajJMPqcjWM= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=njDRT8r1; spf=pass (imf23.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674996224; a=rsa-sha256; cv=none; b=Zdb/ALuKwvWsWNMRXfYiWPsHF2Xlmmsb22MNBQBwjDCpOW1zeK5GrmCukt8UcmoSqb8jo9 4GZLH0CMqf8Qq8zHK9D1hi6VMjC30qQ9TH+9US1fXXcBXKfjTWcGSQ96Or7GCHPVfJRC3B ChFVxlzGCNY9QeLc8YRtpXY2DLaxHpI= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4953F60D34; Sun, 29 Jan 2023 12:43:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C766C433A4; Sun, 29 Jan 2023 12:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674996222; bh=eLMgEpQxFKcAQB5p9iZMGAjv2bPuIyDEI2WrhwgUdQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=njDRT8r1V+uNxSVhpHR4udjDyRAbAHBMKXFaL5NWEOtGVKJyxCPFGbqSBc5dMAksK 2ou+lRn371Ns36eD9qA3Fisz9Im5X2GjiQcRRmbyFJgq8kRLe+ZSKNOiesYqPNHdHn GuWKHlZHWnycj8xdKyzwDNAzu0/Q6GsslJEW6ylVyhVe2Y3NR6CiyaC4iBpfsrWtJR MBkgT0U0En1Neikz9EZkCEPDPsz5x8JX/BxKB0W26mLXO/iUJNmkdnFrUCX/0jclYU m++POMddFWraKFM7w9sk3/DqjnuxZF+J7+LfdptfN29jqclkpmpxIMvzSaE5c0iruH oU0b+vvosjpKA== From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Brian Cain , "David S. Miller" , Dinh Nguyen , Geert Uytterhoeven , Greg Ungerer , Guo Ren , Helge Deller , Huacai Chen , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Palmer Dabbelt , Rich Felker , Richard Weinberger , Russell King , Stafford Horne , Thomas Bogendoerfer , Vineet Gupta , WANG Xuerui , Yoshinori Sato , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, x86@kernel.org, "Mike Rapoport (IBM)" , Huacai Chen Subject: [PATCH v2 4/4] mm, arch: add generic implementation of pfn_valid() for FLATMEM Date: Sun, 29 Jan 2023 14:42:35 +0200 Message-Id: <20230129124235.209895-5-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230129124235.209895-1-rppt@kernel.org> References: <20230129124235.209895-1-rppt@kernel.org> MIME-Version: 1.0 X-Stat-Signature: eas146ihmuz8uroug4tm5qyszjx7rkrc X-Rspam-User: X-Rspamd-Queue-Id: 3E58E140019 X-Rspamd-Server: rspam06 X-HE-Tag: 1674996224-224821 X-HE-Meta: U2FsdGVkX19CbBRfxGyfptNxFWqm5lnxwC0U8KwS5DtTZiXbID1xDvF2A4v8dlwXRAFRUNSvKQmRlx9vYthhp6lOhH/q7s7iOkLkmBF89Nh2EpXCbzbhs86cWWjFCAgEeLLhC5reYXuNUgrvRMdJghANZrYeqzJTA98echYzxUISB6ELK/jxcidhBQxM+8HPSOFGoF+5FPOLqrpCbPdr+xQTAWBwbojE4pwjFrQRDbppGciYfAf675ZBcECwJs/GHrn9UEZ8G3E14XW+qkLC2k4XVky/W2BA9/KzQFfP1hji2o7wqAGO8vxv9w5fD9TFW2h/4ydBSTzT52ULLY9XO9zOOzf0A3SOnXrE1iFhn+9rZZIWNS8Bns2ht3HVSuPz5YOM7z2Y7WBUCyfxWmWG68Oj2/IlTMf9nDimrIyOiDKE72zVwEMfDWoWfb+Mla/PayZfM50wLoIEcKhpyhrHWbfPtivZ77gvgLJFQp5eeYQb/WlvMiKGLMeW18Gwem8JTTUBgxs2QtzO4/EfmDUKPN3sDkKDtEx5KFpuDavlVP2bV8/N+SbP5SefUPWnVvcgakI6dhE3jUK2aYnFV6TBuuyUU+d3kraHIkWtpzLqbYyRxmCdgWt2kG8futcX2fS/UnPi3mZxT8YPi5/kzYe/ThuJwgwSM7hcHy+JJlTSBVqg3Cyxjv1YtGQNs998reICbvr+K9OpRuo8/o89qtqiM76rz+QcxvUX3OCRYU3PgHDtxj/EMDvWpJYid0oA9mf4c7pILS5CUcO7YLKbnQnqUaV0I0qacjduSDV/cteobNN0E0F3ZRI5kSD19zknvG/19U8DklLAim8vaOxNnIDFJVFYJMB4xawbmcQ+VEPAkQHz3DCSTN06iipUZA1o/VrkYA7/NZXHtoXfbQkah42ORAJlDBMpDrbW9zSb6mIBcYrfEYA5v9XW/nDciTrQiGnUd2qhLqYTmt0oTmeZIp1 ica5twOk ma/PZ+sXR2F76KrIIisGWMr2lP0l4S6/vZM1k8g/lB2br6yUm/i9Is0KlG0jYe5Rm5k4ASbb6KsBuTeA7C7jtJWOhlAqGtd90hhqdFf1urdHzN3gxQmc/HqvTEpIa/noJ2FQAUUYnD9oHwWNkBsno2jFaN7/4Vi0o8nW8hUQogtCkfLuPaFg13D6tWXMYbyLcXxMOHxug/bqIHLpAKkt+BpeeK62LzI+79WFI7JHmicyzGXaHuNAymqFYZHKtZPhDg0WmHz2W6MJ6+MsD90H3DshCEPZjPIC4/ZIvCD/jmt72mqqhybsya2GCbXDO01DvH8HPjnQ9rUrn3ec0/Hgnpzvjs8ZIROGrEcPxo3GeP6oigj2oLKkZjLIyh0ABTX5TzoQFGDruZvQ3ZqEHSqgz2RPkAhBZX1AaOL0+mR3PT4H17E0+ntb0rR3Pzm6kvHI/YX0kXZVZM76+PxIru8c2Jmb+tg== 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: From: "Mike Rapoport (IBM)" Every architecture that supports FLATMEM memory model defines its own version of pfn_valid() that essentially compares a pfn to max_mapnr. Use mips/powerpc version implemented as static inline as a generic implementation of pfn_valid() and drop its per-architecture definitions. Signed-off-by: Mike Rapoport (IBM) Acked-by: Arnd Bergmann Acked-by: Guo Ren # csky Acked-by: Huacai Chen # LoongArch Acked-by: Stafford Horne # OpenRISC Acked-by: Michael Ellerman (powerpc) Tested-by: Conor Dooley Reviewed-by: David Hildenbrand --- arch/alpha/include/asm/page.h | 4 ---- arch/arc/include/asm/page.h | 1 - arch/csky/include/asm/page.h | 1 - arch/hexagon/include/asm/page.h | 1 - arch/ia64/include/asm/page.h | 4 ---- arch/loongarch/include/asm/page.h | 13 ------------- arch/m68k/include/asm/page_no.h | 2 -- arch/microblaze/include/asm/page.h | 1 - arch/mips/include/asm/page.h | 13 ------------- arch/nios2/include/asm/page.h | 9 --------- arch/openrisc/include/asm/page.h | 2 -- arch/parisc/include/asm/page.h | 4 ---- arch/powerpc/include/asm/page.h | 9 --------- arch/riscv/include/asm/page.h | 5 ----- arch/sh/include/asm/page.h | 3 --- arch/sparc/include/asm/page_32.h | 1 - arch/um/include/asm/page.h | 1 - arch/x86/include/asm/page_32.h | 4 ---- arch/x86/include/asm/page_64.h | 4 ---- arch/xtensa/include/asm/page.h | 4 ++-- include/asm-generic/memory_model.h | 12 ++++++++++++ include/asm-generic/page.h | 2 -- 22 files changed, 14 insertions(+), 86 deletions(-) diff --git a/arch/alpha/include/asm/page.h b/arch/alpha/include/asm/page.h index 8f3f5eecba28..227d32b6b75f 100644 --- a/arch/alpha/include/asm/page.h +++ b/arch/alpha/include/asm/page.h @@ -87,10 +87,6 @@ typedef struct page *pgtable_t; #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid((__pa(kaddr) >> PAGE_SHIFT)) -#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) ((pfn) < max_mapnr) -#endif /* CONFIG_FLATMEM */ - #include #include diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h index 9a62e1d87967..e43fe27ec54d 100644 --- a/arch/arc/include/asm/page.h +++ b/arch/arc/include/asm/page.h @@ -109,7 +109,6 @@ extern int pfn_valid(unsigned long pfn); #else /* CONFIG_HIGHMEM */ #define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_RAM_BASE) -#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr) #endif /* CONFIG_HIGHMEM */ diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h index ed7451478b1b..b23e3006a9e0 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -39,7 +39,6 @@ #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \ (void *)(kaddr) < high_memory) -#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr) extern void *memset(void *dest, int c, size_t l); extern void *memcpy(void *to, const void *from, size_t l); diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h index d7d4f9fca327..9c03b9965f07 100644 --- a/arch/hexagon/include/asm/page.h +++ b/arch/hexagon/include/asm/page.h @@ -95,7 +95,6 @@ struct page; /* Default vm area behavior is non-executable. */ #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC -#define pfn_valid(pfn) ((pfn) < max_mapnr) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) /* Need to not use a define for linesize; may move this to another file. */ diff --git a/arch/ia64/include/asm/page.h b/arch/ia64/include/asm/page.h index 1b990466d540..783eceab5df3 100644 --- a/arch/ia64/include/asm/page.h +++ b/arch/ia64/include/asm/page.h @@ -97,10 +97,6 @@ do { \ #include -#ifdef CONFIG_FLATMEM -# define pfn_valid(pfn) ((pfn) < max_mapnr) -#endif - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) diff --git a/arch/loongarch/include/asm/page.h b/arch/loongarch/include/asm/page.h index 53f284a96182..fb5338b352e6 100644 --- a/arch/loongarch/include/asm/page.h +++ b/arch/loongarch/include/asm/page.h @@ -82,19 +82,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#ifdef CONFIG_FLATMEM - -static inline int pfn_valid(unsigned long pfn) -{ - /* avoid include hell */ - extern unsigned long max_mapnr; - unsigned long pfn_offset = ARCH_PFN_OFFSET; - - return pfn >= pfn_offset && pfn < max_mapnr; -} - -#endif - #define virt_to_pfn(kaddr) PFN_DOWN(PHYSADDR(kaddr)) #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h index 0a8ccef777fd..2555ec57149d 100644 --- a/arch/m68k/include/asm/page_no.h +++ b/arch/m68k/include/asm/page_no.h @@ -26,8 +26,6 @@ extern unsigned long memory_end; #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) #define page_to_virt(page) __va(((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)) -#define pfn_valid(pfn) ((pfn) < max_mapnr) - #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET) && \ ((unsigned long)(kaddr) < memory_end)) diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 4b8b2fa78fc5..7b9861bcd458 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h @@ -112,7 +112,6 @@ extern int page_is_ram(unsigned long pfn); # define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) # define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT) -# define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < (max_mapnr + ARCH_PFN_OFFSET)) # endif /* __ASSEMBLY__ */ #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr))) diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 9286f11ff6ad..5978a8dfb917 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h @@ -224,19 +224,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x); #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#ifdef CONFIG_FLATMEM - -static inline int pfn_valid(unsigned long pfn) -{ - /* avoid include hell */ - extern unsigned long max_mapnr; - unsigned long pfn_offset = ARCH_PFN_OFFSET; - - return pfn >= pfn_offset && pfn < max_mapnr; -} - -#endif - #define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr))) #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h index 6a989819a7c1..0ae7d9ce369b 100644 --- a/arch/nios2/include/asm/page.h +++ b/arch/nios2/include/asm/page.h @@ -86,15 +86,6 @@ extern struct page *mem_map; # define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -static inline bool pfn_valid(unsigned long pfn) -{ - /* avoid include hell */ - extern unsigned long max_mapnr; - unsigned long pfn_offset = ARCH_PFN_OFFSET; - - return pfn >= pfn_offset && pfn < max_mapnr; -} - # define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr))) # define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr))) diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h index aab6e64d6db4..52b0d7e76446 100644 --- a/arch/openrisc/include/asm/page.h +++ b/arch/openrisc/include/asm/page.h @@ -80,8 +80,6 @@ typedef struct page *pgtable_t; #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) -#define pfn_valid(pfn) ((pfn) < max_mapnr) - #define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr))) #endif /* __ASSEMBLY__ */ diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h index 6faaaa3ebe9b..667e703c0e8f 100644 --- a/arch/parisc/include/asm/page.h +++ b/arch/parisc/include/asm/page.h @@ -155,10 +155,6 @@ extern int npmem_ranges; #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#ifndef CONFIG_SPARSEMEM -#define pfn_valid(pfn) ((pfn) < max_mapnr) -#endif - #ifdef CONFIG_HUGETLB_PAGE #define HPAGE_SHIFT PMD_SHIFT /* fixed for transparent huge pages */ #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index edf1dd1b0ca9..f2b6bf5687d0 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -117,15 +117,6 @@ extern long long virt_phys_offset; #ifdef CONFIG_FLATMEM #define ARCH_PFN_OFFSET ((unsigned long)(MEMORY_START >> PAGE_SHIFT)) -#ifndef __ASSEMBLY__ -extern unsigned long max_mapnr; -static inline bool pfn_valid(unsigned long pfn) -{ - unsigned long min_pfn = ARCH_PFN_OFFSET; - - return pfn >= min_pfn && pfn < max_mapnr; -} -#endif #endif #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 9f432c1b5289..7fed7c431928 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@ -171,11 +171,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x); #define sym_to_pfn(x) __phys_to_pfn(__pa_symbol(x)) -#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) \ - (((pfn) >= ARCH_PFN_OFFSET) && (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)) -#endif - #endif /* __ASSEMBLY__ */ #define virt_addr_valid(vaddr) ({ \ diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h index eca5daa43b93..09ac6c7faee0 100644 --- a/arch/sh/include/asm/page.h +++ b/arch/sh/include/asm/page.h @@ -169,9 +169,6 @@ typedef struct page *pgtable_t; #define PFN_START (__MEMORY_START >> PAGE_SHIFT) #define ARCH_PFN_OFFSET (PFN_START) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn) -#endif #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) #include diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h index fff8861df107..6be6f683f98f 100644 --- a/arch/sparc/include/asm/page_32.h +++ b/arch/sparc/include/asm/page_32.h @@ -130,7 +130,6 @@ extern unsigned long pfn_base; #define ARCH_PFN_OFFSET (pfn_base) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr)) #define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr) #include diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h index cdbd9653aa14..84866127d074 100644 --- a/arch/um/include/asm/page.h +++ b/arch/um/include/asm/page.h @@ -108,7 +108,6 @@ extern unsigned long uml_physmem; #define phys_to_pfn(p) ((p) >> PAGE_SHIFT) #define pfn_to_phys(pfn) PFN_PHYS(pfn) -#define pfn_valid(pfn) ((pfn) < max_mapnr) #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) #include diff --git a/arch/x86/include/asm/page_32.h b/arch/x86/include/asm/page_32.h index df42f8aa99e4..580d71aca65a 100644 --- a/arch/x86/include/asm/page_32.h +++ b/arch/x86/include/asm/page_32.h @@ -15,10 +15,6 @@ extern unsigned long __phys_addr(unsigned long); #define __phys_addr_symbol(x) __phys_addr(x) #define __phys_reloc_hide(x) RELOC_HIDE((x), 0) -#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) ((pfn) < max_mapnr) -#endif /* CONFIG_FLATMEM */ - #include static inline void clear_page(void *page) diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h index 198e03e59ca1..cc6b8e087192 100644 --- a/arch/x86/include/asm/page_64.h +++ b/arch/x86/include/asm/page_64.h @@ -39,10 +39,6 @@ extern unsigned long __phys_addr_symbol(unsigned long); #define __phys_reloc_hide(x) (x) -#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) ((pfn) < max_pfn) -#endif - void clear_page_orig(void *page); void clear_page_rep(void *page); void clear_page_erms(void *page); diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h index 493eb7083b1a..a77d04972eb9 100644 --- a/arch/xtensa/include/asm/page.h +++ b/arch/xtensa/include/asm/page.h @@ -11,6 +11,8 @@ #ifndef _XTENSA_PAGE_H #define _XTENSA_PAGE_H +#include + #include #include #include @@ -189,8 +191,6 @@ static inline unsigned long ___pa(unsigned long va) #endif #define __va(x) \ ((void *)((unsigned long) (x) - PHYS_OFFSET + PAGE_OFFSET)) -#define pfn_valid(pfn) \ - ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index a2c8ed60233a..13d2a844d928 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h @@ -19,6 +19,18 @@ #define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \ ARCH_PFN_OFFSET) +#ifndef pfn_valid +static inline int pfn_valid(unsigned long pfn) +{ + /* avoid include hell */ + extern unsigned long max_mapnr; + unsigned long pfn_offset = ARCH_PFN_OFFSET; + + return pfn >= pfn_offset && pfn < max_mapnr; +} +#define pfn_valid pfn_valid +#endif + #elif defined(CONFIG_SPARSEMEM_VMEMMAP) /* memmap is virtually contiguous. */ diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h index 6fc47561814c..c0be2edeb484 100644 --- a/include/asm-generic/page.h +++ b/include/asm-generic/page.h @@ -84,8 +84,6 @@ extern unsigned long memory_end; #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) #endif -#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr) - #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ ((void *)(kaddr) < (void *)memory_end))