2021-04-27 06:16:35 -05:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* AMD SEV header common between the guest and the hypervisor.
|
|
|
|
*
|
|
|
|
* Author: Brijesh Singh <brijesh.singh@amd.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_X86_SEV_COMMON_H
|
|
|
|
#define __ASM_X86_SEV_COMMON_H
|
|
|
|
|
|
|
|
#define GHCB_MSR_INFO_POS 0
|
2021-06-23 08:40:00 +02:00
|
|
|
#define GHCB_DATA_LOW 12
|
|
|
|
#define GHCB_MSR_INFO_MASK (BIT_ULL(GHCB_DATA_LOW) - 1)
|
2021-04-27 06:16:35 -05:00
|
|
|
|
2021-06-23 08:40:00 +02:00
|
|
|
#define GHCB_DATA(v) \
|
|
|
|
(((unsigned long)(v) & ~GHCB_MSR_INFO_MASK) >> GHCB_DATA_LOW)
|
|
|
|
|
|
|
|
/* SEV Information Request/Response */
|
2021-04-27 06:16:35 -05:00
|
|
|
#define GHCB_MSR_SEV_INFO_RESP 0x001
|
|
|
|
#define GHCB_MSR_SEV_INFO_REQ 0x002
|
2021-11-10 16:06:51 -06:00
|
|
|
|
|
|
|
#define GHCB_MSR_SEV_INFO(_max, _min, _cbit) \
|
|
|
|
/* GHCBData[63:48] */ \
|
|
|
|
((((_max) & 0xffff) << 48) | \
|
|
|
|
/* GHCBData[47:32] */ \
|
|
|
|
(((_min) & 0xffff) << 32) | \
|
|
|
|
/* GHCBData[31:24] */ \
|
|
|
|
(((_cbit) & 0xff) << 24) | \
|
2021-04-27 06:16:35 -05:00
|
|
|
GHCB_MSR_SEV_INFO_RESP)
|
2021-11-10 16:06:51 -06:00
|
|
|
|
2021-04-27 06:16:35 -05:00
|
|
|
#define GHCB_MSR_INFO(v) ((v) & 0xfffUL)
|
2021-11-10 16:06:51 -06:00
|
|
|
#define GHCB_MSR_PROTO_MAX(v) (((v) >> 48) & 0xffff)
|
|
|
|
#define GHCB_MSR_PROTO_MIN(v) (((v) >> 32) & 0xffff)
|
2021-04-27 06:16:35 -05:00
|
|
|
|
2021-06-23 08:40:00 +02:00
|
|
|
/* CPUID Request/Response */
|
2021-04-27 06:16:35 -05:00
|
|
|
#define GHCB_MSR_CPUID_REQ 0x004
|
|
|
|
#define GHCB_MSR_CPUID_RESP 0x005
|
|
|
|
#define GHCB_MSR_CPUID_FUNC_POS 32
|
|
|
|
#define GHCB_MSR_CPUID_FUNC_MASK 0xffffffff
|
|
|
|
#define GHCB_MSR_CPUID_VALUE_POS 32
|
|
|
|
#define GHCB_MSR_CPUID_VALUE_MASK 0xffffffff
|
|
|
|
#define GHCB_MSR_CPUID_REG_POS 30
|
|
|
|
#define GHCB_MSR_CPUID_REG_MASK 0x3
|
|
|
|
#define GHCB_CPUID_REQ_EAX 0
|
|
|
|
#define GHCB_CPUID_REQ_EBX 1
|
|
|
|
#define GHCB_CPUID_REQ_ECX 2
|
|
|
|
#define GHCB_CPUID_REQ_EDX 3
|
2021-11-10 16:06:51 -06:00
|
|
|
#define GHCB_CPUID_REQ(fn, reg) \
|
|
|
|
/* GHCBData[11:0] */ \
|
|
|
|
(GHCB_MSR_CPUID_REQ | \
|
|
|
|
/* GHCBData[31:12] */ \
|
|
|
|
(((unsigned long)(reg) & 0x3) << 30) | \
|
|
|
|
/* GHCBData[63:32] */ \
|
|
|
|
(((unsigned long)fn) << 32))
|
2021-04-27 06:16:35 -05:00
|
|
|
|
2021-06-23 08:40:00 +02:00
|
|
|
/* AP Reset Hold */
|
2024-05-01 02:10:45 -05:00
|
|
|
#define GHCB_MSR_AP_RESET_HOLD_REQ 0x006
|
|
|
|
#define GHCB_MSR_AP_RESET_HOLD_RESP 0x007
|
|
|
|
#define GHCB_MSR_AP_RESET_HOLD_RESULT_POS 12
|
|
|
|
#define GHCB_MSR_AP_RESET_HOLD_RESULT_MASK GENMASK_ULL(51, 0)
|
2021-06-23 08:40:00 +02:00
|
|
|
|
2024-05-01 03:51:58 -05:00
|
|
|
/* Preferred GHCB GPA Request */
|
|
|
|
#define GHCB_MSR_PREF_GPA_REQ 0x010
|
|
|
|
#define GHCB_MSR_GPA_VALUE_POS 12
|
|
|
|
#define GHCB_MSR_GPA_VALUE_MASK GENMASK_ULL(51, 0)
|
|
|
|
|
|
|
|
#define GHCB_MSR_PREF_GPA_RESP 0x011
|
|
|
|
#define GHCB_MSR_PREF_GPA_NONE 0xfffffffffffff
|
|
|
|
|
2022-02-09 12:10:10 -06:00
|
|
|
/* GHCB GPA Register */
|
|
|
|
#define GHCB_MSR_REG_GPA_REQ 0x012
|
|
|
|
#define GHCB_MSR_REG_GPA_REQ_VAL(v) \
|
|
|
|
/* GHCBData[63:12] */ \
|
|
|
|
(((u64)((v) & GENMASK_ULL(51, 0)) << 12) | \
|
|
|
|
/* GHCBData[11:0] */ \
|
|
|
|
GHCB_MSR_REG_GPA_REQ)
|
|
|
|
|
|
|
|
#define GHCB_MSR_REG_GPA_RESP 0x013
|
|
|
|
#define GHCB_MSR_REG_GPA_RESP_VAL(v) \
|
|
|
|
/* GHCBData[63:12] */ \
|
|
|
|
(((u64)(v) & GENMASK_ULL(63, 12)) >> 12)
|
|
|
|
|
2022-02-09 12:10:09 -06:00
|
|
|
/*
|
|
|
|
* SNP Page State Change Operation
|
|
|
|
*
|
|
|
|
* GHCBData[55:52] - Page operation:
|
|
|
|
* 0x0001 Page assignment, Private
|
|
|
|
* 0x0002 Page assignment, Shared
|
|
|
|
*/
|
|
|
|
enum psc_op {
|
|
|
|
SNP_PAGE_STATE_PRIVATE = 1,
|
|
|
|
SNP_PAGE_STATE_SHARED,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GHCB_MSR_PSC_REQ 0x014
|
|
|
|
#define GHCB_MSR_PSC_REQ_GFN(gfn, op) \
|
|
|
|
/* GHCBData[55:52] */ \
|
|
|
|
(((u64)((op) & 0xf) << 52) | \
|
|
|
|
/* GHCBData[51:12] */ \
|
|
|
|
((u64)((gfn) & GENMASK_ULL(39, 0)) << 12) | \
|
|
|
|
/* GHCBData[11:0] */ \
|
|
|
|
GHCB_MSR_PSC_REQ)
|
|
|
|
|
2024-05-01 03:51:59 -05:00
|
|
|
#define GHCB_MSR_PSC_REQ_TO_GFN(msr) (((msr) & GENMASK_ULL(51, 12)) >> 12)
|
|
|
|
#define GHCB_MSR_PSC_REQ_TO_OP(msr) (((msr) & GENMASK_ULL(55, 52)) >> 52)
|
|
|
|
|
2022-02-09 12:10:09 -06:00
|
|
|
#define GHCB_MSR_PSC_RESP 0x015
|
|
|
|
#define GHCB_MSR_PSC_RESP_VAL(val) \
|
|
|
|
/* GHCBData[63:32] */ \
|
|
|
|
(((u64)(val) & GENMASK_ULL(63, 32)) >> 32)
|
|
|
|
|
2024-05-01 03:51:59 -05:00
|
|
|
/* Set highest bit as a generic error response */
|
|
|
|
#define GHCB_MSR_PSC_RESP_ERROR (BIT_ULL(63) | GHCB_MSR_PSC_RESP)
|
|
|
|
|
2024-06-05 10:18:46 -05:00
|
|
|
/* GHCB Run at VMPL Request/Response */
|
|
|
|
#define GHCB_MSR_VMPL_REQ 0x016
|
|
|
|
#define GHCB_MSR_VMPL_REQ_LEVEL(v) \
|
|
|
|
/* GHCBData[39:32] */ \
|
2025-05-11 18:23:28 +09:00
|
|
|
((((u64)(v) & GENMASK_ULL(7, 0)) << 32) | \
|
2024-06-05 10:18:46 -05:00
|
|
|
/* GHCBDdata[11:0] */ \
|
|
|
|
GHCB_MSR_VMPL_REQ)
|
|
|
|
|
|
|
|
#define GHCB_MSR_VMPL_RESP 0x017
|
|
|
|
#define GHCB_MSR_VMPL_RESP_VAL(v) \
|
|
|
|
/* GHCBData[63:32] */ \
|
|
|
|
(((u64)(v) & GENMASK_ULL(63, 32)) >> 32)
|
|
|
|
|
2021-06-23 08:40:00 +02:00
|
|
|
/* GHCB Hypervisor Feature Request/Response */
|
2021-11-10 16:06:51 -06:00
|
|
|
#define GHCB_MSR_HV_FT_REQ 0x080
|
|
|
|
#define GHCB_MSR_HV_FT_RESP 0x081
|
2024-05-01 02:10:46 -05:00
|
|
|
#define GHCB_MSR_HV_FT_POS 12
|
|
|
|
#define GHCB_MSR_HV_FT_MASK GENMASK_ULL(51, 0)
|
2022-02-09 12:10:06 -06:00
|
|
|
#define GHCB_MSR_HV_FT_RESP_VAL(v) \
|
|
|
|
/* GHCBData[63:12] */ \
|
|
|
|
(((u64)(v) & GENMASK_ULL(63, 12)) >> 12)
|
|
|
|
|
|
|
|
#define GHCB_HV_FT_SNP BIT_ULL(0)
|
2022-03-07 15:33:32 -06:00
|
|
|
#define GHCB_HV_FT_SNP_AP_CREATION BIT_ULL(1)
|
2024-06-05 10:18:56 -05:00
|
|
|
#define GHCB_HV_FT_SNP_MULTI_VMPL BIT_ULL(5)
|
2021-06-23 08:40:00 +02:00
|
|
|
|
2023-06-06 09:51:23 -05:00
|
|
|
/*
|
|
|
|
* SNP Page State Change NAE event
|
|
|
|
* The VMGEXIT_PSC_MAX_ENTRY determines the size of the PSC structure, which
|
|
|
|
* is a local stack variable in set_pages_state(). Do not increase this value
|
|
|
|
* without evaluating the impact to stack usage.
|
2024-05-01 03:52:00 -05:00
|
|
|
*
|
|
|
|
* Use VMGEXIT_PSC_MAX_COUNT in cases where the actual GHCB-defined max value
|
|
|
|
* is needed, such as when processing GHCB requests on the hypervisor side.
|
2023-06-06 09:51:23 -05:00
|
|
|
*/
|
|
|
|
#define VMGEXIT_PSC_MAX_ENTRY 64
|
2024-05-01 03:52:00 -05:00
|
|
|
#define VMGEXIT_PSC_MAX_COUNT 253
|
|
|
|
|
|
|
|
#define VMGEXIT_PSC_ERROR_GENERIC (0x100UL << 32)
|
|
|
|
#define VMGEXIT_PSC_ERROR_INVALID_HDR ((1UL << 32) | 1)
|
|
|
|
#define VMGEXIT_PSC_ERROR_INVALID_ENTRY ((1UL << 32) | 2)
|
|
|
|
|
|
|
|
#define VMGEXIT_PSC_OP_PRIVATE 1
|
|
|
|
#define VMGEXIT_PSC_OP_SHARED 2
|
2022-02-24 10:56:01 -06:00
|
|
|
|
|
|
|
struct psc_hdr {
|
|
|
|
u16 cur_entry;
|
|
|
|
u16 end_entry;
|
|
|
|
u32 reserved;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct psc_entry {
|
|
|
|
u64 cur_page : 12,
|
|
|
|
gfn : 40,
|
|
|
|
operation : 4,
|
|
|
|
pagesize : 1,
|
|
|
|
reserved : 7;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct snp_psc_desc {
|
|
|
|
struct psc_hdr hdr;
|
|
|
|
struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY];
|
|
|
|
} __packed;
|
|
|
|
|
2021-04-27 06:16:35 -05:00
|
|
|
#define GHCB_MSR_TERM_REQ 0x100
|
|
|
|
#define GHCB_MSR_TERM_REASON_SET_POS 12
|
|
|
|
#define GHCB_MSR_TERM_REASON_SET_MASK 0xf
|
|
|
|
#define GHCB_MSR_TERM_REASON_POS 16
|
|
|
|
#define GHCB_MSR_TERM_REASON_MASK 0xff
|
|
|
|
|
2021-11-10 16:06:51 -06:00
|
|
|
#define GHCB_SEV_TERM_REASON(reason_set, reason_val) \
|
|
|
|
/* GHCBData[15:12] */ \
|
|
|
|
(((((u64)reason_set) & 0xf) << 12) | \
|
|
|
|
/* GHCBData[23:16] */ \
|
|
|
|
((((u64)reason_val) & 0xff) << 16))
|
2021-04-27 06:16:35 -05:00
|
|
|
|
2022-02-09 12:10:04 -06:00
|
|
|
/* Error codes from reason set 0 */
|
|
|
|
#define SEV_TERM_SET_GEN 0
|
2021-11-10 16:06:50 -06:00
|
|
|
#define GHCB_SEV_ES_GEN_REQ 0
|
|
|
|
#define GHCB_SEV_ES_PROT_UNSUPPORTED 1
|
2022-02-09 12:10:06 -06:00
|
|
|
#define GHCB_SNP_UNSUPPORTED 2
|
2021-04-27 06:16:35 -05:00
|
|
|
|
2022-02-09 12:10:04 -06:00
|
|
|
/* Linux-specific reason codes (used with reason set 1) */
|
|
|
|
#define SEV_TERM_SET_LINUX 1
|
|
|
|
#define GHCB_TERM_REGISTER 0 /* GHCB GPA registration failure */
|
|
|
|
#define GHCB_TERM_PSC 1 /* Page State Change failure */
|
|
|
|
#define GHCB_TERM_PVALIDATE 2 /* Pvalidate failure */
|
2022-02-09 12:10:08 -06:00
|
|
|
#define GHCB_TERM_NOT_VMPL0 3 /* SNP guest is not running at VMPL-0 */
|
2022-02-24 10:56:12 -06:00
|
|
|
#define GHCB_TERM_CPUID 4 /* CPUID-validation failure */
|
|
|
|
#define GHCB_TERM_CPUID_HV 5 /* CPUID failure during hypervisor fallback */
|
2024-06-05 10:18:45 -05:00
|
|
|
#define GHCB_TERM_SECRETS_PAGE 6 /* Secrets page failure */
|
|
|
|
#define GHCB_TERM_NO_SVSM 7 /* SVSM is not advertised in the secrets page */
|
|
|
|
#define GHCB_TERM_SVSM_VMPL0 8 /* SVSM is present but has set VMPL to 0 */
|
|
|
|
#define GHCB_TERM_SVSM_CAA 9 /* SVSM is present but CAA is not page aligned */
|
2025-01-06 18:16:25 +05:30
|
|
|
#define GHCB_TERM_SECURE_TSC 10 /* Secure TSC initialization failed */
|
x86/boot changes for v6.14:
- A large and involved preparatory series to pave the way to add exception
handling for relocate_kernel - which will be a debugging facility that
has aided in the field to debug an exceptionally hard to debug early boot bug.
Plus assorted cleanups and fixes that were discovered along the way,
by David Woodhouse:
- Clean up and document register use in relocate_kernel_64.S
- Use named labels in swap_pages in relocate_kernel_64.S
- Only swap pages for ::preserve_context mode
- Allocate PGD for x86_64 transition page tables separately
- Copy control page into place in machine_kexec_prepare()
- Invoke copy of relocate_kernel() instead of the original
- Move relocate_kernel to kernel .data section
- Add data section to relocate_kernel
- Drop page_list argument from relocate_kernel()
- Eliminate writes through kernel mapping of relocate_kernel page
- Clean up register usage in relocate_kernel()
- Mark relocate_kernel page as ROX instead of RWX
- Disable global pages before writing to control page
- Ensure preserve_context flag is set on return to kernel
- Use correct swap page in swap_pages function
- Fix stack and handling of re-entry point for ::preserve_context
- Mark machine_kexec() with __nocfi
- Cope with relocate_kernel() not being at the start of the page
- Use typedef for relocate_kernel_fn function prototype
- Fix location of relocate_kernel with -ffunction-sections (fix by Nathan Chancellor)
- A series to remove the last remaining absolute symbol references from
.head.text, and enforce this at build time, by Ard Biesheuvel:
- Avoid WARN()s and panic()s in early boot code
- Don't hang but terminate on failure to remap SVSM CA
- Determine VA/PA offset before entering C code
- Avoid intentional absolute symbol references in .head.text
- Disable UBSAN in early boot code
- Move ENTRY_TEXT to the start of the image
- Move .head.text into its own output section
- Reject absolute references in .head.text
- Which build-time enforcement uncovered a handful of bugs of essentially
non-working code, and a wrokaround for a toolchain bug, fixed by
Ard Biesheuvel as well:
- Fix spurious undefined reference when CONFIG_X86_5LEVEL=n, on GCC-12
- Disable UBSAN on SEV code that may execute very early
- Disable ftrace branch profiling in SEV startup code
- And miscellaneous cleanups:
- kexec_core: Add and update comments regarding the KEXEC_JUMP flow (Rafael J. Wysocki)
- x86/sysfs: Constify 'struct bin_attribute' (Thomas Weißschuh)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmeQDmURHG1pbmdvQGtl
cm5lbC5vcmcACgkQEnMQ0APhK1inwRAAjD5QR/Yu7Yiv2nM/ncUwAItsFkv9Jk4Y
HPGz9qNJoZxKxuZVj9bfQhWDe3g6VLnlDYgatht9BsyP5b12qZrUe+yp/TOH54Z3
wPD+U/jun4jiSr7oJkJC+bFn+a/tL39pB8Y6m+jblacgVglleO3SH5fBWNE1UbIV
e2iiNxi0bfuHy3wquegnKaMyF1e7YLw1p5laGSwwk21g5FjT7cLQOqC0/9u8u9xX
Ha+iaod7JOcjiQOqIt/MV57ldWEFCrUhQozRV3tK5Ptf5aoGFpisgQoRoduWUtFz
UbHiHhv6zE4DOIUzaAbJjYfR1Z/LCviwON97XJgeOOkJaULF7yFCfhGxKSyQoMIh
qZtlBs4VsGl2/dOl+iW6xKwgRiNundTzSQtt5D/xuFz5LnDxe/SrlZnYp8lOPP8R
w9V2b/fC0YxmUzEW6EDhBqvfuScKiNWoic47qvYfZPaWyg1ESpvWTIh6AKB5ThUR
upgJQdA4HW+y5C57uHW40TSe3xEeqM3+Slk0jxLElP7/yTul5r7jrjq2EkwaAv/j
6/0LsMSr33r9fVFeMP1qLXPUaipcqTWWTpeeTr8NBGUcvOKzw5SltEG4NihzCyhF
3/UMQhcQ6KE3iFMPlRu4hV7ZV4gErZmLoRwh9Uk28f2Xx8T95uoV8KTg1/sRZRTo
uQLeRxYnyrw=
=vGWS
-----END PGP SIGNATURE-----
Merge tag 'x86-boot-2025-01-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot updates from Ingo Molnar:
- A large and involved preparatory series to pave the way to add
exception handling for relocate_kernel - which will be a debugging
facility that has aided in the field to debug an exceptionally hard
to debug early boot bug. Plus assorted cleanups and fixes that were
discovered along the way, by David Woodhouse:
- Clean up and document register use in relocate_kernel_64.S
- Use named labels in swap_pages in relocate_kernel_64.S
- Only swap pages for ::preserve_context mode
- Allocate PGD for x86_64 transition page tables separately
- Copy control page into place in machine_kexec_prepare()
- Invoke copy of relocate_kernel() instead of the original
- Move relocate_kernel to kernel .data section
- Add data section to relocate_kernel
- Drop page_list argument from relocate_kernel()
- Eliminate writes through kernel mapping of relocate_kernel page
- Clean up register usage in relocate_kernel()
- Mark relocate_kernel page as ROX instead of RWX
- Disable global pages before writing to control page
- Ensure preserve_context flag is set on return to kernel
- Use correct swap page in swap_pages function
- Fix stack and handling of re-entry point for ::preserve_context
- Mark machine_kexec() with __nocfi
- Cope with relocate_kernel() not being at the start of the page
- Use typedef for relocate_kernel_fn function prototype
- Fix location of relocate_kernel with -ffunction-sections (fix by Nathan Chancellor)
- A series to remove the last remaining absolute symbol references from
.head.text, and enforce this at build time, by Ard Biesheuvel:
- Avoid WARN()s and panic()s in early boot code
- Don't hang but terminate on failure to remap SVSM CA
- Determine VA/PA offset before entering C code
- Avoid intentional absolute symbol references in .head.text
- Disable UBSAN in early boot code
- Move ENTRY_TEXT to the start of the image
- Move .head.text into its own output section
- Reject absolute references in .head.text
- The above build-time enforcement uncovered a handful of bugs of
essentially non-working code, and a wrokaround for a toolchain bug,
fixed by Ard Biesheuvel as well:
- Fix spurious undefined reference when CONFIG_X86_5LEVEL=n, on GCC-12
- Disable UBSAN on SEV code that may execute very early
- Disable ftrace branch profiling in SEV startup code
- And miscellaneous cleanups:
- kexec_core: Add and update comments regarding the KEXEC_JUMP flow (Rafael J. Wysocki)
- x86/sysfs: Constify 'struct bin_attribute' (Thomas Weißschuh)"
* tag 'x86-boot-2025-01-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
x86/sev: Disable ftrace branch profiling in SEV startup code
x86/kexec: Use typedef for relocate_kernel_fn function prototype
x86/kexec: Cope with relocate_kernel() not being at the start of the page
kexec_core: Add and update comments regarding the KEXEC_JUMP flow
x86/kexec: Mark machine_kexec() with __nocfi
x86/kexec: Fix location of relocate_kernel with -ffunction-sections
x86/kexec: Fix stack and handling of re-entry point for ::preserve_context
x86/kexec: Use correct swap page in swap_pages function
x86/kexec: Ensure preserve_context flag is set on return to kernel
x86/kexec: Disable global pages before writing to control page
x86/sev: Don't hang but terminate on failure to remap SVSM CA
x86/sev: Disable UBSAN on SEV code that may execute very early
x86/boot/64: Fix spurious undefined reference when CONFIG_X86_5LEVEL=n, on GCC-12
x86/sysfs: Constify 'struct bin_attribute'
x86/kexec: Mark relocate_kernel page as ROX instead of RWX
x86/kexec: Clean up register usage in relocate_kernel()
x86/kexec: Eliminate writes through kernel mapping of relocate_kernel page
x86/kexec: Drop page_list argument from relocate_kernel()
x86/kexec: Add data section to relocate_kernel
x86/kexec: Move relocate_kernel to kernel .data section
...
2025-01-24 05:54:26 -08:00
|
|
|
#define GHCB_TERM_SVSM_CA_REMAP_FAIL 11 /* SVSM is present but CA could not be remapped */
|
2022-02-09 12:10:04 -06:00
|
|
|
|
2021-04-27 06:16:35 -05:00
|
|
|
#define GHCB_RESP_CODE(v) ((v) & GHCB_MSR_INFO_MASK)
|
|
|
|
|
2021-12-02 12:52:05 -06:00
|
|
|
/*
|
2025-02-25 21:39:36 +00:00
|
|
|
* GHCB-defined return codes that are communicated back to the guest via
|
|
|
|
* SW_EXITINFO1.
|
|
|
|
*/
|
|
|
|
#define GHCB_HV_RESP_NO_ACTION 0
|
|
|
|
#define GHCB_HV_RESP_ISSUE_EXCEPTION 1
|
|
|
|
#define GHCB_HV_RESP_MALFORMED_INPUT 2
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GHCB-defined sub-error codes for malformed input (see above) that are
|
|
|
|
* communicated back to the guest via SW_EXITINFO2[31:0].
|
2021-12-02 12:52:05 -06:00
|
|
|
*/
|
|
|
|
#define GHCB_ERR_NOT_REGISTERED 1
|
|
|
|
#define GHCB_ERR_INVALID_USAGE 2
|
|
|
|
#define GHCB_ERR_INVALID_SCRATCH_AREA 3
|
|
|
|
#define GHCB_ERR_MISSING_INPUT 4
|
|
|
|
#define GHCB_ERR_INVALID_INPUT 5
|
|
|
|
#define GHCB_ERR_INVALID_EVENT 6
|
|
|
|
|
2024-10-14 08:09:47 -05:00
|
|
|
struct sev_config {
|
|
|
|
__u64 debug : 1,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Indicates when the per-CPU GHCB has been created and registered
|
|
|
|
* and thus can be used by the BSP instead of the early boot GHCB.
|
|
|
|
*
|
|
|
|
* For APs, the per-CPU GHCB is created before they are started
|
|
|
|
* and registered upon startup, so this flag can be used globally
|
|
|
|
* for the BSP and APs.
|
|
|
|
*/
|
|
|
|
ghcbs_initialized : 1,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Indicates when the per-CPU SVSM CA is to be used instead of the
|
|
|
|
* boot SVSM CA.
|
|
|
|
*
|
|
|
|
* For APs, the per-CPU SVSM CA is created as part of the AP
|
|
|
|
* bringup, so this flag can be used globally for the BSP and APs.
|
|
|
|
*/
|
|
|
|
use_cas : 1,
|
|
|
|
|
|
|
|
__reserved : 61;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct sev_config sev_cfg;
|
|
|
|
|
2021-04-27 06:16:35 -05:00
|
|
|
#endif
|