[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220926085237.1821015-1-yijun@loongson.cn>
Date: Mon, 26 Sep 2022 16:52:37 +0800
From: Jun Yi <yijun@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Qing Zhang <zhangqing@...ngson.cn>,
Guo Ren <guoren@...nel.org>, Mao Bibo <maobibo@...ngson.cn>,
Jianmin Lv <lvjianmin@...ngson.cn>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: [PATCH] LoongArch: Remove useless header branch.h
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 <yijun@...ngson.cn>
---
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 <asm/ptrace.h>
-
-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 <asm/addrspace.h>
#include <asm/bootinfo.h>
-#include <asm/branch.h>
#include <asm/break.h>
#include <asm/cpu.h>
#include <asm/fpu.h>
@@ -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 <linux/extable.h>
#include <linux/spinlock.h>
-#include <asm/branch.h>
#include <linux/uaccess.h>
+#include <asm/ptrace.h>
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 <linux/perf_event.h>
#include <linux/uaccess.h>
-#include <asm/branch.h>
#include <asm/mmu_context.h>
#include <asm/ptrace.h>
@@ -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
Powered by blists - more mailing lists