mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 21:15:45 +00:00
virtio-mem: Update VirtioMemConfig according to Linux kernel
Types of block_size and padding is updated in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=544fc7dbbf920a3e64d109c416ee229e8e1763c5. Update VirtioMemConfig according to it. Signed-off-by: Hui Zhu <teawater@antfin.com>
This commit is contained in:
parent
3cc8ca4ea5
commit
165568e98b
@ -159,10 +159,10 @@ unsafe impl ByteValued for VirtioMemResp {}
|
|||||||
#[derive(Copy, Clone, Debug, Default)]
|
#[derive(Copy, Clone, Debug, Default)]
|
||||||
struct VirtioMemConfig {
|
struct VirtioMemConfig {
|
||||||
// Block size and alignment. Cannot change.
|
// Block size and alignment. Cannot change.
|
||||||
block_size: u32,
|
block_size: u64,
|
||||||
// Valid with VIRTIO_MEM_F_ACPI_PXM. Cannot change.
|
// Valid with VIRTIO_MEM_F_ACPI_PXM. Cannot change.
|
||||||
node_id: u16,
|
node_id: u16,
|
||||||
padding: u16,
|
padding: [u8; 6],
|
||||||
// Start address of the memory region. Cannot change.
|
// Start address of the memory region. Cannot change.
|
||||||
addr: u64,
|
addr: u64,
|
||||||
// Region size (maximum). Cannot change.
|
// Region size (maximum). Cannot change.
|
||||||
@ -803,7 +803,7 @@ impl Mem {
|
|||||||
let avail_features = 1u64 << VIRTIO_F_VERSION_1;
|
let avail_features = 1u64 << VIRTIO_F_VERSION_1;
|
||||||
|
|
||||||
let mut config = VirtioMemConfig::default();
|
let mut config = VirtioMemConfig::default();
|
||||||
config.block_size = VIRTIO_MEM_DEFAULT_BLOCK_SIZE as u32;
|
config.block_size = VIRTIO_MEM_DEFAULT_BLOCK_SIZE;
|
||||||
config.addr = region.start_addr().raw_value();
|
config.addr = region.start_addr().raw_value();
|
||||||
config.region_size = region.len();
|
config.region_size = region.len();
|
||||||
config.usable_region_size = cmp::min(
|
config.usable_region_size = cmp::min(
|
||||||
|
Loading…
Reference in New Issue
Block a user