On Mon, Jan 12, 2026 at 2:23 PM Ani Sinha <[email protected]> wrote: > int kvm_arch_vmfd_change_ops(MachineState *ms, KVMState *s) > { > - abort(); > + Error *local_err = NULL; > + int ret; > + > + /* > + * Initialize confidential context, if required > + * > + * If no memory encryption is requested (ms->cgs == NULL) this is > + * a no-op. > + * > + */ > + if (ms->cgs) { > + ret = confidential_guest_kvm_init(ms->cgs, &local_err); > + if (ret < 0) { > + error_report_err(local_err); > + return ret; > + } > + }
Most of the code here is in common with guest startup; please extract it out of kvm_arch_init() and into a separate function. There shouldn't be many ordering dependencies, if any. For functions like kvm_get_supported_msrs() you can add a "static bool first" to ensure they aren't rerun. Paolo
