Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FDT setup for CPU caches with high number of sets #4869

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vmm/src/arch/aarch64/cache_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) struct CacheEntry {
// Type of cache: Unified, Data, Instruction.
pub type_: CacheType,
pub size_: Option<u32>,
pub number_of_sets: Option<u16>,
pub number_of_sets: Option<u32>,
pub line_size: Option<u16>,
// How many CPUS share this cache.
pub cpus_per_unit: u16,
Expand Down Expand Up @@ -114,7 +114,7 @@ impl CacheEntry {
}

if let Ok(number_of_sets) = store.get_by_key(index, "number_of_sets") {
cache.number_of_sets = Some(number_of_sets.parse::<u16>().map_err(|err| {
cache.number_of_sets = Some(number_of_sets.parse::<u32>().map_err(|err| {
CacheInfoError::InvalidCacheAttr("number_of_sets".to_string(), err.to_string())
})?);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/vmm/src/arch/aarch64/fdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fn create_cpu_nodes(fdt: &mut FdtWriter, vcpu_mpidr: &[u64]) -> Result<(), FdtEr
fdt.property_u32(cache.type_.of_cache_line_size(), u32::from(line_size))?;
}
if let Some(number_of_sets) = cache.number_of_sets {
fdt.property_u32(cache.type_.of_cache_sets(), u32::from(number_of_sets))?;
fdt.property_u32(cache.type_.of_cache_sets(), number_of_sets)?;
}
}

Expand Down Expand Up @@ -197,7 +197,7 @@ fn create_cpu_nodes(fdt: &mut FdtWriter, vcpu_mpidr: &[u64]) -> Result<(), FdtEr
fdt.property_u32(cache.type_.of_cache_line_size(), u32::from(line_size))?;
}
if let Some(number_of_sets) = cache.number_of_sets {
fdt.property_u32(cache.type_.of_cache_sets(), u32::from(number_of_sets))?;
fdt.property_u32(cache.type_.of_cache_sets(), number_of_sets)?;
}
if let Some(cache_type) = cache.type_.of_cache_type() {
fdt.property_null(cache_type)?;
Expand Down
2 changes: 1 addition & 1 deletion src/vmm/src/arch/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::vstate::memory::{Address, Bytes, GuestAddress, GuestMemory, GuestMemo
/// Errors thrown while configuring aarch64 system.
#[derive(Debug, thiserror::Error, displaydoc::Display)]
pub enum ConfigurationError {
/// Failed to create a Flattened Device Tree for this aarch64 microVM.
/// Failed to create a Flattened Device Tree for this aarch64 microVM: {0}
SetupFDT(#[from] fdt::FdtError),
/// Failed to compute the initrd address.
InitrdAddress,
Expand Down
Loading