Re: [PATCH v7 16/45] x86/sev: Register GHCB memory when SEV-SNP is active

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux