From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web11.817.1641866390068883790 for ; Mon, 10 Jan 2022 17:59:51 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 11 Jan 2022 09:59:43 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Dandan Bi'" References: <20220107193612.1350-1-stacy.howell@intel.com> In-Reply-To: <20220107193612.1350-1-stacy.howell@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIXSBNZGVNb2R1bGVQa2dcQ29yZUR4ZTogQWxsb3cgRFhFIERyaXZlcnMgdG8gdXNlIHVudGVzdGVkIG1lbW9yeQ==?= Date: Tue, 11 Jan 2022 09:59:47 +0800 Message-ID: <01ca01d8068e$e98aa590$bc9ff0b0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIs+xFC0ABOah1IIY4Lnv5LhQdu76uzJ0rQ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Stacy: This fix covers the case with AllocateAddress allocation type. I agree this fix. Reviewed-by: Liming Gao Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Stacy Howell > =B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA1=D4=C28=C8=D5 3:36 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Stacy Howell ; Dandan Bi > ; Liming Gao > =D6=F7=CC=E2: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Driver= s to > use untested memory >=20 > REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3D3795 > CC: Dandan Bi > CC: Liming Gao >=20 > Updated CoreInternalAllocatePages() to call PromoteMemoryResource() and > re-attempt the allocation if unable to convert the specified memory range >=20 > Signed-off-by: Stacy Howell > --- > MdeModulePkg/Core/Dxe/Mem/Page.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c > b/MdeModulePkg/Core/Dxe/Mem/Page.c > index 47d4c5d92e..cc0b90ac0d 100644 > --- a/MdeModulePkg/Core/Dxe/Mem/Page.c > +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c > @@ -1417,6 +1417,20 @@ CoreInternalAllocatePages ( > Status =3D CoreConvertPages (Start, NumberOfPages, MemoryType); > } >=20 > + if (EFI_ERROR (Status)) { > + // > + // If requested memory region is unavailable it may be untested > memory > + // Attempt to promote memory resources, then re-attempt the > allocation > + // > + if (PromoteMemoryResource ()) { > + if (NeedGuard) { > + Status =3D CoreConvertPagesWithGuard (Start, NumberOfPages, > MemoryType); > + } else { > + Status =3D CoreConvertPages (Start, NumberOfPages, MemoryType); > + } > + } > + } > + > Done: > CoreReleaseMemoryLock (); >=20 > -- > 2.32.0.windows.2 >=20 >=20 >=20 >=20 >=20