drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / kernel / kexec_internal.h
blobd35d9792402d13ddfd2491962f473afd6c966b19
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_KEXEC_INTERNAL_H
3 #define LINUX_KEXEC_INTERNAL_H
5 #include <linux/kexec.h>
7 struct kexec_segment;
9 struct kimage *do_kimage_alloc_init(void);
10 int sanity_check_segment_list(struct kimage *image);
11 void kimage_free_page_list(struct list_head *list);
12 void kimage_free(struct kimage *image);
13 int kimage_load_segment(struct kimage *image, struct kexec_segment *segment);
14 void kimage_terminate(struct kimage *image);
15 int kimage_is_destination_range(struct kimage *image,
16 unsigned long start, unsigned long end);
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().
23 extern atomic_t __kexec_lock;
24 static inline bool kexec_trylock(void)
26 int old = 0;
27 return atomic_try_cmpxchg_acquire(&__kexec_lock, &old, 1);
29 static inline void kexec_unlock(void)
31 atomic_set_release(&__kexec_lock, 0);
34 #ifdef CONFIG_KEXEC_FILE
35 #include <linux/purgatory.h>
36 void kimage_file_post_load_cleanup(struct kimage *image);
37 extern char kexec_purgatory[];
38 extern size_t kexec_purgatory_size;
39 #else /* CONFIG_KEXEC_FILE */
40 static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
41 #endif /* CONFIG_KEXEC_FILE */
42 #endif /* LINUX_KEXEC_INTERNAL_H */