linux/arch/x86/kernel/machine_kexec_64.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * handle transition of Linux booting another kernel
 * Copyright (C) 2002-2005 Eric Biederman  <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/mm.h>
#include <linux/kexec.h>
#include <linux/string.h>
#include <linux/gfp.h>
#include <linux/reboot.h>
#include <linux/numa.h>
#include <linux/ftrace.h>
#include <linux/io.h>
#include <linux/suspend.h>
#include <linux/vmalloc.h>
#include <linux/efi.h>
#include <linux/cc_platform.h>

#include <asm/init.h>
#include <asm/tlbflush.h>
#include <asm/mmu_context.h>
#include <asm/io_apic.h>
#include <asm/debugreg.h>
#include <asm/kexec-bzimage64.h>
#include <asm/setup.h>
#include <asm/set_memory.h>
#include <asm/cpu.h>

#ifdef CONFIG_ACPI
/*
 * Used while adding mapping for ACPI tables.
 * Can be reused when other iomem regions need be mapped
 */
struct init_pgtable_data {};

static int mem_region_callback(struct resource *res, void *arg)
{}

static int
map_acpi_tables(struct x86_mapping_info *info, pgd_t *level4p)
{}
#else
static int map_acpi_tables(struct x86_mapping_info *info, pgd_t *level4p) { return 0; }
#endif

#ifdef CONFIG_KEXEC_FILE
const struct kexec_file_ops * const kexec_file_loaders[] =;
#endif

static int
map_efi_systab(struct x86_mapping_info *info, pgd_t *level4p)
{}

static void free_transition_pgtable(struct kimage *image)
{}

static int init_transition_pgtable(struct kimage *image, pgd_t *pgd)
{}

static void *alloc_pgt_page(void *data)
{}

static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
{}

static void load_segments(void)
{}

int machine_kexec_prepare(struct kimage *image)
{}

void machine_kexec_cleanup(struct kimage *image)
{}

/*
 * Do not allocate memory (or fail in any way) in machine_kexec().
 * We are past the point of no return, committed to rebooting now.
 */
void machine_kexec(struct kimage *image)
{}

/* arch-dependent functionality related to kexec file-based syscall */

#ifdef CONFIG_KEXEC_FILE
/*
 * Apply purgatory relocations.
 *
 * @pi:		Purgatory to be relocated.
 * @section:	Section relocations applying to.
 * @relsec:	Section containing RELAs.
 * @symtabsec:	Corresponding symtab.
 *
 * TODO: Some of the code belongs to generic code. Move that in kexec.c.
 */
int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
				     Elf_Shdr *section, const Elf_Shdr *relsec,
				     const Elf_Shdr *symtabsec)
{}

int arch_kimage_file_post_load_cleanup(struct kimage *image)
{}
#endif /* CONFIG_KEXEC_FILE */

#ifdef CONFIG_CRASH_DUMP

static int
kexec_mark_range(unsigned long start, unsigned long end, bool protect)
{}

static void kexec_mark_crashkres(bool protect)
{}

void arch_kexec_protect_crashkres(void)
{}

void arch_kexec_unprotect_crashkres(void)
{}
#endif

/*
 * During a traditional boot under SME, SME will encrypt the kernel,
 * so the SME kexec kernel also needs to be un-encrypted in order to
 * replicate a normal SME boot.
 *
 * During a traditional boot under SEV, the kernel has already been
 * loaded encrypted, so the SEV kexec kernel needs to be encrypted in
 * order to replicate a normal SEV boot.
 */
int arch_kexec_post_alloc_pages(void *vaddr, unsigned int pages, gfp_t gfp)
{}

void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages)
{}