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 <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
This commit is contained in:
David Stevens 2024-04-09 13:43:38 +09:00 committed by crosvm LUCI
parent e81dfd2740
commit d4d9fad2ee

View file

@ -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: