[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf878810-81ed-3017-52c6-ce6aa41b5f01@amd.com>
Date: Wed, 23 Apr 2025 10:22:31 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org
Cc: linux-efi@...r.kernel.org, x86@...nel.org, mingo@...nel.org,
Ard Biesheuvel <ardb@...nel.org>,
Dionna Amalie Glaze <dionnaglaze@...gle.com>,
Kevin Loughlin <kevinloughlin@...gle.com>
Subject: Re: [PATCH v5 3/6] x86/sev: Split off startup code from core code
On 4/18/25 09:12, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> Disentangle the SEV core code and the SEV code that is called during
> early boot. The latter piece will be moved into startup/ in a subsequent
> patch.
>
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
This patch breaks SNP guests. The SNP guest boots, but no longer has
access to the VMPCK keys needed to communicate with the ASP, which is
used, for example, to obtain an attestation report.
It looks like the secrets_pa is defined as static in both startup.c and
core.c. It is set by a function in startup.c and so when used in core.c
its value will be 0.
The following fixed the issue for me. Let me know if it can be squashed
in or a full patch is needed. Although, it likely should be named
sev_secrets_pa since it is no longer static.
Thanks,
Tom
diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 617988a5f3d7..a2c984b31fc4 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -80,9 +80,6 @@ static const char * const sev_status_feat_names[] = {
[MSR_AMD64_SNP_SMT_PROT_BIT] = "SMTProt",
};
-/* Secrets page physical address from the CC blob */
-static u64 secrets_pa __ro_after_init;
-
/*
* For Secure TSC guests, the BSP fetches TSC_INFO using SNP guest messaging and
* initializes snp_tsc_scale and snp_tsc_offset. These values are replicated
diff --git a/arch/x86/coco/sev/startup.c b/arch/x86/coco/sev/startup.c
index 9f5dc70cfb44..9fd5c28c6417 100644
--- a/arch/x86/coco/sev/startup.c
+++ b/arch/x86/coco/sev/startup.c
@@ -55,7 +55,7 @@ struct ghcb *boot_ghcb __section(".data");
u64 sev_hv_features __ro_after_init;
/* Secrets page physical address from the CC blob */
-static u64 secrets_pa __ro_after_init;
+u64 secrets_pa __ro_after_init;
/* For early boot SVSM communication */
struct svsm_ca boot_svsm_ca_page __aligned(PAGE_SIZE);
diff --git a/arch/x86/include/asm/sev-internal.h b/arch/x86/include/asm/sev-internal.h
index 73cb774c3639..45a7fc24e37f 100644
--- a/arch/x86/include/asm/sev-internal.h
+++ b/arch/x86/include/asm/sev-internal.h
@@ -5,6 +5,7 @@
extern struct ghcb boot_ghcb_page;
extern struct ghcb *boot_ghcb;
extern u64 sev_hv_features;
+extern u64 secrets_pa;
/* #VC handler runtime per-CPU data */
struct sev_es_runtime_data {
> ---
> arch/x86/boot/compressed/sev.c | 2 +
> arch/x86/coco/sev/Makefile | 12 +-
> arch/x86/coco/sev/core.c | 1563 ++++----------------
> arch/x86/coco/sev/shared.c | 281 ----
> arch/x86/coco/sev/startup.c | 1395 +++++++++++++++++
> 5 files changed, 1652 insertions(+), 1601 deletions(-)
>
Powered by blists - more mailing lists