[edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address

Jeff Brasen via groups.io posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Dxe/DxeMain.inf   | 1 +
MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++-
MdeModulePkg/MdeModulePkg.dec       | 7 +++++++
3 files changed, 11 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by Jeff Brasen via groups.io 1 year, 4 months ago
Add PCD to control if modules with start addresses in PE/COFF > 0x100000
attempt to load at specified address.
If a module has an address in this range and there is untested memory
DxeCore will attempt to promote all memory to tested which bypasses any
memory testing that would occur later in boot.

There are several existing AARCH64 option roms that have base addresses
of 0x180000000.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 MdeModulePkg/Core/Dxe/DxeMain.inf   | 1 +
 MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++-
 MdeModulePkg/MdeModulePkg.dec       | 7 +++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 35d5bf0dee..16871f2021 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -187,6 +187,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask                   ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard                           ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth           ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad                   ## CONSUMES
 
 # [Hob]
 # RESOURCE_DESCRIPTOR   ## CONSUMES
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 9dbfb2a1fa..6bc3a549ae 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -680,7 +680,9 @@ CoreLoadPeImage (
                    );
       }
     } else {
-      if ((Image->ImageContext.ImageAddress >= 0x100000) || Image->ImageContext.RelocationsStripped) {
+      if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image->ImageContext.ImageAddress) >= 0x100000)) ||
+          Image->ImageContext.RelocationsStripped)
+      {
         Status = CoreAllocatePages (
                    AllocateAddress,
                    (EFI_MEMORY_TYPE)(Image->ImageContext.ImageCodeMemoryType),
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 95dd077e19..6fd1bd7b8f 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1116,6 +1116,13 @@
   # @Prompt Output MMIO address of Trace Hub message.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UINT64|0x30001058
 
+  ## Indicates if images with large load address (>0x100000) should attempted to load at specified location.
+  #  If enabled, attempt to allocate at specfied location will be attempted with a fall back to any address.
+  #   TRUE  - UEFI will attempt to load at specified location.<BR>
+  #   FALSE - UEFI will load at any address<BR>
+  # @Prompt Enable large address image loading.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOOLEAN|0x30001059
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   ## Dynamic type PCD can be registered callback function for Pcd setting action.
   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104902): https://edk2.groups.io/g/devel/message/104902
Mute This Topic: https://groups.io/mt/98916659/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by Jeff Brasen via groups.io 1 year, 1 month ago
Any  thoughts/feedback on this patch?

Thanks,
Jeff


> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Monday, May 15, 2023 5:49 PM
> To: devel@edk2.groups.io
> Cc: jian.j.wang@intel.com; gaoliming@byosoft.com.cn; dandan.bi@intel.com;
> Jeff Brasen <jbrasen@nvidia.com>; Ashish Singhal
> <ashishsingha@nvidia.com>
> Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with
> large address
> 
> Add PCD to control if modules with start addresses in PE/COFF > 0x100000
> attempt to load at specified address.
> If a module has an address in this range and there is untested memory
> DxeCore will attempt to promote all memory to tested which bypasses any
> memory testing that would occur later in boot.
> 
> There are several existing AARCH64 option roms that have base addresses of
> 0x180000000.
> 
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> Reviewed-by: Ashish Singhal <ashishsingha@nvidia.com>
> ---
>  MdeModulePkg/Core/Dxe/DxeMain.inf   | 1 +
>  MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++-
>  MdeModulePkg/MdeModulePkg.dec       | 7 +++++++
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf
> b/MdeModulePkg/Core/Dxe/DxeMain.inf
> index 35d5bf0dee..16871f2021 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.inf
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
> @@ -187,6 +187,7 @@
>    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask
> ## CONSUMES
>    gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard                           ##
> CONSUMES
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth
> ## CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad
> ## CONSUMES
> 
>  # [Hob]
>  # RESOURCE_DESCRIPTOR   ## CONSUMES
> diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c
> b/MdeModulePkg/Core/Dxe/Image/Image.c
> index 9dbfb2a1fa..6bc3a549ae 100644
> --- a/MdeModulePkg/Core/Dxe/Image/Image.c
> +++ b/MdeModulePkg/Core/Dxe/Image/Image.c
> @@ -680,7 +680,9 @@ CoreLoadPeImage (
>                     );
>        }
>      } else {
> -      if ((Image->ImageContext.ImageAddress >= 0x100000) || Image-
> >ImageContext.RelocationsStripped) {
> +      if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image-
> >ImageContext.ImageAddress) >= 0x100000)) ||
> +          Image->ImageContext.RelocationsStripped)
> +      {
>          Status = CoreAllocatePages (
>                     AllocateAddress,
>                     (EFI_MEMORY_TYPE)(Image-
> >ImageContext.ImageCodeMemoryType),
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1116,6 +1116,13 @@
>    # @Prompt Output MMIO address of Trace Hub message.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UIN
> T64|0x30001058
> 
> +  ## Indicates if images with large load address (>0x100000) should
> attempted to load at specified location.
> +  #  If enabled, attempt to allocate at specfied location will be attempted with
> a fall back to any address.
> +  #   TRUE  - UEFI will attempt to load at specified location.<BR>
> +  #   FALSE - UEFI will load at any address<BR>
> +  # @Prompt Enable large address image loading.
> +
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOOL
> EAN|0
> + x30001059
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd setting
> action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum
> number of callback function
> --
> 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108497): https://edk2.groups.io/g/devel/message/108497
Mute This Topic: https://groups.io/mt/98916659/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by gaoliming via groups.io 1 year ago
Jeff:
  I have no better solution than your proposal for this problem. So, this
patch is good to me. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: Jeff Brasen <jbrasen@nvidia.com>
> 发送时间: 2023年9月12日 4:14
> 收件人: devel@edk2.groups.io
> 抄送: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> dandan.bi@intel.com; Ashish Singhal <ashishsingha@nvidia.com>
> 主题: RE: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with
> large address
> 
> Any  thoughts/feedback on this patch?
> 
> Thanks,
> Jeff
> 
> 
> > -----Original Message-----
> > From: Jeff Brasen <jbrasen@nvidia.com>
> > Sent: Monday, May 15, 2023 5:49 PM
> > To: devel@edk2.groups.io
> > Cc: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> dandan.bi@intel.com;
> > Jeff Brasen <jbrasen@nvidia.com>; Ashish Singhal
> > <ashishsingha@nvidia.com>
> > Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with
> > large address
> >
> > Add PCD to control if modules with start addresses in PE/COFF > 0x100000
> > attempt to load at specified address.
> > If a module has an address in this range and there is untested memory
> > DxeCore will attempt to promote all memory to tested which bypasses any
> > memory testing that would occur later in boot.
> >
> > There are several existing AARCH64 option roms that have base addresses
> of
> > 0x180000000.
> >
> > Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> > Reviewed-by: Ashish Singhal <ashishsingha@nvidia.com>
> > ---
> >  MdeModulePkg/Core/Dxe/DxeMain.inf   | 1 +
> >  MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++-
> >  MdeModulePkg/MdeModulePkg.dec       | 7 +++++++
> >  3 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf
> > b/MdeModulePkg/Core/Dxe/DxeMain.inf
> > index 35d5bf0dee..16871f2021 100644
> > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf
> > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
> > @@ -187,6 +187,7 @@
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask
> > ## CONSUMES
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
> ##
> > CONSUMES
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth
> > ## CONSUMES
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad
> > ## CONSUMES
> >
> >  # [Hob]
> >  # RESOURCE_DESCRIPTOR   ## CONSUMES
> > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c
> > b/MdeModulePkg/Core/Dxe/Image/Image.c
> > index 9dbfb2a1fa..6bc3a549ae 100644
> > --- a/MdeModulePkg/Core/Dxe/Image/Image.c
> > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c
> > @@ -680,7 +680,9 @@ CoreLoadPeImage (
> >                     );
> >        }
> >      } else {
> > -      if ((Image->ImageContext.ImageAddress >= 0x100000) || Image-
> > >ImageContext.RelocationsStripped) {
> > +      if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image-
> > >ImageContext.ImageAddress) >= 0x100000)) ||
> > +          Image->ImageContext.RelocationsStripped)
> > +      {
> >          Status = CoreAllocatePages (
> >                     AllocateAddress,
> >                     (EFI_MEMORY_TYPE)(Image-
> > >ImageContext.ImageCodeMemoryType),
> > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f
> > 100644
> > --- a/MdeModulePkg/MdeModulePkg.dec
> > +++ b/MdeModulePkg/MdeModulePkg.dec
> > @@ -1116,6 +1116,13 @@
> >    # @Prompt Output MMIO address of Trace Hub message.
> >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UIN
> > T64|0x30001058
> >
> > +  ## Indicates if images with large load address (>0x100000) should
> > attempted to load at specified location.
> > +  #  If enabled, attempt to allocate at specfied location will be
attempted
> with
> > a fall back to any address.
> > +  #   TRUE  - UEFI will attempt to load at specified location.<BR>
> > +  #   FALSE - UEFI will load at any address<BR>
> > +  # @Prompt Enable large address image loading.
> > +
> > +
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOO
> L
> > EAN|0
> > + x30001059
> > +
> >  [PcdsFixedAtBuild, PcdsPatchableInModule]
> >    ## Dynamic type PCD can be registered callback function for Pcd
setting
> > action.
> >    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum
> > number of callback function
> > --
> > 2.25.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109380): https://edk2.groups.io/g/devel/message/109380
Mute This Topic: https://groups.io/mt/101812485/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by Jeff Brasen via groups.io 11 months, 2 weeks ago
Anything else needed to get this merged would as the November stable release is coming up.

Thanks,
Jeff

> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Friday, October 6, 2023 11:23 PM
> To: Jeff Brasen <jbrasen@nvidia.com>; devel@edk2.groups.io
> Cc: jian.j.wang@intel.com; dandan.bi@intel.com; Ashish Singhal
> <ashishsingha@nvidia.com>; michael.d.kinney@intel.com
> Subject: 回复: [PATCH] MdeModulePkg/DxeCore: Allow relocation of
> images with large address
> 
> External email: Use caution opening links or attachments
> 
> 
> Jeff:
>   I have no better solution than your proposal for this problem. So, this patch
> is good to me. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: Jeff Brasen <jbrasen@nvidia.com>
> > 发送时间: 2023年9月12日 4:14
> > 收件人: devel@edk2.groups.io
> > 抄送: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> > dandan.bi@intel.com; Ashish Singhal <ashishsingha@nvidia.com>
> > 主题: RE: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images
> with
> > large address
> >
> > Any  thoughts/feedback on this patch?
> >
> > Thanks,
> > Jeff
> >
> >
> > > -----Original Message-----
> > > From: Jeff Brasen <jbrasen@nvidia.com>
> > > Sent: Monday, May 15, 2023 5:49 PM
> > > To: devel@edk2.groups.io
> > > Cc: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> > dandan.bi@intel.com;
> > > Jeff Brasen <jbrasen@nvidia.com>; Ashish Singhal
> > > <ashishsingha@nvidia.com>
> > > Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images
> > > with large address
> > >
> > > Add PCD to control if modules with start addresses in PE/COFF >
> > > 0x100000 attempt to load at specified address.
> > > If a module has an address in this range and there is untested
> > > memory DxeCore will attempt to promote all memory to tested which
> > > bypasses any memory testing that would occur later in boot.
> > >
> > > There are several existing AARCH64 option roms that have base
> > > addresses
> > of
> > > 0x180000000.
> > >
> > > Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> > > Reviewed-by: Ashish Singhal <ashishsingha@nvidia.com>
> > > ---
> > >  MdeModulePkg/Core/Dxe/DxeMain.inf   | 1 +
> > >  MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++-
> > >  MdeModulePkg/MdeModulePkg.dec       | 7 +++++++
> > >  3 files changed, 11 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf
> > > b/MdeModulePkg/Core/Dxe/DxeMain.inf
> > > index 35d5bf0dee..16871f2021 100644
> > > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf
> > > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
> > > @@ -187,6 +187,7 @@
> > >    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask
> > > ## CONSUMES
> > >    gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
> > ##
> > > CONSUMES
> > >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth
> > > ## CONSUMES
> > > +  gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad
> > > ## CONSUMES
> > >
> > >  # [Hob]
> > >  # RESOURCE_DESCRIPTOR   ## CONSUMES
> > > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c
> > > b/MdeModulePkg/Core/Dxe/Image/Image.c
> > > index 9dbfb2a1fa..6bc3a549ae 100644
> > > --- a/MdeModulePkg/Core/Dxe/Image/Image.c
> > > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c
> > > @@ -680,7 +680,9 @@ CoreLoadPeImage (
> > >                     );
> > >        }
> > >      } else {
> > > -      if ((Image->ImageContext.ImageAddress >= 0x100000) || Image-
> > > >ImageContext.RelocationsStripped) {
> > > +      if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image-
> > > >ImageContext.ImageAddress) >= 0x100000)) ||
> > > +          Image->ImageContext.RelocationsStripped)
> > > +      {
> > >          Status = CoreAllocatePages (
> > >                     AllocateAddress,
> > >                     (EFI_MEMORY_TYPE)(Image-
> > > >ImageContext.ImageCodeMemoryType),
> > > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > > b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f
> > > 100644
> > > --- a/MdeModulePkg/MdeModulePkg.dec
> > > +++ b/MdeModulePkg/MdeModulePkg.dec
> > > @@ -1116,6 +1116,13 @@
> > >    # @Prompt Output MMIO address of Trace Hub message.
> > >
> > >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UI
> N
> > > T64|0x30001058
> > >
> > > +  ## Indicates if images with large load address (>0x100000) should
> > > attempted to load at specified location.
> > > +  #  If enabled, attempt to allocate at specfied location will be
> attempted
> > with
> > > a fall back to any address.
> > > +  #   TRUE  - UEFI will attempt to load at specified location.<BR>
> > > +  #   FALSE - UEFI will load at any address<BR>
> > > +  # @Prompt Enable large address image loading.
> > > +
> > > +
> > >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BO
> O
> > L
> > > EAN|0
> > > + x30001059
> > > +
> > >  [PcdsFixedAtBuild, PcdsPatchableInModule]
> > >    ## Dynamic type PCD can be registered callback function for Pcd
> setting
> > > action.
> > >    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum
> > > number of callback function
> > > --
> > > 2.25.1
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110333): https://edk2.groups.io/g/devel/message/110333
Mute This Topic: https://groups.io/mt/102280269/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by Laszlo Ersek 11 months, 2 weeks ago
On 10/30/23 18:27, Jeff Brasen via groups.io wrote:
> Anything else needed to get this merged would as the November stable release is coming up.

Queued via <https://github.com/tianocore/edk2/pull/4984>.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110412): https://edk2.groups.io/g/devel/message/110412
Mute This Topic: https://groups.io/mt/102280269/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by Laszlo Ersek 11 months, 2 weeks ago
On 10/31/23 14:42, Laszlo Ersek wrote:
> On 10/30/23 18:27, Jeff Brasen via groups.io wrote:
>> Anything else needed to get this merged would as the November stable release is coming up.
> 
> Queued via <https://github.com/tianocore/edk2/pull/4984>.

Commit aa8431822b7631659586247b1e50d21126f3cfcc.




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110426): https://edk2.groups.io/g/devel/message/110426
Mute This Topic: https://groups.io/mt/102280269/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address
Posted by Jeff Brasen via groups.io 1 year ago
Anyone have any thoughts on this patch?

Thanks,
Jeff


> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Monday, September 11, 2023 2:14 PM
> To: devel@edk2.groups.io
> Cc: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> dandan.bi@intel.com; Ashish Singhal <ashishsingha@nvidia.com>
> Subject: RE: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images
> with large address
> 
> Any  thoughts/feedback on this patch?
> 
> Thanks,
> Jeff
> 
> 
> > -----Original Message-----
> > From: Jeff Brasen <jbrasen@nvidia.com>
> > Sent: Monday, May 15, 2023 5:49 PM
> > To: devel@edk2.groups.io
> > Cc: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> > dandan.bi@intel.com; Jeff Brasen <jbrasen@nvidia.com>; Ashish Singhal
> > <ashishsingha@nvidia.com>
> > Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images
> with
> > large address
> >
> > Add PCD to control if modules with start addresses in PE/COFF >
> > 0x100000 attempt to load at specified address.
> > If a module has an address in this range and there is untested memory
> > DxeCore will attempt to promote all memory to tested which bypasses
> > any memory testing that would occur later in boot.
> >
> > There are several existing AARCH64 option roms that have base
> > addresses of 0x180000000.
> >
> > Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> > Reviewed-by: Ashish Singhal <ashishsingha@nvidia.com>
> > ---
> >  MdeModulePkg/Core/Dxe/DxeMain.inf   | 1 +
> >  MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++-
> >  MdeModulePkg/MdeModulePkg.dec       | 7 +++++++
> >  3 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf
> > b/MdeModulePkg/Core/Dxe/DxeMain.inf
> > index 35d5bf0dee..16871f2021 100644
> > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf
> > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
> > @@ -187,6 +187,7 @@
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask
> > ## CONSUMES
> >    gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard                           ##
> > CONSUMES
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth
> > ## CONSUMES
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad
> > ## CONSUMES
> >
> >  # [Hob]
> >  # RESOURCE_DESCRIPTOR   ## CONSUMES
> > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c
> > b/MdeModulePkg/Core/Dxe/Image/Image.c
> > index 9dbfb2a1fa..6bc3a549ae 100644
> > --- a/MdeModulePkg/Core/Dxe/Image/Image.c
> > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c
> > @@ -680,7 +680,9 @@ CoreLoadPeImage (
> >                     );
> >        }
> >      } else {
> > -      if ((Image->ImageContext.ImageAddress >= 0x100000) || Image-
> > >ImageContext.RelocationsStripped) {
> > +      if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image-
> > >ImageContext.ImageAddress) >= 0x100000)) ||
> > +          Image->ImageContext.RelocationsStripped)
> > +      {
> >          Status = CoreAllocatePages (
> >                     AllocateAddress,
> >                     (EFI_MEMORY_TYPE)(Image-
> > >ImageContext.ImageCodeMemoryType),
> > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f
> > 100644
> > --- a/MdeModulePkg/MdeModulePkg.dec
> > +++ b/MdeModulePkg/MdeModulePkg.dec
> > @@ -1116,6 +1116,13 @@
> >    # @Prompt Output MMIO address of Trace Hub message.
> >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UI
> N
> > T64|0x30001058
> >
> > +  ## Indicates if images with large load address (>0x100000) should
> > attempted to load at specified location.
> > +  #  If enabled, attempt to allocate at specfied location will be
> > + attempted with
> > a fall back to any address.
> > +  #   TRUE  - UEFI will attempt to load at specified location.<BR>
> > +  #   FALSE - UEFI will load at any address<BR>
> > +  # @Prompt Enable large address image loading.
> > +
> > +
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BO
> OL
> > EAN|0
> > + x30001059
> > +
> >  [PcdsFixedAtBuild, PcdsPatchableInModule]
> >    ## Dynamic type PCD can be registered callback function for Pcd
> > setting action.
> >    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum
> > number of callback function
> > --
> > 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109320): https://edk2.groups.io/g/devel/message/109320
Mute This Topic: https://groups.io/mt/98916659/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-