From patchwork Wed Sep 20 03:28:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: maobibo X-Patchwork-Id: 142196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3848600vqi; Tue, 19 Sep 2023 20:32:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYBG9xKZVPJ6WbexY7bWHeCrzaQB6YJLl8+V+9bSUoMc+SlOnyhFQFAOTSb2ZWz/fSR01+ X-Received: by 2002:a05:620a:372c:b0:767:2bbc:fcc7 with SMTP id de44-20020a05620a372c00b007672bbcfcc7mr1743917qkb.14.1695180733934; Tue, 19 Sep 2023 20:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695180733; cv=none; d=google.com; s=arc-20160816; b=xt/rpUIYTOXuDqi2tH4UBEWkfqDUlvstdIWV/iYDS50sp+mgK3BHYl2wHv8y1LrFTx 3Q2wGZ9ZDWf5J6Io8szsilxfJwaDZTzpT/Ua2A5CswMgPr7tiIMeCA4s1KSoWudmoQhh CUrI4gYf0Au5EIWJirnx/Mhmisp+LMmLK1LBES1e/kZZZ5WUhIy9szsDlSOHpEGfizIi RXOR3rjMgDCKqNoZnaaK0Yoyb2REounxwd1SmGvX1bT1qxfsHB+bmDmobfPK6TppQ9m4 3SFEiUWedq1GxbhGQ4jXZS6NkbxzJawbma/zk7dcRuTsFAFmjNDTUVYFaozrxhnXEQO1 9zbA== 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=u2brKadcWKh303ztQEfwsyf5Q4cZlV+kmU3Sg9lbPRk=; fh=HY9cYSSwdEXGEpP+dn40shRckbSxGHznHy91qLzEn74=; b=fVGacCO6ASWg+HlkblS9FQXAGdQY5Iud2GVzqYweKDG4uZJZctJngi1qURY+xCJnPD qwke0jLVonkzJxK5YOK0xejnrOM9zOmHLwVlHUYVQfBs3Lat/yNo3GpgruU8Bj7axMb/ fU/fpWqvQffyFImAbfKSZ5oIJP/eBJNyzr7QSPEwin5bYoRMH/LA94qbhmPoHc695Yt2 3neAL1hVBt2Cx2YENOorV0ZBTFh+lRCR0WA3d1kmOztH3iyJBtuYVRc5A77aeKFzko7G KEBOn4s1XNbZ9Q9XCevvQPPU6GY3zTM/TCbQMbNg4VuvdUNyJZNJ8Ie1VPjsvuyPYrf6 y2Gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b2-20020a63eb42000000b00573fbbb7803si10965976pgk.613.2023.09.19.20.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 20:32:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8EF79802658B; Tue, 19 Sep 2023 20:28:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232444AbjITD2X (ORCPT + 26 others); Tue, 19 Sep 2023 23:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231630AbjITD2V (ORCPT ); Tue, 19 Sep 2023 23:28:21 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6452DB0 for ; Tue, 19 Sep 2023 20:28:12 -0700 (PDT) Received: from loongson.cn (unknown [10.2.9.158]) by gateway (Coremail) with SMTP id _____8CxfOrKZgplJyYqAA--.53937S3; Wed, 20 Sep 2023 11:28:10 +0800 (CST) Received: from kvm-1-158.loongson.cn (unknown [10.2.9.158]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxG9zKZgpl6jUMAA--.24496S2; Wed, 20 Sep 2023 11:28:10 +0800 (CST) From: Bibo Mao To: Huacai Chen Cc: Xi Ruoyao , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] LoongArch: Fix some build warnings with W=1 option Date: Wed, 20 Sep 2023 11:28:10 +0800 Message-Id: <20230920032810.1392548-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxG9zKZgpl6jUMAA--.24496S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW3ur47Xr1rWFyUJF47ZF13trc_yoWDKF17pF ZrAr1kGrZ5Gw1kZF9rA3yjvr13Jws5Kw12v3W2kFyrAF12qrn5Xr4v9FyDXF18ta95KFy0 vFWfKw1SvF45XwcCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07jUsqXUUUUU= X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 20:28:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777525833281534185 X-GMAIL-MSGID: 1777525833281534185 There are some building warnings when building LoongArch kernel with W=1 option as following, this patch fixes these building warnings. arch/loongarch/kernel/traps.c:496:25: warning: no previous prototype for 'do_fpe' [-Wmissing-prototypes] 496 | asmlinkage void noinstr do_fpe(struct pt_regs *regs | ^~~~~~ arch/loongarch/kernel/syscall.c:21:40: warning: initialized field overwritten [-Woverride-init] 21 | #define __SYSCALL(nr, call) [nr] = (call), | ^ Signed-off-by: Bibo Mao --- Changes in v2: 1. Remove modification about file arch/loongarch/kernel/asm-offsets.c, since it is refacted now. 2. Add more modification and eliminate almost all building warnings in arch/loongarch tree. --- arch/loongarch/include/asm/exception.h | 26 ++++++++++++++++++++++++++ arch/loongarch/include/asm/io.h | 4 +--- arch/loongarch/include/asm/smp.h | 1 + arch/loongarch/include/asm/syscall.h | 1 + arch/loongarch/kernel/Makefile | 1 + arch/loongarch/kernel/process.c | 1 + arch/loongarch/kernel/signal.c | 6 +++--- arch/loongarch/kernel/smp.c | 3 +++ arch/loongarch/kernel/syscall.c | 1 + arch/loongarch/kernel/time.c | 2 +- arch/loongarch/kernel/traps.c | 10 ++++++---- arch/loongarch/mm/fault.c | 1 + arch/loongarch/mm/tlb.c | 2 +- 13 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 arch/loongarch/include/asm/exception.h base-commit: 9fdfb15a3dbf818e06be514f4abbfc071004cbe7 diff --git a/arch/loongarch/include/asm/exception.h b/arch/loongarch/include/asm/exception.h new file mode 100644 index 000000000000..ffa068aa6ac9 --- /dev/null +++ b/arch/loongarch/include/asm/exception.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_EXCEPTION_H +#define __ASM_EXCEPTION_H + +#include + +asmlinkage void noinstr do_fpe(struct pt_regs *regs, unsigned long fcsr); +asmlinkage void noinstr do_ade(struct pt_regs *regs); +asmlinkage void noinstr do_ale(struct pt_regs *regs); +asmlinkage void noinstr do_bce(struct pt_regs *regs); +asmlinkage void noinstr do_bp(struct pt_regs *regs); +asmlinkage void noinstr do_watch(struct pt_regs *regs); +asmlinkage void noinstr do_ri(struct pt_regs *regs); +asmlinkage void noinstr do_fpu(struct pt_regs *regs); +asmlinkage void noinstr do_lsx(struct pt_regs *regs); +asmlinkage void noinstr do_lasx(struct pt_regs *regs); +asmlinkage void noinstr do_lbt(struct pt_regs *regs); +asmlinkage void noinstr do_reserved(struct pt_regs *regs); +asmlinkage void cache_parity_error(void); +asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs); +asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp); +asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, + unsigned long write, unsigned long address); + +#endif /* __ASM_EXCEPTION_H */ diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h index 0dcb36b32cb2..58bc88c5a9e5 100644 --- a/arch/loongarch/include/asm/io.h +++ b/arch/loongarch/include/asm/io.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -19,9 +20,6 @@ */ #define page_to_phys(page) ((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT) -extern void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size); -extern void __init early_iounmap(void __iomem *addr, unsigned long size); - #define early_memremap early_ioremap #define early_memunmap early_iounmap diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/asm/smp.h index 66ecb480c894..a845ed3a6456 100644 --- a/arch/loongarch/include/asm/smp.h +++ b/arch/loongarch/include/asm/smp.h @@ -19,6 +19,7 @@ extern cpumask_t cpu_sibling_map[]; extern cpumask_t cpu_core_map[]; extern cpumask_t cpu_foreign_map[]; +asmlinkage void start_secondary(void); void loongson_smp_setup(void); void loongson_prepare_cpus(unsigned int max_cpus); void loongson_boot_secondary(int cpu, struct task_struct *idle); diff --git a/arch/loongarch/include/asm/syscall.h b/arch/loongarch/include/asm/syscall.h index e286dc58476e..089a58d2a45f 100644 --- a/arch/loongarch/include/asm/syscall.h +++ b/arch/loongarch/include/asm/syscall.h @@ -20,6 +20,7 @@ extern void *sys_call_table[]; +void noinstr do_syscall(struct pt_regs *regs); static inline long syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile index c56ea0b75448..1e94764005e1 100644 --- a/arch/loongarch/kernel/Makefile +++ b/arch/loongarch/kernel/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_CPU_HAS_LBT) += lbt.o obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o +CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,) ifdef CONFIG_FUNCTION_TRACER ifndef CONFIG_DYNAMIC_FTRACE obj-y += mcount.o ftrace.o diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/process.c index 3cb082e0c992..767d94cce0de 100644 --- a/arch/loongarch/kernel/process.c +++ b/arch/loongarch/kernel/process.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/loongarch/kernel/signal.c b/arch/loongarch/kernel/signal.c index 504fdfe85203..aa482eae5e79 100644 --- a/arch/loongarch/kernel/signal.c +++ b/arch/loongarch/kernel/signal.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -891,7 +892,7 @@ static unsigned long setup_extcontext(struct extctx_layout *extctx, unsigned lon return new_sp; } -void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, +static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, struct extctx_layout *extctx) { unsigned long sp; @@ -921,8 +922,7 @@ void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, /* * Atomically swap in the new signal mask, and wait for a signal. */ - -asmlinkage long sys_rt_sigreturn(void) +SYSCALL_DEFINE0(rt_sigreturn) { int sig; sigset_t set; diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 6667b0a90f81..ef35c871244f 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -556,10 +557,12 @@ void smp_send_stop(void) smp_call_function(stop_this_cpu, NULL, 0); } +#ifdef CONFIG_PROFILING int setup_profiling_timer(unsigned int multiplier) { return 0; } +#endif static void flush_tlb_all_ipi(void *info) { diff --git a/arch/loongarch/kernel/syscall.c b/arch/loongarch/kernel/syscall.c index 3fc4211db989..b73218ce55e8 100644 --- a/arch/loongarch/kernel/syscall.c +++ b/arch/loongarch/kernel/syscall.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #undef __SYSCALL diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c index c189e03cd5da..3064af94db9c 100644 --- a/arch/loongarch/kernel/time.c +++ b/arch/loongarch/kernel/time.c @@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_device *dev) { } -irqreturn_t constant_timer_interrupt(int irq, void *data) +static irqreturn_t constant_timer_interrupt(int irq, void *data) { int cpu = smp_processor_id(); struct clock_event_device *cd; diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c index 65214774ef7c..e6429047b6d9 100644 --- a/arch/loongarch/kernel/traps.c +++ b/arch/loongarch/kernel/traps.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -371,7 +372,7 @@ void show_regs(struct pt_regs *regs) dump_stack(); } -void show_registers(struct pt_regs *regs) +static void show_registers(struct pt_regs *regs) { __show_regs(regs); print_modules(); @@ -439,7 +440,7 @@ static inline void setup_vint_size(unsigned int size) * happen together with Overflow or Underflow, and `ptrace' can set * any bits. */ -void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, +static void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, struct task_struct *tsk) { int si_code = FPE_FLTUNK; @@ -458,7 +459,8 @@ void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, force_sig_fault(SIGFPE, si_code, fault_addr); } -int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr) +static int process_fpemu_return(int sig, void __user *fault_addr, + unsigned long fcsr) { int si_code; @@ -824,7 +826,7 @@ asmlinkage void noinstr do_watch(struct pt_regs *regs) asmlinkage void noinstr do_ri(struct pt_regs *regs) { int status = SIGILL; - unsigned int opcode = 0; + unsigned int __maybe_unused opcode; unsigned int __user *era = (unsigned int __user *)exception_era(regs); irqentry_state_t state = irqentry_enter(regs); diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm/fault.c index e6376e3dce86..02f2a9765524 100644 --- a/arch/loongarch/mm/fault.c +++ b/arch/loongarch/mm/fault.c @@ -26,6 +26,7 @@ #include #include +#include #include #include diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c index eb8572e201ea..2c0a411f23aa 100644 --- a/arch/loongarch/mm/tlb.c +++ b/arch/loongarch/mm/tlb.c @@ -261,7 +261,7 @@ unsigned long pcpu_handlers[NR_CPUS]; #endif extern long exception_handlers[VECSIZE * 128 / sizeof(long)]; -void setup_tlb_handler(int cpu) +static void setup_tlb_handler(int cpu) { setup_ptwalker(); local_flush_tlb_all();