From nobody Mon Feb 9 11:32:15 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+97753+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+97753+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1672018444; cv=none; d=zohomail.com; s=zohoarc; b=J9oFIDCYVo/Kgpy1hZrMCFx2ecP/kVNqy+CJjCRlXGh8DNzY7sLNt6wpZPzt7QjP2cXff5EM6HADo/PZnnRYBnhAc9oSnPUPHAHaCiMA+64jinRJZtW+HFxfkUNCZPTV5fymhzenQEwKzmiq8ZSyfp/e/98Q3UmfmB9/xWekZXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672018444; h=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=da6BmiKHtZcBpJG4oU/Yl1P2NFXwQSSbzQMr01IX8Fk=; b=QN2itfndA2OsVFZxvxX3LkBiTCOG6XdnPtHgQ99jckez/R2RtF7S+G83M2OZ0SCkByDHaqK7R0vRfAy9kTGot2hkJeZPjBPxhpEd6QKr8Wh+pycQhnTJ+QhrzFqZCH4m2BiGR7M7sqSZGlJAntA+7ZxSAJDwGvCpvQ48FSwEIY8= 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+97753+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 167201844479323.13813482485625; Sun, 25 Dec 2022 17:34:04 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id qhBmYY1788612xUn0Qu2wHH0; Sun, 25 Dec 2022 17:34:04 -0800 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.129091.1672018441335739938 for ; Sun, 25 Dec 2022 17:34:01 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10571"; a="347697082" X-IronPort-AV: E=Sophos;i="5.96,274,1665471600"; d="scan'208";a="347697082" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Dec 2022 17:34:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10571"; a="826755467" X-IronPort-AV: E=Sophos;i="5.96,274,1665471600"; d="scan'208";a="826755467" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.169.98]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Dec 2022 17:33:56 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , Gerd Hoffmann , James Bottomley , Jiewen Yao , Tom Lendacky Subject: [edk2-devel] [PATCH V1 3/3] OvmfPkg/PlatformPei: Adjust LowerMemorySize in PublishPeiMemory Date: Mon, 26 Dec 2022 09:33:38 +0800 Message-Id: <20221226013338.1924-4-min.m.xu@intel.com> In-Reply-To: <20221226013338.1924-1-min.m.xu@intel.com> References: <20221226013338.1924-1-min.m.xu@intel.com> MIME-Version: 1.0 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,min.m.xu@intel.com X-Gm-Message-State: nFbadF959XZf4FnPWpGh5PBex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1672018444; bh=fnwVA4S7m2sms3T85qQ6J3ELfYgVHeJh12OKBiStxo8=; h=Cc:Date:From:Reply-To:Subject:To; b=qSzlLK0dDRBnE5rqFk0Utb5VpgCmfEMnQPjDcY+86kSarv40PcQhxFac7eEq2Ae6TrB e+vu2mhd6XpbLlH8n+Q3NwyBHauWDHW1U3kaovwmOV55rrUoLxOo755KD0z5IdMnWICVf kDpUZpBA4kXpAVi5yFr0lxefpgYq75gQWjI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1672018445132000011 Content-Type: text/plain; charset="utf-8" From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4181 With the introduce of PcdAcceptMemoryEndAddress, TDVF may accept less memory than LowerMemorySizse. So it should be adjusted in PublishPeiMemory(). Cc: Erdem Aktas Cc: Gerd Hoffmann Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Signed-off-by: Min Xu --- OvmfPkg/PlatformPei/MemDetect.c | 13 +++++++++++++ OvmfPkg/PlatformPei/PlatformPei.inf | 1 + 2 files changed, 14 insertions(+) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index 3d8375320dcb..12a1ad46f1ca 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -270,8 +270,21 @@ PublishPeiMemory ( UINT32 PeiMemoryCap; UINT32 S3AcpiReservedMemoryBase; UINT32 S3AcpiReservedMemorySize; + UINT64 AcceptMemoryEndAddress; =20 LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob= ); + + // + // In Tdx guest there may be less memory accepted than LowerMemorySize. + // So LowerMemorySize need to be adjusted accordingly. + // + if (TdIsEnabled ()) { + AcceptMemoryEndAddress =3D FixedPcdGet64 (PcdAcceptMemoryEndAddress); + if ((AcceptMemoryEndAddress < SIZE_4GB) && (LowerMemorySize > (UINT32)= (UINTN)AcceptMemoryEndAddress)) { + LowerMemorySize =3D (UINT32)(UINTN)AcceptMemoryEndAddress; + } + } + if (PlatformInfoHob->SmmSmramRequire) { // // TSEG is chipped from the end of low RAM diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index 1fadadeb5565..c87d2fa25c08 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -130,6 +130,7 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize + gUefiOvmfPkgTokenSpaceGuid.PcdAcceptMemoryEndAddress =20 [FeaturePcd] gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable --=20 2.29.2.windows.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 (#97753): https://edk2.groups.io/g/devel/message/97753 Mute This Topic: https://groups.io/mt/95882250/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-