Thread (123 messages) 123 messages, 8 authors, 2021-09-15

Re: [PATCH Part1 v5 13/38] x86/sev: Register GHCB memory when SEV-SNP is active

From: Brijesh Singh <hidden>
Date: 2021-08-23 18:56:15
Also in: kvm, linux-coco, linux-mm, lkml, platform-driver-x86


On 8/23/21 12:35 PM, Borislav Petkov wrote:
On Fri, Aug 20, 2021 at 10:19:08AM -0500, Brijesh Singh wrote:
quoted
The SEV-SNP guest is required to perform GHCB GPA registration. 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.

During the boot, init_ghcb() allocates a per-cpu GHCB page. On very first
VC exception, the exception handler switch to using the per-cpu GHCB page
allocated during the init_ghcb(). The GHCB page must be registered in
the current vcpu context.

Signed-off-by: Brijesh Singh <redacted>
---
  arch/x86/kernel/sev-internal.h | 12 ++++++++++++
  arch/x86/kernel/sev.c          | 28 ++++++++++++++++++++++++++++
  2 files changed, 40 insertions(+)
  create mode 100644 arch/x86/kernel/sev-internal.h
diff --git a/arch/x86/kernel/sev-internal.h b/arch/x86/kernel/sev-internal.h
new file mode 100644
index 000000000000..0fb7324803b4
--- /dev/null
+++ b/arch/x86/kernel/sev-internal.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Forward declarations for sev-shared.c
+ *
+ * Author: Brijesh Singh <brijesh.singh@amd.com>
+ */
+
+#ifndef __X86_SEV_INTERNAL_H__
+
+static void snp_register_ghcb_early(unsigned long paddr);
+
+#endif	/* __X86_SEV_INTERNAL_H__ */
I believe you don't need that header if you move __sev_get_ghcb()
and snp_register_ghcb() under the #include "sev-shared.c" so that
snp_register_ghcb_early() is visible by then.
thanks, I will merge this in next version.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help