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 4ABD7941BF6 for ; Fri, 4 Aug 2023 19:13:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=CdQ7XHBNjXXU3g3rxBEGcLjAGEgI3Rq62WS/OyO7UF8=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1691176390; v=1; b=OixXRzV4fJtSMpKF18ocdT+CmxAIXiQic2h0317AZe+OasXVo37uFS4CT4uQlU6MC9oW4lWF KTGQPsnPKq2vo4qZAB08dLQarGQ+Ro1lPmXorjQrdKw/b4y9vBfqjoo18Dc6A0yMwDzpXpgGgGE zUAb3JLvwJlKB7r2dFPsQkFQ= X-Received: by 127.0.0.2 with SMTP id eCWIYY7687511xKaEGrII27n; Fri, 04 Aug 2023 12:13:10 -0700 X-Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) by mx.groups.io with SMTP id smtpd.web11.5608.1691176389371267022 for ; Fri, 04 Aug 2023 12:13:09 -0700 X-Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-5844bb9923eso28056067b3.0 for ; Fri, 04 Aug 2023 12:13:09 -0700 (PDT) X-Gm-Message-State: mD0s8xkXf3gTUejZLjPmAv0Ax7686176AA= X-Google-Smtp-Source: AGHT+IEUjUqcc/rm4GOa0F9IB+00NAomKRBB1FcHZEVKUDv2bflDcmromN1UN0W2Pjt/eznbOwt9uO00NJ9AGl0663E= X-Received: by 2002:a0d:d842:0:b0:57a:6bf0:2100 with SMTP id a63-20020a0dd842000000b0057a6bf02100mr3254072ywe.1.1691176387560; Fri, 04 Aug 2023 12:13:07 -0700 (PDT) MIME-Version: 1.0 References: <88dd0aaaa5fa6f6750515fe1441c167c5501947a.1691054931.git.chitralekha.ck@intel.com> In-Reply-To: <88dd0aaaa5fa6f6750515fe1441c167c5501947a.1691054931.git.chitralekha.ck@intel.com> From: "Mike Maslenkin" Date: Fri, 4 Aug 2023 22:12:31 +0300 Message-ID: Subject: Re: [edk2-devel] [PATCH v3] MdeModulePkg: AllocatePages for TranslateBmpToGopBlt To: devel@edk2.groups.io, chitralekha.ck@intel.com Cc: Ray Ni , Zhichao Gao , Ashraf Ali S , Chinni B Duggapu 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,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: 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=OixXRzV4; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.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 Very nice, that functional changes were separated. But, as far as I remember, Pedro noticed that AllocatePages() takes number of pages, not a bytes. So, the change could be as: *GopBlt =3D AllocatePages (EFI_SIZE_TO_PAGES(*GopBltSize)); But I I would like you to pay special attention that this change breaks a previous contract. AllocatePages() requires FreePages() to free memory, and currently all consumers of TranslateBmpToGopBlt() expect memory was allocated in pool and call FreePool() to release this buf= fer: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Library/DxeCapsu= leLibFmp/DxeCapsuleLib.c#L439 https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Application/Caps= uleApp/CapsuleApp.c#L96 https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Tige= rlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspSaPolicyInit= Lib.c#L176 So why don't you want to allocate enough memory and pass this pointer to TranslateBmpToGopBlt(). As I can see there are some places where it has been done in that way (thus I was not able to find where buffer is released) : https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Whis= keylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c#L= 133 https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Come= tlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c#L13= 3 On Fri, Aug 4, 2023 at 9:08=E2=80=AFPM chitralekha ck wrote: > > https://bugzilla.tianocore.org/show_bug.cgi?id=3D4507 > AllocatePool limits to allocate memory of 64 KB at most in PEI Phase. > AllocatePool() is being avoided due to its 64k allocation size limit > when the library is incorporated into a PEI component. > > Cc: Ray Ni > Cc: Zhichao Gao > Cc: Ashraf Ali S > Cc: Chinni B Duggapu > Signed-off-by: chitralekha ck > --- > MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/Mde= ModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > index c5e885d7a6..a7ebcd1d65 100644 > --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c > @@ -52,7 +52,7 @@ const BMP_IMAGE_HEADER mBmpImageHeaderTemplate =3D { > /** > Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt bu= ffer > is passed in a GopBlt buffer will be allocated by this routine using > - EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it w= ill be > + EFI_BOOT_SERVICES.AllocatePages(). If a GopBlt buffer is passed in it = will be > used if it is big enough. > > @param[in] BmpImage Pointer to BMP file. > @@ -312,7 +312,7 @@ TranslateBmpToGopBlt ( > // > DEBUG ((DEBUG_INFO, "Bmp Support: Allocating 0x%X bytes of memory\n"= , BltBufferSize)); > *GopBltSize =3D (UINTN)BltBufferSize; > - *GopBlt =3D AllocatePool (*GopBltSize); > + *GopBlt =3D AllocatePages (*GopBltSize); > IsAllocated =3D TRUE; > if (*GopBlt =3D=3D NULL) { > return RETURN_OUT_OF_RESOURCES; > -- > 2.38.1.windows.1 > > > >=20 > > -=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 (#107585): https://edk2.groups.io/g/devel/message/107585 Mute This Topic: https://groups.io/mt/100551576/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-