// SPDX-License-Identifier: GPL-2.0-only/* * AMD Memory Encryption Support * * Copyright (C) 2019 SUSE * * Author: Joerg Roedel <jroedel@suse.de> */#define pr_fmt(fmt) "SEV-ES: " fmt#include<linux/sched/debug.h> /* For show_regs() */#include<linux/percpu-defs.h>#include<linux/mem_encrypt.h>#include<linux/lockdep.h>#include<linux/printk.h>#include<linux/mm_types.h>#include<linux/set_memory.h>#include<linux/memblock.h>#include<linux/kernel.h>#include<linux/mm.h>#include<asm/cpu_entry_area.h>#include<asm/stacktrace.h>#include<asm/sev.h>#include<asm/insn-eval.h>#include<asm/fpu/internal.h>#include<asm/processor.h>#include<asm/realmode.h>#include<asm/traps.h>#include<asm/svm.h>#include<asm/smp.h>#include<asm/cpu.h>#define DR7_RESET_VALUE 0x400/* For early boot hypervisor communication in SEV-ES enabled guests */staticstructghcbboot_ghcb_page__bss_decrypted__aligned(PAGE_SIZE);/* * Needs to be in the .data section because we need it NULL before bss is * cleared */staticstructghcb__initdata*boot_ghcb;/* #VC handler runtime per-CPU data */structsev_es_runtime_data{structghcbghcb_page;/* Physical storage for the per-CPU IST stack of the #VC handler */charist_stack[EXCEPTION_STKSZ]__aligned(PAGE_SIZE);/* * Physical storage for the per-CPU fall-back stack of the #VC handler. * The fall-back stack is used when it is not safe to switch back to the * interrupted stack in the #VC entry code. */