x86/sev: Get the AP jump table address from secrets page
authorBrijesh Singh <brijesh.singh@amd.com>
Fri, 22 Apr 2022 13:56:24 +0000 (08:56 -0500)
committerBorislav Petkov <bp@suse.de>
Wed, 27 Apr 2022 11:31:38 +0000 (13:31 +0200)
commitc2106a231c2ba36ff9af50cdf2867b9a5f8150a6
tree9b1e88b57fa942f2f31375b44d321fb140d42e8b
parent75d359ec4141b013727022a663762931f69e6510
x86/sev: Get the AP jump table address from secrets page

The GHCB specification section 2.7 states that when SEV-SNP is enabled,
a guest should not rely on the hypervisor to provide the address of the
AP jump table. Instead, if a guest BIOS wants to provide an AP jump
table, it should record the address in the SNP secrets page so the guest
operating system can obtain it directly from there.

Fix this on the guest kernel side by having SNP guests use the AP jump
table address published in the secrets page rather than issuing a GHCB
request to get it.

  [ mroth:
    - Improve error handling when ioremap()/memremap() return NULL
    - Don't mix function calls with declarations
    - Add missing __init
    - Tweak commit message ]

Fixes: 0afb6b660a6b ("x86/sev: Use SEV-SNP AP creation to start secondary CPUs")
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220422135624.114172-3-michael.roth@amd.com
arch/x86/include/asm/sev.h
arch/x86/kernel/sev.c
drivers/virt/coco/sev-guest/sev-guest.h