From: "Lendacky, Thomas" <thomas.lendacky@amd.com>
To: Laszlo Ersek <lersek@redhat.com>, devel@edk2.groups.io
Cc: "Brijesh Singh" <brijesh.singh@amd.com>,
"Eric Dong" <eric.dong@intel.com>, "Ray Ni" <ray.ni@intel.com>,
"Rahul Kumar" <rahul1.kumar@intel.com>,
"Marvin Häuser" <mhaeuser@posteo.de>
Subject: Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib: Allocate a separate SEV-ES AP reset stack area
Date: Thu, 20 May 2021 10:09:06 -0500 [thread overview]
Message-ID: <98f17eb3-4e21-d11c-e2a6-f1eb02c9fa3b@amd.com> (raw)
In-Reply-To: <991462a7-042c-3186-0459-84c75de245b9@redhat.com>
On 5/19/21 2:27 AM, Laszlo Ersek wrote:
> On 05/17/21 17:03, Lendacky, Thomas wrote:
>> On 5/16/21 11:22 PM, Laszlo Ersek wrote:
>
>>> But now, with SEV-ES enabled, we'll have a separate, discontiguous area
>>> -- and neither BackupAndPrepareWakeupBuffer(), nor its counterpart
>>> RestoreWakeupBuffer() take that into account.
>>>
>>> Therefore I think, while this patch is regression-free for the SEV-ES
>>> *disabled* case, it may corrupt memory (through not restoring the AP
>>> stack area's original contents) with SEV-ES enabled.
>>
>> This is the current behavior for SEV-ES. The wakeup buffer memory is
>> marked as reserved, at least in the DXE phase.
>
> Another question that occurred to me later: where does this reservation
> happen? If we have a separate allocation for the AP stacks now, do we
> need to reserve that too, separately?
The GetWakeupBuffer() in DxeMpLib.c will perform AllocatePages() with a
memory type of "EfiReservedMemoryType" for SEV-ES. Since, with this patch,
it is called twice (once for the reset vector area and once for the stack
area) and both allocations will be EfiReservedMemoryType.
>
> What about PEI in general? Why is there no risk of corruption there?
That's a good question. The PEI GetWakeupBuffer() looks for memory that
hasn't been allocated below 1MB and just uses it - no reservation or
allocation. For OVMF, I imagine that nothing is really populated there and
so it is truly just "free" memory that doesn't need to be restored.
Thanks,
Tom
>
> (Sorry if these are lame questions!)
>
> Thanks,
> Laszlo
>
next prev parent reply other threads:[~2021-05-20 15:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 20:28 [PATCH v2] UefiCpuPkg/MpInitLib: Allocate a separate SEV-ES AP reset stack area Lendacky, Thomas
2021-05-17 4:22 ` [edk2-devel] " Laszlo Ersek
2021-05-17 15:03 ` Lendacky, Thomas
2021-05-18 17:17 ` Laszlo Ersek
2021-05-18 17:34 ` Marvin Häuser
2021-05-20 14:21 ` Lendacky, Thomas
2021-05-19 7:27 ` Laszlo Ersek
2021-05-20 15:09 ` Lendacky, Thomas [this message]
2021-05-20 8:43 ` Laszlo Ersek
2021-05-29 11:38 ` Laszlo Ersek
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-list 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=98f17eb3-4e21-d11c-e2a6-f1eb02c9fa3b@amd.com \
--to=devel@edk2.groups.io \
/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