> On 18 Nov 2025, at 5:51 PM, Gerd Hoffmann <[email protected]> wrote:
>
> Move igvm file processing from machine init to reset callbacks. With
> that the igvm file is properly re-loaded on reset. Also the loading
> happens later in the init process now. This will simplify future
> support for some IGVM parameters which depend on initialization steps
> which happen after machine init.
LGTM.
>
> Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Ani Sinha <[email protected]>
> ---
> backends/igvm-cfg.c | 7 +++++++
> hw/i386/pc_piix.c | 10 ----------
> hw/i386/pc_q35.c | 10 ----------
> 3 files changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c
> index 08501a67e58e..c1b45401f429 100644
> --- a/backends/igvm-cfg.c
> +++ b/backends/igvm-cfg.c
> @@ -15,6 +15,8 @@
> #include "system/igvm.h"
> #include "system/reset.h"
> #include "qom/object_interfaces.h"
> +#include "hw/qdev-core.h"
> +#include "hw/boards.h"
>
> #include "trace.h"
>
> @@ -44,7 +46,12 @@ static void igvm_reset_enter(Object *obj, ResetType type)
>
> static void igvm_reset_hold(Object *obj, ResetType type)
> {
> + MachineState *ms = MACHINE(qdev_get_machine());
> + IgvmCfg *igvm = IGVM_CFG(obj);
> +
> trace_igvm_reset_hold(type);
> +
> + qigvm_process_file(igvm, ms->cgs, false, &error_fatal);
> }
>
> static void igvm_reset_exit(Object *obj, ResetType type)
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7b3611e973cd..b3b71df64bfc 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -320,16 +320,6 @@ static void pc_init1(MachineState *machine, const char
> *pci_type)
> x86_nvdimm_acpi_dsmio,
> x86ms->fw_cfg, OBJECT(pcms));
> }
> -
> -#if defined(CONFIG_IGVM)
> - /* Apply guest state from IGVM if supplied */
> - if (x86ms->igvm) {
> - if (IGVM_CFG_GET_CLASS(x86ms->igvm)
> - ->process(x86ms->igvm, machine->cgs, false, &error_fatal) <
> 0) {
> - g_assert_not_reached();
> - }
> - }
> -#endif
> }
>
> typedef enum PCSouthBridgeOption {
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 6015e639d7bc..f2e6ebfe294c 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -328,16 +328,6 @@ static void pc_q35_init(MachineState *machine)
> x86_nvdimm_acpi_dsmio,
> x86ms->fw_cfg, OBJECT(pcms));
> }
> -
> -#if defined(CONFIG_IGVM)
> - /* Apply guest state from IGVM if supplied */
> - if (x86ms->igvm) {
> - if (IGVM_CFG_GET_CLASS(x86ms->igvm)
> - ->process(x86ms->igvm, machine->cgs, false, &error_fatal) <
> 0) {
> - g_assert_not_reached();
> - }
> - }
> -#endif
> }
>
> #define DEFINE_Q35_MACHINE(major, minor) \
> --
> 2.51.1
>