From patchwork Sun May 5 14:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13654325 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 08C3CC4345F for ; Sun, 5 May 2024 14:29:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88B4E6B00AA; Sun, 5 May 2024 10:29:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 814946B00AB; Sun, 5 May 2024 10:29:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6681F6B00AC; Sun, 5 May 2024 10:29:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3FE756B00AA for ; Sun, 5 May 2024 10:29:13 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E7F0A1A07E0 for ; Sun, 5 May 2024 14:29:12 +0000 (UTC) X-FDA: 82084574544.22.ED6188B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 4A031A0005 for ; Sun, 5 May 2024 14:29:11 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CNaiozzZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf15.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=1714919351; 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=L2IvRt6u6jqo/e5amHBUqWQrOE6g/Jgm0JvMVudiXTE=; b=IeHa3aTe4hUBD5tiegbHNIiQPNyk3f7kJdcNdwoBnjcqG7rP3FLtsekF1dHtDmZHoqXBZ0 2ZDJfiZe3AHBo5U1QbljWte0KugjI609lntX2E7bYJ8Y2yw7qX1p3CfvG8mHrPoMdsFUZU zVE9r2UFB7NTkr3lYtoMELMEn9Hzggg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CNaiozzZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf15.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=1714919351; a=rsa-sha256; cv=none; b=AuZNjURKwwNVlsaY5tkBrh1X+yYfGq3b/lI+vz4ZsJ0rSzm7WZPW2J39L6mw0GFkw9m00D vNdlM85gfaO51FpUp8anoYEnF+XYqI8fUBiDOCoNyz3mZmdnMeeNQQLxHdeHtEvZ3gxLsB v1ndVRlrQ6wu4V/+fa97AhTp+lBeUnA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7CC1D60C8A; Sun, 5 May 2024 14:29:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5B80C4DDE6; Sun, 5 May 2024 14:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714919350; bh=dj8Jeem56mTOW4r4fQ6hbW3YTYti2N5hSv58QgNFPjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNaiozzZBPV5RkmmCSs3ddeefpiiUqQirjI/NoCsuXOKs0DbDvjNMShBg3s8/Dhzd /8+wSAwnK7YP9vpM60p4P0kXVUfkY/DKFS5XETjMSY1Yn0AlnNtgqXJY8J0FAn2JVl 0ctgKBM1THkhe3JzQO7EAESxmJ954zXTGdmdvXH04ABGYJ8l/o1+//6Oq58i3gUgbQ vk0Qs8zYXhabR3/pc9pxGPLAlHRVRARH2FKfc0xQ53GnA6fcDxn7DQgVPl4WZBQKhb SJwjh13B8dG/mTe1tKedqrtwNxEs6rR3yEFHPqq4OPDxWkCOsYj4HktaweRgRSLKN0 piZmThi/hEO+A== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Andrew Morton , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , 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_Mathieu-Daud?= =?utf-8?q?=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 v8 14/17] powerpc: use CONFIG_EXECMEM instead of CONFIG_MODULES where appropriate Date: Sun, 5 May 2024 17:25:57 +0300 Message-ID: <20240505142600.2322517-15-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505142600.2322517-1-rppt@kernel.org> References: <20240505142600.2322517-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4A031A0005 X-Stat-Signature: mjyon8gygq6t1ynthi58jmgxfrqh9rq3 X-HE-Tag: 1714919351-722545 X-HE-Meta: U2FsdGVkX1+BwJ3g1xj77gvtc2ZORwnIWg/BXJu5IoefIyEclef9VHEUNY/4DAswPipMYwqNQ3u5FVM+Ebez1zVZOoGp9Cuce2N1sQnG33zj7RN3tsbWrUBZmOsBvPq3TEMGmTSEalQQchbf3KKD0RGZRRcwgFMUCB84FJB9nAX55jkyaSMshsB09Gv4h8XXyi5bq+eLiQ0caE1lQK4dKfPwU9bEm8XoxEoL2xeAU8tRBmBK0gMmFcVmJZw/TVrYX2IBJmNk8N7BXuKk8k90TsQhc1qdlKyu0MX0GAYI4mII+PJwHL9Ea+3LNa5spf81FJjk0iN91ztoVfJqwd1u6jLJNPzchlLftofyBjh74ApUsCKF36IHYmwkMzfsgRLJt3Cw7rXvk/el/o3b5xuufU5W1aYTcO532MRv0DIpHRPuiY1dYkrdw+DJWcJ74VEn/yNqmm7qHWtg/3hNCYqWaRpWsdWNKJdnzu+CMw5kTxPmQUTFljLvaemZfKmOkFB5/tV7QnzCNMWrPE+daMr/1ecctZ56CZg7F4+USTcRfjJl2RNqkOQma6Cs2P2WSTp1QLSSS0k7Xqo5h5O+CYudKADq0ciGEjXnQvHxgInMOH6KWEldBvpxLP2KHowzWTOcdmxX4+J4sgepcfwxxQoIw73KQaX7Hr0w0sXK4vxpDe+7QdyzirUMXUQw/lYKIwv4fM9RRqNjyx4jTCORp8QKtPo5OFNAkqDhP7B+nRdJ84+3em8Fbpou+Uw6Caz09C6rRGW2QPhxlGyvHbI3EJYgCJj/+CwqTZ42i8eCGgG+7IDvwoGUmtR0M2QHv4w2yPluas8ZZVl7xTNg4SuNduxueExeOr5Q0J1P3mngaT5eUKQSgKv+VrwK+WjGtGT2wBjowDZ5Gv5/x/wku/1OdNCoqBT7bP3UDW7A5zwPAOhLTcoAlhuKCnBzR0sygVczl1WTy11VS5sf7Nyj7w2FjzY nekvYHNh IrZuQBEgEKQg3PYweoll/maLrZ6vNJsCwOI52gFs5jRONYOPlN0sMnjWFVegDd399W8SqGIERU7SPGK5UuVPZO2YEjq/9PKbnj5SkYa9J1MJRBhUs5dqhmbVJ4WnTd/xA1tmXJdXrJNJFPtGoxSngEKNlCO1HeOpir3DS+6oRjAroiIBz7fB7X4RgvrhVfoUm5aYovBYbl8YN1Udu9j/WdVY6Dg2BIKYIWODeHdkJqijZDIdgUqx1lsyE/9QNxaiYwqiHWnhs1EmEKhL5c8TfcX9ZVP//MPjQQ7mv60Jj1zrWguyTc1UbC1gZ50k5bdlvgIxYTSXH9q+fERQaQ2c3O0vuDT9MqsOQOjTFjJONM6JteCuRRbWiU4FNRFoilLyPlDXaH5+RcA3M7rG/i3hr3cGs0RlMREIwkLgOPk/8Ip7oZuVRseMn6Mqdbw== 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: "Mike Rapoport (IBM)" There are places where CONFIG_MODULES guards the code that depends on memory allocation being done with module_alloc(). Replace CONFIG_MODULES with CONFIG_EXECMEM in such places. Signed-off-by: Mike Rapoport (IBM) --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/kasan.h | 2 +- arch/powerpc/kernel/head_8xx.S | 4 ++-- arch/powerpc/kernel/head_book3s_32.S | 6 +++--- arch/powerpc/lib/code-patching.c | 2 +- arch/powerpc/mm/book3s32/mmu.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1c4be3373686..2e586733a464 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -285,7 +285,7 @@ config PPC select IOMMU_HELPER if PPC64 select IRQ_DOMAIN select IRQ_FORCED_THREADING - select KASAN_VMALLOC if KASAN && MODULES + select KASAN_VMALLOC if KASAN && EXECMEM select LOCK_MM_AND_FIND_VMA select MMU_GATHER_PAGE_SIZE select MMU_GATHER_RCU_TABLE_FREE diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h index 365d2720097c..b5bbb94c51f6 100644 --- a/arch/powerpc/include/asm/kasan.h +++ b/arch/powerpc/include/asm/kasan.h @@ -19,7 +19,7 @@ #define KASAN_SHADOW_SCALE_SHIFT 3 -#if defined(CONFIG_MODULES) && defined(CONFIG_PPC32) +#if defined(CONFIG_EXECMEM) && defined(CONFIG_PPC32) #define KASAN_KERN_START ALIGN_DOWN(PAGE_OFFSET - SZ_256M, SZ_256M) #else #define KASAN_KERN_START PAGE_OFFSET diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 647b0b445e89..edc479a7c2bc 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -199,12 +199,12 @@ instruction_counter: mfspr r10, SPRN_SRR0 /* Get effective address of fault */ INVALIDATE_ADJACENT_PAGES_CPU15(r10, r11) mtspr SPRN_MD_EPN, r10 -#ifdef CONFIG_MODULES +#ifdef CONFIG_EXECMEM mfcr r11 compare_to_kernel_boundary r10, r10 #endif mfspr r10, SPRN_M_TWB /* Get level 1 table */ -#ifdef CONFIG_MODULES +#ifdef CONFIG_EXECMEM blt+ 3f rlwinm r10, r10, 0, 20, 31 oris r10, r10, (swapper_pg_dir - PAGE_OFFSET)@ha diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S index c1d89764dd22..57196883a00e 100644 --- a/arch/powerpc/kernel/head_book3s_32.S +++ b/arch/powerpc/kernel/head_book3s_32.S @@ -419,14 +419,14 @@ InstructionTLBMiss: */ /* Get PTE (linux-style) and check access */ mfspr r3,SPRN_IMISS -#ifdef CONFIG_MODULES +#ifdef CONFIG_EXECMEM lis r1, TASK_SIZE@h /* check if kernel address */ cmplw 0,r1,r3 #endif mfspr r2, SPRN_SDR1 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC rlwinm r2, r2, 28, 0xfffff000 -#ifdef CONFIG_MODULES +#ifdef CONFIG_EXECMEM li r0, 3 bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ @@ -442,7 +442,7 @@ InstructionTLBMiss: andc. r1,r1,r2 /* check access & ~permission */ bne- InstructionAddressInvalid /* return if access not permitted */ /* Convert linux-style PTE to low word of PPC-style PTE */ -#ifdef CONFIG_MODULES +#ifdef CONFIG_EXECMEM rlwimi r2, r0, 0, 31, 31 /* userspace ? -> PP lsb */ #endif ori r1, r1, 0xe06 /* clear out reserved bits */ diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index c6ab46156cda..7af791446ddf 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c @@ -225,7 +225,7 @@ void __init poking_init(void) static unsigned long get_patch_pfn(void *addr) { - if (IS_ENABLED(CONFIG_MODULES) && is_vmalloc_or_module_addr(addr)) + if (IS_ENABLED(CONFIG_EXECMEM) && is_vmalloc_or_module_addr(addr)) return vmalloc_to_pfn(addr); else return __pa_symbol(addr) >> PAGE_SHIFT; diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index 100f999871bc..625fe7d08e06 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -184,7 +184,7 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top) static bool is_module_segment(unsigned long addr) { - if (!IS_ENABLED(CONFIG_MODULES)) + if (!IS_ENABLED(CONFIG_EXECMEM)) return false; if (addr < ALIGN_DOWN(MODULES_VADDR, SZ_256M)) return false;