mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Decompose the monolithic `new_from_memory_manager` function into smaller, focused helper methods to improve code readability, maintainability, and testability. Changes: - Extract `should_force_iommu()` to determine IOMMU requirements for confidential computing (TDX/SEV-SNP) - Extract `should_stop_on_boot()` to check debug pause configuration - Extract `create_cpu_manager()` to encapsulate CPU manager creation and CPUID population - Extract `init_tdx_if_enabled()` for TDX-specific VM initialization - Extract `create_device_manager()` to encapsulate device manager setup - Extract `hypervisor_specific_init()` to orchestrate initialization sequences for different hypervisors (KVM, MSHV, SEV-SNP) - Extract `init_sev_snp()` for SEV-SNP confidential VM setup - Extract `init_mshv()` for MSHV hypervisor initialization - Extract `init_kvm()` for KVM hypervisor initialization - Extract `create_fw_cfg_if_enabled()` for fw_cfg device creation This refactoring replaces complex nested `cfg_if!` blocks with cleaner conditional method calls, providing clear separation between hypervisor- specific initialization paths while preserving existing functionality. No functional changes intended. Issue: https://github.com/cloud-hypervisor/cloud-hypervisor/issues/7598 Signed-off-by: Muminul Islam <muislam@microsoft.com>