From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3CA63780091 for ; Tue, 10 Dec 2024 03:28:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=uyJwKTJRiiylCtWIsSvV6ZGJcYX6a0FrNwS51HbhtU8=; c=relaxed/simple; d=groups.io; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240830; t=1733801301; v=1; x=1734060499; b=JK3yIcjDUYrkBMrzygFMYeqLHDZa45GfhiS3WfX6U/wHTSN1MOPASCqwYUqgS2oRzwcfUrgO hAjEyM85rC/L48xH9UvRGv4mnBrNs9B6RLehum7os2KBOgoJCzhRMgZXj5NJlLDmT/BkKqqwcxE a91wiU1v72eNlY4dACeCj84uzFw8OCM8yiuCC3a43jxabnguZJemwWSKQWRW90+FcVV15K+opmf SMGW7hCUezNO0OBuyzg2ddPqgzSpFsPIasmasJIjMsXPCL80La5BrP2W8MP0ieaAzUvImvPfsSd 3HczkQGVL/OEbf9IPj9R+HM4zwF4kgkIZXYXKl2+ZkWTQ== X-Received: by 127.0.0.2 with SMTP id V9WVYY7687511xTpXibRoAJX; Mon, 09 Dec 2024 19:28:19 -0800 X-Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by mx.groups.io with SMTP id smtpd.web10.2076.1733801298803291904 for ; Mon, 09 Dec 2024 19:28:18 -0800 X-Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-e3a5125c024so976088276.0 for ; Mon, 09 Dec 2024 19:28:18 -0800 (PST) X-Gm-Message-State: ip31SZTr0QezQkAS2QW4wQwUx7686176AA= X-Gm-Gg: ASbGncv5SGlb/lpHIxxcY8RsldwOUPNYoy2ZCY5VX+SlST/97+vBS+Ip0wJ6sh3TR9R 1zWEhB/klWZGWC3YrAQKMy7hWBCsbBO7+y2w= X-Google-Smtp-Source: AGHT+IFEu7YmdJtAZLWXZiGtnUOvQb5Kzs1OaRMFrdQXaI37NHuWdyJK0TDcx8W4y/wVrC5aCQwpCSiSlh/FsizBt88= X-Received: by 2002:a05:6902:a83:b0:e39:82e7:ffe8 with SMTP id 3f1490d57ef6-e3a0b0bbbb0mr15529811276.12.1733801297750; Mon, 09 Dec 2024 19:28:17 -0800 (PST) MIME-Version: 1.0 From: "Benjamin Doron via groups.io" Date: Mon, 9 Dec 2024 22:28:00 -0500 Message-ID: Subject: [edk2-devel] UPL: UefiPayload depends on FIT FDT, but Platform Init has no reason to load it To: devel@edk2.groups.io Cc: Guo Dong , Sean Rhodes , James Lu , linus.liu@intel.com, Gua Guo 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 Resent-Date: Mon, 09 Dec 2024 19:28:19 -0800 Resent-From: benjamin.doron00@gmail.com Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: multipart/alternative; boundary="00000000000076b52c0628e2123d" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=JK3yIcjD; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --00000000000076b52c0628e2123d Content-Type: text/plain; charset="UTF-8" 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@`. 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 (#120887): https://edk2.groups.io/g/devel/message/120887 Mute This Topic: https://groups.io/mt/110019777/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- --00000000000076b52c0628e2123d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

In https://github.com/tianocore/edk2/blob/a0ac7cf/U= efiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c#L220, UefiPay= load 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 gUniv= ersalPayloadBaseGuid 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 need= s to have hardcoded logic to load the entire .FIT file to where the entrypo= int image points. See below:

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

UefiPayloadPkg/= UniversalPayloadBuild.py:

=C2=A0 =C2=A0 =C2=A0= =C2=A0 RunCommand (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Gen= Fw --rebase 0x{:02X} -o {} {} ".format (
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 fit_image_info_header.LoadAddr + fit_image_info_he= ader.DataOffset,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Target= RebaseFile,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TargetRebas= eFile,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ))

So, the entrypoint is supposed to be located 0x800000 + 0x1000, no= t 0x800000. The first 0x1000 is the FDT, but a Platform Init simply complyi= ng with the FIT spec does not know that. We would have this problem in core= boot.

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 co= py it without needing hardcoded logic.

(I'm aw= are that a patch would be needed somewhere in UefiPayload - I believe FitUn= iversalPayloadEntry but it might be FitParserLib - to make sure that this i= mage or this classification of images are not turned into FV HOBs inside ED= K2)

What do you think?

Best regards,
Benjamin
_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#120887) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--00000000000076b52c0628e2123d--