coconut-svsm / svsm

COCONUT-SVSM
MIT License
123 stars 43 forks source link

IGVM: Embed firmware in IGVM file and parse OVMF metadata into IGVM parameter block #199

Closed roy-hopkins closed 11 months ago

roy-hopkins commented 11 months ago

This PR adds support for embedding firmware, particularly OVMF into an IGVM file using the IGVM builder.

The Makefile has been updated to allow the OVMF file to be specified by the FW_FILE environment variable. This needs to be set to the OVMF.fd file (and not the separate OVMF_CODE.fd and OVMF_VARS.fd files). When provided, the firmware binary is parsed by the IGVM builder during the build to extract metadata which is then populated into the IGVM parameter block, passed to SVSM.

By providing the metadata in the IGVM parameter block, SVSM does not need to parse the OVMF metadata when using an IGVM file. The SVSM has been updated to reflect this by removing the fw_metadata IGVM parameter that specified the OVMF metadata page. In the future, if IGVM is solely used to configure the SVSM then the OVMF metadata parsing can be removed entirely from SVSM.

roy-hopkins commented 11 months ago

@msft-jlange, on reflection following our email conversation it is probably best to hardcode the firmware base calculation for QEMU and just return an error at the moment if --firmware is specified for Hyper-V as I don't know how the base address will be calculated in this case. This means I can remove --fwtop and --fwbase.

I've pushed a new version with this change.