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 4F4C77803CC for ; Wed, 11 Dec 2024 05:58:02 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=uyTX3lKjOsDHYoAoDcQoLuDXhxDNlRkKFtBHGWDMF48=; c=relaxed/simple; d=groups.io; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID:MIME-Version: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:Content-Transfer-Encoding; s=20240830; t=1733896681; v=1; x=1734155880; b=cyCSCwxVh5cC+jo0+zm9kjaPlgwvgAs0ixYo3oFB/2YNMJSTzq7zPa+jDCKuO64UuPUdq1ok Y4MVxHB1ZvvXJyDP1nViBY7GY+T5mbqYXl67ViPep0gdlYdHbeTWHYN83REi+71BtXN2j7tcO/p m5pcs1D6G+jYbvj7771gpHy0b9g8iDqocvztwSDghK375tozJcKSUoQt1h1LqauByTma6R+qDSE cm+vW1h8/tlKS0DiLW0YdTfcHyLVcPiVsUMGAJa6ZrSQbsCrxjA6J3dtHFcNivhI4Yu1+hWKB7f VL5PgJhx2iyfPZXb7ioswtFcQQ/VOHd7pWMkCmUobJiJg== X-Received: by 127.0.0.2 with SMTP id MF0cYY7687511xjNaaEDGDDF; Tue, 10 Dec 2024 21:58:00 -0800 X-Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by mx.groups.io with SMTP id smtpd.web10.4339.1733896679500742809 for ; Tue, 10 Dec 2024 21:57:59 -0800 X-Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7b6952e2257so491510485a.1 for ; Tue, 10 Dec 2024 21:57:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU0IbDl1ZQXSHaG41KOzl8kAsd34bw+tg/TJHTOi/VohcQDKMLl005l95o1Ni1IY3O4g2xHLg==@edk2.groups.io X-Gm-Message-State: bkfQiLiTkdzG8tpqwjfXToGYx7686176AA= X-Gm-Gg: ASbGncufZG47A2azQS/dh/j+5Xw9n8K0smnixSrZctRmRF/f+zCsDQld+RFj7uTmqqx Sn/Ua2qeYlFwYi1f7XcwaYeayq0/ISt7PS7vcwbg8nqplgxy6sN7iSI/+Mks4HQzG6uAbrV/Wjx CWnvSpoEjBwXUCkKWX7H3qS5vHXa/WAv76MI5fHHmqALRIKC4acsW8hI8QsRVyTojKKltOEW+Sb Dn6Uarsjmu9LI2gGU3imdLDjjP78Wun7lldKoRUZdIo2/THNUQtmJnOH2kDxgrwQxtG+vtIWFMn ACfYofj9ohFfcIo1hH9edN8HatpR X-Google-Smtp-Source: AGHT+IHE5XzvTnDAnmVAHre4aYQgK/1Q9wKfgdFdRN+okXMXb0G6XIbD84Vbe8xodOGAVi985gs/og== X-Received: by 2002:a05:620a:1b84:b0:7b6:d710:2282 with SMTP id af79cd13be357-7b6eb4d9984mr371327985a.49.1733896678376; Tue, 10 Dec 2024 21:57:58 -0800 (PST) X-Received: from [127.0.0.1] (ip5-91.eyrkonaeac04.dialup.ca.telus.com. [209.29.168.91]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b6c4ed20e8sm415138685a.63.2024.12.10.21.57.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Dec 2024 21:57:57 -0800 (PST) Date: Wed, 11 Dec 2024 00:57:55 -0500 From: "Benjamin Doron via groups.io" To: "Liu, Linus" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Rhodes, Sean" , "Lu, James" , "Guo, Gua" , "Chiu, Chasel" Subject: Re: [edk2-devel] UPL: UefiPayload depends on FIT FDT, but Platform Init has no reason to load it In-Reply-To: References: Message-ID: <661C2B23-66EC-436C-82D2-6135FA22E0BF@gmail.com> MIME-Version: 1.0 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: Tue, 10 Dec 2024 21:57:59 -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=----UFKYBIDD8U72H9JSBRQI6L6DZTBKYY Content-Transfer-Encoding: 7bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=cyCSCwxV; 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 ------UFKYBIDD8U72H9JSBRQI6L6DZTBKYY Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ah, coreboot wants to load the images individually. And if you check the PE= image base and entrypoint, there's a mismatch of 0x1000, so loading the ti= anocore image to where the "load" property says it should go won't work. In= my email, you can see that the module is rebased to 8M + 4K, but "load" is= set to 8M. I've fixed this issue now, see https://github.com/tianocore/edk2/pull/6382/= commits/90b718c9ba43100ff4dc045d4806683942934d8d. This will keep working fo= r EDK2-based Platform Init, and allow us to support coreboot too. The current plan, as discussed in the UPL meeting today, is to implement su= pport for "/options/upl-images@/image" as defined in the spec in EDK2= , which will tell us where the FVs are without parsing the FIT header. I've= implemented and tested that on coreboot, and I'll push that patch in the m= orning. Best regards, Benjamin On December 10, 2024 9:38:28=E2=80=AFp.m. EST, "Liu, Linus" wrote: >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 ; devel@edk2.groups.io >Cc: Dong, Guo ; Rhodes, Sean ; = Lu, James ; Guo, Gua ; Chiu, Chasel = >Subject: RE: UPL: UefiPayload depends on FIT FDT, but Platform Init has no= reason to load it > >Add Chasel. > > >From: Benjamin Doron > >Sent: Tuesday, December 10, 2024 11:28 AM >To: devel@edk2.groups.io >Cc: Dong, Guo >; Rhodes, Sea= n >; Lu, James >; Liu, Linus >; Guo, Gua > >Subject: UPL: UefiPayload depends on FIT FDT, but Platform Init has no rea= son to load it > >Hi, > >In https://github.com/tianocore/edk2/blob/a0ac7cf/UefiPayloadPkg/UefiPaylo= adEntry/FitUniversalPayloadEntry.c#L220, UefiPayload parses its own UPL FIT= 's FDT to determine where the other FVs can be found (if you follow the ref= erences backwards, you'll see that gUniversalPayloadBaseGuid HOBs come from= `upl-images@`. I don't love this design, but the alternative is to h= ave 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 bel= ow: > >FDT dump of UPL FIT: >images { > tianocore { > description =3D "Uefi Universal Payload"; > project =3D "tianocore"; > arch =3D "x86"; > type =3D "flat-binary"; > producer =3D "intel"; > data-offset =3D <0x00001000>; > data-size =3D <0x00016000>; > reloc-start =3D <0x00012000>; > entry-start =3D <0x00000000 0x00807c98>; > load =3D <0x00000000 0x00800000>; > }; > // more images here >}; > >UefiPayloadPkg/UniversalPayloadBuild.py: > > RunCommand ( > "GenFw --rebase 0x{:02X} -o {} {} ".format ( > fit_image_info_header.LoadAddr + fit_image_info_header.DataO= ffset, > TargetRebaseFile, > TargetRebaseFile, > )) > >So, the entrypoint is supposed to be located 0x800000 + 0x1000, not 0x8000= 00. 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, c= alled "upl-fit-fdt". Then, we can shift the entrypoint's load value back wh= ere it should be (0x1000 greater than it is now), and platform init will co= py it without needing hardcoded logic. >(I'm aware that a patch would be needed somewhere in UefiPayload - I belie= ve FitUniversalPayloadEntry but it might be FitParserLib - to make sure tha= t this image or this classification of images are not turned into FV HOBs i= nside EDK2) > >What do you think? > >Best regards, >Benjamin -=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 (#120894): https://edk2.groups.io/g/devel/message/120894 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- ------UFKYBIDD8U72H9JSBRQI6L6DZTBKYY Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Ah, coreboot wants to load the images individuall= y. And if you check the PE image base and entrypoint, there's a mismatch of= 0x1000, so loading the tianocore image to where the "load" property says i= t should go won't work. In my email, you can see that the module is rebased= to 8M + 4K, but "load" is set to 8M.

I've fixed this issue now, see= https://github.com/tianocore/edk2/pull/6382/= commits/90b718c9ba43100ff4dc045d4806683942934d8d. This will keep workin= g for EDK2-based Platform Init, and allow us to support coreboot too.
The current plan, as discussed in the UPL meeting today, is to implement = support for "/options/upl-images@<addr>/image" as defined in the spec= in EDK2, which will tell us where the FVs are without parsing the FIT head= er. I've implemented and tested that on coreboot, and I'll push that patch = in the morning.

Best regards,
Benjamin
<= br>
On December 10, 2024 9:= 38:28=E2=80=AFp.m. EST, "Liu, Linus" <linus.liu@intel.com> wrote:

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.doron00@gmail.com>; devel@edk2.gr= oups.io
Cc: Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@star= labs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.gu= o@intel.com>; Chiu, Chasel <chasel.chiu@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.doron00@gmail.com>
Sent: Tuesday, December 10, 2024 11:28 AM
To: devel@edk2.groups.io=
Cc: Dong, Guo <guo.dong@int= el.com>; Rhodes, Sean <s= ean@starlabs.systems>; Lu, James <james.lu@intel.com>; Liu, Linus <linus.liu@intel.com>; Guo, Gua <gua.guo@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/UefiPayloadEn= try/FitUniversalPayloadEntry.c#L220, UefiPayload parses its own UPL FIT= 's FDT to determine where the other FVs can be found (if you follow the ref= erences 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 th= e `images` node from the FIT FDT to the UPL FDT, which may not be any bette= r.

 

The problem is that currently, Platform Init needs t= o 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 =3D "Uefi Universal Payload";
        project =3D "tianocore";
        arch =3D "x86";
        type =3D "flat-binary";
        producer =3D "intel";
        data-offset =3D <0x00001000>;
        data-size =3D <0x00016000>;
        reloc-start =3D <0x00012000>;
        entry-start =3D <0x00000000 0x00807c98>;<= br>         load =3D <0x00000000 0x00800000>;
    };
    // more images here
};

UefiPayloadPkg/UniversalPayloadBuild.py:

 

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

 

So, the entrypoint is supposed to be located 0x80000= 0 + 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 p= roblem in coreboot.

 

To fix this issue, I = propose we emit another 'image' into the FIT's FDT, called "upl-fit-fdt". T= hen, we can shift the entrypoint's load value back where it should be (0x10= 00 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 FitParser= Lib - 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:

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

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

_._,_._,_
------UFKYBIDD8U72H9JSBRQI6L6DZTBKYY--