edk2 icon indicating copy to clipboard operation
edk2 copied to clipboard

UefiPayloadPkg: Add SMM variable related HOBs support for SBL

Open Joursoir opened this issue 1 year ago • 1 comments

When UefiPayloadPkg is compiled with SMM_SUPPORT enabled and VARIABLE_SUPPORT set to SPI, the following HOBs must be available:

  • gSmmRegisterInfoGuid
  • gEfiSmmSmramMemoryGuid
  • gSpiFlashInfoGuid
  • gNvVariableInfoGuid
  • gS3CommunicationGuid

Migrate these HOBs information from the bootloader HOB space to the UEFI payload HOB space. Parse them in misc function, so it won't fail if there would be no HOBs.

This patch was tested on Slim Bootloader with latest UEFI payload, and it worked as expected.

Joursoir avatar May 21 '24 09:05 Joursoir

The legacy UEFI payload (non-universal payload, which need a parse library to get required information) is deprecated. you could build universal payload (which uses ELF image format, and consumes HOBs from SBL) which should work with SBL without any change.

gdong1 avatar Jun 05 '24 23:06 gdong1

Where can I find information about it being deprecated? SBL and coreboot still support and run on the usual UEFI payload. Does this mean that the legacy uefi payload patches is no longer acceptable?

Joursoir avatar Jul 02 '24 09:07 Joursoir

Universal Scalable Firmware (USF) defined the interface between bootloader and payload. Both UEFI payload and SBL follow the interface so we don't need use a ParseLib to parse required information. Even EDK2 and coreboot could also support universal UEFI payload. The interface details could be found @ https://universalscalablefirmware.github.io/documentation/2_universal_payload.html) I agree with this patch, using old format (FV) it would work. But these HOBs are implementation specific, potentially some of them could be changed or removed. That's why I prefer using universal UEFI payload with SBL.

gdong1 avatar Jul 02 '24 16:07 gdong1

But as far as I understand coreboot cannot use Universal Payload at the moment, because it requires some shim layer that translates coreboot tables into HOBs. Only StarLabs edk2 fork does this.

I want to use the same payload for SBL and coreboot. That's why I sent this patch.

Joursoir avatar Jul 30 '24 09:07 Joursoir

SBL and coreboot use different parseLib instance, same UEFI payload binary could not support both SBL and coreboot. That's the universal payload goal. You are right, latest coreboot does not support USF universal payload since coreboot community has some concerns on the spec. Late a new universal payload spec was published, and it looks EDKII, SBL, coreboot and uboot all support the new spec. Since this spec is released recently, the implementation for each firmware solution is WIP. SBL already implemented part of it. you could find coreboot details from https://mail.coreboot.org/hyperkitty/list/[email protected]/thread/DTIU7OYB44TOA76NN5UM2B2LLMUMA6YM/

gdong1 avatar Jul 30 '24 15:07 gdong1

When I said I want to use the same payload for SBL and coreboot I meant that I want to use a legacy payload that can be the same for SBL and coreboot, except for the parseLib instance. Sorry for the initial poor wording.

That's great that there's a new specification which will be supported by all firmware components. Although the WIP status might take a while, my patch will allow the use of SBL with SMM variables immediately on legacy payload :)

Joursoir avatar Jul 31 '24 18:07 Joursoir

As I mentioned, Universal UEFI payload (ELF format) already supports SMM variable to work with SBL without any change. I am afraid this patch would mislead user to continue use legacy UEFI payload. Legacy UEFI payload is not preferred because some SBL info used in parselib might not be available in the future. Both SBL and UEFI payload prefer using universal payload because the interface are defined by spec.

gdong1 avatar Jul 31 '24 20:07 gdong1

This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

github-actions[bot] avatar Sep 29 '24 23:09 github-actions[bot]

This pull request has been automatically been closed because it did not have any activity in 60 days and no follow up within 7 days after being marked stale. Thank you for your contributions.

github-actions[bot] avatar Oct 06 '24 23:10 github-actions[bot]