mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Most of the SEV support code used to reside in a single C source file that was included in two places: the core kernel, and the decompressor. The code that is actually shared with the decompressor was moved into a separate, shared source file under startup/, on the basis that the decompressor also executes from the early 1:1 mapping of memory. However, while the elaborate #VC handling and instruction decoding that it involves is also performed by the decompressor, it does not actually occur in the core kernel at early boot, and therefore, does not need to be part of the confined early startup code. So split off the #VC handling code and move it back into arch/x86/coco where it came from, into another C source file that is included from both the decompressor and the core kernel. Code movement only - no functional change intended. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: Dionna Amalie Glaze <dionnaglaze@google.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Kevin Loughlin <kevinloughlin@google.com> Cc: Len Brown <len.brown@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: linux-efi@vger.kernel.org Link: https://lore.kernel.org/r/20250504095230.2932860-31-ardb+git@google.com
44 lines
842 B
C
44 lines
842 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* AMD SEV header for early boot related functions.
|
|
*
|
|
* Author: Tom Lendacky <thomas.lendacky@amd.com>
|
|
*/
|
|
|
|
#ifndef BOOT_COMPRESSED_SEV_H
|
|
#define BOOT_COMPRESSED_SEV_H
|
|
|
|
#ifdef CONFIG_AMD_MEM_ENCRYPT
|
|
|
|
#include "../msr.h"
|
|
|
|
void snp_accept_memory(phys_addr_t start, phys_addr_t end);
|
|
u64 sev_get_status(void);
|
|
bool early_is_sevsnp_guest(void);
|
|
|
|
static inline u64 sev_es_rd_ghcb_msr(void)
|
|
{
|
|
struct msr m;
|
|
|
|
boot_rdmsr(MSR_AMD64_SEV_ES_GHCB, &m);
|
|
|
|
return m.q;
|
|
}
|
|
|
|
static inline void sev_es_wr_ghcb_msr(u64 val)
|
|
{
|
|
struct msr m;
|
|
|
|
m.q = val;
|
|
boot_wrmsr(MSR_AMD64_SEV_ES_GHCB, &m);
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void snp_accept_memory(phys_addr_t start, phys_addr_t end) { }
|
|
static inline u64 sev_get_status(void) { return 0; }
|
|
static inline bool early_is_sevsnp_guest(void) { return false; }
|
|
|
|
#endif
|
|
|
|
#endif
|