mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-04 07:33:41 -10:00
IGVM files can contain an initial VMSA that should be applied to each vcpu as part of the initial guest state. The sev_features flags are provided as part of the VMSA structure. However, KVM only allows sev_features to be set during initialization and not as the guest is being prepared for launch. This patch queries KVM for the supported set of sev_features flags and processes the VP context entries in the IGVM file during kvm_init to determine any sev_features flags set in the IGVM file. These are then provided in the call to KVM_SEV_INIT2 to ensure the guest state matches that specified in the IGVM file. The igvm process() function is modified to allow a partial processing of the file during initialization, with only the IGVM_VHT_VP_CONTEXT fields being processed. This means the function is called twice, firstly to extract the sev_features then secondly to actually configure the guest. Signed-off-by: Roy Hopkins <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Acked-by: Stefano Garzarella <[email protected]> Acked-by: Gerd Hoffman <[email protected]> Tested-by: Stefano Garzarella <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Ani Sinha <[email protected]> Link: https://lore.kernel.org/r/b2f986aae04e1da2aee530c9be22a54c0c59a560.1751554099.git.roy.hopkins@randomman.co.uk Signed-off-by: Paolo Bonzini <[email protected]>