From d4d9fad2ee5ee50b23f09b01bc43f4cf8128c53b Mon Sep 17 00:00:00 2001 From: David Stevens Date: Tue, 9 Apr 2024 13:43:38 +0900 Subject: [PATCH] base: Round up when calculating cache flush count When dividing target length by the cache line size, round up to make sure we flush the entire target region. BUG=b:316402315 TEST=tast run asurada arc.Boot.vm Change-Id: I66938bb51e1ce58f17e4bb28ec7b8f1e14a4fc6d Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5437515 Reviewed-by: Keiichi Watanabe Commit-Queue: David Stevens --- base/src/mmap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/src/mmap.rs b/base/src/mmap.rs index 87737a571d..fd53fa8af3 100644 --- a/base/src/mmap.rs +++ b/base/src/mmap.rs @@ -394,7 +394,7 @@ impl MemoryMapping { let mut next: *const u8 = unsafe { addr.add(offset) }; let cacheline_size = get_cacheline_size(); - let cacheline_count = len / cacheline_size; + let cacheline_count = len.div_ceil(cacheline_size); for _ in 0..cacheline_count { // SAFETY: