[edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions

Gerd Hoffmann posted 5 patches 2 years, 11 months ago
There is a newer version of this series
[edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions
Posted by Gerd Hoffmann 2 years, 11 months ago
This patch is a preparation for the patches that follow. The
subsequent patches will introduce and integrate new alignment-related
macros, which collide with existing definitions in OvmfPkg.
Temporarily rename them to avoid build failure, till they can be
substituted with the new, shared definitions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/AmdSevDxe/AmdSevDxe.c                               | 6 +++---
 .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index a726498e2792..71a1eaaf0a1d 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -44,7 +44,7 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
 
 STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;
 
-#define IS_ALIGNED(x, y)  ((((x) & ((y) - 1)) == 0))
+#define IS_ALIGNED_(x, y)  ((((x) & ((y) - 1)) == 0))
 
 STATIC
 EFI_STATUS
@@ -60,8 +60,8 @@ AmdSevMemoryAccept (
   // multiple of SIZE_4KB. Use an assert instead of returning an erros since
   // this is an EDK2-internal protocol.
   //
-  ASSERT (IS_ALIGNED (StartAddress, SIZE_4KB));
-  ASSERT (IS_ALIGNED (Size, SIZE_4KB));
+  ASSERT (IS_ALIGNED_ (StartAddress, SIZE_4KB));
+  ASSERT (IS_ALIGNED_ (Size, SIZE_4KB));
   ASSERT (Size != 0);
 
   MemEncryptSevSnpPreValidateSystemRam (
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index 4d684964d838..f35bba5deb46 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -20,7 +20,7 @@
 
 #include "SnpPageStateChange.h"
 
-#define IS_ALIGNED(x, y)  ((((x) & (y - 1)) == 0))
+#define IS_ALIGNED_(x, y)  ((((x) & (y - 1)) == 0))
 #define PAGES_PER_LARGE_ENTRY  512
 
 STATIC
@@ -150,7 +150,7 @@ BuildPageStateBuffer (
     //
     // Is this a 2MB aligned page? Check if we can use the Large RMP entry.
     //
-    if (UseLargeEntry && IS_ALIGNED (BaseAddress, SIZE_2MB) &&
+    if (UseLargeEntry && IS_ALIGNED_ (BaseAddress, SIZE_2MB) &&
         ((EndAddress - BaseAddress) >= SIZE_2MB))
     {
       RmpPageSize = PvalidatePageSize2MB;
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100665): https://edk2.groups.io/g/devel/message/100665
Mute This Topic: https://groups.io/mt/97357269/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions
Posted by Michael D Kinney 2 years, 10 months ago
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann
> Sent: Thursday, March 2, 2023 10:51 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Gerd Hoffmann <kraxel@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Marvin Häuser <mhaeuser@posteo.de>; James Bottomley <jejb@linux.ibm.com>; Michael Roth
> <michael.roth@amd.com>; Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Oliver Steffen
> <osteffen@redhat.com>; Xu, Min M <min.m.xu@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>; Tom
> Lendacky <thomas.lendacky@amd.com>; Aktas, Erdem <erdemaktas@google.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Pawel Polawski
> <ppolawsk@redhat.com>; Justen, Jordan L <jordan.l.justen@intel.com>
> Subject: [edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions
> 
> This patch is a preparation for the patches that follow. The
> subsequent patches will introduce and integrate new alignment-related
> macros, which collide with existing definitions in OvmfPkg.
> Temporarily rename them to avoid build failure, till they can be
> substituted with the new, shared definitions.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  OvmfPkg/AmdSevDxe/AmdSevDxe.c                               | 6 +++---
>  .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> index a726498e2792..71a1eaaf0a1d 100644
> --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> @@ -44,7 +44,7 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
> 
>  STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;
> 
> -#define IS_ALIGNED(x, y)  ((((x) & ((y) - 1)) == 0))
> +#define IS_ALIGNED_(x, y)  ((((x) & ((y) - 1)) == 0))
> 
>  STATIC
>  EFI_STATUS
> @@ -60,8 +60,8 @@ AmdSevMemoryAccept (
>    // multiple of SIZE_4KB. Use an assert instead of returning an erros since
>    // this is an EDK2-internal protocol.
>    //
> -  ASSERT (IS_ALIGNED (StartAddress, SIZE_4KB));
> -  ASSERT (IS_ALIGNED (Size, SIZE_4KB));
> +  ASSERT (IS_ALIGNED_ (StartAddress, SIZE_4KB));
> +  ASSERT (IS_ALIGNED_ (Size, SIZE_4KB));
>    ASSERT (Size != 0);
> 
>    MemEncryptSevSnpPreValidateSystemRam (
> diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
> b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
> index 4d684964d838..f35bba5deb46 100644
> --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
> +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
> @@ -20,7 +20,7 @@
> 
>  #include "SnpPageStateChange.h"
> 
> -#define IS_ALIGNED(x, y)  ((((x) & (y - 1)) == 0))
> +#define IS_ALIGNED_(x, y)  ((((x) & (y - 1)) == 0))
>  #define PAGES_PER_LARGE_ENTRY  512
> 
>  STATIC
> @@ -150,7 +150,7 @@ BuildPageStateBuffer (
>      //
>      // Is this a 2MB aligned page? Check if we can use the Large RMP entry.
>      //
> -    if (UseLargeEntry && IS_ALIGNED (BaseAddress, SIZE_2MB) &&
> +    if (UseLargeEntry && IS_ALIGNED_ (BaseAddress, SIZE_2MB) &&
>          ((EndAddress - BaseAddress) >= SIZE_2MB))
>      {
>        RmpPageSize = PvalidatePageSize2MB;
> --
> 2.39.2
> 
> 
> 
> 
> 



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


Re: [edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions
Posted by Yao, Jiewen 2 years, 10 months ago
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Wednesday, March 22, 2023 5:41 AM
> To: devel@edk2.groups.io; kraxel@redhat.com
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Wang, Jian J
> <jian.j.wang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Marvin
> Häuser <mhaeuser@posteo.de>; James Bottomley <jejb@linux.ibm.com>;
> Michael Roth <michael.roth@amd.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Oliver Steffen <osteffen@redhat.com>; Xu, Min M <min.m.xu@intel.com>;
> Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>; Tom
> Lendacky <thomas.lendacky@amd.com>; Aktas, Erdem
> <erdemaktas@google.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Pawel
> Polawski <ppolawsk@redhat.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Subject: RE: [edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED
> macros to avoid name collisions
> 
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd
> Hoffmann
> > Sent: Thursday, March 2, 2023 10:51 PM
> > To: devel@edk2.groups.io
> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Gerd Hoffmann
> <kraxel@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Yao,
> > Jiewen <jiewen.yao@intel.com>; Marvin Häuser <mhaeuser@posteo.de>;
> James Bottomley <jejb@linux.ibm.com>; Michael Roth
> > <michael.roth@amd.com>; Wu, Hao A <hao.a.wu@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Oliver Steffen
> > <osteffen@redhat.com>; Xu, Min M <min.m.xu@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>; Tom
> > Lendacky <thomas.lendacky@amd.com>; Aktas, Erdem
> <erdemaktas@google.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Pawel
> Polawski
> > <ppolawsk@redhat.com>; Justen, Jordan L <jordan.l.justen@intel.com>
> > Subject: [edk2-devel] [PATCH 2/5] OvmfPkg: Rename IS_ALIGNED macros
> to avoid name collisions
> >
> > This patch is a preparation for the patches that follow. The
> > subsequent patches will introduce and integrate new alignment-related
> > macros, which collide with existing definitions in OvmfPkg.
> > Temporarily rename them to avoid build failure, till they can be
> > substituted with the new, shared definitions.
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> >  OvmfPkg/AmdSevDxe/AmdSevDxe.c                               | 6 +++---
> >  .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   | 4 ++--
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> > index a726498e2792..71a1eaaf0a1d 100644
> > --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> > +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
> > @@ -44,7 +44,7 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
> >
> >  STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;
> >
> > -#define IS_ALIGNED(x, y)  ((((x) & ((y) - 1)) == 0))
> > +#define IS_ALIGNED_(x, y)  ((((x) & ((y) - 1)) == 0))
> >
> >  STATIC
> >  EFI_STATUS
> > @@ -60,8 +60,8 @@ AmdSevMemoryAccept (
> >    // multiple of SIZE_4KB. Use an assert instead of returning an erros since
> >    // this is an EDK2-internal protocol.
> >    //
> > -  ASSERT (IS_ALIGNED (StartAddress, SIZE_4KB));
> > -  ASSERT (IS_ALIGNED (Size, SIZE_4KB));
> > +  ASSERT (IS_ALIGNED_ (StartAddress, SIZE_4KB));
> > +  ASSERT (IS_ALIGNED_ (Size, SIZE_4KB));
> >    ASSERT (Size != 0);
> >
> >    MemEncryptSevSnpPreValidateSystemRam (
> > diff --git
> a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeIntern
> al.c
> >
> b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeIntern
> al.c
> > index 4d684964d838..f35bba5deb46 100644
> > ---
> a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeIntern
> al.c
> > +++
> b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeIntern
> al.c
> > @@ -20,7 +20,7 @@
> >
> >  #include "SnpPageStateChange.h"
> >
> > -#define IS_ALIGNED(x, y)  ((((x) & (y - 1)) == 0))
> > +#define IS_ALIGNED_(x, y)  ((((x) & (y - 1)) == 0))
> >  #define PAGES_PER_LARGE_ENTRY  512
> >
> >  STATIC
> > @@ -150,7 +150,7 @@ BuildPageStateBuffer (
> >      //
> >      // Is this a 2MB aligned page? Check if we can use the Large RMP entry.
> >      //
> > -    if (UseLargeEntry && IS_ALIGNED (BaseAddress, SIZE_2MB) &&
> > +    if (UseLargeEntry && IS_ALIGNED_ (BaseAddress, SIZE_2MB) &&
> >          ((EndAddress - BaseAddress) >= SIZE_2MB))
> >      {
> >        RmpPageSize = PvalidatePageSize2MB;
> > --
> > 2.39.2
> >
> >
> >
> > 
> >



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