public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: 'Laszlo Ersek' <lersek@redhat.com>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH 1/2] OvmfPkg: disable build-time relocation for DXEFV modules
Date: Mon, 3 Jul 2017 15:08:18 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D750C3D@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1990275e-e537-54c9-cbc3-2712c4abcbcc@redhat.com>

Laszlo:
  PI spec has no limitation that XIP is for PEIM only. DXE driver may be built as XIP for other purpose. For example, if DXE driver image address is not zero, DxeCore will try allocating the preferred address and load it. In another case, once DXE driver is relocated at build time, DxeCore will dispatch it and start it directly without loading, it may save boot performance. 

Thanks
Liming
>-----Original Message-----
>From: Laszlo Ersek [mailto:lersek@redhat.com]
>Sent: Sunday, July 02, 2017 4:36 AM
>To: Gao, Liming <liming.gao@intel.com>; edk2-devel-01 <edk2-
>devel@lists.01.org>
>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Justen, Jordan L
><jordan.l.justen@intel.com>
>Subject: Re: [PATCH 1/2] OvmfPkg: disable build-time relocation for DXEFV
>modules
>
>Liming,
>
>On 06/29/17 05:32, Gao, Liming wrote:	
>> Laszlo:
>>   LMFA feature doesn't do PE image rebase at build time. Only XIP
>>   module needs to be rebased at build time.
>
>Thank you for the clarification.
>
>In this case, BaseTools/GenFv has a bug.
>
>Namely, if LMFA does not need build-time relocation for DXE-phase
>modules, then *what exactly* needs build-time relocation for DXE-phase
>modules?
>
>This is the code in "BaseTools/Source/C/GenFv/GenFvInternalLib.c":
>
>  3537        case EFI_FV_FILETYPE_DRIVER:
>  3538        case EFI_FV_FILETYPE_DXE_CORE:
>  3539          //
>  3540          // Check if section-alignment and file-alignment match or not
>  3541          //
>  3542          if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr-
>>Pe32.OptionalHeader.FileAlignment)) {
>  3543            //
>  3544            // Xip module has the same section alignment and file alignment.
>  3545            //
>  3546            Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-
>Alignment do not match : %s.", FileName);
>  3547            return EFI_ABORTED;
>  3548          }
>  3549          NewPe32BaseAddress = XipBase + (UINTN)
>CurrentPe32Section.Pe32Section + CurSecHdrSize - (UINTN)FfsFile;
>  3550          break;
>
>According to the Platform Init 1.6 spec,
>
>- 2.1.4.1 Firmware File Types:
>
>  [...] the type EFI_FV_FILETYPE_DRIVER indicates that the file is a DXE
>  driver and is interesting to the DXE Dispatcher.
>
>- 2.1.4.1.4 EFI_FV_FILETYPE_DRIVER:
>
>  The file type EFI_FV_FILETYPE_DRIVER denotes a file that contains a
>  PE32 image that can be dispatched by the DXE Dispatcher.
>
>So, *when exactly* is it the case that a module dispatched by the DXE
>core *needs* build-time relocation?
>
>I claim that the answer is "never", and therefore the above code is a
>bug in BaseTools/GenFv.
>
>I thought that this build-time relocation was needed by the LMFA
>feature, but you confirmed above that LMFA does not need it. So, it
>looks like *nothing at all* needs build-time relocation for
>EFI_FV_FILETYPE_DRIVER, because the modules dispatched by the DXE core
>are *never* XIP modules.
>
>Do you agree?
>
>>   For this case, OvmfPkg DXEFV doesn't require to run as XIP. So, it
>>   doesn't require rebase. I agree this change.
>
>This change (for the OVMF FDF files) is only valid if the above
>BaseTools/GenFv code is also valid. In other words, *if* there is at
>least one valid reason for rebasing DXE modules at build-time.
>
>If there is *no* such reason, then the OVMF FDF files do not need this
>change, and GenFv must be fixed instead.
>
>So: if LMFA is *not* the one reason that justifies the rebasing for
>EFI_FV_FILETYPE_DRIVER, then *what* is the reason? In my commit message
>for the OVMF FDF change, I have to refer to that exact reason.
>
>Thanks
>Laszlo

  reply	other threads:[~2017-07-03 15:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 22:06 [PATCH 0/2] OvmfPkg: refresh -D E1000_ENABLE (Intel proprietary driver for e1000) Laszlo Ersek
2017-06-28 22:06 ` [PATCH 1/2] OvmfPkg: disable build-time relocation for DXEFV modules Laszlo Ersek
2017-06-29  3:32   ` Gao, Liming
2017-07-01 20:36     ` Laszlo Ersek
2017-07-03 15:08       ` Gao, Liming [this message]
2017-07-03 17:53         ` Laszlo Ersek
2017-07-05 17:48     ` Jordan Justen
2017-07-05 17:55       ` Laszlo Ersek
2017-06-28 22:06 ` [PATCH 2/2] OvmfPkg: update -D E1000_ENABLE from Intel PROEFI v.07 to BootUtil v.22 Laszlo Ersek
2017-06-30  1:20   ` Wu, Jiaxin
2017-07-01 20:22     ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14D750C3D@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox