public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: "Michael D Kinney" <michael.d.kinney@intel.com>,
	"Erdem Aktas" <erdemaktas@google.com>,
	"James Bottomley" <jejb@linux.ibm.com>,
	"Liming Gao" <gaoliming@byosoft.com.cn>,
	"Marvin Häuser" <mhaeuser@posteo.de>,
	"Pawel Polawski" <ppolawsk@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Jiewen Yao" <jiewen.yao@intel.com>,
	"Jian J Wang" <jian.j.wang@intel.com>,
	"Ard Biesheuvel" <ardb+tianocore@kernel.org>,
	"Jordan Justen" <jordan.l.justen@intel.com>,
	"Hao A Wu" <hao.a.wu@intel.com>,
	"Zhiguang Liu" <zhiguang.liu@intel.com>,
	"Ray Ni" <ray.ni@intel.com>, "Min Xu" <min.m.xu@intel.com>,
	"Oliver Steffen" <osteffen@redhat.com>,
	"Jiewen Yao" <Jiewen.yao@intel.com>
Subject: [PATCH v2 5/6] OvmfPkg: Consume new alignment-related macros
Date: Wed, 22 Mar 2023 08:02:42 +0100	[thread overview]
Message-ID: <20230322070243.410903-6-kraxel@redhat.com> (raw)
In-Reply-To: <20230322070243.410903-1-kraxel@redhat.com>

This patch substitutes the macros that were renamed in the second
patch with the new, shared alignment macros.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 OvmfPkg/AmdSevDxe/AmdSevDxe.c                               | 6 ++----
 .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index 71a1eaaf0a1d..9b0d0e92b6f7 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -44,8 +44,6 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
 
 STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;
 
-#define IS_ALIGNED_(x, y)  ((((x) & ((y) - 1)) == 0))
-
 STATIC
 EFI_STATUS
 EFIAPI
@@ -60,8 +58,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 f35bba5deb46..7a8878b1a9c2 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -20,7 +20,6 @@
 
 #include "SnpPageStateChange.h"
 
-#define IS_ALIGNED_(x, y)  ((((x) & (y - 1)) == 0))
 #define PAGES_PER_LARGE_ENTRY  512
 
 STATIC
@@ -150,7 +149,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


  parent reply	other threads:[~2023-03-22  7:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  7:02 [PATCH v2 0/6] MdePkg/Base.h: Introduce various alignment-related macros Gerd Hoffmann
2023-03-22  7:02 ` [PATCH v2 1/6] MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisions Gerd Hoffmann
2023-03-22  7:02 ` [PATCH v2 2/6] OvmfPkg: " Gerd Hoffmann
2023-03-22  7:02 ` [PATCH v2 3/6] MdePkg/Base.h: Introduce various alignment-related macros Gerd Hoffmann
2023-03-22 22:17   ` Michael D Kinney
2023-03-22  7:02 ` [PATCH v2 4/6] MdeModulePkg: Consume new " Gerd Hoffmann
2023-03-22  7:02 ` Gerd Hoffmann [this message]
2023-03-22  7:02 ` [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() macro Gerd Hoffmann
2023-03-22  9:03   ` Ni, Ray
2023-03-22 22:15   ` [edk2-devel] " Michael D Kinney
2023-03-30  7:33 ` [PATCH v2 0/6] MdePkg/Base.h: Introduce various alignment-related macros Gerd Hoffmann
2023-04-01 23:38   ` [edk2-devel] " Michael D Kinney

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=20230322070243.410903-6-kraxel@redhat.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