mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Ard Biesheuvel <ardb+git@google.com>,
	linux-efi@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	Borislav Petkov <bp@alien8.de>,
	Dionna Amalie Glaze <dionnaglaze@google.com>,
	Kevin Loughlin <kevinloughlin@google.com>
Subject: Re: [RFC/RFT PATCH] x86/efistub: Don't bother enabling SEV in the EFI stub
Date: Mon, 14 Apr 2025 14:53:35 -0500	[thread overview]
Message-ID: <ba23ff1e-b9ba-3633-7712-0a73f38a0fe5@amd.com> (raw)
In-Reply-To: <CAMj1kXGOegcJhOOiyw_0A0Y1GW0K3LqBuhpn1TrVp4aKLGn=-w@mail.gmail.com>

On 4/14/25 14:45, Ard Biesheuvel wrote:
> Hi Tom,
> 
> Thanks for taking a look.
> 
> 
> On Mon, 14 Apr 2025 at 21:10, Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>
>> On 4/14/25 08:04, Ard Biesheuvel wrote:
>>> From: Ard Biesheuvel <ardb@kernel.org>
>>>
>>> One of the last things the EFI stub does before handing over to the core
>>> kernel when booting as a SEV guest is enabling SEV, even though this is
>>> mostly redundant: one of the first things the core kernel does is
>>> calling sme_enable(), after setting up the early GDT and IDT but before
>>> even setting up the kernel page tables.
>>>
>>> So let's just drop this call to sev_enable(), and rely on the core
>>> kernel to initiaize SEV correctly.
>>
>> SEV support does some things in sev_enable() that aren't done later in
>> the kernel proper. For example, we check certain hypervisor features and
>> save the CC blob into the boot parameters.
> 
> I misread the last part: the kernel proper checks struct boot_params
> and setup_data, whereas the decompressor checks both of those as well
> as the EFI config table.
> 
> It would make sense for the EFI stub to populate the field in struct
> boot_params directly.
> 
>> And as I look closer, I see
>> that we don't call initialize_identity_maps() from the EFI stub so we
>> aren't calling snp_check_features() from the EFI stub, which we should
>> have been doing.
>>
> 
> The EFI stub has its own check for this, based on the same underlying
> logic (have_unsupported_snp_features()). But it checks this much
> earlier so it can fail gracefully and return to the firmware, rather
> than terminate.

Ah, whew! I forgot we have a slightly different call for that in the EFI
stub, thanks for reminding me.

Thanks,
Tom

> 
>> Just removing the call does cause an SNP boot to crash. My testing shows
>> just ensuring that the cc_blob_address in the boot_params structure is
>> set results in a successful boot under SNP. So some of sev_enable()
>> needs to remain and some things need to be moved into the kernel proper.
>>
> 
> Thanks, this is very helpful. I'll dig a bit deeper and try to address
> the points you raised.

      reply	other threads:[~2025-04-14 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 13:04 Ard Biesheuvel
2025-04-14 19:10 ` Tom Lendacky
2025-04-14 19:45   ` Ard Biesheuvel
2025-04-14 19:53     ` Tom Lendacky [this message]

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=ba23ff1e-b9ba-3633-7712-0a73f38a0fe5@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=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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®