mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
x86/sev: Use boot SVSM CA for all startup and init code
To avoid having to reason about whether or not to use the per-CPU SVSM calling area when running startup and init code on the boot CPU, reuse the boot SVSM calling area as the per-CPU area for the BSP. Thus, remove the need to make the per-CPU variables and associated state in sev_cfg accessible to the startup code once confined. [ bp: Massage commit message. ] Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250828102202.1849035-33-ardb+git@google.com
This commit is contained in:
committed by
Borislav Petkov (AMD)
parent
00d2556676
commit
c54604fb7f
@@ -37,19 +37,6 @@ struct ghcb *boot_ghcb;
|
||||
|
||||
#define __BOOT_COMPRESSED
|
||||
|
||||
extern u64 boot_svsm_caa_pa;
|
||||
|
||||
struct svsm_ca *svsm_get_caa(void)
|
||||
{
|
||||
/* The decompressor is mapped 1:1 so VA == PA */
|
||||
return (struct svsm_ca *)boot_svsm_caa_pa;
|
||||
}
|
||||
|
||||
u64 svsm_get_caa_pa(void)
|
||||
{
|
||||
return boot_svsm_caa_pa;
|
||||
}
|
||||
|
||||
u8 snp_vmpl;
|
||||
|
||||
/* Include code for early handlers */
|
||||
|
||||
@@ -50,9 +50,6 @@ u64 sev_secrets_pa __ro_after_init;
|
||||
/* For early boot SVSM communication */
|
||||
struct svsm_ca boot_svsm_ca_page __aligned(PAGE_SIZE);
|
||||
|
||||
DEFINE_PER_CPU(struct svsm_ca *, svsm_caa);
|
||||
DEFINE_PER_CPU(u64, svsm_caa_pa);
|
||||
|
||||
/*
|
||||
* Nothing shall interrupt this code path while holding the per-CPU
|
||||
* GHCB. The backup GHCB is only for NMIs interrupting this path.
|
||||
@@ -153,7 +150,9 @@ void __head early_snp_set_memory_private(unsigned long vaddr, unsigned long padd
|
||||
unsigned long npages)
|
||||
{
|
||||
struct psc_desc d = {
|
||||
SNP_PAGE_STATE_PRIVATE, svsm_get_caa(), svsm_get_caa_pa()
|
||||
SNP_PAGE_STATE_PRIVATE,
|
||||
rip_rel_ptr(&boot_svsm_ca_page),
|
||||
boot_svsm_caa_pa
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -176,7 +175,9 @@ void __head early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr
|
||||
unsigned long npages)
|
||||
{
|
||||
struct psc_desc d = {
|
||||
SNP_PAGE_STATE_SHARED, svsm_get_caa(), svsm_get_caa_pa()
|
||||
SNP_PAGE_STATE_SHARED,
|
||||
rip_rel_ptr(&boot_svsm_ca_page),
|
||||
boot_svsm_caa_pa
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user