Skip to content

Commit 5f4c374

Browse files
committed
Merge branch 'for-next/undef-traps' into for-next/core
* for-next/undef-traps: arm64: armv8_deprecated: fix unused-function error arm64: armv8_deprecated: rework deprected instruction handling arm64: armv8_deprecated: move aarch32 helper earlier arm64: armv8_deprecated move emulation functions arm64: armv8_deprecated: fold ops into insn_emulation arm64: rework EL0 MRS emulation arm64: factor insn read out of call_undef_hook() arm64: factor out EL1 SSBS emulation hook arm64: split EL0/EL1 UNDEF handlers arm64: allow kprobes on EL0 handlers
2 parents 9d84ad4 + 223d3a0 commit 5f4c374

File tree

9 files changed

+345
-403
lines changed

9 files changed

+345
-403
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,8 @@ static inline bool system_supports_tlb_range(void)
832832
cpus_have_const_cap(ARM64_HAS_TLB_RANGE);
833833
}
834834

835-
extern int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt);
835+
int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt);
836+
bool try_emulate_mrs(struct pt_regs *regs, u32 isn);
836837

837838
static inline u32 id_aa64mmfr0_parange_to_phys_shift(int parange)
838839
{

arch/arm64/include/asm/exception.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ asmlinkage void call_on_irq_stack(struct pt_regs *regs,
5858
asmlinkage void asm_exit_to_user_mode(struct pt_regs *regs);
5959

6060
void do_mem_abort(unsigned long far, unsigned long esr, struct pt_regs *regs);
61-
void do_undefinstr(struct pt_regs *regs, unsigned long esr);
61+
void do_el0_undef(struct pt_regs *regs, unsigned long esr);
62+
void do_el1_undef(struct pt_regs *regs, unsigned long esr);
6263
void do_el0_bti(struct pt_regs *regs);
6364
void do_el1_bti(struct pt_regs *regs, unsigned long esr);
6465
void do_debug_exception(unsigned long addr_if_watchpoint, unsigned long esr,
@@ -67,10 +68,10 @@ void do_fpsimd_acc(unsigned long esr, struct pt_regs *regs);
6768
void do_sve_acc(unsigned long esr, struct pt_regs *regs);
6869
void do_sme_acc(unsigned long esr, struct pt_regs *regs);
6970
void do_fpsimd_exc(unsigned long esr, struct pt_regs *regs);
70-
void do_sysinstr(unsigned long esr, struct pt_regs *regs);
71+
void do_el0_sys(unsigned long esr, struct pt_regs *regs);
7172
void do_sp_pc_abort(unsigned long addr, unsigned long esr, struct pt_regs *regs);
7273
void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr);
73-
void do_cp15instr(unsigned long esr, struct pt_regs *regs);
74+
void do_el0_cp15(unsigned long esr, struct pt_regs *regs);
7475
int do_compat_alignment_fixup(unsigned long addr, struct pt_regs *regs);
7576
void do_el0_svc(struct pt_regs *regs);
7677
void do_el0_svc_compat(struct pt_regs *regs);

arch/arm64/include/asm/spectre.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum mitigation_state {
2626
SPECTRE_VULNERABLE,
2727
};
2828

29+
struct pt_regs;
2930
struct task_struct;
3031

3132
/*
@@ -98,5 +99,6 @@ enum mitigation_state arm64_get_spectre_bhb_state(void);
9899
bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int scope);
99100
u8 spectre_bhb_loop_affected(int scope);
100101
void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
102+
bool try_emulate_el1_ssbs(struct pt_regs *regs, u32 instr);
101103
#endif /* __ASSEMBLY__ */
102104
#endif /* __ASM_SPECTRE_H */

arch/arm64/include/asm/traps.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@
1313

1414
struct pt_regs;
1515

16-
struct undef_hook {
17-
struct list_head node;
18-
u32 instr_mask;
19-
u32 instr_val;
20-
u64 pstate_mask;
21-
u64 pstate_val;
22-
int (*fn)(struct pt_regs *regs, u32 instr);
23-
};
16+
#ifdef CONFIG_ARMV8_DEPRECATED
17+
bool try_emulate_armv8_deprecated(struct pt_regs *regs, u32 insn);
18+
#else
19+
static inline bool
20+
try_emulate_armv8_deprecated(struct pt_regs *regs, u32 insn)
21+
{
22+
return false;
23+
}
24+
#endif /* CONFIG_ARMV8_DEPRECATED */
2425

25-
void register_undef_hook(struct undef_hook *hook);
26-
void unregister_undef_hook(struct undef_hook *hook);
2726
void force_signal_inject(int signal, int code, unsigned long address, unsigned long err);
2827
void arm64_notify_segfault(unsigned long addr);
2928
void arm64_force_sig_fault(int signo, int code, unsigned long far, const char *str);

0 commit comments

Comments
 (0)