1 // SPDX-License-Identifier: GPL-2.0
3 * AMD Encrypted Register State Support
5 * Author: Joerg Roedel <jroedel@suse.de>
9 * misc.h needs to be first because it knows how to include the other kernel
10 * headers in the pre-decompression code in a way that does not break
15 #include <asm/sev-es.h>
16 #include <asm/msr-index.h>
17 #include <asm/ptrace.h>
20 static inline u64 sev_es_rd_ghcb_msr(void)
22 unsigned long low, high;
24 asm volatile("rdmsr" : "=a" (low), "=d" (high) :
25 "c" (MSR_AMD64_SEV_ES_GHCB));
27 return ((high << 32) | low);
30 static inline void sev_es_wr_ghcb_msr(u64 val)
34 low = val & 0xffffffffUL;
37 asm volatile("wrmsr" : : "c" (MSR_AMD64_SEV_ES_GHCB),
38 "a"(low), "d" (high) : "memory");
44 /* Include code for early handlers */
45 #include "../../kernel/sev-es-shared.c"