lkml.org 
[lkml]   [2021]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 16/45] x86/sev: Register GHCB memory when SEV-SNP is active
On Wed, Nov 10, 2021 at 04:07:02PM -0600, Brijesh Singh wrote:
> 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,

That is not true anymore - you're doing proper init at init time - no
more #VC hackery.

> @@ -1977,6 +1978,10 @@ void cpu_init_exception_handling(void)
>
> load_TR_desc();
>
> + /* Register the GHCB before taking any VC exception */
> + if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT))

No need for that if branch - sev_snp_register_ghcb() already has an
empty stub for the !CONFIG_AMD_MEM_ENCRYPT case so you can simply call
it unconditionally.

> + sev_snp_register_ghcb();
> +
> /* Finally load the IDT */
> load_current_idt();
> }
> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
> index 54bf0603002f..968105cec364 100644
> --- a/arch/x86/kernel/head64.c
> +++ b/arch/x86/kernel/head64.c
> @@ -588,6 +588,9 @@ void early_setup_idt(void)
>
> bringup_idt_descr.address = (unsigned long)bringup_idt_table;
> native_load_idt(&bringup_idt_descr);
> +
> + if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT))
> + sev_snp_register_ghcb();

Ditto.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2021-12-08 18:43    [W:0.375 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site