.. | .. |
---|
13 | 13 | int kimage_is_destination_range(struct kimage *image, |
---|
14 | 14 | unsigned long start, unsigned long end); |
---|
15 | 15 | |
---|
16 | | -extern struct mutex kexec_mutex; |
---|
| 16 | +int machine_kexec_post_load(struct kimage *image); |
---|
| 17 | + |
---|
| 18 | +/* |
---|
| 19 | + * Whatever is used to serialize accesses to the kexec_crash_image needs to be |
---|
| 20 | + * NMI safe, as __crash_kexec() can happen during nmi_panic(), so here we use a |
---|
| 21 | + * "simple" atomic variable that is acquired with a cmpxchg(). |
---|
| 22 | + */ |
---|
| 23 | +extern atomic_t __kexec_lock; |
---|
| 24 | +static inline bool kexec_trylock(void) |
---|
| 25 | +{ |
---|
| 26 | + return atomic_cmpxchg_acquire(&__kexec_lock, 0, 1) == 0; |
---|
| 27 | +} |
---|
| 28 | +static inline void kexec_unlock(void) |
---|
| 29 | +{ |
---|
| 30 | + atomic_set_release(&__kexec_lock, 0); |
---|
| 31 | +} |
---|
17 | 32 | |
---|
18 | 33 | #ifdef CONFIG_KEXEC_FILE |
---|
19 | 34 | #include <linux/purgatory.h> |
---|