1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef LINUX_KEXEC_INTERNAL_H 2 #ifndef LINUX_KEXEC_INTERNAL_H 3 #define LINUX_KEXEC_INTERNAL_H 3 #define LINUX_KEXEC_INTERNAL_H 4 4 5 #include <linux/kexec.h> 5 #include <linux/kexec.h> 6 6 7 struct kexec_segment; << 8 << 9 struct kimage *do_kimage_alloc_init(void); 7 struct kimage *do_kimage_alloc_init(void); 10 int sanity_check_segment_list(struct kimage *i 8 int sanity_check_segment_list(struct kimage *image); 11 void kimage_free_page_list(struct list_head *l 9 void kimage_free_page_list(struct list_head *list); 12 void kimage_free(struct kimage *image); 10 void kimage_free(struct kimage *image); 13 int kimage_load_segment(struct kimage *image, 11 int kimage_load_segment(struct kimage *image, struct kexec_segment *segment); 14 void kimage_terminate(struct kimage *image); 12 void kimage_terminate(struct kimage *image); 15 int kimage_is_destination_range(struct kimage 13 int kimage_is_destination_range(struct kimage *image, 16 unsigned long 14 unsigned long start, unsigned long end); 17 15 18 /* 16 /* 19 * Whatever is used to serialize accesses to t 17 * Whatever is used to serialize accesses to the kexec_crash_image needs to be 20 * NMI safe, as __crash_kexec() can happen dur 18 * NMI safe, as __crash_kexec() can happen during nmi_panic(), so here we use a 21 * "simple" atomic variable that is acquired w 19 * "simple" atomic variable that is acquired with a cmpxchg(). 22 */ 20 */ 23 extern atomic_t __kexec_lock; 21 extern atomic_t __kexec_lock; 24 static inline bool kexec_trylock(void) 22 static inline bool kexec_trylock(void) 25 { 23 { 26 return atomic_cmpxchg_acquire(&__kexec 24 return atomic_cmpxchg_acquire(&__kexec_lock, 0, 1) == 0; 27 } 25 } 28 static inline void kexec_unlock(void) 26 static inline void kexec_unlock(void) 29 { 27 { 30 atomic_set_release(&__kexec_lock, 0); 28 atomic_set_release(&__kexec_lock, 0); 31 } 29 } 32 30 33 #ifdef CONFIG_KEXEC_FILE 31 #ifdef CONFIG_KEXEC_FILE 34 #include <linux/purgatory.h> 32 #include <linux/purgatory.h> 35 void kimage_file_post_load_cleanup(struct kima 33 void kimage_file_post_load_cleanup(struct kimage *image); 36 extern char kexec_purgatory[]; 34 extern char kexec_purgatory[]; 37 extern size_t kexec_purgatory_size; 35 extern size_t kexec_purgatory_size; 38 #else /* CONFIG_KEXEC_FILE */ 36 #else /* CONFIG_KEXEC_FILE */ 39 static inline void kimage_file_post_load_clean 37 static inline void kimage_file_post_load_cleanup(struct kimage *image) { } 40 #endif /* CONFIG_KEXEC_FILE */ 38 #endif /* CONFIG_KEXEC_FILE */ 41 #endif /* LINUX_KEXEC_INTERNAL_H */ 39 #endif /* LINUX_KEXEC_INTERNAL_H */ 42 40
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.