From nobody Tue May 14 05:10:47 2024 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+98676+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+98676+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673957798; cv=none; d=zohomail.com; s=zohoarc; b=czM+EIlkEK7jbGSc564LO1XF/iXF3kGOHEnIrE8deTHxvGiughVBtS//sm5YjgQxDXKQrKaxmlzCPDl0wKIQvTNOthbgHkSz1W62WRz4J2CW8KfSYGcKYzHj0l6DVSI51W8p1rc5EP1Aq4GEHltFSwLJdo0bD8C+QUAdaTHnhE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673957798; 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=X9bdXRXx3YjKqGHN6RXZgtKDNHUqyu9YRi+crP9td9g=; b=GvvZxzXkUYzSm+QyleonUj/e71FVN9y8xL8FXImFQymQ6ZPs/ZZ4pdMJQqijUrmvA3h03nxtCphdl/AaqclyxQpFisGwSD+axgcqdOvQx7Sl3t44o20G8d4U/8NZpV3pgtxA/ssrRVO+3BS7qK9OvwuyVOlcqy6KlpamAA9SzJw= 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+98676+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 1673957798142178.496079666627; Tue, 17 Jan 2023 04:16:38 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZhsbYY1788612xaHwgIdyiEa; Tue, 17 Jan 2023 04:16:37 -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.web11.194670.1673957796973690462 for ; Tue, 17 Jan 2023 04:16:37 -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-564-_QXgpShNP9SzflxOTCecLw-1; Tue, 17 Jan 2023 07:16:32 -0500 X-MC-Unique: _QXgpShNP9SzflxOTCecLw-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C2F1E181E3F2; Tue, 17 Jan 2023 12:16:31 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 42A43492B00; Tue, 17 Jan 2023 12:16:31 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EBBFE1800624; Tue, 17 Jan 2023 13:16:29 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Ard Biesheuvel , Pawel Polawski , Jordan Justen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v4 1/5] OvmfPkg/PlatformInitLib: Add PlatformScanE820 and GetFirstNonAddressCB Date: Tue, 17 Jan 2023 13:16:25 +0100 Message-Id: <20230117121629.2149112-2-kraxel@redhat.com> In-Reply-To: <20230117121629.2149112-1-kraxel@redhat.com> References: <20230117121629.2149112-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: DNkbD84Ai66p3oBmXS62gjqsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673957797; bh=UDE8hYx7YY0gJmjjpXizrbmkjDyptLy0egLIziYhKhc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=cr81KHHmF+Nstp9Z2jzw0njf3B2+/cdFtTSfMewxblwWpxTmE4Kd4fhpxvtsdSvHBsG 6leGcdklm1mBHiE6S6pPzbZCXuAs9OXXaRsiW51ngqFqRJLPQMZq/f6Bj3u2WCrlDxEpz kVeg4exlTECxmU0MfOkkUWTdKSPdeOha7iw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673957798709100006 Content-Type: text/plain; charset="utf-8"; x-default="true" First step replacing the PlatformScanOrAdd64BitE820Ram() function. Add a PlatformScanE820() function which loops over the e280 entries from FwCfg and calls a callback for each of them. Add a GetFirstNonAddressCB() function which will store the first free address (right after the last RAM block) in PlatformInfoHob->FirstNonAddress. This replaces calls to PlatformScanOrAdd64BitE820Ram() with non-NULL MaxAddress. Write any actions done (setting FirstNonAddress) to the firmware log with INFO loglevel. Also drop local FirstNonAddress variables and use PlatformInfoHob->FirstNonAddress instead everywhere. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 115 ++++++++++++++++---- 1 file changed, 92 insertions(+), 23 deletions(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index 882805269b3e..1ea91f78cefd 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -251,6 +251,83 @@ PlatformScanOrAdd64BitE820Ram ( return EFI_SUCCESS; } =20 +typedef VOID (*E820_SCAN_CALLBACK) ( + EFI_E820_ENTRY64 *E820Entry, + EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ); + +/** + Store first address not used by e820 RAM entries in + PlatformInfoHob->FirstNonAddress +**/ +VOID +PlatformGetFirstNonAddressCB ( + IN EFI_E820_ENTRY64 *E820Entry, + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + UINT64 Candidate; + + if (E820Entry->Type !=3D EfiAcpiAddressRangeMemory) { + return; + } + + Candidate =3D E820Entry->BaseAddr + E820Entry->Length; + if (PlatformInfoHob->FirstNonAddress < Candidate) { + DEBUG ((DEBUG_INFO, "%a: FirstNonAddress=3D0x%Lx\n", __FUNCTION__, Can= didate)); + PlatformInfoHob->FirstNonAddress =3D Candidate; + } +} + +/** + Iterate over the entries in QEMU's fw_cfg E820 RAM map, call the + passed callback for each entry. + + @param[in] Callback The callback function to be called. + + @param[in out] PlatformInfoHob PlatformInfo struct which is passed + through to the callback. + + @retval EFI_SUCCESS The fw_cfg E820 RAM map was found and p= rocessed. + + @retval EFI_PROTOCOL_ERROR The RAM map was found, but its size was= n't a + whole multiple of sizeof(EFI_E820_ENTRY= 64). No + RAM entry was processed. + + @return Error codes from QemuFwCfgFindFile(). N= o RAM + entry was processed. +**/ +STATIC +EFI_STATUS +PlatformScanE820 ( + IN E820_SCAN_CALLBACK Callback, + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + EFI_STATUS Status; + FIRMWARE_CONFIG_ITEM FwCfgItem; + UINTN FwCfgSize; + EFI_E820_ENTRY64 E820Entry; + UINTN Processed; + + Status =3D QemuFwCfgFindFile ("etc/e820", &FwCfgItem, &FwCfgSize); + if (EFI_ERROR (Status)) { + return Status; + } + + if (FwCfgSize % sizeof E820Entry !=3D 0) { + return EFI_PROTOCOL_ERROR; + } + + QemuFwCfgSelectItem (FwCfgItem); + for (Processed =3D 0; Processed < FwCfgSize; Processed +=3D sizeof E820E= ntry) { + QemuFwCfgReadBytes (sizeof E820Entry, &E820Entry); + Callback (&E820Entry, PlatformInfoHob); + } + + return EFI_SUCCESS; +} + /** Returns PVH memmap =20 @@ -384,23 +461,17 @@ PlatformGetSystemMemorySizeAbove4gb ( Return the highest address that DXE could possibly use, plus one. **/ STATIC -UINT64 +VOID PlatformGetFirstNonAddress ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINT64 FirstNonAddress; UINT32 FwCfgPciMmio64Mb; EFI_STATUS Status; FIRMWARE_CONFIG_ITEM FwCfgItem; UINTN FwCfgSize; UINT64 HotPlugMemoryEnd; =20 - // - // set FirstNonAddress to suppress incorrect compiler/analyzer warnings - // - FirstNonAddress =3D 0; - // // If QEMU presents an E820 map, then get the highest exclusive >=3D4GB = RAM // address from it. This can express an address >=3D 4GB+1TB. @@ -408,9 +479,10 @@ PlatformGetFirstNonAddress ( // Otherwise, get the flat size of the memory above 4GB from the CMOS (w= hich // can only express a size smaller than 1TB), and add it to 4GB. // - Status =3D PlatformScanOrAdd64BitE820Ram (FALSE, NULL, &FirstNonAddress); + PlatformInfoHob->FirstNonAddress =3D BASE_4GB; + Status =3D PlatformScanE820 (PlatformGetFirstN= onAddressCB, PlatformInfoHob); if (EFI_ERROR (Status)) { - FirstNonAddress =3D BASE_4GB + PlatformGetSystemMemorySizeAbove4gb (); + PlatformInfoHob->FirstNonAddress =3D BASE_4GB + PlatformGetSystemMemor= ySizeAbove4gb (); } =20 // @@ -420,7 +492,7 @@ PlatformGetFirstNonAddress ( // #ifdef MDE_CPU_IA32 if (!FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { - return FirstNonAddress; + return; } =20 #endif @@ -473,7 +545,7 @@ PlatformGetFirstNonAddress ( // determines the highest address plus one. The memory hotplug area (s= ee // below) plays no role for the firmware in this case. // - return FirstNonAddress; + return; } =20 // @@ -497,15 +569,15 @@ PlatformGetFirstNonAddress ( HotPlugMemoryEnd )); =20 - ASSERT (HotPlugMemoryEnd >=3D FirstNonAddress); - FirstNonAddress =3D HotPlugMemoryEnd; + ASSERT (HotPlugMemoryEnd >=3D PlatformInfoHob->FirstNonAddress); + PlatformInfoHob->FirstNonAddress =3D HotPlugMemoryEnd; } =20 // // SeaBIOS aligns both boundaries of the 64-bit PCI host aperture to 1GB= , so // that the host can map it with 1GB hugepages. Follow suit. // - PlatformInfoHob->PcdPciMmio64Base =3D ALIGN_VALUE (FirstNonAddress, (UIN= T64)SIZE_1GB); + PlatformInfoHob->PcdPciMmio64Base =3D ALIGN_VALUE (PlatformInfoHob->Firs= tNonAddress, (UINT64)SIZE_1GB); PlatformInfoHob->PcdPciMmio64Size =3D ALIGN_VALUE (PlatformInfoHob->PcdP= ciMmio64Size, (UINT64)SIZE_1GB); =20 // @@ -519,8 +591,8 @@ PlatformGetFirstNonAddress ( // // The useful address space ends with the 64-bit PCI host aperture. // - FirstNonAddress =3D PlatformInfoHob->PcdPciMmio64Base + PlatformInfoHob-= >PcdPciMmio64Size; - return FirstNonAddress; + PlatformInfoHob->FirstNonAddress =3D PlatformInfoHob->PcdPciMmio64Base += PlatformInfoHob->PcdPciMmio64Size; + return; } =20 /* @@ -781,7 +853,6 @@ PlatformAddressWidthInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINT64 FirstNonAddress; UINT8 PhysMemAddressWidth; EFI_STATUS Status; =20 @@ -794,7 +865,7 @@ PlatformAddressWidthInitialization ( // First scan host-provided hardware information to assess if the address // space is already known. If so, guest must use those values. // - Status =3D PlatformScanHostProvided64BitPciMmioEnd (&FirstNonAddress); + Status =3D PlatformScanHostProvided64BitPciMmioEnd (&PlatformInfoHob->Fi= rstNonAddress); =20 if (EFI_ERROR (Status)) { // @@ -806,13 +877,12 @@ PlatformAddressWidthInitialization ( // The DXL IPL keys off of the physical address bits advertized in the= CPU // HOB. To conserve memory, we calculate the minimum address width her= e. // - FirstNonAddress =3D PlatformGetFirstNonAddress (PlatformInfoHob); + PlatformGetFirstNonAddress (PlatformInfoHob); } =20 PlatformAddressWidthFromCpuid (PlatformInfoHob, TRUE); if (PlatformInfoHob->PhysMemAddressWidth !=3D 0) { // physical address width is known - PlatformInfoHob->FirstNonAddress =3D FirstNonAddress; PlatformDynamicMmioWindow (PlatformInfoHob); return; } @@ -823,13 +893,13 @@ PlatformAddressWidthInitialization ( // -> try be conservstibe to stay below the guaranteed minimum of // 36 phys bits (aka 64 GB). // - PhysMemAddressWidth =3D (UINT8)HighBitSet64 (FirstNonAddress); + PhysMemAddressWidth =3D (UINT8)HighBitSet64 (PlatformInfoHob->FirstNonAd= dress); =20 // // If FirstNonAddress is not an integral power of two, then we need an // additional bit. // - if ((FirstNonAddress & (FirstNonAddress - 1)) !=3D 0) { + if ((PlatformInfoHob->FirstNonAddress & (PlatformInfoHob->FirstNonAddres= s - 1)) !=3D 0) { ++PhysMemAddressWidth; } =20 @@ -857,7 +927,6 @@ PlatformAddressWidthInitialization ( ASSERT (PhysMemAddressWidth <=3D 48); #endif =20 - PlatformInfoHob->FirstNonAddress =3D FirstNonAddress; PlatformInfoHob->PhysMemAddressWidth =3D PhysMemAddressWidth; } =20 --=20 2.39.0 -=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 (#98676): https://edk2.groups.io/g/devel/message/98676 Mute This Topic: https://groups.io/mt/96328404/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- From nobody Tue May 14 05:10:47 2024 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+98675+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+98675+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673957797; cv=none; d=zohomail.com; s=zohoarc; b=Wp9QDrXwS80xpgMixM/8/GPz0hPJl+vUKGD4LPxzb8wd/zVggz/bqBdul1h/EGVScCfXXMi07egHZ+UrcUz9/mLeDRUPoCPwqHETqGND/MPQ3JhWyMXukLkOHtnHQ2GIV1lVFSAxiTkGh5z+Dgld8FcG4P5rttwX80rdyki0Wk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673957797; 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=WAlZ4FPkWDxi1uY0TuRik6TH3b4uqiuPzwfIdw/zPmQ=; b=gvdgOWYemCqmWrhopYjZ9x30zY/JKx76HZkWviawO+gPfTdAxDI/G3DLVAl6/ZgJA3WnmjTy9a9ax537/fPKg/ACcpi1oV0WpS+96RJkTGm6l+8PRBSmRow8cHC9KaGulG+D15ROX0YFMUfN840cOhD60d3OLMaefeQL/t5KDcw= 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+98675+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 1673957797397133.12746671736363; Tue, 17 Jan 2023 04:16:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fdRQYY1788612x1RVYB8F7QM; Tue, 17 Jan 2023 04:16:36 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.194534.1673957796432413913 for ; Tue, 17 Jan 2023 04:16:36 -0800 X-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-671-a29Q_dR6OXqgc2yLmcJJnw-1; Tue, 17 Jan 2023 07:16:33 -0500 X-MC-Unique: a29Q_dR6OXqgc2yLmcJJnw-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A952380662C; Tue, 17 Jan 2023 12:16:33 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C856740C6EC4; Tue, 17 Jan 2023 12:16:32 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F15711800865; Tue, 17 Jan 2023 13:16:29 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Ard Biesheuvel , Pawel Polawski , Jordan Justen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v4 2/5] OvmfPkg/PlatformInitLib: Add PlatformGetLowMemoryCB Date: Tue, 17 Jan 2023 13:16:26 +0100 Message-Id: <20230117121629.2149112-3-kraxel@redhat.com> In-Reply-To: <20230117121629.2149112-1-kraxel@redhat.com> References: <20230117121629.2149112-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 7d1pumh5CGPrGujKuVzGRAAOx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673957796; bh=HThVZD0/FH4sonmGVhQXUEtHGUHpnnjmXKf1cRSMCKs=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=MmyHSeXH/5sIL/JTd1NWk/xUi+MIy6rYoK/64tXS7mJN/XuT1bRhaShcl1FSM3ngT0+ YXAi/1WuvMlr/qb5WLi53gjlAKlXmyRp4g+YYaz3+tDmTQE7r+L8LbBWaTjswO/ddhppc tCVIcnX+gM6frNRPkjO/77CMZxWJXWrAHQ4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673957798732100009 Content-Type: text/plain; charset="utf-8"; x-default="true" Add PlatformGetLowMemoryCB() callback function for use with PlatformScanE820(). It stores the low memory size in PlatformInfoHob->LowMemory. This replaces calls to PlatformScanOrAdd64BitE820Ram() with non-NULL LowMemory. Write any actions done (setting LowMemory) to the firmware log with INFO loglevel. Also change PlatformGetSystemMemorySizeBelow4gb() to likewise set PlatformInfoHob->LowMemory instead of returning the value. Update all Callers to the new convention. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/Include/Library/PlatformInitLib.h | 3 +- OvmfPkg/Library/PeilessStartupLib/Hob.c | 3 +- .../PeilessStartupLib/PeilessStartup.c | 7 +- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 69 +++++++++++++------ OvmfPkg/Library/PlatformInitLib/Platform.c | 7 +- OvmfPkg/PlatformPei/MemDetect.c | 3 +- 6 files changed, 59 insertions(+), 33 deletions(-) diff --git a/OvmfPkg/Include/Library/PlatformInitLib.h b/OvmfPkg/Include/Li= brary/PlatformInitLib.h index bf6f90a5761c..051b31191194 100644 --- a/OvmfPkg/Include/Library/PlatformInitLib.h +++ b/OvmfPkg/Include/Library/PlatformInitLib.h @@ -26,6 +26,7 @@ typedef struct { BOOLEAN Q35SmramAtDefaultSmbase; UINT16 Q35TsegMbytes; =20 + UINT32 LowMemory; UINT64 FirstNonAddress; UINT8 PhysMemAddressWidth; UINT32 Uc32Base; @@ -144,7 +145,7 @@ PlatformQemuUc32BaseInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 -UINT32 +VOID EFIAPI PlatformGetSystemMemorySizeBelow4gb ( IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob diff --git a/OvmfPkg/Library/PeilessStartupLib/Hob.c b/OvmfPkg/Library/Peil= essStartupLib/Hob.c index 630ce445ebec..318b74c95d8e 100644 --- a/OvmfPkg/Library/PeilessStartupLib/Hob.c +++ b/OvmfPkg/Library/PeilessStartupLib/Hob.c @@ -42,7 +42,8 @@ ConstructSecHobList ( =20 ZeroMem (&PlatformInfoHob, sizeof (PlatformInfoHob)); PlatformInfoHob.HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); - LowMemorySize =3D PlatformGetSystemMemorySizeBelow4gb = (&PlatformInfoHob); + PlatformGetSystemMemorySizeBelow4gb (&PlatformInfoHob); + LowMemorySize =3D PlatformInfoHob.LowMemory; ASSERT (LowMemorySize !=3D 0); LowMemoryStart =3D FixedPcdGet32 (PcdOvmfDxeMemFvBase) + FixedPcdGet32 (= PcdOvmfDxeMemFvSize); LowMemorySize -=3D LowMemoryStart; diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c b/OvmfPkg/L= ibrary/PeilessStartupLib/PeilessStartup.c index 380e71597206..928120d183ba 100644 --- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c +++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c @@ -41,8 +41,7 @@ InitializePlatform ( EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINT32 LowerMemorySize; - VOID *VariableStore; + VOID *VariableStore; =20 DEBUG ((DEBUG_INFO, "InitializePlatform in Pei-less boot\n")); PlatformDebugDumpCmos (); @@ -70,14 +69,14 @@ InitializePlatform ( PlatformInfoHob->PcdCpuBootLogicalProcessorNumber )); =20 - LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob= ); + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); PlatformQemuUc32BaseInitialization (PlatformInfoHob); DEBUG (( DEBUG_INFO, "Uc32Base =3D 0x%x, Uc32Size =3D 0x%x, LowerMemorySize =3D 0x%x\n", PlatformInfoHob->Uc32Base, PlatformInfoHob->Uc32Size, - LowerMemorySize + PlatformInfoHob->LowMemory )); =20 VariableStore =3D PlatformReserveEmuVar= iableNvStore (); diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index 1ea91f78cefd..dfaa05a1c24f 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -51,18 +51,16 @@ PlatformQemuUc32BaseInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINT32 LowerMemorySize; - if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff /* microvm */) { return; } =20 if (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { - LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoH= ob); + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); ASSERT (PcdGet64 (PcdPciExpressBaseAddress) <=3D MAX_UINT32); - ASSERT (PcdGet64 (PcdPciExpressBaseAddress) >=3D LowerMemorySize); + ASSERT (PcdGet64 (PcdPciExpressBaseAddress) >=3D PlatformInfoHob->LowM= emory); =20 - if (LowerMemorySize <=3D BASE_2GB) { + if (PlatformInfoHob->LowMemory <=3D BASE_2GB) { // Newer qemu with gigabyte aligned memory, // 32-bit pci mmio window is 2G -> 4G then. PlatformInfoHob->Uc32Base =3D BASE_2GB; @@ -92,8 +90,8 @@ PlatformQemuUc32BaseInitialization ( // variable MTRR suffices by truncating the size to a whole power of two, // while keeping the end affixed to 4GB. This will round the base up. // - LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (Platf= ormInfoHob); - PlatformInfoHob->Uc32Size =3D GetPowerOfTwo32 ((UINT32)(SIZE_4GB - Lower= MemorySize)); + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); + PlatformInfoHob->Uc32Size =3D GetPowerOfTwo32 ((UINT32)(SIZE_4GB - Platf= ormInfoHob->LowMemory)); PlatformInfoHob->Uc32Base =3D (UINT32)(SIZE_4GB - PlatformInfoHob->Uc32S= ize); // // Assuming that LowerMemorySize is at least 1 byte, Uc32Size is at most= 2GB. @@ -101,13 +99,13 @@ PlatformQemuUc32BaseInitialization ( // ASSERT (PlatformInfoHob->Uc32Base >=3D BASE_2GB); =20 - if (PlatformInfoHob->Uc32Base !=3D LowerMemorySize) { + if (PlatformInfoHob->Uc32Base !=3D PlatformInfoHob->LowMemory) { DEBUG (( DEBUG_VERBOSE, "%a: rounded UC32 base from 0x%x up to 0x%x, for " "an UC32 size of 0x%x\n", __FUNCTION__, - LowerMemorySize, + PlatformInfoHob->LowMemory, PlatformInfoHob->Uc32Base, PlatformInfoHob->Uc32Size )); @@ -279,6 +277,33 @@ PlatformGetFirstNonAddressCB ( } } =20 +/** + Store the low (below 4G) memory size in + PlatformInfoHob->LowMemory +**/ +STATIC VOID +PlatformGetLowMemoryCB ( + IN EFI_E820_ENTRY64 *E820Entry, + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + UINT64 Candidate; + + if (E820Entry->Type !=3D EfiAcpiAddressRangeMemory) { + return; + } + + Candidate =3D E820Entry->BaseAddr + E820Entry->Length; + if (Candidate >=3D BASE_4GB) { + return; + } + + if (PlatformInfoHob->LowMemory < Candidate) { + DEBUG ((DEBUG_INFO, "%a: LowMemory=3D0x%Lx\n", __FUNCTION__, Candidate= )); + PlatformInfoHob->LowMemory =3D (UINT32)Candidate; + } +} + /** Iterate over the entries in QEMU's fw_cfg E820 RAM map, call the passed callback for each entry. @@ -395,14 +420,13 @@ GetHighestSystemMemoryAddressFromPvhMemmap ( return HighestAddress; } =20 -UINT32 +VOID EFIAPI PlatformGetSystemMemorySizeBelow4gb ( IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { EFI_STATUS Status; - UINT64 LowerMemorySize =3D 0; UINT8 Cmos0x34; UINT8 Cmos0x35; =20 @@ -410,12 +434,13 @@ PlatformGetSystemMemorySizeBelow4gb ( (CcProbe () !=3D CcGuestTypeIntelTdx)) { // Get the information from PVH memmap - return (UINT32)GetHighestSystemMemoryAddressFromPvhMemmap (TRUE); + PlatformInfoHob->LowMemory =3D (UINT32)GetHighestSystemMemoryAddressFr= omPvhMemmap (TRUE); + return; } =20 - Status =3D PlatformScanOrAdd64BitE820Ram (FALSE, &LowerMemorySize, NULL); - if ((Status =3D=3D EFI_SUCCESS) && (LowerMemorySize > 0)) { - return (UINT32)LowerMemorySize; + Status =3D PlatformScanE820 (PlatformGetLowMemoryCB, PlatformInfoHob); + if (!EFI_ERROR (Status) && (PlatformInfoHob->LowMemory > 0)) { + return; } =20 // @@ -430,7 +455,7 @@ PlatformGetSystemMemorySizeBelow4gb ( Cmos0x34 =3D (UINT8)PlatformCmosRead8 (0x34); Cmos0x35 =3D (UINT8)PlatformCmosRead8 (0x35); =20 - return (UINT32)(((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB); + PlatformInfoHob->LowMemory =3D (UINT32)(((UINTN)((Cmos0x35 << 8) + Cmos0= x34) << 16) + SIZE_16MB); } =20 STATIC @@ -966,7 +991,6 @@ PlatformQemuInitializeRam ( IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINT64 LowerMemorySize; UINT64 UpperMemorySize; MTRR_SETTINGS MtrrSettings; EFI_STATUS Status; @@ -976,7 +1000,7 @@ PlatformQemuInitializeRam ( // // Determine total memory size available // - LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob= ); + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); =20 if (PlatformInfoHob->BootMode =3D=3D BOOT_ON_S3_RESUME) { // @@ -1010,14 +1034,14 @@ PlatformQemuInitializeRam ( UINT32 TsegSize; =20 TsegSize =3D PlatformInfoHob->Q35TsegMbytes * SIZE_1MB; - PlatformAddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize); + PlatformAddMemoryRangeHob (BASE_1MB, PlatformInfoHob->LowMemory - Ts= egSize); PlatformAddReservedMemoryBaseSizeHob ( - LowerMemorySize - TsegSize, + PlatformInfoHob->LowMemory - TsegSize, TsegSize, TRUE ); } else { - PlatformAddMemoryRangeHob (BASE_1MB, LowerMemorySize); + PlatformAddMemoryRangeHob (BASE_1MB, PlatformInfoHob->LowMemory); } =20 // @@ -1195,9 +1219,10 @@ PlatformQemuInitializeRamForS3 ( // Make sure the TSEG area that we reported as a reserved memory res= ource // cannot be used for reserved memory allocations. // + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); TsegSize =3D PlatformInfoHob->Q35TsegMbytes * SIZE_1MB; BuildMemoryAllocationHob ( - PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob) - TsegSize, + PlatformInfoHob->LowMemory - TsegSize, TsegSize, EfiReservedMemoryType ); diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/P= latformInitLib/Platform.c index 3e13c5d4b34f..9ab0342fd8c0 100644 --- a/OvmfPkg/Library/PlatformInitLib/Platform.c +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c @@ -128,7 +128,6 @@ PlatformMemMapInitialization ( { UINT64 PciIoBase; UINT64 PciIoSize; - UINT32 TopOfLowRam; UINT64 PciExBarBase; UINT32 PciBase; UINT32 PciSize; @@ -150,7 +149,7 @@ PlatformMemMapInitialization ( return; } =20 - TopOfLowRam =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); PciExBarBase =3D 0; if (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { // @@ -158,11 +157,11 @@ PlatformMemMapInitialization ( // the base of the 32-bit PCI host aperture. // PciExBarBase =3D PcdGet64 (PcdPciExpressBaseAddress); - ASSERT (TopOfLowRam <=3D PciExBarBase); + ASSERT (PlatformInfoHob->LowMemory <=3D PciExBarBase); ASSERT (PciExBarBase <=3D MAX_UINT32 - SIZE_256MB); PciBase =3D (UINT32)(PciExBarBase + SIZE_256MB); } else { - ASSERT (TopOfLowRam <=3D PlatformInfoHob->Uc32Base); + ASSERT (PlatformInfoHob->LowMemory <=3D PlatformInfoHob->Uc32Base); PciBase =3D PlatformInfoHob->Uc32Base; } =20 diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index 3d8375320dcb..41d186986ba8 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -271,7 +271,8 @@ PublishPeiMemory ( UINT32 S3AcpiReservedMemoryBase; UINT32 S3AcpiReservedMemorySize; =20 - LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob= ); + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); + LowerMemorySize =3D PlatformInfoHob->LowMemory; if (PlatformInfoHob->SmmSmramRequire) { // // TSEG is chipped from the end of low RAM --=20 2.39.0 -=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 (#98675): https://edk2.groups.io/g/devel/message/98675 Mute This Topic: https://groups.io/mt/96328403/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- From nobody Tue May 14 05:10:47 2024 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+98674+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+98674+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673957797; cv=none; d=zohomail.com; s=zohoarc; b=RbPmkIMEQxaQIr1bO4QoKjdfgZREmbz1nfZynA2PowFB/iMDyNfgn46M9NZD5vaqkffd1LG7OEJ7b6iTWBgwVwQ/cVgCK7nbhcEFsyebc2VtF4e2vcQ5Wr//8tnLpvzp58s8g/ZyaIh3BXxdW7/opLIidZfQENQ67wXLYniWHo4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673957797; 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=cRbdeeaLVADwl9zLGqdKP+ftxH6+T+pEJ3JzcqeM9EM=; b=GQEScLioaTJOhFBfmB5U6dIgUZLTcj8V4KHZ9rQIySEW38kvXbJUrXa4LOP3/CsdnGlvtxOa3Y8tYWGnK5H5qn9VVv1Djo2ir9tzK6UqoPx3mm+HDQ4cl3TJeEZZA9BINAmKYfS09u3CwBso3QcTEs32Immcme+qAnWXCUrW2Nk= 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+98674+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 1673957797046780.3257687207646; Tue, 17 Jan 2023 04:16:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id bjSIYY1788612xl0ZHwdyn7b; Tue, 17 Jan 2023 04:16:36 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.194533.1673957795521916184 for ; Tue, 17 Jan 2023 04:16:35 -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-191-wEVvJwb6OuGV0f8oA1lZ_w-1; Tue, 17 Jan 2023 07:16:33 -0500 X-MC-Unique: wEVvJwb6OuGV0f8oA1lZ_w-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6194B85C6E0; Tue, 17 Jan 2023 12:16:33 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F00B21121315; Tue, 17 Jan 2023 12:16:32 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0107E1801ABD; Tue, 17 Jan 2023 13:16:30 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Ard Biesheuvel , Pawel Polawski , Jordan Justen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v4 3/5] OvmfPkg/PlatformInitLib: Add PlatformAddHobCB Date: Tue, 17 Jan 2023 13:16:27 +0100 Message-Id: <20230117121629.2149112-4-kraxel@redhat.com> In-Reply-To: <20230117121629.2149112-1-kraxel@redhat.com> References: <20230117121629.2149112-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 0badK4wTKTMqY3gnfGdlnejyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673957796; bh=7PxxNChxOKuolmYV3y/ugSzQ25vqIJCH03k9vNAuLVQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=HuyqmYDovSHl4/A2iJla3IEgk5i6jXR7n2wAiXmRDpE1WeE1vwcwa8nkZNmlJPvSXPq e7w+Bah1lKK/GyEva/OaPWdCJmOQCqlQVCZVnQ1dfENfrbVw49mNnjDCA2Eavi1fdqHlV SXIUY0klKyRSR3Yn5k/tWdtxFSUp5HRwbJ8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673957798708100005 Content-Type: text/plain; charset="utf-8"; x-default="true" Add PlatformAddHobCB() callback function for use with PlatformScanE820(). It adds HOBs for high memory and reservations (low memory is handled elsewhere because there are some special cases to consider). This replaces calls to PlatformScanOrAdd64BitE820Ram() with AddHighHobs =3D TRUE. Write any actions done (adding HOBs, skip unknown types) to the firmware log with INFO loglevel. Also remove PlatformScanOrAdd64BitE820Ram() which is not used any more. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 185 +++++--------------- 1 file changed, 47 insertions(+), 138 deletions(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index dfaa05a1c24f..c626fc49cf6c 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -112,143 +112,6 @@ PlatformQemuUc32BaseInitialization ( } } =20 -/** - Iterate over the RAM entries in QEMU's fw_cfg E820 RAM map that start ou= tside - of the 32-bit address range. - - Find the highest exclusive >=3D4GB RAM address, or produce memory resour= ce - descriptor HOBs for RAM entries that start at or above 4GB. - - @param[out] MaxAddress If MaxAddress is NULL, then PlatformScanOrAdd64B= itE820Ram() - produces memory resource descriptor HOBs for RAM - entries that start at or above 4GB. - - Otherwise, MaxAddress holds the highest exclusive - >=3D4GB RAM address on output. If QEMU's fw_cfg = E820 - RAM map contains no RAM entry that starts outsid= e of - the 32-bit address range, then MaxAddress is exa= ctly - 4GB on output. - - @retval EFI_SUCCESS The fw_cfg E820 RAM map was found and proces= sed. - - @retval EFI_PROTOCOL_ERROR The RAM map was found, but its size wasn't a - whole multiple of sizeof(EFI_E820_ENTRY64). = No - RAM entry was processed. - - @return Error codes from QemuFwCfgFindFile(). No RAM - entry was processed. -**/ -STATIC -EFI_STATUS -PlatformScanOrAdd64BitE820Ram ( - IN BOOLEAN AddHighHob, - OUT UINT64 *LowMemory OPTIONAL, - OUT UINT64 *MaxAddress OPTIONAL - ) -{ - EFI_STATUS Status; - FIRMWARE_CONFIG_ITEM FwCfgItem; - UINTN FwCfgSize; - EFI_E820_ENTRY64 E820Entry; - UINTN Processed; - - Status =3D QemuFwCfgFindFile ("etc/e820", &FwCfgItem, &FwCfgSize); - if (EFI_ERROR (Status)) { - return Status; - } - - if (FwCfgSize % sizeof E820Entry !=3D 0) { - return EFI_PROTOCOL_ERROR; - } - - if (LowMemory !=3D NULL) { - *LowMemory =3D 0; - } - - if (MaxAddress !=3D NULL) { - *MaxAddress =3D BASE_4GB; - } - - QemuFwCfgSelectItem (FwCfgItem); - for (Processed =3D 0; Processed < FwCfgSize; Processed +=3D sizeof E820E= ntry) { - QemuFwCfgReadBytes (sizeof E820Entry, &E820Entry); - DEBUG (( - DEBUG_VERBOSE, - "%a: Base=3D0x%Lx Length=3D0x%Lx Type=3D%u\n", - __FUNCTION__, - E820Entry.BaseAddr, - E820Entry.Length, - E820Entry.Type - )); - if (E820Entry.Type =3D=3D EfiAcpiAddressRangeMemory) { - if (AddHighHob && (E820Entry.BaseAddr >=3D BASE_4GB)) { - UINT64 Base; - UINT64 End; - - // - // Round up the start address, and round down the end address. - // - Base =3D ALIGN_VALUE (E820Entry.BaseAddr, (UINT64)EFI_PAGE_SIZE); - End =3D (E820Entry.BaseAddr + E820Entry.Length) & - ~(UINT64)EFI_PAGE_MASK; - if (Base < End) { - PlatformAddMemoryRangeHob (Base, End); - DEBUG (( - DEBUG_VERBOSE, - "%a: PlatformAddMemoryRangeHob [0x%Lx, 0x%Lx)\n", - __FUNCTION__, - Base, - End - )); - } - } - - if (MaxAddress || LowMemory) { - UINT64 Candidate; - - Candidate =3D E820Entry.BaseAddr + E820Entry.Length; - if (MaxAddress && (Candidate > *MaxAddress)) { - *MaxAddress =3D Candidate; - DEBUG (( - DEBUG_VERBOSE, - "%a: MaxAddress=3D0x%Lx\n", - __FUNCTION__, - *MaxAddress - )); - } - - if (LowMemory && (Candidate > *LowMemory) && (Candidate < BASE_4GB= )) { - *LowMemory =3D Candidate; - DEBUG (( - DEBUG_VERBOSE, - "%a: LowMemory=3D0x%Lx\n", - __FUNCTION__, - *LowMemory - )); - } - } - } else if (E820Entry.Type =3D=3D EfiAcpiAddressRangeReserved) { - if (AddHighHob) { - DEBUG (( - DEBUG_INFO, - "%a: Reserved: Base=3D0x%Lx Length=3D0x%Lx\n", - __FUNCTION__, - E820Entry.BaseAddr, - E820Entry.Length - )); - BuildResourceDescriptorHob ( - EFI_RESOURCE_MEMORY_RESERVED, - 0, - E820Entry.BaseAddr, - E820Entry.Length - ); - } - } - } - - return EFI_SUCCESS; -} - typedef VOID (*E820_SCAN_CALLBACK) ( EFI_E820_ENTRY64 *E820Entry, EFI_HOB_PLATFORM_INFO *PlatformInfoHob @@ -304,6 +167,52 @@ PlatformGetLowMemoryCB ( } } =20 +/** + Create HOBs for reservations and RAM (except low memory). +**/ +STATIC VOID +PlatformAddHobCB ( + IN EFI_E820_ENTRY64 *E820Entry, + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + UINT64 Base, End; + + Base =3D E820Entry->BaseAddr; + End =3D E820Entry->BaseAddr + E820Entry->Length; + + switch (E820Entry->Type) { + case EfiAcpiAddressRangeMemory: + if (Base >=3D BASE_4GB) { + // + // Round up the start address, and round down the end address. + // + Base =3D ALIGN_VALUE (Base, (UINT64)EFI_PAGE_SIZE); + End =3D End & ~(UINT64)EFI_PAGE_MASK; + if (Base < End) { + DEBUG ((DEBUG_INFO, "%a: HighMemory [0x%Lx, 0x%Lx)\n", __FUNCTIO= N__, Base, End-1)); + PlatformAddMemoryRangeHob (Base, End); + } + } + + break; + case EfiAcpiAddressRangeReserved: + BuildResourceDescriptorHob (EFI_RESOURCE_MEMORY_RESERVED, 0, Base, E= nd); + DEBUG ((DEBUG_INFO, "%a: Reserved [0x%Lx, 0x%Lx)\n", __FUNCTION__, B= ase, End-1)); + break; + default: + DEBUG (( + DEBUG_WARN, + "%a: Type %u [0x%Lx, 0x%Lx) (NOT HANDLED)\n", + __FUNCTION__, + E820Entry->Type, + Base, + End-1 + )); + break; + } +} + /** Iterate over the entries in QEMU's fw_cfg E820 RAM map, call the passed callback for each entry. @@ -1049,7 +958,7 @@ PlatformQemuInitializeRam ( // entries. Otherwise, create a single memory HOB with the flat >=3D4GB // memory size read from the CMOS. // - Status =3D PlatformScanOrAdd64BitE820Ram (TRUE, NULL, NULL); + Status =3D PlatformScanE820 (PlatformAddHobCB, PlatformInfoHob); if (EFI_ERROR (Status)) { UpperMemorySize =3D PlatformGetSystemMemorySizeAbove4gb (); if (UpperMemorySize !=3D 0) { --=20 2.39.0 -=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 (#98674): https://edk2.groups.io/g/devel/message/98674 Mute This Topic: https://groups.io/mt/96328402/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- From nobody Tue May 14 05:10:47 2024 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+98678+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+98678+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673957800; cv=none; d=zohomail.com; s=zohoarc; b=LM3/QRIgPZdNI4tkXnV1nP4Opcinjw3pUJJJvAt0kdb49FieDUfYKtbnewP9Z8YjSu/T2SqGIqCv6soG8ynweR0XVSvSR5bUly2hkI1imex4sogmylre/u3BacozKo/QnbuJuPGKuQehVG863kkkCswcwm2JCKiooy3D0XTtpYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673957800; 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=UVfsK+sMntz644enEmUT2OOL8IlCXoKiQ+rEPmfDm84=; b=DxaHUs4xpIV88MzDM2Z4IDs6wrF46w7YmoE93pMm7hb0pWGWXPucTVonCpV6zaAcgNPaxh9TTofeB89Qf2RxCMuhCvvuh9+H+7BZXKSikPOYc9HYIUkzkZuiYeZl09Jxn9mSwdte0588e6+sHofLxL5zUo9SiVPEaP7O7MKA604= 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+98678+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 1673957800080662.1279257535924; Tue, 17 Jan 2023 04:16:40 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id arAeYY1788612xp5BPL3SYEr; Tue, 17 Jan 2023 04:16:39 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.194535.1673957798911350131 for ; Tue, 17 Jan 2023 04:16:39 -0800 X-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-591-3CXc4kqeN1mHpBv0FR2gkA-1; Tue, 17 Jan 2023 07:16:35 -0500 X-MC-Unique: 3CXc4kqeN1mHpBv0FR2gkA-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 C281A2A59566; Tue, 17 Jan 2023 12:16:34 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B5B32026D4B; Tue, 17 Jan 2023 12:16:34 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 047091801ABE; Tue, 17 Jan 2023 13:16:30 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Ard Biesheuvel , Pawel Polawski , Jordan Justen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v4 4/5] OvmfPkg/PlatformInitLib: Add PlatformReservationConflictCB Date: Tue, 17 Jan 2023 13:16:28 +0100 Message-Id: <20230117121629.2149112-5-kraxel@redhat.com> In-Reply-To: <20230117121629.2149112-1-kraxel@redhat.com> References: <20230117121629.2149112-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: tuN0JCSU6o6OGHuitewKANInx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673957799; bh=wLzfvU3dLz3KbKkupbM3hkGO360b5kNoUg/9aI6vJQg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=WwJH/oe1279R4IgcC6rSeARWS+ILWEcn5tLClBZt4XMth4XYo509j7+EpS8KsYjPOWu zvrIJfgx09rfMTTaPrwoOKthmoHFlBToyC5IjEZ47AdQ35kjZWrCo2ML3qgjCSICPehX1 cRBF0AwrjZc5gYmpIfomPv0hT2QIbLJzWzQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673957800705100018 Content-Type: text/plain; charset="utf-8"; x-default="true" Add PlatformReservationConflictCB() callback function for use with PlatformScanE820(). It checks whenever the 64bit PCI MMIO window overlaps with a reservation from qemu. If so move down the MMIO window to resolve the conflict. Write any actions done (moving mmio window) to the firmware log with INFO loglevel. This happens on (virtual) AMD machines with 1TB address space, because the AMD IOMMU uses an address window just below 1TB. Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4251 Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 45 +++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index c626fc49cf6c..1ce692e77ecb 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -213,6 +213,50 @@ PlatformAddHobCB ( } } =20 +/** + Check whenever the 64bit PCI MMIO window overlaps with a reservation + from qemu. If so move down the MMIO window to resolve the conflict. + + This happens on (virtual) AMD machines with 1TB address space, + because the AMD IOMMU uses an address window just below 1TB. +**/ +STATIC VOID +PlatformReservationConflictCB ( + IN EFI_E820_ENTRY64 *E820Entry, + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + UINT64 IntersectionBase; + UINT64 IntersectionEnd; + UINT64 NewBase; + + IntersectionBase =3D MAX ( + E820Entry->BaseAddr, + PlatformInfoHob->PcdPciMmio64Base + ); + IntersectionEnd =3D MIN ( + E820Entry->BaseAddr + E820Entry->Length, + PlatformInfoHob->PcdPciMmio64Base + + PlatformInfoHob->PcdPciMmio64Size + ); + + if (IntersectionBase >=3D IntersectionEnd) { + return; // no overlap + } + + NewBase =3D E820Entry->BaseAddr - PlatformInfoHob->PcdPciMmio64Size; + NewBase =3D NewBase & ~(PlatformInfoHob->PcdPciMmio64Size - 1); + + DEBUG (( + DEBUG_INFO, + "%a: move mmio: 0x%Lx =3D> %Lx\n", + __FUNCTION__, + PlatformInfoHob->PcdPciMmio64Base, + NewBase + )); + PlatformInfoHob->PcdPciMmio64Base =3D NewBase; +} + /** Iterate over the entries in QEMU's fw_cfg E820 RAM map, call the passed callback for each entry. @@ -650,6 +694,7 @@ PlatformDynamicMmioWindow ( DEBUG ((DEBUG_INFO, "%a: MMIO Space 0x%Lx (%Ld GB)\n", __func__, Mmi= oSpace, RShiftU64 (MmioSpace, 30))); PlatformInfoHob->PcdPciMmio64Size =3D MmioSpace; PlatformInfoHob->PcdPciMmio64Base =3D AddrSpace - MmioSpace; + PlatformScanE820 (PlatformReservationConflictCB, PlatformInfoHob); } else { DEBUG ((DEBUG_INFO, "%a: using classic mmio window\n", __func__)); } --=20 2.39.0 -=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 (#98678): https://edk2.groups.io/g/devel/message/98678 Mute This Topic: https://groups.io/mt/96328407/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- From nobody Tue May 14 05:10:47 2024 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+98677+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+98677+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673957799; cv=none; d=zohomail.com; s=zohoarc; b=iuihr4N94CHFSYTWYcHAUUZLjJ0FEBVYPFTlurQiAGm7vXcWULAZ8EsNpQohjI50FUQ6R4XLZZEuqScIF2fVjILiHVPLhWyL3y5XZG6hj/2FqUKrNosW2sHReYIbo6CsI/tTI2+clBLGCiGkJJoflngTeohLJ6ZaQfsbruUK1Vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673957799; 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=EjS5NgPHL2HkYX8Zcv2cTt+dDLy1hM+sENIw+p2KLcc=; b=QVIevEXA4d0+om1cMtckwMg+zcAgVpWtmLn8Yr/DUX4ziExCCv8NAKqppSuq1LpuPeGo5Muh+P8M3JMV3XyJDkYsJnujz1flQhw+FMidPBUBrYp1H0mKbbhs2Y+P8klsN+T5qxmzZajM/pAIFmJr+1394RfN80cil9HFLvCQsdg= 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+98677+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 1673957799129819.4128305732829; Tue, 17 Jan 2023 04:16:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id YClsYY1788612xHz5CejhysU; Tue, 17 Jan 2023 04:16:38 -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.web11.194671.1673957797904287433 for ; Tue, 17 Jan 2023 04:16:38 -0800 X-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-422-ruGLapq8PRa0-s_SD2EMzg-1; Tue, 17 Jan 2023 07:16:35 -0500 X-MC-Unique: ruGLapq8PRa0-s_SD2EMzg-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E32911C07554; Tue, 17 Jan 2023 12:16:34 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A621BC15BA0; Tue, 17 Jan 2023 12:16:34 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 07F991801ABF; Tue, 17 Jan 2023 13:16:30 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Ard Biesheuvel , Pawel Polawski , Jordan Justen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v4 5/5] OvmfPkg/PlatformInitLib: reorder PlatformQemuUc32BaseInitialization Date: Tue, 17 Jan 2023 13:16:29 +0100 Message-Id: <20230117121629.2149112-6-kraxel@redhat.com> In-Reply-To: <20230117121629.2149112-1-kraxel@redhat.com> References: <20230117121629.2149112-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: KlOUemR2LsqXg5J2kBWVr00fx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673957798; bh=aPL7JTgtaR4cud6TkxdbqdRmMCV9G1NmSnOmy9LqdQs=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=WizUW5M9L3Bak12wz0+jHPaRuuy3hZ3XM4UXPAFrAgYo6/klajsjvAZw9qj6rl/R2/G VutFBE02Uc1DLYJVw6jPhoVKXY5uLTuOQZcPoYWmdw1ZvREbUbCeADYy6iZGAiS+ocJGM B1Ux7F+N7nQOvQ6q5xVI+y9w6UBoBjGGvAM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673957800708100020 Content-Type: text/plain; charset="utf-8"; x-default="true" First handle the cases which do not need know the value of PlatformInfoHob->LowMemory (microvm and cloudhv). Then call PlatformGetSystemMemorySizeBelow4gb() to get LowMemory. Finally handle the cases (q35 and pc) which need to look at LowMemory, Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index 1ce692e77ecb..d6984ee96eb4 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -55,8 +55,15 @@ PlatformQemuUc32BaseInitialization ( return; } =20 + if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { + PlatformInfoHob->Uc32Size =3D CLOUDHV_MMIO_HOLE_SIZE; + PlatformInfoHob->Uc32Base =3D CLOUDHV_MMIO_HOLE_ADDRESS; + return; + } + + PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); + if (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { - PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); ASSERT (PcdGet64 (PcdPciExpressBaseAddress) <=3D MAX_UINT32); ASSERT (PcdGet64 (PcdPciExpressBaseAddress) >=3D PlatformInfoHob->LowM= emory); =20 @@ -78,19 +85,12 @@ PlatformQemuUc32BaseInitialization ( return; } =20 - if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { - PlatformInfoHob->Uc32Size =3D CLOUDHV_MMIO_HOLE_SIZE; - PlatformInfoHob->Uc32Base =3D CLOUDHV_MMIO_HOLE_ADDRESS; - return; - } - ASSERT (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_82441_DEVICE_ID); // // On i440fx, start with the [LowerMemorySize, 4GB) range. Make sure one // variable MTRR suffices by truncating the size to a whole power of two, // while keeping the end affixed to 4GB. This will round the base up. // - PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob); PlatformInfoHob->Uc32Size =3D GetPowerOfTwo32 ((UINT32)(SIZE_4GB - Platf= ormInfoHob->LowMemory)); PlatformInfoHob->Uc32Base =3D (UINT32)(SIZE_4GB - PlatformInfoHob->Uc32S= ize); // --=20 2.39.0 -=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 (#98677): https://edk2.groups.io/g/devel/message/98677 Mute This Topic: https://groups.io/mt/96328405/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-