From: Tom Lendacky <thomas.lendacky@amd.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Dionna Amalie Glaze <dionnaglaze@google.com>,
Ard Biesheuvel <ardb+git@google.com>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
x86@kernel.org, Borislav Petkov <bp@alien8.de>,
Kevin Loughlin <kevinloughlin@google.com>
Subject: Re: [PATCH v2 3/3] x86/boot: Implement early memory acceptance for SEV-SNP
Date: Tue, 8 Apr 2025 10:53:36 -0500 [thread overview]
Message-ID: <a53b3a3f-9fa1-4939-7885-1c06fe31af23@amd.com> (raw)
In-Reply-To: <CAMj1kXERL=8Y51RUJSqgLWVMs4PJa9aQK0puvKaCpg6eRu0t8g@mail.gmail.com>
On 4/7/25 14:59, Ard Biesheuvel wrote:
> On Mon, 7 Apr 2025 at 20:05, Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>
>> On 4/7/25 04:25, Kirill A. Shutemov wrote:
>>> On Fri, Apr 04, 2025 at 08:07:03AM -0700, Dionna Amalie Glaze wrote:
>>>> If the GHCB is available, we should always prefer it.
>>>
>>> I believe we should consider the cost of code duplication in this
>>> situation.
>>>
>>> If the non-early version is only used in the kexec path, it will not be
>>> tested as frequently and could be more easily broken. I think it would be
>>> acceptable for kexec to be slightly slower if it results in more
>>> maintainable code.
>>>
>>
>> Is accept_memory() in the decompressor or efistub only used in the kexec
>> path?
>>
>
> The EFI stub does not call accept_memory(), only the decompressor
> does. The only use case for explicit memory acceptance in the EFI stub
Since EFI stub never uses accept_memory() I looked at moving enablement
of SEV to be before the setup of the accepted memory bitmap, as SEV
enablement doesn't need any e820 info. But that didn't work because the
real issue is early_setup_ghcb() calls set_page_decrypted() which calls
set_clr_page_flags(). The latter function is not meant to work with EFI
page tables, so there is an incompatibility.
If we had a way to check for whether we are coming through the EFI stub
vs the decompressor, then snp_accept_memory() could decide to skip
early_setup_ghcb() when called from the EFI stub and call either
__snp_accept_memory() from the decompressor or __page_state_change()
from the EFI stub (the latter having to be updated to return a value).
I think there are other areas that might need investigating because I
noticed that efi_warn() is successful before efi_exit_boot_services()
but blows up immediately after (possibly in the EFI #VC handler having
to do with addressing the string?).
Thanks,
Tom
> is process_unaccepted_memory(), which accepts the misaligned chunk of
> memory that cannot be described at 2M granularity by the accepted
> memory table.
>
> Remember that the EFI stub no longer calls into the legacy
> decompressor at all - it decompresses the kernel while executing the
> EFI boot services and branches straight to it.
next prev parent reply other threads:[~2025-04-08 15:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 8:29 [PATCH v2 0/3] efistub/x86: Fix early SEV-SNP memory acceptance Ard Biesheuvel
2025-04-04 8:29 ` [PATCH v2 1/3] x86/boot: Move accept_memory() into decompressor Ard Biesheuvel
2025-04-04 8:29 ` [PATCH v2 2/3] x86/boot: Use separate API for memory acceptance in the EFI stub Ard Biesheuvel
2025-04-04 8:29 ` [PATCH v2 3/3] x86/boot: Implement early memory acceptance for SEV-SNP Ard Biesheuvel
2025-04-04 8:43 ` Kirill A. Shutemov
2025-04-04 8:46 ` Ard Biesheuvel
2025-04-04 15:07 ` Dionna Amalie Glaze
2025-04-07 9:25 ` Kirill A. Shutemov
2025-04-07 16:44 ` Ingo Molnar
2025-04-07 17:21 ` Ard Biesheuvel
2025-04-07 17:33 ` Kirill A. Shutemov
2025-04-07 17:45 ` Ard Biesheuvel
2025-04-07 21:08 ` Kirill A. Shutemov
2025-04-07 18:05 ` Tom Lendacky
2025-04-07 19:59 ` Ard Biesheuvel
2025-04-08 15:53 ` Tom Lendacky [this message]
2025-04-10 13:28 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a53b3a3f-9fa1-4939-7885-1c06fe31af23@amd.com \
--to=thomas.lendacky@amd.com \
--cc=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dionnaglaze@google.com \
--cc=kevinloughlin@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®