Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp127698lqf; Fri, 26 Apr 2024 01:31:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJb3WmsC3J+Ubgyyt8+l1BJCLZKIRWUSWLyk6g0qQGfRGshW9a6ZB6qf+ZWdaUx7oK90PuL6DY1cZO4HdImIQ4kvp1e2O4Arnn8Kpp0A== X-Google-Smtp-Source: AGHT+IFMlSLf9XwEDTQMxf+KFmqHBjlsNdYTxnFotoxWQncowfu6vHE01l1Z6+XcWlhwVPuLGmes X-Received: by 2002:a05:6a00:9386:b0:6eb:2fdc:f8d9 with SMTP id ka6-20020a056a00938600b006eb2fdcf8d9mr2375075pfb.9.1714120296706; Fri, 26 Apr 2024 01:31:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714120296; cv=pass; d=google.com; s=arc-20160816; b=gHE7Pz+KpgVTup/Av7P2asmahnvrdwol/ScSkq2Qa1dbC8hClNJaXkXPp/PpvarcGI j7tp7EcBMF9z80UtBwO+mLEX//NPRKjdoTOqTKbEdyhAdseSwg57oZq9YKmAOPj6Jw3r w4jsujPtqF236kJ2lg5koNvx/6UZlqxl3kRR2gwSjayddo7kZjGbj3zorZN87h+W10pT aWM1itcsUfY3xEcl99U79dXI1p55ljN4vysDyUw63W2D8KHY2lMS/CW4cSU74j1Lqhhc Lv+FEriBttevWiFL9QD+JE+2paCk8N4KaN7frKwpLy/9u2rciC4rSgums/bVU4y2k9d8 4t/w== 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=v9h5Ceo2H7n+7/flj6+VCTiMD2pRka7m4z/lLKCOaas=; fh=CzSJNj8w8iUnmlgWvNYhDvD5pl9OAXL/ljrL7Y6PMxw=; b=tCzLT3oIpuYdbpjHrpaEBimEtKzzpHNOdKNX0shINKEPevAUwJqJKmAIET9P2KgXOR SsuwR5kWauKWWye7u4U36QXZ6PjCa2jx7ygIzM/fQSzi1PQBasPN38Kmo8cLUOcP6C1b 9snzkaaVUIztqWvPtoW/mBN8AqDFPtOr66uQoGGLk+kliMU9QU2U36+J2QhCF7Bb6BE/ n7H042eIGf1rJy5zgJdXYpeNYQqiuUjYrIlYihVTpPsVYHUD86qdGuPutICAEkRqi7qN ctpCbjzH0f0rYYmsalh9SEvJedAV+woLZRftCr1Y3Ipie6rCXE5jiGcOqAcJHNRAvb6s 9+4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FxtLE7FD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159699-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159699-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d23-20020aa78e57000000b006edd43fb59fsi14499060pfr.400.2024.04.26.01.31.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 01:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159699-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FxtLE7FD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159699-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159699-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5AE8528369C for ; Fri, 26 Apr 2024 08:31:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EECB13F42A; Fri, 26 Apr 2024 08:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FxtLE7FD" 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 6117A13C9BA; Fri, 26 Apr 2024 08:29:59 +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=1714120199; cv=none; b=sTO8e5WCCywujCE0sef2YwiSLHvUeeXlU1E5yMcVA7lG82Zzu3eoA4LlvlVP7oEK4ww9kigabYIz46jN/b77qs3ahm+wIPPclTlxW1TpJRbLi/ChacLqMoFVd6LpwbL4cD/rR0w2GsTMDHy319QxwUDDoCuPB6uaVKL7Ymu9Bzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714120199; c=relaxed/simple; bh=3M2ZG/VEWUi/tLsKuWV23dNNSZ6f7DkD53R0UR9I374=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BYDQ9dbWojhp+SsNg5jRQIxzop1/Uq5sktnDvezGDyGKqARTCzN9GAx+YdpphJxYF9+ZpD5H00I0OsOZnw6e8VLoj1+STGLiZuoJ3KxixMebrAJ9XSThfoxFIxatVdqoL3i3XZmFcFVpW8iJNGhU/F5RmT5z/+KTaYuGvvSMT00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FxtLE7FD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 542DDC4AF07; Fri, 26 Apr 2024 08:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714120198; bh=3M2ZG/VEWUi/tLsKuWV23dNNSZ6f7DkD53R0UR9I374=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FxtLE7FDecUHDXtLc4lOQtpBLWDxwjYFEEqYIkPR0QwLBDoD0zZ8t9vMwtiNZytp+ ABQ7RDoHM2Wc8RbUl8TpphzmEPE3zGDm9H3NJtnVJldRKMdfi/pFNBIoxoDEyAWloM qKk5ZdZFe/QBUMzCeM17G3JEc1Q4ge5Z39+eSmY1YmeSj+KnOWOdkwt7Vg0syHyV2v MWiu4EM+A60684+xjiReNXSAogLjTsxd0SEDmFZ/ASqSKiS3Ag5ts/MGVnz++OOj4B XyuNjsYN43GEx4Pus1MPQkKPSwr0XVDkAZGhn7sXt+cl6vvS3YrJ7KQi2FaOLbqO+3 OD3ZnzghTMFZg== 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 , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , 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 v6 04/16] sparc: simplify module_alloc() Date: Fri, 26 Apr 2024 11:28:42 +0300 Message-ID: <20240426082854.7355-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240426082854.7355-1-rppt@kernel.org> References: <20240426082854.7355-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) --- 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