Hi Benjamin
May I know what the problem in coreboot is?

Thanks


From: Liu, Linus
Sent: Tuesday, December 10, 2024 1:42 PM
To: Benjamin Doron <benjamin.doro...@gmail.com>; devel@edk2.groups.io
Cc: Dong, Guo <guo.d...@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, 
James <james...@intel.com>; Guo, Gua <gua....@intel.com>; Chiu, Chasel 
<chasel.c...@intel.com>
Subject: RE: UPL: UefiPayload depends on FIT FDT, but Platform Init has no 
reason to load it

Add Chasel.


From: Benjamin Doron 
<benjamin.doro...@gmail.com<mailto:benjamin.doro...@gmail.com>>
Sent: Tuesday, December 10, 2024 11:28 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Dong, Guo <guo.d...@intel.com<mailto:guo.d...@intel.com>>; Rhodes, Sean 
<sean@starlabs.systems<mailto:sean@starlabs.systems>>; Lu, James 
<james...@intel.com<mailto:james...@intel.com>>; Liu, Linus 
<linus....@intel.com<mailto:linus....@intel.com>>; Guo, Gua 
<gua....@intel.com<mailto:gua....@intel.com>>
Subject: UPL: UefiPayload depends on FIT FDT, but Platform Init has no reason 
to load it

Hi,

In 
https://github.com/tianocore/edk2/blob/a0ac7cf/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c#L220,
 UefiPayload parses its own UPL FIT's FDT to determine where the other FVs can 
be found (if you follow the references backwards, you'll see that 
gUniversalPayloadBaseGuid HOBs come from `upl-images@<addr>`. I don't love this 
design, but the alternative is to have Platform Init copy in the `images` node 
from the FIT FDT to the UPL FDT, which may not be any better.

The problem is that currently, Platform Init needs to have hardcoded logic to 
load the entire .FIT file to where the entrypoint image points. See below:

FDT dump of UPL FIT:
images {
    tianocore {
        description = "Uefi Universal Payload";
        project = "tianocore";
        arch = "x86";
        type = "flat-binary";
        producer = "intel";
        data-offset = <0x00001000>;
        data-size = <0x00016000>;
        reloc-start = <0x00012000>;
        entry-start = <0x00000000 0x00807c98>;
        load = <0x00000000 0x00800000>;
    };
    // more images here
};

UefiPayloadPkg/UniversalPayloadBuild.py:

        RunCommand (
            "GenFw --rebase 0x{:02X} -o {} {} ".format (
              fit_image_info_header.LoadAddr + fit_image_info_header.DataOffset,
              TargetRebaseFile,
              TargetRebaseFile,
            ))

So, the entrypoint is supposed to be located 0x800000 + 0x1000, not 0x800000. 
The first 0x1000 is the FDT, but a Platform Init simply complying with the FIT 
spec does not know that. We would have this problem in coreboot.

To fix this issue, I propose we emit another 'image' into the FIT's FDT, called 
"upl-fit-fdt". Then, we can shift the entrypoint's load value back where it 
should be (0x1000 greater than it is now), and platform init will copy it 
without needing hardcoded logic.
(I'm aware that a patch would be needed somewhere in UefiPayload - I believe 
FitUniversalPayloadEntry but it might be FitParserLib - to make sure that this 
image or this classification of images are not turned into FV HOBs inside EDK2)

What do you think?

Best regards,
Benjamin


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120893): https://edk2.groups.io/g/devel/message/120893
Mute This Topic: https://groups.io/mt/110019777/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to