Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/x86/boot/compressed/sev.h
26481 views
1
/* SPDX-License-Identifier: GPL-2.0 */
2
/*
3
* AMD SEV header for early boot related functions.
4
*
5
* Author: Tom Lendacky <[email protected]>
6
*/
7
8
#ifndef BOOT_COMPRESSED_SEV_H
9
#define BOOT_COMPRESSED_SEV_H
10
11
#ifdef CONFIG_AMD_MEM_ENCRYPT
12
13
#include "../msr.h"
14
15
void snp_accept_memory(phys_addr_t start, phys_addr_t end);
16
u64 sev_get_status(void);
17
bool early_is_sevsnp_guest(void);
18
19
static inline u64 sev_es_rd_ghcb_msr(void)
20
{
21
struct msr m;
22
23
boot_rdmsr(MSR_AMD64_SEV_ES_GHCB, &m);
24
25
return m.q;
26
}
27
28
static inline void sev_es_wr_ghcb_msr(u64 val)
29
{
30
struct msr m;
31
32
m.q = val;
33
boot_wrmsr(MSR_AMD64_SEV_ES_GHCB, &m);
34
}
35
36
#else
37
38
static inline void snp_accept_memory(phys_addr_t start, phys_addr_t end) { }
39
static inline u64 sev_get_status(void) { return 0; }
40
static inline bool early_is_sevsnp_guest(void) { return false; }
41
42
#endif
43
44
#endif
45
46