1 /* 2 * AMD SEV support in kvm-unit-tests 3 * 4 * Copyright (c) 2021, Google Inc 5 * 6 * Authors: 7 * Zixuan Wang <zixuanwang@google.com> 8 * 9 * SPDX-License-Identifier: LGPL-2.0-or-later 10 */ 11 12 #ifndef _X86_AMD_SEV_H_ 13 #define _X86_AMD_SEV_H_ 14 15 #ifdef CONFIG_EFI 16 17 #include "libcflat.h" 18 #include "desc.h" 19 #include "asm/page.h" 20 #include "efi.h" 21 22 /* 23 * AMD Programmer's Manual Volume 2 24 * - Section "SEV_STATUS MSR" 25 */ 26 #define MSR_SEV_STATUS 0xc0010131 27 #define SEV_ENABLED_MASK 0b1 28 #define SEV_ES_ENABLED_MASK 0b10 29 30 bool amd_sev_enabled(void); 31 efi_status_t setup_amd_sev(void); 32 33 /* 34 * AMD Programmer's Manual Volume 2 35 * - Section "GHCB" 36 */ 37 #define SEV_ES_GHCB_MSR_INDEX 0xc0010130 38 39 bool amd_sev_es_enabled(void); 40 efi_status_t setup_amd_sev_es(void); 41 void setup_ghcb_pte(pgd_t *page_table); 42 43 unsigned long long get_amd_sev_c_bit_mask(void); 44 unsigned long long get_amd_sev_addr_upperbound(void); 45 46 #endif /* CONFIG_EFI */ 47 48 #endif /* _X86_AMD_SEV_H_ */ 49