Flag guard virtual cpufreq support
The feature is guarded by the RELEASE_AVF_ENABLE_VIRT_CPUFREQ flag. In
Virtualization manager, --virt-cpufreq and --host-cpu-topology is only
passed to crosvm when launching a VM if this feature is enabled.
Bug: 322415363
Test: Builds
Change-Id: I35dca05b42323bdca4f5855bbfe991ba90bbb229
Signed-off-by: David Dai <davidai@google.com>
diff --git a/virtualizationmanager/src/crosvm.rs b/virtualizationmanager/src/crosvm.rs
index 4b3478e..fe8a587 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -810,8 +810,10 @@
}
if config.host_cpu_topology {
- // TODO(b/266664564): replace with --host-cpu-topology once available
- if let Some(cpus) = get_num_cpus() {
+ if cfg!(virt_cpufreq) {
+ command.arg("--host-cpu-topology");
+ command.arg("--virt-cpufreq");
+ } else if let Some(cpus) = get_num_cpus() {
command.arg("--cpus").arg(cpus.to_string());
} else {
bail!("Could not determine the number of CPUs in the system");