sdei.c (bd4298c72b56d7faf0ee3671739f3a704a962d0f) | sdei.c (69ea03b56ed2c7189ccd0b5910ad39f3cad1df21) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2// Copyright (C) 2017 Arm Ltd. 3#define pr_fmt(fmt) "sdei: " fmt 4 5#include <linux/arm-smccc.h> 6#include <linux/arm_sdei.h> 7#include <linux/hardirq.h> 8#include <linux/irqflags.h> --- 81 unchanged lines hidden (view full) --- 90 return err; 91} 92 93static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info) 94{ 95 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr); 96 unsigned long high = low + SDEI_STACK_SIZE; 97 | 1// SPDX-License-Identifier: GPL-2.0 2// Copyright (C) 2017 Arm Ltd. 3#define pr_fmt(fmt) "sdei: " fmt 4 5#include <linux/arm-smccc.h> 6#include <linux/arm_sdei.h> 7#include <linux/hardirq.h> 8#include <linux/irqflags.h> --- 81 unchanged lines hidden (view full) --- 90 return err; 91} 92 93static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info) 94{ 95 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr); 96 unsigned long high = low + SDEI_STACK_SIZE; 97 |
98 return on_stack(sp, low, high, STACK_TYPE_SDEI_NORMAL, info); | 98 if (!low) 99 return false; 100 101 if (sp < low || sp >= high) 102 return false; 103 104 if (info) { 105 info->low = low; 106 info->high = high; 107 info->type = STACK_TYPE_SDEI_NORMAL; 108 } 109 110 return true; |
99} 100 101static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info) 102{ 103 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr); 104 unsigned long high = low + SDEI_STACK_SIZE; 105 | 111} 112 113static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info) 114{ 115 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr); 116 unsigned long high = low + SDEI_STACK_SIZE; 117 |
106 return on_stack(sp, low, high, STACK_TYPE_SDEI_CRITICAL, info); | 118 if (!low) 119 return false; 120 121 if (sp < low || sp >= high) 122 return false; 123 124 if (info) { 125 info->low = low; 126 info->high = high; 127 info->type = STACK_TYPE_SDEI_CRITICAL; 128 } 129 130 return true; |
107} 108 109bool _on_sdei_stack(unsigned long sp, struct stack_info *info) 110{ 111 if (!IS_ENABLED(CONFIG_VMAP_STACK)) 112 return false; 113 114 if (on_sdei_critical_stack(sp, info)) --- 107 unchanged lines hidden (view full) --- 222 return vbar + 0x480; 223} 224 225 226asmlinkage __kprobes notrace unsigned long 227__sdei_handler(struct pt_regs *regs, struct sdei_registered_event *arg) 228{ 229 unsigned long ret; | 131} 132 133bool _on_sdei_stack(unsigned long sp, struct stack_info *info) 134{ 135 if (!IS_ENABLED(CONFIG_VMAP_STACK)) 136 return false; 137 138 if (on_sdei_critical_stack(sp, info)) --- 107 unchanged lines hidden (view full) --- 246 return vbar + 0x480; 247} 248 249 250asmlinkage __kprobes notrace unsigned long 251__sdei_handler(struct pt_regs *regs, struct sdei_registered_event *arg) 252{ 253 unsigned long ret; |
230 bool do_nmi_exit = false; | |
231 | 254 |
232 /* 233 * nmi_enter() deals with printk() re-entrance and use of RCU when 234 * RCU believed this CPU was idle. Because critical events can 235 * interrupt normal events, we may already be in_nmi(). 236 */ 237 if (!in_nmi()) { 238 nmi_enter(); 239 do_nmi_exit = true; 240 } | 255 nmi_enter(); |
241 242 ret = _sdei_handler(regs, arg); 243 | 256 257 ret = _sdei_handler(regs, arg); 258 |
244 if (do_nmi_exit) 245 nmi_exit(); | 259 nmi_exit(); |
246 247 return ret; 248} | 260 261 return ret; 262} |