traps.c (34069d12e239ae8f36dd96c378e4622fb1c42a76) | traps.c (bd3c5798484aa9a08302a844d7a75a2ee3b53d05) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Author: Huacai Chen <chenhuacai@loongson.cn> 4 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 5 */ 6#include <linux/bitfield.h> 7#include <linux/bitops.h> 8#include <linux/bug.h> --- 22 unchanged lines hidden (view full) --- 31#include <linux/perf_event.h> 32 33#include <asm/addrspace.h> 34#include <asm/bootinfo.h> 35#include <asm/branch.h> 36#include <asm/break.h> 37#include <asm/cpu.h> 38#include <asm/fpu.h> | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Author: Huacai Chen <chenhuacai@loongson.cn> 4 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 5 */ 6#include <linux/bitfield.h> 7#include <linux/bitops.h> 8#include <linux/bug.h> --- 22 unchanged lines hidden (view full) --- 31#include <linux/perf_event.h> 32 33#include <asm/addrspace.h> 34#include <asm/bootinfo.h> 35#include <asm/branch.h> 36#include <asm/break.h> 37#include <asm/cpu.h> 38#include <asm/fpu.h> |
39#include <asm/lbt.h> |
|
39#include <asm/inst.h> 40#include <asm/loongarch.h> 41#include <asm/mmu_context.h> 42#include <asm/pgtable.h> 43#include <asm/ptrace.h> 44#include <asm/sections.h> 45#include <asm/siginfo.h> 46#include <asm/stacktrace.h> --- 914 unchanged lines hidden (view full) --- 961 init_restore_lasx(); 962 preempt_enable(); 963 964out: 965 local_irq_disable(); 966 irqentry_exit(regs, state); 967} 968 | 40#include <asm/inst.h> 41#include <asm/loongarch.h> 42#include <asm/mmu_context.h> 43#include <asm/pgtable.h> 44#include <asm/ptrace.h> 45#include <asm/sections.h> 46#include <asm/siginfo.h> 47#include <asm/stacktrace.h> --- 914 unchanged lines hidden (view full) --- 962 init_restore_lasx(); 963 preempt_enable(); 964 965out: 966 local_irq_disable(); 967 irqentry_exit(regs, state); 968} 969 |
970static void init_restore_lbt(void) 971{ 972 if (!thread_lbt_context_live()) { 973 /* First time LBT context user */ 974 init_lbt(); 975 set_thread_flag(TIF_LBT_CTX_LIVE); 976 } else { 977 if (!is_lbt_owner()) 978 own_lbt_inatomic(1); 979 } 980 981 BUG_ON(!is_lbt_enabled()); 982} 983 |
|
969asmlinkage void noinstr do_lbt(struct pt_regs *regs) 970{ 971 irqentry_state_t state = irqentry_enter(regs); 972 | 984asmlinkage void noinstr do_lbt(struct pt_regs *regs) 985{ 986 irqentry_state_t state = irqentry_enter(regs); 987 |
973 local_irq_enable(); 974 force_sig(SIGILL); 975 local_irq_disable(); | 988 /* 989 * BTD (Binary Translation Disable exception) can be triggered 990 * during FP save/restore if TM (Top Mode) is on, which may 991 * cause irq_enable during 'switch_to'. To avoid this situation 992 * (including the user using 'MOVGR2GCSR' to turn on TM, which 993 * will not trigger the BTE), we need to check PRMD first. 994 */ 995 if (regs->csr_prmd & CSR_PRMD_PIE) 996 local_irq_enable(); |
976 | 997 |
998 if (!cpu_has_lbt) { 999 force_sig(SIGILL); 1000 goto out; 1001 } 1002 BUG_ON(is_lbt_enabled()); 1003 1004 preempt_disable(); 1005 init_restore_lbt(); 1006 preempt_enable(); 1007 1008out: 1009 if (regs->csr_prmd & CSR_PRMD_PIE) 1010 local_irq_disable(); 1011 |
|
977 irqentry_exit(regs, state); 978} 979 980asmlinkage void noinstr do_reserved(struct pt_regs *regs) 981{ 982 irqentry_state_t state = irqentry_enter(regs); 983 984 local_irq_enable(); --- 157 unchanged lines hidden --- | 1012 irqentry_exit(regs, state); 1013} 1014 1015asmlinkage void noinstr do_reserved(struct pt_regs *regs) 1016{ 1017 irqentry_state_t state = irqentry_enter(regs); 1018 1019 local_irq_enable(); --- 157 unchanged lines hidden --- |