Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp956042lqh; Sun, 5 May 2024 09:09:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUf+tKtmvwnSf3BrXu+TG7jv/djXlnjgq02FX3xel0X4HCYWAq1UmXXLu7O/ce1UhSoqlVTUJiYVfUC60PrDsKcgMzrpWWgW3SfzTmGQ== X-Google-Smtp-Source: AGHT+IHvgnE5gqA/tBucAXqVbu25xfqLQdw04QktyZnMJo60LOLK4bX8TsvnCZJHXm9qjL7IBaK6 X-Received: by 2002:a05:6e02:1fec:b0:36c:bb8:9eef with SMTP id dt12-20020a056e021fec00b0036c0bb89eefmr11342527ilb.24.1714925363927; Sun, 05 May 2024 09:09:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714925362; cv=pass; d=google.com; s=arc-20160816; b=krxfR1pNgqnO39JJE1LDKDHfp14gdM2ZIeIY5ymi+fofiMURgbKdqBvAEzVWnM5xMA MIhxAOlNwcsjv4arzzUl24+qisMHpdz1UbdjIGoH5QVxBRFCaJbL3mK2rqoOoQa8gW1U DfqbvHknmkTsQS5iCP/xektb/lmD14vybg4k2ExwkImbvhrllinHtNQQ5ZxBwyJ4QGHe hfVGyqheg1SSx6Li12nUhAkWNVApxx34C8LVpAeiJxVV2/uT3aWRxgsAhJIq26TxE6he Y71XvN7itfV3zciNjIw6xyu1OdUar9/wnSCTH5eyT//v9SsdE2x1fU1IFQjw3kEqvPxe NCSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xv1c3NSNlbKJt7QC2dkLsLhlMd2xAG4RTcPEyFkesSs=; fh=Hur1Ox4UVY8CJ+UkFvS1tjjuIJbfjIxUd04pOdDk42c=; b=OJPTYTvMo7FxGcnADQRA4nq8Wt1zeDt/BWUNJrTFBmkbL/hrNe3quF0uts9myh9DgI 9NGcPgDAsX6h+2VSr5oI0x+rN92iBStCmCkbKtN4wrsH4hAoJb9XaDrF0dso2GBZWlov rtq8joPpKf3YFv8gakQAfwbwwLOwi8Ri4P5TznWsidQZz8OHhXDttdEymXSH/8SmJ/Wx WE0+U92PUTdH/Bp6Ynv5tJCAKiw2SIVSDA4fo8EmK2ENrZjbf3vUiUR3S1+i5G/njBiY 1NWW3c49S8lGZ0T218fSVIYKC7fitvXC+arRe3cobFDXaCHRNXhwo73M6+uJ3SdaKcyU 4tFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mnzdUSuF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169040-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 199-20020a6302d0000000b005f7cb790764si6391781pgc.237.2024.05.05.09.09.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 09:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169040-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=@kernel.org header.s=k20201202 header.b=mnzdUSuF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169040-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 DD119B210DC for ; Sun, 5 May 2024 16:08:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06ACD6CDB9; Sun, 5 May 2024 16:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mnzdUSuF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EBAC37707; Sun, 5 May 2024 16:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714925256; cv=none; b=EHV4x3dAY7CrzdXZh6UMtvGpoPcTyFT0J/6BNh5w1lLaouDOeIfWwm2LR++GGnqViNT9OqzBfA8ED4fEWXpOztveF+KYCTmo/Df4JNbBE8YHVrZF05ouj9Nv07tUVOm/Kjt3mQ0PZrGP4WWzJ9op+4nYbCf09c9f7t7NBmgSbxA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714925256; c=relaxed/simple; bh=S2WO9rrdnIu5PceUjVXVwYLrUCttkXy1oVefr4+OvH4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GzqJ6//sTi+rdXCKzC0UzWVVbtqWxptL7goidwZWa5wKc8IA/9JIeVcn5a2P3wwA09pELUpI62q+zFtPv3vFiLBflrDbHBLXuNXWWfgFzvCnhZNjduzIlhvX3ig+uhIbj3fEmawMfejklDF3fV768A/D0yBEl4jPsWjcGeALOoU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mnzdUSuF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 556B2C4DDE6; Sun, 5 May 2024 16:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714925255; bh=S2WO9rrdnIu5PceUjVXVwYLrUCttkXy1oVefr4+OvH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnzdUSuFwZFr/+Ip2l7zLEpPo7HXw0QyaxcHIUqM8tYDbmvTYVi7whZRj6QYhAI5c u+OLcnSpi7V7V0jzzVPB9rWa+rJA3dD3nlH+8wp77vvEuH9IEFWLpzyrsWjJPj/jKs BDJmr/0582lWHgGlperk2Rs+BsENvYpmK5JvRFZoFvCPINOMHITRzkh8LcMznIdb8y hOOVaEDM0UZeQGuU9MlrUVaRg389IJ8S7gihJymsFxUbKAYtkt7Avfm7rb5zhV1CaN R6G5Pk6nhS/74iVs2XgCvdWj3a1mXB9GimpVhAzA7uDys6bqCeiKfazaVLcWk7io+d ZIn5pR9SP9ZcA== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Andrew Morton , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Liviu Dudau , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rick Edgecombe , Russell King , Sam Ravnborg , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH RESEND v8 04/16] sparc: simplify module_alloc() Date: Sun, 5 May 2024 19:06:16 +0300 Message-ID: <20240505160628.2323363-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505160628.2323363-1-rppt@kernel.org> References: <20240505160628.2323363-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Mike Rapoport (IBM)" Define MODULES_VADDR and MODULES_END as VMALLOC_START and VMALLOC_END for 32-bit and reduce module_alloc() to __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, ...) as with the new defines the allocations becomes identical for both 32 and 64 bits. While on it, drop unused include of Suggested-by: Sam Ravnborg Signed-off-by: Mike Rapoport (IBM) Reviewed-by: Sam Ravnborg --- arch/sparc/include/asm/pgtable_32.h | 2 ++ arch/sparc/kernel/module.c | 25 +------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 9e85d57ac3f2..62bcafe38b1f 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, #define VMALLOC_START _AC(0xfe600000,UL) #define VMALLOC_END _AC(0xffc00000,UL) +#define MODULES_VADDR VMALLOC_START +#define MODULES_END VMALLOC_END /* We provide our own get_unmapped_area to cope with VA holes for userland */ #define HAVE_ARCH_UNMAPPED_AREA diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 66c45a2764bc..d37adb2a0b54 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -21,35 +21,12 @@ #include "entry.h" -#ifdef CONFIG_SPARC64 - -#include - -static void *module_map(unsigned long size) +void *module_alloc(unsigned long size) { - if (PAGE_ALIGN(size) > MODULES_LEN) - return NULL; return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, __builtin_return_address(0)); } -#else -static void *module_map(unsigned long size) -{ - return vmalloc(size); -} -#endif /* CONFIG_SPARC64 */ - -void *module_alloc(unsigned long size) -{ - void *ret; - - ret = module_map(size); - if (ret) - memset(ret, 0, size); - - return ret; -} /* Make generic code ignore STT_REGISTER dummy undefined symbols. */ int module_frob_arch_sections(Elf_Ehdr *hdr, -- 2.43.0