On Thu, 1 Oct 2026 at 11:52, Aastha Rawat <[email protected]> wrote: > > Replace the compile-time #if/#elif preprocessor ladder in > aarch64_host_initfn() with runtime calls and add mshv_enabled() to it. > This ensures the correct accelerator is selected at runtime when > multiple accelerators are compiled in. > > Add CONFIG_MSHV to the aarch64_cpus[] guard so that mshv accelerator can > register the "host" CPU type.
Don't do two things in one commit, please. > Signed-off-by: Aastha Rawat <[email protected]> > --- > target/arm/cpu64.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > > diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c > index dcd0d698b3..a9e346049d 100644 > --- a/target/arm/cpu64.c > +++ b/target/arm/cpu64.c > @@ -811,17 +811,21 @@ void aarch64_host_initfn(Object *obj) > } > #endif > > + if (mshv_enabled()) { > + mshv_arm_set_cpu_features_from_host(cpu); > + } else if (kvm_enabled()) { > #if defined(CONFIG_KVM) > - kvm_arm_set_cpreg_mig_tolerances(cpu); > - kvm_arm_set_cpu_features_from_host(cpu); > - aarch64_add_sve_properties(obj); > -#elif defined(CONFIG_HVF) > - hvf_arm_set_cpu_features_from_host(cpu); > -#elif defined(CONFIG_WHPX) > - whpx_arm_set_cpu_features_from_host(cpu); > -#else > - g_assert_not_reached(); > + kvm_arm_set_cpreg_mig_tolerances(cpu); > #endif > + kvm_arm_set_cpu_features_from_host(cpu); > + aarch64_add_sve_properties(obj); > + } else if (hvf_enabled()) { > + hvf_arm_set_cpu_features_from_host(cpu); > + } else if (whpx_enabled()) { > + whpx_arm_set_cpu_features_from_host(cpu); > + } else { > + g_assert_not_reached(); > + } The reason for the ifdefs is that if CONFIG_HVF etc aren't set then the functions hvf_arm_set_cpu_features_from_host() don't exist... thanks -- PMM
