aboutsummaryrefslogtreecommitdiff
path: root/aarch64
diff options
context:
space:
mode:
authorPawan Wagh <waghpawan@google.com>2024-01-16 19:38:29 +0000
committerPawan Wagh <waghpawan@google.com>2024-01-16 21:04:50 +0000
commitc8efbbac3c71233bd48d61e3773b91c15c7b3fb7 (patch)
treeb29112f9cfa29b8cfc94f75816edd26a15e9a243 /aarch64
parent345c5a3c4c90cbddc5a901e3ddd7f013e4cb7611 (diff)
parent3914b3dbdc7604cd7afa82eae71fb5ad92b52e75 (diff)
downloadcrosvm-c8efbbac3c71233bd48d61e3773b91c15c7b3fb7.tar.gz
Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (39 commits) devices: virtcpufreq: Add scaling factor to UClamp applied Roll recipe dependencies (trivial). Roll recipe dependencies (trivial). seccomp: Add a policy for pvclock device e2e_tests: Update use_local_build.sh to include the initrd env var aarch64: fdt: Update compatible string for virt cpufreq hypervisor: x86: Add MSR allowlist and restore MSRs 1 at a time jail: seccomp: fix missing syscall for fs on arm Roll recipe dependencies (trivial). Clone host CPU capacity/clusters for --host-cpu-topology Roll recipe dependencies (trivial). swap: prevent guest memory in the main process munmap(2)ed swap: do not panic if main process dies while swapping in swap: do not panic on tube errors Roll recipe dependencies (trivial). devices: disable read-only memslots based on hypervisor hypervisor: kvm: Fix xsave size when Xsave2 is not supported jail: seccomp: add missing battery syscalls on non-x86 book: Use v6.6 termina kernel in custom_kernel_rootfs linux_input_sys: simplify input event decoders ... Bug: 319252379 Test: atest --test-mapping external/crosvm Change-Id: I68e9777dfa707df75af64e1b66e2229bdd7b88a7
Diffstat (limited to 'aarch64')
-rw-r--r--aarch64/src/fdt.rs2
-rw-r--r--aarch64/src/lib.rs30
2 files changed, 31 insertions, 1 deletions
diff --git a/aarch64/src/fdt.rs b/aarch64/src/fdt.rs
index b5b2353d0..10b9c87d5 100644
--- a/aarch64/src/fdt.rs
+++ b/aarch64/src/fdt.rs
@@ -243,7 +243,7 @@ fn create_timer_node(fdt: &mut Fdt, num_cpus: u32) -> Result<()> {
}
fn create_virt_cpufreq_node(fdt: &mut Fdt, num_cpus: u64) -> Result<()> {
- let compatible = "virtual,kvm-cpufreq";
+ let compatible = "qemu,virtual-cpufreq";
let vcf_node = fdt.root_mut().subnode_mut("cpufreq")?;
let reg = [AARCH64_VIRTFREQ_BASE, AARCH64_VIRTFREQ_SIZE * num_cpus];
diff --git a/aarch64/src/lib.rs b/aarch64/src/lib.rs
index fbd3460f8..d5c476dae 100644
--- a/aarch64/src/lib.rs
+++ b/aarch64/src/lib.rs
@@ -13,6 +13,7 @@ use std::sync::mpsc;
use std::sync::Arc;
use arch::get_serial_cmdline;
+use arch::CpuSet;
use arch::DtbOverlay;
use arch::GetSerialCmdlineError;
use arch::RunnableLinuxVm;
@@ -231,6 +232,8 @@ pub enum Error {
Cmdline(kernel_cmdline::Error),
#[error("failed to configure CPU Frequencies: {0}")]
CpuFrequencies(base::Error),
+ #[error("failed to configure CPU topology: {0}")]
+ CpuTopology(base::Error),
#[error("unable to create battery devices: {0}")]
CreateBatDevices(arch::DeviceRegistrationError),
#[error("unable to make an Event: {0}")]
@@ -832,6 +835,33 @@ impl arch::LinuxArch for AArch64 {
.collect(),
)
}
+
+ // Returns a (cpu_id -> value) map of the DMIPS/MHz capacities of logical cores
+ // in the host system.
+ fn get_host_cpu_capacity() -> std::result::Result<BTreeMap<usize, u32>, Self::Error> {
+ Ok(Self::collect_for_each_cpu(base::logical_core_capacity)
+ .map_err(Error::CpuTopology)?
+ .into_iter()
+ .enumerate()
+ .collect())
+ }
+
+ // Creates CPU cluster mask for each CPU in the host system.
+ fn get_host_cpu_clusters() -> std::result::Result<Vec<CpuSet>, Self::Error> {
+ let cluster_ids = Self::collect_for_each_cpu(base::logical_core_cluster_id)
+ .map_err(Error::CpuTopology)?;
+ Ok(cluster_ids
+ .iter()
+ .map(|&vcpu_cluster_id| {
+ cluster_ids
+ .iter()
+ .enumerate()
+ .filter(|(_, &cpu_cluster_id)| vcpu_cluster_id == cpu_cluster_id)
+ .map(|(cpu_id, _)| cpu_id)
+ .collect()
+ })
+ .collect())
+ }
}
#[cfg(feature = "gdb")]