aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/sev-common.h
diff options
context:
space:
mode:
authorGravatar Brijesh Singh <brijesh.singh@amd.com> 2022-02-09 12:10:10 -0600
committerGravatar Borislav Petkov <bp@suse.de> 2022-04-06 13:14:24 +0200
commit87294bdb7b4b73555b0fba45da1cdecdc6a0d5a8 (patch)
tree1a9da8387cd9b30e1ac28ca1992f45659e6d467b /arch/x86/include/asm/sev-common.h
parentx86/compressed: Add helper for validating pages in the decompression stage (diff)
downloadlinux-87294bdb7b4b73555b0fba45da1cdecdc6a0d5a8.tar.gz
linux-87294bdb7b4b73555b0fba45da1cdecdc6a0d5a8.tar.bz2
linux-87294bdb7b4b73555b0fba45da1cdecdc6a0d5a8.zip
x86/compressed: Register GHCB memory when SEV-SNP is active
The SEV-SNP guest is required by the GHCB spec to register the GHCB's Guest Physical Address (GPA). This is because the hypervisor may prefer that a guest use a consistent and/or specific GPA for the GHCB associated with a vCPU. For more information, see the GHCB specification section "GHCB GPA Registration". If hypervisor can not work with the guest provided GPA then terminate the guest boot. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Venu Busireddy <venu.busireddy@oracle.com> Link: https://lore.kernel.org/r/20220307213356.2797205-17-brijesh.singh@amd.com
Diffstat (limited to 'arch/x86/include/asm/sev-common.h')
-rw-r--r--arch/x86/include/asm/sev-common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h
index fe7fe16e5fd5..f077a6c95e67 100644
--- a/arch/x86/include/asm/sev-common.h
+++ b/arch/x86/include/asm/sev-common.h
@@ -57,6 +57,19 @@
#define GHCB_MSR_AP_RESET_HOLD_REQ 0x006
#define GHCB_MSR_AP_RESET_HOLD_RESP 0x007
+/* 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)
+
/*
* SNP Page State Change Operation
*