Skip to content

Commit 1c49679

Browse files
committed
fix(fdt): Support FDT setup for CPU caches with high number of sets
Change the type of `CacheEntry`'s `number_of_sets` field from `u16` to `u32`, to allow correctly parsing CPU cache information from sysfs and successfully setting up the FDT on hosts with CPU caches with a number of sets that is higher than `u16::MAX`. Signed-off-by: Christos Katsakioris <ckatsak@cslab.ece.ntua.gr> Signed-off-by: Filippos Tofalos <phtof@cslab.ece.ntua.gr>
1 parent af9424c commit 1c49679

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/vmm/src/arch/aarch64/cache_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) struct CacheEntry {
3838
// Type of cache: Unified, Data, Instruction.
3939
pub type_: CacheType,
4040
pub size_: Option<u32>,
41-
pub number_of_sets: Option<u16>,
41+
pub number_of_sets: Option<u32>,
4242
pub line_size: Option<u16>,
4343
// How many CPUS share this cache.
4444
pub cpus_per_unit: u16,
@@ -114,7 +114,7 @@ impl CacheEntry {
114114
}
115115

116116
if let Ok(number_of_sets) = store.get_by_key(index, "number_of_sets") {
117-
cache.number_of_sets = Some(number_of_sets.parse::<u16>().map_err(|err| {
117+
cache.number_of_sets = Some(number_of_sets.parse::<u32>().map_err(|err| {
118118
CacheInfoError::InvalidCacheAttr("number_of_sets".to_string(), err.to_string())
119119
})?);
120120
} else {

0 commit comments

Comments
 (0)