From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.38662.1675078056580873468 for ; Mon, 30 Jan 2023 03:27:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YceP7Jk1; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5932AB80F9F for ; Mon, 30 Jan 2023 11:27:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06AC8C433D2 for ; Mon, 30 Jan 2023 11:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675078053; bh=T8UfYAEXwEFThmClgUjb5y2MtSDKgJlwil4z3cSMBfQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YceP7Jk1ArasbxSSslvlvYl0nzI6viihH737KqXk27sigaLbsILapKp4g6A2IuOR+ ye3nyuSvP0tVNpBYLwjDZHhd44td93ZDlAHhob/GiwSaz8WEHd+/IvDfw7raBJEo1L IbVSKgML0UBf5poqmV2zixqHZqsCvVdMOwSsLDgW/ck14mhQ5DDRAhSGQ5ebX5guDO zBGcIWdP3WVqGJT7fHykvNIaKzdbqE4gwZGOQp49LusB9t33shUVC7KOTYOeb9zVAF I/rbk7DsV0FqZuCkvLy2QQHOeog2mv7ozeX/RbH+vR02fCcRdMGT73hBXRZZQpLeJ0 WgKjfSMYKRb9Q== Received: by mail-lf1-f50.google.com with SMTP id u12so7965531lfq.0 for ; Mon, 30 Jan 2023 03:27:32 -0800 (PST) X-Gm-Message-State: AFqh2kpO1E+qpLvvcP2mSRMrGOP/HfUTNbY/VE0EL9AE+vv3r9rsP/7t pQ/aGGResxd1eDcVHBRaE1OYeFPrJdcAw+wm4rY= X-Google-Smtp-Source: AMrXdXtcTVPtO8Nfdr2LpXrSrYfmMHZb5OAqKRshQ9nXgxp1/Eii2Xipp+dkKHYHImTUfdYYVC4co4MpBS88e9bVdoo= X-Received: by 2002:a05:6512:2525:b0:4b6:fae9:c9b9 with SMTP id be37-20020a056512252500b004b6fae9c9b9mr4340655lfb.207.1675078051075; Mon, 30 Jan 2023 03:27:31 -0800 (PST) MIME-Version: 1.0 References: <20230128002657.1290601-1-gmahadevan@nvidia.com> In-Reply-To: <20230128002657.1290601-1-gmahadevan@nvidia.com> From: "Ard Biesheuvel" Date: Mon, 30 Jan 2023 12:27:19 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/1] StandaloneMmPkg: StandaloneMmMemLib: Change max address computation To: Girish Mahadevan , "Milosek, Damian" Cc: devel@edk2.groups.io, sami.mujawar@arm.com, ardb+tianocore@kernel.org, jiewen.yao@intel.com, supreeth.venkatesh@arm.com, jbrasen@nvidia.com, ashishsingha@nvidia.com, nramirez@nvidia.com Content-Type: text/plain; charset="UTF-8" (cc Damian) On Sat, 28 Jan 2023 at 01:27, Girish Mahadevan wrote: > > Currently the standalonemmlibinternal assumes the max physical bits > to be 36 which is causing issues on v8 architectures. > Instead use the MAX_ADDRESS macro to determine the maximum allowed address > rather than recomputing it locally. > > Signed-off-by: Girish Mahadevan > --- > .../ArmStandaloneMmMemLibInternal.c | 15 +-------------- > 1 file changed, 1 insertion(+), 14 deletions(-) > > diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c > index 297cfae916..4dc392b4e3 100644 > --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c > +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c > @@ -20,13 +20,6 @@ > // > extern EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress; > > -#ifdef MDE_CPU_AARCH64 > -#define ARM_PHYSICAL_ADDRESS_BITS 36 > -#endif > -#ifdef MDE_CPU_ARM > -#define ARM_PHYSICAL_ADDRESS_BITS 32 > -#endif > - > /** > Calculate and save the maximum support address. > > @@ -36,14 +29,8 @@ MmMemLibInternalCalculateMaximumSupportAddress ( > VOID > ) > { > - UINT8 PhysicalAddressBits; > - > - PhysicalAddressBits = ARM_PHYSICAL_ADDRESS_BITS; > + mMmMemLibInternalMaximumSupportAddress = MAX_ADDRESS; This should be MAX_ALLOC_ADDRESS not MAX_ADDRESS > > - // > - // Save the maximum support address in one global variable > - // > - mMmMemLibInternalMaximumSupportAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1); > DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", mMmMemLibInternalMaximumSupportAddress)); > } > > -- > 2.17.1 >