From nobody Mon Feb 9 04:45:49 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+93134+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+93134+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1662366940; cv=none; d=zohomail.com; s=zohoarc; b=fRx0Nbixs8ifSIM7dakxfzF6hFkZ1pDccNNLj5K96fIJvgA41Ec3YFYNjip+yLRdzkGg9wbA3n5PLlLb9FNz+qnV1yzhAqpF9DR9QeDZ8irFyCIDUiZSqbzLlkqR3I4O/0EZaFPRAxvYgHPhHT4RGQNclHBBgeMSUTAj+HEHbpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662366940; 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=tkSzdCrfHpAUXNrWkZnbMkiyWAhc8JJ5+VO/ObZ72J8=; b=h92Vi+uc9H5OAsOoyHjjlI0fCL2boRu45AwVdGa34vtWsqPztcBQdZEtN7P3+GJkc3rgRXhERuDvw3xzzQTjId4rakQcwIzkE3w1pPHSZyAw34qgOYEKHfYeOHsttJ9j4yK43tz2gPSbrloMmLpd9ZowP6dlIa5A0U3sCtAWIk4= 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+93134+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 1662366940260809.1027897391273; Mon, 5 Sep 2022 01:35:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DEHFYY1788612xvtAvpkX3wO; Mon, 05 Sep 2022 01:35:39 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web09.22417.1662366920227192887 for ; Mon, 05 Sep 2022 01:35:39 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10460"; a="279355930" X-IronPort-AV: E=Sophos;i="5.93,290,1654585200"; d="scan'208";a="279355930" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 01:35:38 -0700 X-IronPort-AV: E=Sophos;i="5.93,290,1654585200"; d="scan'208";a="675194465" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.30.119]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 01:35:37 -0700 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 V3 09/12] OvmfPkg: Update ConstructFwHobList for lazy accept Date: Mon, 5 Sep 2022 16:35:03 +0800 Message-Id: <5f53ebaa41c5231ff9bb0031ca95afd7e05684c1.1662365866.git.min.m.xu@intel.com> In-Reply-To: References: 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: 13VZTILpoTrLJPrrhd3d38Hsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662366939; bh=JqFpcCgRyJ8Z7WKOEsfsNCtXWn5lIjYT8j8IWyOYuMQ=; h=Cc:Date:From:Reply-To:Subject:To; b=hlZRkoWfNJCcFskFanrUqI77KEZRKBdJjIdn5Fq5X9oAn7bE0bGB9dnJvo3kfA0pnap LBvOerIgbDM+Lmxib3DtgiEqUT9rpZNe3+Z4rNDmf4OYSPOb4/1DKzl65GRFJgcbtJLvE 14KiKDIU1kC20Js7Ao4W7ZSuOo+v5ccocCU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662366940567100011 Content-Type: text/plain; charset="utf-8" From: Min M Xu RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3937 In TDVF the hob list is constructed at the memory region which is the largest one below 4GB. After lazy accept is introduced, the MaxAcceptedMemoryAddress (which is tha max accpeted memory address in lazy accept) should be considered. Cc: Erdem Aktas Cc: Gerd Hoffmann Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Signed-off-by: Min Xu --- OvmfPkg/Library/PeilessStartupLib/Hob.c | 23 ++++++++++++++++++- .../PeilessStartupLib/PeilessStartupLib.inf | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PeilessStartupLib/Hob.c b/OvmfPkg/Library/Peil= essStartupLib/Hob.c index a9b92b5fbaba..884490af68fd 100644 --- a/OvmfPkg/Library/PeilessStartupLib/Hob.c +++ b/OvmfPkg/Library/PeilessStartupLib/Hob.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "PeilessStartupInternal.h" =20 /** @@ -74,10 +75,13 @@ ConstructFwHobList ( ) { EFI_PEI_HOB_POINTERS Hob; + EFI_PHYSICAL_ADDRESS PhysicalStart; EFI_PHYSICAL_ADDRESS PhysicalEnd; UINT64 ResourceLength; EFI_PHYSICAL_ADDRESS LowMemoryStart; UINT64 LowMemoryLength; + UINT64 MaxAcceptedMemoryAddress; + TDX_WORK_AREA *WorkArea; =20 ASSERT (VmmHobList !=3D NULL); =20 @@ -86,14 +90,31 @@ ConstructFwHobList ( LowMemoryLength =3D 0; LowMemoryStart =3D 0; =20 + WorkArea =3D (TDX_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase); + ASSERT (WorkArea !=3D NULL); + ASSERT (WorkArea->Header.GuestType =3D=3D CcGuestTypeIntelTdx); + MaxAcceptedMemoryAddress =3D WorkArea->SecTdxWorkArea.MaxAcceptedMemoryA= ddress; + if (MaxAcceptedMemoryAddress =3D=3D 0) { + MaxAcceptedMemoryAddress =3D MAX_UINT64; + } + // // Parse the HOB list until end of list or matching type is found. // while (!END_OF_HOB_LIST (Hob)) { if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { - if (Hob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_MEMORY_= UNACCEPTED) { + if ((Hob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_MEMORY= _UNACCEPTED) && (Hob.ResourceDescriptor->PhysicalStart < MaxAcceptedMemoryA= ddress)) { PhysicalEnd =3D Hob.ResourceDescriptor->PhysicalStart + Hob.Res= ourceDescriptor->ResourceLength; ResourceLength =3D Hob.ResourceDescriptor->ResourceLength; + PhysicalStart =3D Hob.ResourceDescriptor->PhysicalStart; + + if ((PhysicalEnd >=3D MaxAcceptedMemoryAddress) && (PhysicalStart = < MaxAcceptedMemoryAddress)) { + // + // This memory region is split into 2 parts. The left part is ac= cepted. + // + PhysicalEnd =3D MaxAcceptedMemoryAddress; + ResourceLength =3D PhysicalEnd - PhysicalStart; + } =20 if (PhysicalEnd <=3D BASE_4GB) { if (ResourceLength > LowMemoryLength) { diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf b/Ovmf= Pkg/Library/PeilessStartupLib/PeilessStartupLib.inf index def50b4b019e..eed9f27d3d01 100644 --- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf +++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf @@ -88,3 +88,4 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ##= CONSUMES gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase --=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 (#93134): https://edk2.groups.io/g/devel/message/93134 Mute This Topic: https://groups.io/mt/93474520/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-