From mboxrd@z Thu Jan 1 00:00:00 1970 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.36975.1679468579412020565 for ; Wed, 22 Mar 2023 00:02:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tyki2DrC; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679468578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ooglPZh3TGoM6ZY3YQaHVWUjEcEVstVQNGCnav+0wpQ=; b=Tyki2DrCx3wbBIsg7EXLe+Kg4tXX2ONeq2sD2cbc4CoawLuGuZ2LarMWrqlF9vLnU3yCcW 2qtjcVk3aoOcZs9EbdNZpS+oJAmmwTeW+WMN+YrtjDlVLuFVpFGeWek+sKbM+NWPYhQS/t YLmssWKf4KwIBUuZXTPvChRsW9OKmqg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-326-tneX8USKMk2iu23J9AmNlQ-1; Wed, 22 Mar 2023 03:02:54 -0400 X-MC-Unique: tneX8USKMk2iu23J9AmNlQ-1 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 354333810B1F; Wed, 22 Mar 2023 07:02:53 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4BC52027041; Wed, 22 Mar 2023 07:02:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C0AE6180039D; Wed, 22 Mar 2023 08:02:43 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Michael D Kinney , Erdem Aktas , James Bottomley , Liming Gao , =?UTF-8?q?Marvin=20H=C3=A4user?= , Pawel Polawski , Michael Roth , Tom Lendacky , Gerd Hoffmann , Jiewen Yao , Jian J Wang , Ard Biesheuvel , Jordan Justen , Hao A Wu , Zhiguang Liu , Ray Ni , Min Xu , Oliver Steffen , Jiewen Yao Subject: [PATCH v2 2/6] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions Date: Wed, 22 Mar 2023 08:02:39 +0100 Message-Id: <20230322070243.410903-3-kraxel@redhat.com> In-Reply-To: <20230322070243.410903-1-kraxel@redhat.com> References: <20230322070243.410903-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Reviewed-by: Michael D Kinney Reviewed-by: Jiewen Yao Acked-by: Tom Lendacky --- 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