Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Lendacky, Thomas via groups.io
On 3/13/23 03:00, Gerd Hoffmann wrote: Hi, // Allocate a single page for the SEV-ES Save Area and initialize it. + // Due to an erratum that prevents a VMSA being on a 2MB boundary, + // allocate an extra page to work around the issue. A reference to the erratum (web link or erratum

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Lendacky, Thomas via groups.io
On 3/13/23 03:28, Ni, Ray wrote: +#define IS_ALIGNED(x, y) UINTN)(x) & (y - 1)) == 0)) 1. Can you use the existing macro ALIGN_POINTER() defined in Base.h? See my reply to the cover letter where I say I want to replace the usage with Gerd's definitions/updates series (but wanted

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Ni, Ray
; Michael Roth ; Ashish > Kalra > Subject: Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV- > SNP VMSA allocations are not 2MB aligned > > On Mon, Mar 13, 2023 at 08:28:57AM +, Ni, Ray wrote: > > > > > > +#define IS_ALIGNED(x, y) UINTN)(x) &a

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Gerd Hoffmann
On Mon, Mar 13, 2023 at 08:28:57AM +, Ni, Ray wrote: > > > > +#define IS_ALIGNED(x, y) UINTN)(x) & (y - 1)) == 0)) > > 1. Can you use the existing macro ALIGN_POINTER() defined in Base.h? Having copies of this all over the tree is indeed a bad idea. See

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Ni, Ray
Agree with both comments > -Original Message- > From: Gerd Hoffmann > Sent: Monday, March 13, 2023 4:00 PM > To: Tom Lendacky > Cc: devel@edk2.groups.io; Dong, Eric ; Ni, Ray > ; Kumar, Rahul R ; Michael > Roth ; Ashish Kalra > Subject: Re: [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Ni, Ray
> > +#define IS_ALIGNED(x, y) UINTN)(x) & (y - 1)) == 0)) 1. Can you use the existing macro ALIGN_POINTER() defined in Base.h? -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#101059): https://edk2.groups.io/g/devel/message/101059

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-13 Thread Gerd Hoffmann
Hi, >// Allocate a single page for the SEV-ES Save Area and initialize it. > + // Due to an erratum that prevents a VMSA being on a 2MB boundary, > + // allocate an extra page to work around the issue. A reference to the erratum (web link or erratum id) would be nice here. Also swapping

[edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Ensure SEV-SNP VMSA allocations are not 2MB aligned

2023-03-10 Thread Lendacky, Thomas via groups.io
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4353 Due to an erratum, an SEV-SNP VMSA cannot be 2MB aligned. To work around this issue, allocate two pages instead of one. Because of the way that page allocation is implemented, always try to use the second page. If the second page is not 2MB