From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) by mx.groups.io with SMTP id smtpd.web11.2484.1573513067828535786 for ; Mon, 11 Nov 2019 14:57:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=aLIoJpwJ; spf=pass (domain: nvidia.com, ip: 216.228.121.64, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 11 Nov 2019 14:56:45 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 11 Nov 2019 14:57:47 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 11 Nov 2019 14:57:47 -0800 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 11 Nov 2019 22:57:46 +0000 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (104.47.48.58) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 11 Nov 2019 22:57:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hTFTEAXSpQ8eMhTQOiNCLFUF+xT2rD3x9Iitfe7b65AFZa/iHJvNcKiTxFmfpj0IBYiDrvs4faMhEQ4jA7RAhT69ZeTcPm4IXkbKBDoUa/DuOTm55WK6P30TgLK+4d94SsQMIVS7I1PDm91swAlJ3nd1RUImaILATm05GRExIDOIc90TBWMGHvSztkidE2iLbbaCfUy+H90moTg+Hx164HRsR5f6kZ+zqTgLBxfxrGnfH9yBdbKeAr4ucXRUp2gNr14b+DqOqxlMluY2bPSFrktNqJHVh7OL4Mwc6IdK02mvBa3FpbWxvhdoKiPyxU62POLfzOtJYQhTx+G6KjObGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w/eox9WQEuZFOFg0Scgvi/pzWnvvitS03bNVpi28N4Q=; b=jPQiDJi8p1Y7XzQDBaaNJ4RpPYulyzljv7X1BC1RIxRUxuXf0ip/40m4FQp2F/6cXuuU143D3vqqxEjwsVy+plX+0ape6TKcJ8kSdH+GtdKOHPG+kvASNujOxoDRl5a+E8gjLA75HWxAeGGy8FbL6eCxVH9sqyxAo+ZpbdaL7rk7CmM8Sk5MYNSL7R/ek0RtNYrpPyJGhORElVStbsddZv8f9uDQU5d6FwEfLmvKsKml5QPKm+37vse49RPxmXQ1nSZOJXqx5IETMuZUxm/giCzvdYcH9veUErTzSQJhmopnthcpzscGp5719aiA/mwN5Uxcqu/QvH+zh8daFko1hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from BYAPR12MB3462.namprd12.prod.outlook.com (20.178.196.208) by BYAPR12MB3352.namprd12.prod.outlook.com (20.178.55.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Mon, 11 Nov 2019 22:57:44 +0000 Received: from BYAPR12MB3462.namprd12.prod.outlook.com ([fe80::75d1:6f54:3d0:69d8]) by BYAPR12MB3462.namprd12.prod.outlook.com ([fe80::75d1:6f54:3d0:69d8%6]) with mapi id 15.20.2430.027; Mon, 11 Nov 2019 22:57:44 +0000 From: "Jeff Brasen" To: Laszlo Ersek , "Ni, Ray" , "devel@edk2.groups.io" , "afish@apple.com" CC: Ashish Singhal , "Wang, Jian J" , "Wu, Hao A" , "Gao, Zhichao" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Thread-Topic: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Thread-Index: AQHVlD5/488eXaMRxUa5BaRrbDICz6d9WZjRgAAW7wCAAAlggIAA2ZOAgADEX9CAADF4gIAAAGDIgAAFpgCAAK41UIABf7mAgAUfGpA= Date: Mon, 11 Nov 2019 22:57:44 +0000 Message-ID: References: <37D801DD-41E8-452E-9F24-ADF52BFDB676@apple.com> <72ce1d71-2a65-a6c0-1dd8-7628429c5a3c@redhat.com> <746A8D5E-DC45-4D39-9C4D-97A10BE2E0B0@apple.com> <734D49CCEBEEF84792F5B80ED585239D5C35125E@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C352ECA@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C352F7C@SHSMSX104.ccr.corp.intel.com> ,<897d405a-b164-773c-5784-47fb8c4f9040@redhat.com> In-Reply-To: <897d405a-b164-773c-5784-47fb8c4f9040@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jbrasen@nvidia.com; x-originating-ip: [216.228.112.21] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a4652694-7f3a-4cf0-f6c4-08d766fa9075 x-ms-traffictypediagnostic: BYAPR12MB3352:|BYAPR12MB3352: x-ms-exchange-purlcount: 6 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 0218A015FA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(136003)(346002)(376002)(39860400002)(189003)(51444003)(199004)(66066001)(86362001)(3846002)(4326008)(6116002)(66556008)(66476007)(64756008)(66446008)(5660300002)(66946007)(6246003)(45080400002)(55016002)(76116006)(478600001)(74316002)(7736002)(316002)(30864003)(52536014)(2201001)(25786009)(99286004)(110136005)(7696005)(606006)(102836004)(6306002)(236005)(54896002)(9686003)(2906002)(486006)(53546011)(6506007)(76176011)(26005)(71200400001)(966005)(105004)(14454004)(6436002)(2501003)(33656002)(229853002)(256004)(14444005)(186003)(19627405001)(8676002)(54906003)(446003)(8936002)(81156014)(81166006)(71190400001)(476003)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR12MB3352;H:BYAPR12MB3462.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: w3QfVet8AYvud8TK03RgIC/auWhwvPmG5fQTZrKk1eOchsDJV3eWkDbe/tnYxCwQLhsm8kYUa4sYfvPli9jUl648OnyljW9MZEAUeRzCxmsDzLFCMGDMNzR4imXYYqh9mpLT0++bLDO38lBOO02GI0hiTvzkdxUKzWx3hxy3ZtP41f0SU3JFJSBW1rWeAYSPSf/HTsM8ZFlkBSU4dN57tkoEBVqXlUuLBRf+1lOUgB1GgogQlHLB0/PJwI2upJR0WM1Bmb8y2IxdQ8wbB7vudHeaXM+f5Id+uBTmPF6lSY0Swygbus+ssbaqfKNw7tkAq4ZjNZ8GEE0rILjY4mJtQmVoJYkTE1zGtX8cmu0WXwGMB60ComhVUG7a5LnD1DAtDeqg0WB1P36KODSrKLqPO0oi1cdNL3JBfRBPdZjzgxaisu4Q3tkonYo4kHmQ9qmX+YSn5+FnKNdV+TpLCUFz/yOFcpY9VcDLcw1oeBHxs9Q= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a4652694-7f3a-4cf0-f6c4-08d766fa9075 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2019 22:57:44.5922 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EyUaqgRgAIv13KFklfqWQnk79E5QSwMV6fJbjAs86AS4HPgkE0nDXAkc4xGmtNkC8cZEYDeKcUOXNydbEXx4KQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3352 Return-Path: jbrasen@nvidia.com X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1573513005; bh=w/eox9WQEuZFOFg0Scgvi/pzWnvvitS03bNVpi28N4Q=; h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature: ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To: Accept-Language:X-MS-Has-Attach:X-MS-TNEF-Correlator: authentication-results:x-originating-ip:x-ms-publictraffictype: x-ms-office365-filtering-correlation-id:x-ms-traffictypediagnostic: x-ms-exchange-purlcount:x-ms-exchange-transport-forked: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-forefront-prvs:x-forefront-antispam-report:received-spf: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:MIME-Version: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg: Content-Language:Content-Type; b=aLIoJpwJWnXb8zi2mZLcRQkcob8DHojwTX7CSD4V2IRiL+PqgPMQyLm22jxNGsEj4 tk6vOF8MM9BvomFenbhikbIBH/mzNWKAC0b3IbUYLRJrSNYFJoyvrNqhdX8PDEgjsP KrhPW5nRVslQqZH+FJtko/BPp+Gk2/29yAWwmcqK3WvcKsZUGfKAZxMCQAFh+SWIsU VVyl1w0aMNrVO9nUfu7S+VZb29cUYMAIN9TD+NVR9n//WrBWRtCOEZKuB32c33R/ln 7OAQ1Vx+5ZZMs41WqvueEfr3UiGo7n1sQ/tenuggkWYw7GpgyR+gN8kPdc7Jfz5D/q pgIbp4FEdyr0A== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BYAPR12MB34627036641C4FCA00B9CD07CB740BYAPR12MB3462namp_" --_000_BYAPR12MB34627036641C4FCA00B9CD07CB740BYAPR12MB3462namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable If we are concerned about deploying this and breaking builds we could do th= is via a new protocol instead. In that case though we would leave the old d= efault behavior in the code to handle platforms that didn't implement the n= ew protocol, so this might not be the cleanest way to deploy this. We could also look at adding a generic platform boot hook function (either= as a library function or protocol) if we wanted to limit the number of dis= ruption on new customization hooks. Something like EFI_STATUS PlatformBootNotify (CONST EFI_GUID *NotificationType, VOID *Con= textData OPTIONAL) Where Notification type describes where we are that we want platform to po= tentially handle and ContextData is per type caller allocated data that pro= vides additional in/out data. This has the same issue of leaving the curren= t default behavior in place for unsupported types as well as being a less t= han specific function to describe. Thanks, Jeff ________________________________ From: Laszlo Ersek Sent: Friday, November 8, 2019 9:37 AM To: Jeff Brasen ; Ni, Ray ; devel@ed= k2.groups.io ; afish@apple.com Cc: Ashish Singhal ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n On 11/07/19 18:46, Jeff Brasen wrote: > Fixing UiApp seems reasonable, I do think we would want a hook to the pl= atform library in here as the enumeration that occurs in the UiApp is inten= ded to do a full enumeration of the system and there may be platform specif= ics to how that occurs. Fully agreed -- entering UiApp should expose everything bootable in the system, unless (perhaps) PlatformBootManagerLib specifically thinks otherwise. Of course, then we arrive (again) at the problem that a call in UefiBootManagerLib, to a *new* PlatformBootManagerLib API, will break tens of out-of-tree platforms. :) I think that can be prevented, as follows; but it will take quite some tim= e: - introduce the new function declaration in "PlatformBootManagerLib.h", - modify all platforms (in tree and out of tree) to implement (define) the new function, - call the new function from UefiBootManagerLib For some history / background on this kind of problem, I suggest reading through: https://bugzilla.tianocore.org/show_bug.cgi?id=3D982 Thanks, Laszlo > From: Ni, Ray > Sent: Thursday, November 7, 2019 12:21 AM > To: devel@edk2.groups.io; Jeff Brasen ; afish@apple.= com > Cc: Ashish Singhal ; Laszlo Ersek ; Wang, Jian J ; Wu, Hao A ; Gao, Zhichao ; Kinney, Michael D > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumerat= ion > > I treat the issue in this way: > > 1. Platform Boot Manager library does a good job. It doesn't always c= all RefreshAll() API to auto-create the boot options > 2. But UiApp doesn't. It constantly call RefreshAll(). > > Do you think that we can fix UiApp instead? For example, introducing a P= CD to control the boot option refresh behavior? > > Thanks, > Ray > > From: devel@edk2.groups.io > On Behalf Of Jeff Brasen > Sent: Thursday, November 7, 2019 3:02 PM > To: Ni, Ray >; afish@apple.com= > Cc: devel@edk2.groups.io; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Kinney, Michael D > > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumerat= ion > > The issue is there are some auto created options we do not want on our p= latform. > Get Outlook for Android > > ________________________________ > From: Ni, Ray > > Sent: Wednesday, November 6, 2019 11:59:31 PM > To: Jeff Brasen >; afish@a= pple.com > > Cc: devel@edk2.groups.io >; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao,= Zhichao >; Kinney, Mic= hael D > > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumerat= ion > > > Jeff, > > RefreshAllBootOption() only modifies/creates the auto-created boot optio= ns. For the boot options created by platform boot manager library, they sta= y with no one touches. And all auto-created boot options are appended in th= e end of boot option list (through BootOrder). > > > > From: Jeff Brasen > > Sent: Thursday, November 7, 2019 12:13 PM > To: afish@apple.com; Ni, Ray > > Cc: devel@edk2.groups.io; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Kinney, Michael D > > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumerat= ion > > > > As the suggestions below made sense, we updated our platform boot manage= r library to behave in this manner and for normal boots everything works we= ll. However the UiApp and boot maintenance applications in EDK2 also call E= fiBootManagerRefreshAllBootOption() when ever a user goes into the menu whi= ch will re-create the skipped boot options with no place for the platform c= ode to intervene. > > > > What about a solution where we add a new Platform library function that = allows for override of the behavior of BmEnumerateBootOptions? For example,= either a function or protocol that takes the same parameters as this funct= ion and only if it returns NULL then we continue to the default enumeration= code. Or a function call inserted at the end that would modify the load o= ption array after the system does the standard enumeration. > > > > -Jeff > > > > From: afish@apple.com > > Sent: Wednesday, November 6, 2019 9:20 AM > To: Ni, Ray > > Cc: devel@edk2.groups.io; Jeff Brasen >; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Mi= ke Kinney > > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumerat= ion > > > > Ray, > > > > Is there an obvious hook point we could point Jeff and Ashish at? > > > > Long term it would be a good idea to have a Wiki page to give some guida= nce on how to customize the BDS. > > > > Thanks, > > > > Andrew Fish > > > > On Nov 5, 2019, at 9:20 PM, Ni, Ray > wrote: > > > > Andrew, > > I agree with your opinion. > > It's expected that Platform Boot Manager lib calls EfiBootManagerRefresh= AllBootOption() only in full configuration boot path. > > The full configuration boot path is chosen when hardware changes happen.= So it's not expected EfiBootManagerRefresh...() be > called in every boot. > > So you could: > > 1. Delete the auto-created option pointing to LoadFile instance > 2. Create your own one with customized description. > > > > > > From: afish@apple.com > > Sent: Wednesday, November 6, 2019 10:47 AM > To: devel@edk2.groups.io; jbrasen@nvidia.co= m > Cc: Ashish Singhal >; Laszlo Ersek >; Ni, Ray <= ray.ni@intel.com>; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Kinney, Michael D > > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumerat= ion > > > > > > > > On Nov 5, 2019, at 7:34 PM, Jeff Brasen > wrote: > > > > Wouldn't having a variable that we create and delete on every boot put u= nnecessary stress on the SPI-NOR that the variable store lives on? > What about the alternative approach where we allow the platform code to = modify the attributes of the auto created variable to disable it with hidde= n/!active but still match for detection purposes so that it doesn't delete = and recreate the modified variable each boot? That way all the logic on wha= t to disable can still be in the platform code and all the existing logic i= n the boot manager can stay basically the same? > > What changes every boot that forces the variable to need to get modified= ? > > I would assume the NOR driver is smart enough to not update a variable t= hat is not changing. > > The custom BDS could could only create the variable for this device if i= t does not exist. > > [JB] The current flow with no changes in the boot manager would be as fo= llows > > > > 1. Scan for instance of the boot option in the variables > 2. It will not be found, so create a new boot option store it to a va= riable and update BootOrder > 3. Platform code runs creates the options for the boot option it want= s and writes those to variable store > 4. Delete/disable the boot option in the variable store > > > > When you reboot it won't find the variable so 1/2/4 will re-occur > > > > The code that does this (1/2) is EfiBootManagerRefreshAllBootOption in B= mBoot.c > > > > If you modify the variable to disable it with hidden/not active it would= delete that and create a new one as well as the code wouldn't recognize th= at is the same boot option. > > > > If however we modify EfiBootManagerFindLoadOption to not compare the att= ributes (at least allow for differences in active and hidden) then the when= it refreshes every thing it would see the match and not delete/create a ne= w variable in the store and thus we wouldn't have changes every boot. > > > > > > Jeff, > > > > Sorry if I'm a little off on the sequence of things as the platform I wo= rk on day to day has a custom BDS and does not use this library..... I thou= gh the patch changed BmEnumerateBootOptions(), so that is going to change h= ow EfiBootManagerRefreshAllBootOption() works. I'd also point out the patch= as given is invalid as it changed the behavior of the public library API f= or EfiBootManagerRefreshAllBootOption() [1] so for the patch to be valid it= would need to change the comments to reflect the new behavior. This is kin= d of what Laszlo's technical debt comment was about. > > > > I think Laszlo advocated having the BDS platform specific code make sure= the boot variables are in the correct state. That should happen before the= Boot Manager code runs, and it is not clear to me why the Boot Manager co= uld would need to run if you have a valid EFI nvram variable to boot from. > > > > I think the question is how is your use case different than the boot var= iable that Windows installs? If it works kind of the same way then the answ= er is to have the BDS platform specific code write the boot variable. > > > > > > [1] > > /** > > The function creates boot options for all possible bootable medias in = the following order: > > 1. Removable BlockIo - The boot option only points to the r= emovable media > > device, like USB key, DVD, Floppy et= c. > > 2. Fixed BlockIo - The boot option only points to a Fix= ed blockIo device, > > like HardDisk. > > 3. Non-BlockIo SimpleFileSystem - The boot option points to a device s= upporting > > SimpleFileSystem Protocol, but not s= upporting BlockIo > > protocol. > > 4. LoadFile - The boot option points to the media = supporting > > LoadFile protocol. > > Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Be= havior > > > > The function won't delete the boot option not added by itself. > > **/ > > VOID > > EFIAPI > > EfiBootManagerRefreshAllBootOption ( > > VOID > > ); > > > > Thanks, > > > > Andrew Fish > > > > Thanks, > > Andrew Fish > > Thanks, > > Jeff > > ________________________________ > > This email message is for the sole use of the intended recipient(s) and = may contain confidential information. Any unauthorized review, use, disclo= sure or distribution is prohibited. If you are not the intended recipient,= please contact the sender by reply email and destroy all copies of the ori= ginal message. > > ________________________________ > > >=20 > --_000_BYAPR12MB34627036641C4FCA00B9CD07CB740BYAPR12MB3462namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
If we are concerned about deploying this and breaking builds we could do t= his via a new protocol instead. In that case though we would leave the old = default behavior in the code to handle platforms that didn't implement the = new protocol, so this might not be the cleanest way to deploy this.

We could also look at adding a generic platform boot hook function (either= as a library function or protocol) if we wanted to limit the number of dis= ruption on new customization hooks. Something like

EFI_STATUS PlatformBootNotify (CONST EFI_GUID *NotificationType, VOID *Con= textData OPTIONAL)

Where Notification type describes where we are that we want platform to po= tentially handle and ContextData is per type caller allocated data that pro= vides additional in/out data. This has the same issue of leaving the curren= t default behavior in place for unsupported types as well as being a less than specific function to describe.

Thanks,

Jeff



From: Laszlo Ersek <ler= sek@redhat.com>
Sent: Friday, November 8, 2019 9:37 AM
To: Jeff Brasen <jbrasen@nvidia.com>; Ni, Ray <ray.ni@inte= l.com>; devel@edk2.groups.io <devel@edk2.groups.io>; afish@apple.c= om <afish@apple.com>
Cc: Ashish Singhal <ashishsingha@nvidia.com>; Wang, Jian J &l= t;jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhi= chao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@= intel.com>
Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enu= meration
 
On 11/07/19 18:46, Jeff Brasen wrote:
> Fixing UiApp seems reasonable, I do think we would want a hook to the= platform library in here as the enumeration that occurs in the UiApp is in= tended to do a full enumeration of the system and there may be platform spe= cifics to how that occurs.

Fully agreed -- entering UiApp should expose everything bootable in the system, unless (perhaps) PlatformBootManagerLib specifically thinks
otherwise.

Of course, then we arrive (again) at the problem that a call in
UefiBootManagerLib, to a *new* PlatformBootManagerLib API, will break
tens of out-of-tree platforms. :)

I think that can be prevented, as follows; but it will take quite some tim= e:

- introduce the new function declaration in "PlatformBootManagerLib.h= ",
- modify all platforms (in tree and out of tree) to implement (define)
the new function,
- call the new function from UefiBootManagerLib

For some history / background on this kind of problem, I suggest reading through:

  ht= tps://bugzilla.tianocore.org/show_bug.cgi?id=3D982

Thanks,
Laszlo

> From: Ni, Ray <ray.ni@intel.com>
> Sent: Thursday, November 7, 2019 12:21 AM
> To: devel@edk2.groups.io; Jeff Brasen <jbrasen@nvidia.com>; afi= sh@apple.com
> Cc: Ashish Singhal <ashishsingha@nvidia.com>; Laszlo Ersek <= lersek@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao = A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; K= inney, Michael D <michael.d.kinney@intel.com>
> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enume= ration
>
> I treat the issue in this way:
>
>   1.  Platform Boot Manager library does a good job. I= t doesn't always call RefreshAll() API to auto-create the boot options
>   2.  But UiApp doesn't. It constantly call RefreshAll= ().
>
> Do you think that we can fix UiApp instead? For example, introducing = a PCD to control the boot option refresh behavior?
>
> Thanks,
> Ray
>
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <dev= el@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Jeff = Brasen
> Sent: Thursday, November 7, 2019 3:02 PM
> To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; = afish@apple.com<mailto:afish@apple.co= m>
> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ashish S= inghal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>= ;; Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>; = Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>&= gt;; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Ga= o, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>= ;; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kin= ney@intel.com>>
> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enume= ration
>
> The issue is there are some auto created options we do not want on ou= r platform.
> Get Outlook for Android<https://= aka.ms/ghei36>
>
> ________________________________
> From: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>=
> Sent: Wednesday, November 6, 2019 11:59:31 PM
> To: Jeff Brasen <jbrasen@nvidia.com<mailto:jbrasen@nvidia.com&g= t;>; afish@apple.com<mailto:afish@= apple.com> <afish@apple.com<mailto:afish@apple.com>>
> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel= @edk2.groups.io<mailto:devel@edk2.groups.io>>; Ashish Singhal <= ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>; Laszlo E= rsek <lersek@redhat.com<mailto:lersek@redhat.com>>; Wang, Jian = J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Ga= o, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>= ;; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kin= ney@intel.com>>
> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enume= ration
>
>
> Jeff,
>
> RefreshAllBootOption() only modifies/creates the auto-created boot op= tions. For the boot options created by platform boot manager library, they = stay with no one touches. And all auto-created boot options are appended in= the end of boot option list (through BootOrder).
>
>
>
> From: Jeff Brasen <jbrasen@nvidia.com<mailto:jbrasen@nvidia.com= >>
> Sent: Thursday, November 7, 2019 12:13 PM
> To: afish@apple.com<mailto:afis= h@apple.com>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.co= m>>
> Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ashish S= inghal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>= ;; Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>; = Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>&= gt;; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Ga= o, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>= ;; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kin= ney@intel.com>>
> Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enume= ration
>
>
>
> As the suggestions below made sense, we updated our platform boot man= ager library to behave in this manner and for normal boots everything works= well. However the UiApp and boot maintenance applications in EDK2 also cal= l EfiBootManagerRefreshAllBootOption() when ever a user goes into the menu which will re-create the skipped boot= options with no place for the platform code to intervene.
>
>
>
> What about a solution where we add a new Platform library function th= at allows for override of the behavior of BmEnumerateBootOptions? For examp= le, either a function or protocol that takes the same parameters as this fu= nction and only if it returns NULL then we continue to the default enumeration code.  Or a function call ins= erted at the end that would modify the load option array after the system d= oes the standard enumeration.
>
>
>
> -Jeff
>
>
>
> From: afish@apple.com<mailto:af= ish@apple.com> <afish@apple.com<mailto:afish@apple.com>>=
> Sent: Wednesday, November 6, 2019 9:20 AM
> To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>> > Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Jeff Bra= sen <jbrasen@nvidia.com<mailto:jbrasen@nvidia.com>>; Ashish Sin= ghal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>;= Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>>; Wa= ng, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>;= Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao= , Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>= ; Mike Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@int= el.com>>
> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enume= ration
>
>
>
> Ray,
>
>
>
> Is there an obvious hook point we could point Jeff and Ashish at?
>
>
>
> Long term it would be a good idea to have a Wiki page to give some gu= idance on how to customize the BDS.
>
>
>
> Thanks,
>
>
>
> Andrew Fish
>
>
>
> On Nov 5, 2019, at 9:20 PM, Ni, Ray <ray.ni@intel.com<mailto:ra= y.ni@intel.com>> wrote:
>
>
>
> Andrew,
>
> I agree with your opinion.
>
> It's expected that Platform Boot Manager lib calls EfiBootManagerRefr= eshAllBootOption() only in full configuration boot path.
>
> The full configuration boot path is chosen when hardware changes happ= en. So it's not expected EfiBootManagerRefresh...() be
> called in every boot.
>
> So you could:
>
>   1.  Delete the auto-created option pointing to LoadF= ile instance
>   2.  Create your own one with customized description.=
>
>
>
>
>
> From: afish@apple.com<mailto:af= ish@apple.com> <afish@apple.com<mailto:afish@apple.com>>=
> Sent: Wednesday, November 6, 2019 10:47 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; jbrasen@= nvidia.com<mailto:jbrasen@nvidia.c= om>
> Cc: Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha= @nvidia.com>>; Laszlo Ersek <lersek@redhat.com<mailto:lersek@re= dhat.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com&g= t;>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.= com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Ga= o, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>= ;; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kin= ney@intel.com>>
> Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enume= ration
>
>
>
>
>
>
>
> On Nov 5, 2019, at 7:34 PM, Jeff Brasen <jbrasen@nvidia.com<mai= lto:jbrasen@nvidia.com>> wrote:
>
>
>
> Wouldn't having a variable that we create and delete on every boot pu= t unnecessary stress on the SPI-NOR that the variable store lives on?
> What about the alternative approach where we allow the platform code = to modify the attributes of the auto created variable to disable it with hi= dden/!active but still match for detection purposes so that it doesn't dele= te and recreate the modified variable each boot? That way all the logic on what to disable can still be in the = platform code and all the existing logic in the boot manager can stay basic= ally the same?
>
> What changes every boot that forces the variable to need to get modif= ied?
>
> I would assume the NOR driver is smart enough to not update a variabl= e that is not changing.
>
> The custom BDS could could only create the variable for this device i= f it does not exist.
>
> [JB] The current flow with no changes in the boot manager would be as= follows
>
>
>
>   1.  Scan for instance of the boot option in the vari= ables
>   2.  It will not be found, so create a new boot optio= n store it to a variable and update BootOrder
>   3.  Platform code runs creates the options for the b= oot option it wants and writes those to variable store
>   4.  Delete/disable the boot option in the variable s= tore
>
>
>
> When you reboot it won't find the variable so 1/2/4 will re-occur
>
>
>
> The code that does this (1/2) is EfiBootManagerRefreshAllBootOption i= n BmBoot.c
>
>
>
> If you modify the variable to disable it with hidden/not active it wo= uld delete that and create a new one as well as the code wouldn't recognize= that is the same boot option.
>
>
>
> If however we modify EfiBootManagerFindLoadOption to not compare the = attributes (at least allow for differences in active and hidden) then the w= hen it refreshes every thing it would see the match and not delete/create a= new variable in the store and thus we wouldn't have changes every boot.
>
>
>
>
>
> Jeff,
>
>
>
> Sorry if I'm a little off on the sequence of things as the platform I= work on day to day has a custom BDS and does not use this library..... I t= hough the patch changed BmEnumerateBootOptions(), so that is going to chang= e how EfiBootManagerRefreshAllBootOption() works. I'd also point out the patch as given is invalid as it changed the= behavior of the public library API for EfiBootManagerRefreshAllBootOption(= ) [1] so for the patch to be valid it would need to change the comments to = reflect the new behavior. This is kind of what Laszlo's technical debt comment was about.
>
>
>
> I think Laszlo advocated having the BDS platform specific code make s= ure the boot variables are in the correct state. That should happen before = the Boot Manager code runs, and it is  not clear to me why the Boot Ma= nager could would need to run if you have a valid EFI nvram variable to boot from.
>
>
>
> I think the question is how is your use case different than the boot = variable that Windows installs? If it works kind of the same way then the a= nswer is to have the BDS platform specific code write the boot variable. >
>
>
>
>
> [1]
>
> /**
>
>   The function creates boot options for all possible bootab= le medias in the following order:
>
>   1. Removable BlockIo      &= nbsp;     - The boot option only points to the removabl= e media
>
>           &nbs= p;            &= nbsp;            dev= ice, like USB key, DVD, Floppy etc.
>
>   2. Fixed BlockIo       = ;         - The boot option only po= ints to a Fixed blockIo device,
>
>           &nbs= p;            &= nbsp;            lik= e HardDisk.
>
>   3. Non-BlockIo SimpleFileSystem - The boot option points = to a device supporting
>
>           &nbs= p;            &= nbsp;            Sim= pleFileSystem Protocol, but not supporting BlockIo
>
>           &nbs= p;            &= nbsp;            pro= tocol.
>
>   4. LoadFile       &nbs= p;             = - The boot option points to the media supporting
>
>           &nbs= p;            &= nbsp;            Loa= dFile protocol.
>
>   Reference: UEFI Spec chapter 3.3 Boot Option Variables De= fault Boot Behavior
>
>
>
>   The function won't delete the boot option not added by it= self.
>
> **/
>
> VOID
>
> EFIAPI
>
> EfiBootManagerRefreshAllBootOption (
>
>   VOID
>
>   );
>
>
>
> Thanks,
>
>
>
> Andrew Fish
>
>
>
> Thanks,
>
> Andrew Fish
>
> Thanks,
>
> Jeff
>
> ________________________________
>
> This email message is for the sole use of the intended recipient(s) a= nd may contain confidential information.  Any unauthorized review, use= , disclosure or distribution is prohibited.  If you are not the intend= ed recipient, please contact the sender by reply email and destroy all copies of the original message.
>
> ________________________________
>
>=20 >

--_000_BYAPR12MB34627036641C4FCA00B9CD07CB740BYAPR12MB3462namp_--