mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-02 01:45:21 +00:00
vmm: Add page size as a parameter for MemoryRangeTable::from_bitmap()
This will be helpful to support the creation of a MemoryRangeTable from virtio-mem, as it uses 2M pages. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
af3a59aa33
commit
a1caa6549a
@ -554,7 +554,7 @@ impl VhostUserHandle {
|
|||||||
let ptr = region.as_ptr() as *const u64;
|
let ptr = region.as_ptr() as *const u64;
|
||||||
std::slice::from_raw_parts(ptr, len).to_vec()
|
std::slice::from_raw_parts(ptr, len).to_vec()
|
||||||
};
|
};
|
||||||
Ok(MemoryRangeTable::from_bitmap(bitmap, 0))
|
Ok(MemoryRangeTable::from_bitmap(bitmap, 0, 4096))
|
||||||
} else {
|
} else {
|
||||||
Err(Error::MissingShmLogRegion)
|
Err(Error::MissingShmLogRegion)
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,7 @@ pub struct MemoryRangeTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MemoryRangeTable {
|
impl MemoryRangeTable {
|
||||||
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64) -> Self {
|
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64, page_size: u64) -> Self {
|
||||||
let page_size = 4096;
|
|
||||||
let mut table = MemoryRangeTable::default();
|
let mut table = MemoryRangeTable::default();
|
||||||
let mut entry: Option<MemoryRange> = None;
|
let mut entry: Option<MemoryRange> = None;
|
||||||
for (i, block) in bitmap.iter().enumerate() {
|
for (i, block) in bitmap.iter().enumerate() {
|
||||||
|
@ -2038,7 +2038,7 @@ impl Migratable for MemoryManager {
|
|||||||
.map(|(x, y)| x | y)
|
.map(|(x, y)| x | y)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let sub_table = MemoryRangeTable::from_bitmap(dirty_bitmap, r.gpa);
|
let sub_table = MemoryRangeTable::from_bitmap(dirty_bitmap, r.gpa, 4096);
|
||||||
|
|
||||||
if sub_table.regions().is_empty() {
|
if sub_table.regions().is_empty() {
|
||||||
info!("Dirty Memory Range Table is empty");
|
info!("Dirty Memory Range Table is empty");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user