[edk2-devel] [PATCH 0/2] SEV BaseMemEncryptLib cleanup

Brijesh Singh via groups.io posted 2 patches 2 years, 3 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
.../DxeMemEncryptSevLib.inf                   |   1 +
.../PeiMemEncryptSevLib.inf                   |   1 +
.../SecMemEncryptSevLib.inf                   |   1 +
OvmfPkg/Include/WorkArea.h                    |  12 +-
.../DxeMemEncryptSevLibInternal.c             | 142 ++++++++----------
.../PeiMemEncryptSevLibInternal.c             | 139 ++++++-----------
.../SecMemEncryptSevLibInternal.c             |  80 +++++-----
OvmfPkg/Sec/AmdSev.c                          |   2 +-
OvmfPkg/ResetVector/Ia32/AmdSev.asm           |  38 +++--
OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm   |   3 +-
OvmfPkg/ResetVector/ResetVector.nasmb         |   3 +
11 files changed, 189 insertions(+), 233 deletions(-)
[edk2-devel] [PATCH 0/2] SEV BaseMemEncryptLib cleanup
Posted by Brijesh Singh via groups.io 2 years, 3 months ago
This is the first of cleanup for SEV MemEncryptLib. The library uses
the CPUID followed by the MSR read to determine whether SEV is enabled.

Now that we have a workarea concept, the logic can be simplified to
store the msr status in workarea and use that to build PCDs and then
later simply use the PCDs instead of going through the CPUID and RDMSR.

The complete branch is available at
  https://github.com/codomania/edk2/tree/sev-workarea-cleanup

Brijesh Singh (2):
  OvmfPkg/ResetVector: cache the SEV status MSR value in workarea
  OvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea

 .../DxeMemEncryptSevLib.inf                   |   1 +
 .../PeiMemEncryptSevLib.inf                   |   1 +
 .../SecMemEncryptSevLib.inf                   |   1 +
 OvmfPkg/Include/WorkArea.h                    |  12 +-
 .../DxeMemEncryptSevLibInternal.c             | 142 ++++++++----------
 .../PeiMemEncryptSevLibInternal.c             | 139 ++++++-----------
 .../SecMemEncryptSevLibInternal.c             |  80 +++++-----
 OvmfPkg/Sec/AmdSev.c                          |   2 +-
 OvmfPkg/ResetVector/Ia32/AmdSev.asm           |  38 +++--
 OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm   |   3 +-
 OvmfPkg/ResetVector/ResetVector.nasmb         |   3 +
 11 files changed, 189 insertions(+), 233 deletions(-)

-- 
2.25.1



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


Re: [edk2-devel] [PATCH 0/2] SEV BaseMemEncryptLib cleanup
Posted by Gerd Hoffmann 2 years, 3 months ago
On Wed, Jan 19, 2022 at 05:03:30PM -0600, Brijesh Singh wrote:
> This is the first of cleanup for SEV MemEncryptLib. The library uses
> the CPUID followed by the MSR read to determine whether SEV is enabled.
> 
> Now that we have a workarea concept, the logic can be simplified to
> store the msr status in workarea and use that to build PCDs and then
> later simply use the PCDs instead of going through the CPUID and RDMSR.
> 
> The complete branch is available at
>   https://github.com/codomania/edk2/tree/sev-workarea-cleanup
> 
> Brijesh Singh (2):
>   OvmfPkg/ResetVector: cache the SEV status MSR value in workarea
>   OvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea

Looks good to me.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

take care,
  Gerd



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


Re: [edk2-devel] [PATCH 0/2] SEV BaseMemEncryptLib cleanup
Posted by Brijesh Singh via groups.io 2 years, 2 months ago

On 1/21/22 2:04 AM, Gerd Hoffmann via groups.io wrote:
> On Wed, Jan 19, 2022 at 05:03:30PM -0600, Brijesh Singh wrote:
>> This is the first of cleanup for SEV MemEncryptLib. The library uses
>> the CPUID followed by the MSR read to determine whether SEV is enabled.
>>
>> Now that we have a workarea concept, the logic can be simplified to
>> store the msr status in workarea and use that to build PCDs and then
>> later simply use the PCDs instead of going through the CPUID and RDMSR.
>>
>> The complete branch is available at
>>    https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcodomania%2Fedk2%2Ftree%2Fsev-workarea-cleanup&amp;data=04%7C01%7Cbrijesh.singh%40amd.com%7C72f26427ada24f9fc2aa08d9dcb4bc74%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637783491097406747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=DKsibiI3OYAJkR09fMPCUz0JGyh7ZrGJGj55VmO5%2FsQ%3D&amp;reserved=0
>>
>> Brijesh Singh (2):
>>    OvmfPkg/ResetVector: cache the SEV status MSR value in workarea
>>    OvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea
> 
> Looks good to me.
> 
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> 

I ran into a regression for non-SEV guest, let me work to fix and post v2.

-Brijesh


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