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

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  6:51 [PATCH 0/5] MdePkg/Base.h: Introduce various alignment-related macros Gerd Hoffmann
2023-03-03  6:51 ` [PATCH 1/5] MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisions Gerd Hoffmann
2023-03-21  2:01   ` Wu, Hao A
2023-03-21 21:40   ` [edk2-devel] " Michael D Kinney
2023-03-03  6:51 ` [PATCH 2/5] OvmfPkg: " Gerd Hoffmann
2023-03-21 21:40   ` [edk2-devel] " Michael D Kinney
2023-03-21 23:30     ` Yao, Jiewen
2023-03-03  6:51 ` [PATCH 3/5] MdePkg/Base.h: Introduce various alignment-related macros Gerd Hoffmann
2023-03-21 21:37   ` Michael D Kinney
2023-03-21 21:59     ` Marvin Häuser
2023-03-21 22:28       ` Michael D Kinney
2023-03-21 22:43         ` Marvin Häuser
2023-03-21 22:50           ` Michael D Kinney
2023-03-22  0:09             ` Ni, Ray
2023-03-03  6:51 ` [PATCH 4/5] MdeModulePkg: Consume new " Gerd Hoffmann
2023-03-21  2:01   ` Wu, Hao A
2023-03-21 21:39   ` Michael D Kinney
2023-03-03  6:51 ` Gerd Hoffmann [this message]
2023-03-21 21:40   ` [PATCH 5/5] OvmfPkg: " Michael D Kinney
2023-03-21 23:30     ` Yao, Jiewen
2023-03-03 15:12 ` [PATCH 0/5] MdePkg/Base.h: Introduce various " Lendacky, Thomas
2023-03-20 10:04 ` Gerd Hoffmann

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=20230303065115.406020-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