Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp500217rwb; Fri, 2 Sep 2022 18:59:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR4/O2MMjaE9eyocm1jRoKx6VNbeyDw+xIa2tyR1ZutmFWuIm+ndqSYoFmo8tpC2CaY29tNX X-Received: by 2002:a05:6402:4282:b0:43e:612c:fcf7 with SMTP id g2-20020a056402428200b0043e612cfcf7mr34619569edc.242.1662170364678; Fri, 02 Sep 2022 18:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662170364; cv=none; d=google.com; s=arc-20160816; b=RTS2it6iB/GlfPLmAdWgnzR1FLukJa+EWg9ibB8J8D+KDmDXByA8Pw4dzL5XedQ4rc l4BmL/kmIRmrZWUx24V2oTMJjeC/QXobF8MA1WMwqf6vYiNwiucErvs2wRLVEyPrlpmM tutthCWwJ6YzQvjDg4zGBfp5n5nHX52sVQ3EcNQXFfLCiap+HnFkflQGGiuvNxXyEZBb Huy7BrQKdoJvZmTPTM9X1deqN45ojgeApu4ajcIUSjUuwDuXsJxJ2GdHvHJWW0tjCx3m JuqtrOwr1PK/VKDyZnv3lSOHn77vHx/+vd98nz2LzK74vEbqzsQetunvA1rRopZk4jqn 2TRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=74wdk9PM2k3prX3xc8rxjFo1a3+ozt2X5wAxj5Zb7wc=; b=qzEzJdgWwLGT5cvYSzD0t3Xo1f/UpfCJOYcWvgYD+ty31bm0LF5Hqlu0B+eAZ88SLA OnAft5FtNKdqmldeRFasA8Vgnn6gitxYF3RAtgzcqPmG/6Ss3kDNE00kopr28zGfb4XU mgCCzOKt9C8mhLe7Uf2jIwmHqX1/s27TPb0qlZybUgL/2B9eplfQixBhlhys+X8k4lxQ BMWL9E4Ifv/MvfCThkAP6ZMIha1yyA75K9AgjaFtdd+hqXbgt5yhQkTQLwh5wxjp4YLo p12iw7DNQHB6kO54Dm3rnsOPkrgwZuU3URlXR2BVSHF4H8zNIQ4p5oY6moYR6lrQZ1Bh 647A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga14-20020a1709070c0e00b0073d61fd57ddsi3036223ejc.542.2022.09.02.18.58.59; Fri, 02 Sep 2022 18:59:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbiICBmt (ORCPT + 99 others); Fri, 2 Sep 2022 21:42:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbiICBmq (ORCPT ); Fri, 2 Sep 2022 21:42:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD7A883D6; Fri, 2 Sep 2022 18:42:46 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id E22F8B82D27; Sat, 3 Sep 2022 01:42:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2598AC433D6; Sat, 3 Sep 2022 01:42:40 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Huacai Chen Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, Huacai Chen Subject: [PATCH] LoongArch: Fix section mismatch due to acpi_os_ioremap() Date: Sat, 3 Sep 2022 09:42:07 +0800 Message-Id: <20220903014207.2312965-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now acpi_os_ioremap() is marked with __init because it calls memblock_ is_memory() which is also marked with __init in the !ARCH_KEEP_MEMBLOCK case. However, acpi_os_ioremap() is called by ordinary functions such as acpi_os_{read, write}_memory() and causes section mismatch warnings: WARNING: modpost: vmlinux.o: section mismatch in reference: acpi_os_read_memory (section: .text) -> acpi_os_ioremap (section: .init.text) WARNING: modpost: vmlinux.o: section mismatch in reference: acpi_os_write_memory (section: .text) -> acpi_os_ioremap (section: .init.text) Fix these warnings by selecting ARCH_KEEP_MEMBLOCK unconditionally and removing the __init modifier of acpi_os_ioremap(). This can also give a chance to track "memory" and "reserved" memblocks after early boot. Signed-off-by: Huacai Chen --- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/acpi.h | 2 +- arch/loongarch/kernel/acpi.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 3bc5b911ae1a..c7dd6ad779af 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -39,6 +39,7 @@ config LOONGARCH select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION + select ARCH_KEEP_MEMBLOCK select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select ARCH_SPARSEMEM_ENABLE diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h index c5108213876c..17162f494b9b 100644 --- a/arch/loongarch/include/asm/acpi.h +++ b/arch/loongarch/include/asm/acpi.h @@ -15,7 +15,7 @@ extern int acpi_pci_disabled; extern int acpi_noirq; #define acpi_os_ioremap acpi_os_ioremap -void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); static inline void disable_acpi(void) { diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c index f1c928648a4a..335398482038 100644 --- a/arch/loongarch/kernel/acpi.c +++ b/arch/loongarch/kernel/acpi.c @@ -48,7 +48,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size) early_memunmap(map, size); } -void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { if (!memblock_is_memory(phys)) return ioremap(phys, size); -- 2.31.1