Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp529874rwb; Mon, 26 Sep 2022 02:19:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zKC2m3tuCrxv6gmjWPmoNwidPtO+K2C29RH/ELO/3GUQWM1xqFUOPHInGDsJRV9x6I0Dc X-Received: by 2002:a63:5a63:0:b0:42f:e143:80d4 with SMTP id k35-20020a635a63000000b0042fe14380d4mr19428217pgm.456.1664183952067; Mon, 26 Sep 2022 02:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664183952; cv=none; d=google.com; s=arc-20160816; b=MiXpvddlrs4ZvrUi9z+iu4ZSFbA685Z0zdWYnVof5ALrumtO7NEjpUAu27waz8gtkc tD0Zm7XHe7IDEcZh27rqfqJi5DqgaGP/4H9DLOxh6yfKgZp6ZgmQ7aNWyMJCJOKlopVw DsgwxTFtakn46yF4dPSokQIlm0Y1L9HA/hSwfIfGsdByNaImehlYdplTIMGCAg/IBVei KqxI3whgFJFyMW16Ii/760PRgk8/YS58xA9ZEgckyBBFgI62BFctfiPywcAD55e5yKbn eMMnxnu/ErcCJrsTh0v7V8ZCZCdbkMGx0Wha3DAbTrCiKoVaXagelDU7rLjnGF/nwwOy kNcA== 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=xl+e+hILcLb1eEQtjeZR0mN87votRtZE7Wlxekr+YWw=; b=BK4aF5qP6GMyO+1sNbsT+PYnChK4aPFuTGG3KZDuF60nUhRnGyOJxGXMZgcYUrPx6k 28TCQjBrwFlzzFwYHQ0Q6Y8BZyXHmMMID9ATNwAq7kXLqRC2QS8EbXAiqIjXNF4SQUD9 N2wvLpTFjsNUyflvwI40qOf0jlEo4Dw3C47Hrwdn9Ug6cGUplawZUqys5aDOJuQ4kfZo iox9+ZMXQoY3c0EqowuAs/Ktnv31FFgG9/vd7Jhf+ZBesDbOpHa/Ww8dv2ZKmxKazy4W tG41xv8iLiwpH5Nxqs+zz4G4qiIRJftGOVRI65hStKcwLCmh5aeI4xY//B+ToGkRtXco Hyfg== 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 k185-20020a6324c2000000b0042b890d55dasi17700749pgk.503.2022.09.26.02.19.01; Mon, 26 Sep 2022 02:19:12 -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 S234379AbiIZIww (ORCPT + 99 others); Mon, 26 Sep 2022 04:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbiIZIws (ORCPT ); Mon, 26 Sep 2022 04:52:48 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E0C613C8C0 for ; Mon, 26 Sep 2022 01:52:42 -0700 (PDT) Received: from 4.cn (unknown [10.20.4.148]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxkOBVaDFjySIiAA--.62110S2; Mon, 26 Sep 2022 16:52:37 +0800 (CST) From: Jun Yi To: Huacai Chen , WANG Xuerui , Tiezhu Yang , Jiaxun Yang , Qing Zhang , Guo Ren , Mao Bibo , Jianmin Lv Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] LoongArch: Remove useless header branch.h Date: Mon, 26 Sep 2022 16:52:37 +0800 Message-Id: <20220926085237.1821015-1-yijun@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8CxkOBVaDFjySIiAA--.62110S2 X-Coremail-Antispam: 1UD129KBjvJXoWxGr4UJF4fJw4ktFy7Zr13urg_yoWrXw1DpF 9rAFs7GrZ5Wrn5Z3yDJ340vF15Jrs5Kw429a42ka4S9F1avryrWr4kG3srXFWvya9YyFy0 gFyrtw1YqF45XaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvv14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCY02Avz4vE-syl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr 1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE 14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7 IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73Uj IFyTuYvjfUF9a9DUUUU X-CM-SenderInfo: p1lm30o6or00hjvr0hdfq/1tbiAQABAWMwRN0OuAABs8 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 The content of LoongArch's branch.h is porting from MIPS which includes some functions about delay slot, so inline the definitions and remove the header. Signed-off-by: Jun Yi --- arch/loongarch/include/asm/branch.h | 20 -------------------- arch/loongarch/kernel/traps.c | 7 ++----- arch/loongarch/mm/extable.c | 4 ++-- arch/loongarch/mm/fault.c | 5 ++--- 4 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 arch/loongarch/include/asm/branch.h diff --git a/arch/loongarch/include/asm/branch.h b/arch/loongarch/include/asm/branch.h deleted file mode 100644 index 9a133e4c068e..000000000000 --- a/arch/loongarch/include/asm/branch.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited - */ -#ifndef _ASM_BRANCH_H -#define _ASM_BRANCH_H - -#include - -static inline unsigned long exception_era(struct pt_regs *regs) -{ - return regs->csr_era; -} - -static inline void compute_return_era(struct pt_regs *regs) -{ - regs->csr_era += 4; -} - -#endif /* _ASM_BRANCH_H */ diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c index aa1c95aaf595..3c82c57daeee 100644 --- a/arch/loongarch/kernel/traps.c +++ b/arch/loongarch/kernel/traps.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -378,7 +377,7 @@ asmlinkage void noinstr do_bp(struct pt_regs *regs) { bool user = user_mode(regs); unsigned int opcode, bcode; - unsigned long era = exception_era(regs); + unsigned long era = regs->csr_era; irqentry_state_t state = irqentry_enter(regs); local_irq_enable(); @@ -463,7 +462,7 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs) { int status = -1; unsigned int opcode = 0; - unsigned int __user *era = (unsigned int __user *)exception_era(regs); + unsigned int __user *era = (unsigned int __user *) regs->csr_era; unsigned long old_era = regs->csr_era; unsigned long old_ra = regs->regs[1]; irqentry_state_t state = irqentry_enter(regs); @@ -477,8 +476,6 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs) die_if_kernel("Reserved instruction in kernel code", regs); - compute_return_era(regs); - if (unlikely(get_user(opcode, era) < 0)) { status = SIGSEGV; current->thread.error_code = 1; diff --git a/arch/loongarch/mm/extable.c b/arch/loongarch/mm/extable.c index bc20988f2b87..6da7c5e5847b 100644 --- a/arch/loongarch/mm/extable.c +++ b/arch/loongarch/mm/extable.c @@ -4,14 +4,14 @@ */ #include #include -#include #include +#include int fixup_exception(struct pt_regs *regs) { const struct exception_table_entry *fixup; - fixup = search_exception_tables(exception_era(regs)); + fixup = search_exception_tables(regs->csr_era); if (fixup) { regs->csr_era = fixup->fixup; diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm/fault.c index 1ccd53655cab..5c2a3399c823 100644 --- a/arch/loongarch/mm/fault.c +++ b/arch/loongarch/mm/fault.c @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -197,9 +196,9 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, if (!(vma->vm_flags & VM_WRITE)) goto bad_area; } else { - if (!(vma->vm_flags & VM_READ) && address != exception_era(regs)) + if (!(vma->vm_flags & VM_READ) && address != regs->csr_era) goto bad_area; - if (!(vma->vm_flags & VM_EXEC) && address == exception_era(regs)) + if (!(vma->vm_flags & VM_EXEC) && address == regs->csr_era) goto bad_area; } -- 2.31.1