[edk2-devel] [PATCH 0/9] SEV-ES guest support fixes and cleanup

Lendacky, Thomas posted 9 patches 3 years, 6 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
MdePkg/Include/Register/Amd/Ghcb.h                    | 48 ++++++++------------
OvmfPkg/Library/VmgExitLib/VmgExitLib.c               | 30 ++++++++++++
OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c         | 10 +++-
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c    |  4 +-
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 21 +++++++++
UefiCpuPkg/Library/MpInitLib/MpLib.c                  |  7 ++-
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm         |  6 +++
7 files changed, 91 insertions(+), 35 deletions(-)
[edk2-devel] [PATCH 0/9] SEV-ES guest support fixes and cleanup
Posted by Lendacky, Thomas 3 years, 6 months ago
From: Tom Lendacky <thomas.lendacky@amd.com>

This patch series provides some fixes, updates and cleanup to the SEV-ES
guest support:

The first patch updates the calculation of the qword offset of fields
within the GHCB. Specifically, it removes the hardcoding of the offsets
and uses the OFFSET_OF () and sizeof () functions to calculate the
values, removes unused values and add values that will be used in later
patches.

The next five patches set the SwExitCode/SwExitInfo1/SwExitInfo2/SwScratch
valid bits in the GHCB ValidBitmap area when these fields are set at
VMGEXIT.

The next two patches update the Qemu flash drive services support to
add SEV-ES support to erasing blocks and to disable interrupts when using
the GHCB.

Finally, the last patch uses the processor number for setting the AP stack
pointer instead of the APIC ID (using GetProcessorNumber()).

---

These patches are based on commit:
ae511331e0fb ("BaseTools Build_Rule: Add the missing ASM16_FLAGS for ASM16 source file")

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>

Tom Lendacky (9):
  OvmfPkg/VmgExitLib: Update ValidBitmap settings
  OvmfPkg/VmgExitLib: Set the SW exit fields when performing VMGEXIT
  OvmfPkg/VmgExitLib: Set the SwScratch valid bit for IOIO events
  OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events
  UefiCpuPkg/MpInitLib: Set the SW exit fields when performing VMGEXIT
  OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Set the SwScratch valid bit
  OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Fix erase blocks for SEV-ES
  OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Disable interrupts when using
    GHCB
  UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor
    number

 MdePkg/Include/Register/Amd/Ghcb.h                    | 48 ++++++++------------
 OvmfPkg/Library/VmgExitLib/VmgExitLib.c               | 30 ++++++++++++
 OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c         | 10 +++-
 OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c    |  4 +-
 OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 21 +++++++++
 UefiCpuPkg/Library/MpInitLib/MpLib.c                  |  7 ++-
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm         |  6 +++
 7 files changed, 91 insertions(+), 35 deletions(-)

-- 
2.28.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66099): https://edk2.groups.io/g/devel/message/66099
Mute This Topic: https://groups.io/mt/77425904/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH 0/9] SEV-ES guest support fixes and cleanup
Posted by Laszlo Ersek 3 years, 6 months ago
Hi Tom,

On 10/10/20 18:06, Tom Lendacky wrote:
> From: Tom Lendacky <thomas.lendacky@amd.com>
> 
> This patch series provides some fixes, updates and cleanup to the SEV-ES
> guest support:
> 
> The first patch updates the calculation of the qword offset of fields
> within the GHCB. Specifically, it removes the hardcoding of the offsets
> and uses the OFFSET_OF () and sizeof () functions to calculate the
> values, removes unused values and add values that will be used in later
> patches.
> 
> The next five patches set the SwExitCode/SwExitInfo1/SwExitInfo2/SwScratch
> valid bits in the GHCB ValidBitmap area when these fields are set at
> VMGEXIT.
> 
> The next two patches update the Qemu flash drive services support to
> add SEV-ES support to erasing blocks and to disable interrupts when using
> the GHCB.
> 
> Finally, the last patch uses the processor number for setting the AP stack
> pointer instead of the APIC ID (using GetProcessorNumber()).

please file a TianoCore BZ for this series, assign it to yourself, link
the v1 posting in a comment on the BZ, and update the commit messages to
reference that BZ.

I find this relevant because edk2-stable202008 resolved TianoCore#2198.
If (in your opinion) downstreams that aim at supporting SEV-ES should
also have these patches (for example, if they should backport them on
top of edk2-stable202008), then having a TianoCore Bugzilla would be
quite helpful to them, for tracking purposes.

Thanks,
Laszlo

> 
> ---
> 
> These patches are based on commit:
> ae511331e0fb ("BaseTools Build_Rule: Add the missing ASM16_FLAGS for ASM16 source file")
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> 
> Tom Lendacky (9):
>   OvmfPkg/VmgExitLib: Update ValidBitmap settings
>   OvmfPkg/VmgExitLib: Set the SW exit fields when performing VMGEXIT
>   OvmfPkg/VmgExitLib: Set the SwScratch valid bit for IOIO events
>   OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events
>   UefiCpuPkg/MpInitLib: Set the SW exit fields when performing VMGEXIT
>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Set the SwScratch valid bit
>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Fix erase blocks for SEV-ES
>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Disable interrupts when using
>     GHCB
>   UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor
>     number
> 
>  MdePkg/Include/Register/Amd/Ghcb.h                    | 48 ++++++++------------
>  OvmfPkg/Library/VmgExitLib/VmgExitLib.c               | 30 ++++++++++++
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c         | 10 +++-
>  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c    |  4 +-
>  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 21 +++++++++
>  UefiCpuPkg/Library/MpInitLib/MpLib.c                  |  7 ++-
>  UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm         |  6 +++
>  7 files changed, 91 insertions(+), 35 deletions(-)
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66238): https://edk2.groups.io/g/devel/message/66238
Mute This Topic: https://groups.io/mt/77425904/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH 0/9] SEV-ES guest support fixes and cleanup
Posted by Lendacky, Thomas 3 years, 6 months ago
On 10/15/20 2:43 AM, Laszlo Ersek wrote:
> Hi Tom,
> 
> On 10/10/20 18:06, Tom Lendacky wrote:
>> From: Tom Lendacky <thomas.lendacky@amd.com>
>>
>> This patch series provides some fixes, updates and cleanup to the SEV-ES
>> guest support:
>>
>> The first patch updates the calculation of the qword offset of fields
>> within the GHCB. Specifically, it removes the hardcoding of the offsets
>> and uses the OFFSET_OF () and sizeof () functions to calculate the
>> values, removes unused values and add values that will be used in later
>> patches.
>>
>> The next five patches set the SwExitCode/SwExitInfo1/SwExitInfo2/SwScratch
>> valid bits in the GHCB ValidBitmap area when these fields are set at
>> VMGEXIT.
>>
>> The next two patches update the Qemu flash drive services support to
>> add SEV-ES support to erasing blocks and to disable interrupts when using
>> the GHCB.
>>
>> Finally, the last patch uses the processor number for setting the AP stack
>> pointer instead of the APIC ID (using GetProcessorNumber()).
> 
> please file a TianoCore BZ for this series, assign it to yourself, link
> the v1 posting in a comment on the BZ, and update the commit messages to
> reference that BZ.
> 
> I find this relevant because edk2-stable202008 resolved TianoCore#2198.
> If (in your opinion) downstreams that aim at supporting SEV-ES should
> also have these patches (for example, if they should backport them on
> top of edk2-stable202008), then having a TianoCore Bugzilla would be
> quite helpful to them, for tracking purposes.

Ok, done (https://bugzilla.tianocore.org/show_bug.cgi?id=3008).

One thing I noticed in the bugzilla is that there is a way to specify the 
releases the issue was observed in and must be fixed in, but the 
edk2-stable202008 release isn't listed in it (yet).

Thanks,
Tom

> 
> Thanks,
> Laszlo
> 
>>
>> ---
>>
>> These patches are based on commit:
>> ae511331e0fb ("BaseTools Build_Rule: Add the missing ASM16_FLAGS for ASM16 source file")
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>> Cc: Brijesh Singh <brijesh.singh@amd.com>
>>
>> Tom Lendacky (9):
>>    OvmfPkg/VmgExitLib: Update ValidBitmap settings
>>    OvmfPkg/VmgExitLib: Set the SW exit fields when performing VMGEXIT
>>    OvmfPkg/VmgExitLib: Set the SwScratch valid bit for IOIO events
>>    OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events
>>    UefiCpuPkg/MpInitLib: Set the SW exit fields when performing VMGEXIT
>>    OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Set the SwScratch valid bit
>>    OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Fix erase blocks for SEV-ES
>>    OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Disable interrupts when using
>>      GHCB
>>    UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor
>>      number
>>
>>   MdePkg/Include/Register/Amd/Ghcb.h                    | 48 ++++++++------------
>>   OvmfPkg/Library/VmgExitLib/VmgExitLib.c               | 30 ++++++++++++
>>   OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c         | 10 +++-
>>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c    |  4 +-
>>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 21 +++++++++
>>   UefiCpuPkg/Library/MpInitLib/MpLib.c                  |  7 ++-
>>   UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm         |  6 +++
>>   7 files changed, 91 insertions(+), 35 deletions(-)
>>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66255): https://edk2.groups.io/g/devel/message/66255
Mute This Topic: https://groups.io/mt/77425904/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH 0/9] SEV-ES guest support fixes and cleanup
Posted by Laszlo Ersek 3 years, 6 months ago
Mike,

(top posting on purpose)

can you please update the bugzilla installation so that it show the
edk2-stable202008 tag in the "list of affected releases" and "list of
releases needing fixes" widgets?

Thanks!
Laszlo

On 10/15/20 15:26, Tom Lendacky wrote:
> On 10/15/20 2:43 AM, Laszlo Ersek wrote:
>> Hi Tom,
>>
>> On 10/10/20 18:06, Tom Lendacky wrote:
>>> From: Tom Lendacky <thomas.lendacky@amd.com>
>>>
>>> This patch series provides some fixes, updates and cleanup to the SEV-ES
>>> guest support:
>>>
>>> The first patch updates the calculation of the qword offset of fields
>>> within the GHCB. Specifically, it removes the hardcoding of the offsets
>>> and uses the OFFSET_OF () and sizeof () functions to calculate the
>>> values, removes unused values and add values that will be used in later
>>> patches.
>>>
>>> The next five patches set the
>>> SwExitCode/SwExitInfo1/SwExitInfo2/SwScratch
>>> valid bits in the GHCB ValidBitmap area when these fields are set at
>>> VMGEXIT.
>>>
>>> The next two patches update the Qemu flash drive services support to
>>> add SEV-ES support to erasing blocks and to disable interrupts when
>>> using
>>> the GHCB.
>>>
>>> Finally, the last patch uses the processor number for setting the AP
>>> stack
>>> pointer instead of the APIC ID (using GetProcessorNumber()).
>>
>> please file a TianoCore BZ for this series, assign it to yourself, link
>> the v1 posting in a comment on the BZ, and update the commit messages to
>> reference that BZ.
>>
>> I find this relevant because edk2-stable202008 resolved TianoCore#2198.
>> If (in your opinion) downstreams that aim at supporting SEV-ES should
>> also have these patches (for example, if they should backport them on
>> top of edk2-stable202008), then having a TianoCore Bugzilla would be
>> quite helpful to them, for tracking purposes.
> 
> Ok, done (https://bugzilla.tianocore.org/show_bug.cgi?id=3008).
> 
> One thing I noticed in the bugzilla is that there is a way to specify
> the releases the issue was observed in and must be fixed in, but the
> edk2-stable202008 release isn't listed in it (yet).
> 
> Thanks,
> Tom
> 
>>
>> Thanks,
>> Laszlo
>>
>>>
>>> ---
>>>
>>> These patches are based on commit:
>>> ae511331e0fb ("BaseTools Build_Rule: Add the missing ASM16_FLAGS for
>>> ASM16 source file")
>>>
>>> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
>>> Cc: Eric Dong <eric.dong@intel.com>
>>> Cc: Laszlo Ersek <lersek@redhat.com>
>>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>>> Cc: Ray Ni <ray.ni@intel.com>
>>> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>>> Cc: Brijesh Singh <brijesh.singh@amd.com>
>>>
>>> Tom Lendacky (9):
>>>    OvmfPkg/VmgExitLib: Update ValidBitmap settings
>>>    OvmfPkg/VmgExitLib: Set the SW exit fields when performing VMGEXIT
>>>    OvmfPkg/VmgExitLib: Set the SwScratch valid bit for IOIO events
>>>    OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events
>>>    UefiCpuPkg/MpInitLib: Set the SW exit fields when performing VMGEXIT
>>>    OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Set the SwScratch valid bit
>>>    OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Fix erase blocks for SEV-ES
>>>    OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Disable interrupts when using
>>>      GHCB
>>>    UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor
>>>      number
>>>
>>>   MdePkg/Include/Register/Amd/Ghcb.h                    | 48
>>> ++++++++------------
>>>   OvmfPkg/Library/VmgExitLib/VmgExitLib.c               | 30
>>> ++++++++++++
>>>   OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c         | 10 +++-
>>>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c    |  4 +-
>>>   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 21 +++++++++
>>>   UefiCpuPkg/Library/MpInitLib/MpLib.c                  |  7 ++-
>>>   UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm         |  6 +++
>>>   7 files changed, 91 insertions(+), 35 deletions(-)
>>>
>>
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66267): https://edk2.groups.io/g/devel/message/66267
Mute This Topic: https://groups.io/mt/77425904/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-