Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

roy-hopkins
Copy link
Collaborator

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.

Perform a refactor of the firmware configuration fields within the IGVM
parameter block and add the additional fields required by OVMF firmware.

This neatly separates the firmware metadata from the remaineder of the
IGVM parameters and makes it clearer which fields relate to the firmware
rather than the SVSM itself.

Signed-off-by: Roy Hopkins <roy.hopkins@suse.com>
Comment on lines +1 to +6
// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright (c) 2024 SUSE LLC
//
// Author: Joerg Roedel <jroedel@suse.de>
// Author: Roy Hopkins <roy.hopkins@suse.com>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is mostly a copy of utils/print-meta.c, hence keeping Joerg as the author.

Makefile Outdated Show resolved Hide resolved
igvmbld/igvmbld.c Outdated Show resolved Hide resolved
igvmbld/igvmbld.c Outdated Show resolved Hide resolved
igvmbld/igvmbld.c Outdated Show resolved Hide resolved
This commit adds parameters to the IGVM builder command line that allow
a firmware binary file to be specified along with either the firmware
base address or top address. The firmware is then populated into the
IGVM file at the specified address.

If the firmware contains metadata in OVMF format then this is parsed and
the relevant fields of the IGVM parameter block that is passed to the
guest.

This allows OVMF (and potentially other) firmware to be embedded in the
IGVM file and launched from the SVSM.

Signed-off-by: Roy Hopkins <roy.hopkins@suse.com>
When using an IGVM based configuration, currently the firmware metadata
can be provided either in the IGVM configuration itself or can be parsed
from the OVMF image. However, there is no reason for SVSM to parse the
OVMF metadata as this can be done by the IGVM builder and populated into
the IGVM configuration.

This patch removes the logic to parse OVMF metadata when using IGVM
configuration and applies the required extra fields from the IGMV
configuration.

Signed-off-by: Roy Hopkins <roy.hopkins@suse.com>
Following the changes to SVSM that mean the firmware configuration is
always completely described by the IGVM parameter block, this commit
removes the now unused 'metadata' field that previously defined the
location of the OVMF metadata page in guest memory.

Signed-off-by: Roy Hopkins <roy.hopkins@suse.com>
@roy-hopkins
Copy link
Collaborator Author

@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.

@joergroedel joergroedel merged commit f6c93c1 into coconut-svsm:main Jan 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants