Skip to content

Commit 7fca221

Browse files
committed
riscv: andes: fix make failure with riscv generic defconfig (torvalds#206)
Signed-off-by: charles <[email protected]> Reviewed-on: https://gitea.andestech.com/RD-SW/linux/pulls/206 Reviewed-by: randolph <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]> Co-authored-by: charles <[email protected]> Co-committed-by: charles <[email protected]>
1 parent a598976 commit 7fca221

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

arch/riscv/include/asm/entry-common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
void handle_page_fault(struct pt_regs *regs);
1111
void handle_break(struct pt_regs *regs);
1212

13+
#ifdef CONFIG_ARCH_ANDES
1314
static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
1415
unsigned long ti_work)
1516
{
@@ -23,4 +24,5 @@ static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
2324
}
2425
}
2526
#define arch_exit_to_user_mode_work arch_exit_to_user_mode_work
27+
#endif
2628
#endif /* _ASM_RISCV_ENTRY_COMMON_H */

arch/riscv/include/asm/ptrace.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ struct pt_regs {
5050
unsigned long badaddr;
5151
unsigned long cause;
5252

53+
#ifdef CONFIG_ARCH_ANDES
5354
/* Andes supervisor detailed trap cause */
5455
unsigned long sdcause;
56+
#endif
5557
/* a0 value before the syscall */
5658
unsigned long orig_a0;
5759
};
@@ -65,8 +67,10 @@ struct pt_regs {
6567
#define REG_FMT "%08lx"
6668
#endif
6769

70+
#ifdef CONFIG_ARCH_ANDES
6871
/* Andes use trigger module to implement the ptrace single step. */
6972
#define arch_has_single_step() (1)
73+
#endif
7074

7175
#define user_mode(regs) (((regs)->status & SR_PP) == 0)
7276

arch/riscv/kernel/asm-offsets.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ void asm_offsets(void)
115115
OFFSET(PT_STATUS, pt_regs, status);
116116
OFFSET(PT_BADADDR, pt_regs, badaddr);
117117
OFFSET(PT_CAUSE, pt_regs, cause);
118+
#ifdef CONFIG_ARCH_ANDES
118119
OFFSET(PT_SDCAUSE, pt_regs, sdcause);
120+
#endif
119121

120122
OFFSET(SUSPEND_CONTEXT_REGS, suspend_context, regs);
121123

arch/riscv/kernel/entry.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,18 @@ _save_context:
6464
csrr s3, CSR_TVAL
6565
csrr s4, CSR_CAUSE
6666
csrr s5, CSR_SCRATCH
67+
#ifdef CONFIG_ARCH_ANDES
6768
csrr s6, CSR_SDCAUSE
69+
#endif
6870
REG_S s0, PT_SP(sp)
6971
REG_S s1, PT_STATUS(sp)
7072
REG_S s2, PT_EPC(sp)
7173
REG_S s3, PT_BADADDR(sp)
7274
REG_S s4, PT_CAUSE(sp)
7375
REG_S s5, PT_TP(sp)
76+
#ifdef CONFIG_ARCH_ANDES
7477
REG_S s6, PT_SDCAUSE(sp)
78+
#endif
7579

7680
/*
7781
* Set the scratch register to 0, so that if a recursive exception

0 commit comments

Comments
 (0)