From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1789978003C for ; Mon, 29 Jan 2024 19:53:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Uho5VilwwbA7N8XWms8ZrVKxm2kNxD+5cQXb8Zcz6F8=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706558038; v=1; b=KUfKTQHPJOnahBowZIGabTMSfFiFYKS/kqiUEbx/9EcsuVjWqhamRK2BjSAdlqg+n4VKql4d MMWzeD2RbiC6zxHSTIu6SwZ1+2qZMapuhcY7j5ih6wl5Y8HnviSYF7KtxorypTJ/lGHkBx0jFdS NxUWumO/8Sp267aKAHl3yiFI= X-Received: by 127.0.0.2 with SMTP id vIfHYY7687511xSgAxoClk16; Mon, 29 Jan 2024 11:53:58 -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.427.1706558038102562457 for ; Mon, 29 Jan 2024 11:53:58 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-cUHMyAAOPf2HELIEfvESNQ-1; Mon, 29 Jan 2024 14:53:51 -0500 X-MC-Unique: cUHMyAAOPf2HELIEfvESNQ-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7EBA1C0432C; Mon, 29 Jan 2024 19:53:50 +0000 (UTC) X-Received: from [10.39.192.97] (unknown [10.39.192.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 305B62026D66; Mon, 29 Jan 2024 19:53:49 +0000 (UTC) Message-ID: Date: Mon, 29 Jan 2024 20:53:48 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [Patch v2 1/2] MdeModulePkg/Core/Dxe: Initialize GCD before RT memory allocations To: devel@edk2.groups.io, michael.d.kinney@intel.com Cc: Liming Gao , Aaron Li , Liu Yun , Andrew Fish References: <20240129034514.1898-1-michael.d.kinney@intel.com> <20240129034514.1898-2-michael.d.kinney@intel.com> From: "Laszlo Ersek" In-Reply-To: <20240129034514.1898-2-michael.d.kinney@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Ol4BMvbfr6cpmWA63PhYqY77x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=KUfKTQHP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 1/29/24 04:45, Michael D Kinney wrote: > Update the DxeMain initialization order to initialize GCD > services before any runtime allocations are performed. This > is required to prevent runtime data fragmentation when the > UEFI System Table and UEFI Runtime Service Table are allocated > before both the memory and GCD services are initialized. >=20 > Cc: Liming Gao > Cc: Aaron Li > Cc: Liu Yun > Cc: Andrew Fish > Signed-off-by: Michael D Kinney > --- > MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 23 ++++++++++++++--------- > MdeModulePkg/Core/Dxe/Image/Image.c | 1 - > 2 files changed, 14 insertions(+), 10 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/= Dxe/DxeMain/DxeMain.c > index 0e0f9769b99d..17d510a287e5 100644 > --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > @@ -276,6 +276,18 @@ DxeMain ( > =20 > MemoryProfileInit (HobStart); > =20 > + // > + // Start the Image Services. > + // > + Status =3D CoreInitializeImageServices (HobStart); > + ASSERT_EFI_ERROR (Status); > + > + // > + // Initialize the Global Coherency Domain Services > + // > + Status =3D CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, Me= moryLength); > + ASSERT_EFI_ERROR (Status); > + > // > // Allocate the EFI System Table and EFI Runtime Service Table from Ef= iRuntimeServicesData > // Use the templates to initialize the contents of the EFI System Tabl= e and EFI Runtime Services Table > @@ -289,16 +301,9 @@ DxeMain ( > gDxeCoreST->RuntimeServices =3D gDxeCoreRT; > =20 > // > - // Start the Image Services. > + // Update DXE Core Loaded Image Protocol with allocated UEFI System Ta= ble > // > - Status =3D CoreInitializeImageServices (HobStart); > - ASSERT_EFI_ERROR (Status); > - > - // > - // Initialize the Global Coherency Domain Services > - // > - Status =3D CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, Me= moryLength); > - ASSERT_EFI_ERROR (Status); > + gDxeCoreLoadedImage->SystemTable =3D gDxeCoreST; > =20 > // > // Call constructor for all libraries > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/= Image/Image.c > index 6bc3a549ae5e..3fc74eb9fd6b 100644 > --- a/MdeModulePkg/Core/Dxe/Image/Image.c > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c > @@ -222,7 +222,6 @@ CoreInitializeImageServices ( > Image->ImageBasePage =3D DxeCoreImageBaseAddress; > Image->NumberOfPages =3D (UINTN)(EFI_SIZE_TO_PAGES ((UINTN)(DxeCore= ImageLength))); > Image->Tpl =3D gEfiCurrentTpl; > - Image->Info.SystemTable =3D gDxeCoreST; > Image->Info.ImageBase =3D (VOID *)(UINTN)DxeCoreImageBaseAddress; > Image->Info.ImageSize =3D DxeCoreImageLength; > =20 Reviewed-by: Laszlo Ersek -=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 (#114741): https://edk2.groups.io/g/devel/message/114741 Mute This Topic: https://groups.io/mt/104025661/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-