From nobody Sun Feb 8 19:13:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+100667+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100667+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677826292; cv=none; d=zohomail.com; s=zohoarc; b=cOnznOkUpGd7857Ev3Iwih6/B38Azz9CA6FmVHl502UwZzj/BmK6dmv86FyWPQ2QVNZ514yODeB5KfsgwjPmD3jHsgXYgCjHp2GtcNOIh+h2eYf848QF25q17mYkM1aPMsd6+GrtYNVhqUhtJOd9nrg7i44Seghy/S9Dj4s7QzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677826292; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Z0hN38f4i1DkGV6px5VJiXZpdOca5/T2Z2VGqDePjJ8=; b=Vukb/ttri13exYaqsGmXkzrV7qCXmgr90O44zVP9OBpBJUipJtSTvGmPs1kao3LYHROlIgs3jS5SqpJVtgKDO23i+N78x95ducyz/pMJGTzXDw3v01kdYTaz1V/RK6Zv9WakXmfNJ+gv75/dPEebpC3udqtNMumTSdQUS1psaW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100667+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1677826292711114.88772891293479; Thu, 2 Mar 2023 22:51:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id AtUyYY1788612xtOB0TbWpqE; Thu, 02 Mar 2023 22:51:32 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.17713.1677826291748354900 for ; Thu, 02 Mar 2023 22:51:31 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-468-Pm0LZdnePtqaEcr2blXQIQ-1; Fri, 03 Mar 2023 01:51:23 -0500 X-MC-Unique: Pm0LZdnePtqaEcr2blXQIQ-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11DF3800B23; Fri, 3 Mar 2023 06:51:23 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B95512026D4B; Fri, 3 Mar 2023 06:51:22 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 162FB180108D; Fri, 3 Mar 2023 07:51:16 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Gerd Hoffmann , Jian J Wang , Jiewen Yao , =?UTF-8?q?Marvin=20H=C3=A4user?= , James Bottomley , Michael Roth , Hao A Wu , Michael D Kinney , Oliver Steffen , Min Xu , Liming Gao , Ray Ni , Tom Lendacky , Erdem Aktas , Zhiguang Liu , Pawel Polawski , Jordan Justen Subject: [edk2-devel] [PATCH 5/5] OvmfPkg: Consume new alignment-related macros Date: Fri, 3 Mar 2023 07:51:15 +0100 Message-Id: <20230303065115.406020-6-kraxel@redhat.com> In-Reply-To: <20230303065115.406020-1-kraxel@redhat.com> References: <20230303065115.406020-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: Fn01zhyYx01itn6BqGXPrPLNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1677826292; bh=cxuWd44kcYBJLSHxRypWLa4sMX9EOPqvhysWzPH8XpY=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=xCkhO36bddqVcHLz8AH1Sn+Ln/xySAi8puSObJCOhtuwUGtMcZ0auRr/zbnLCTeIZn2 kWpnkaUx770BNe7KeiGavrVYG2ngF6bFm7uaDHbUpkAl36GIsMBdcyiQCaOFVgNH0TPJp WOPn5sWg8bDwCf1dFWsJUaigSBC557QzOAs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1677826294670100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This patch substitutes the macros that were renamed in the second patch with the new, shared alignment macros. Signed-off-by: Gerd Hoffmann Reviewed-by: Jiewen Yao Reviewed-by: Michael D Kinney --- 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 =3D TRUE; =20 STATIC EFI_EVENT mAcceptAllMemoryEvent =3D NULL; =20 -#define IS_ALIGNED_(x, y) ((((x) & ((y) - 1)) =3D=3D 0)) - STATIC EFI_STATUS EFIAPI @@ -60,8 +58,8 @@ AmdSevMemoryAccept ( // multiple of SIZE_4KB. Use an assert instead of returning an erros sin= ce // 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 !=3D 0); =20 MemEncryptSevSnpPreValidateSystemRam ( diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInt= ernal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeIntern= al.c index f35bba5deb46..7a8878b1a9c2 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c @@ -20,7 +20,6 @@ =20 #include "SnpPageStateChange.h" =20 -#define IS_ALIGNED_(x, y) ((((x) & (y - 1)) =3D=3D 0)) #define PAGES_PER_LARGE_ENTRY 512 =20 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) >=3D SIZE_2MB)) { RmpPageSize =3D PvalidatePageSize2MB; --=20 2.39.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100667): https://edk2.groups.io/g/devel/message/100667 Mute This Topic: https://groups.io/mt/97357272/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-