mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Compare commits
3 Commits
v37.1
...
stable/v37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c0784f041 | ||
|
|
8632dda669 | ||
|
|
c2d3d015d8 |
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -2377,9 +2377,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vhost"
|
||||
version = "0.10.0"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b64e816d0d49769fbfaa1494eb77cc2a3ddc526ead05c7f922cb7d64106286f"
|
||||
checksum = "6be08d1166d41a78861ad50212ab3f9eca0729c349ac3a7a8f557c62406b87cc"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"libc",
|
||||
@@ -2389,9 +2389,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vhost-user-backend"
|
||||
version = "0.13.1"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c8c447d076ac508d78cb45664d203df7989e891656dce260a7e93d72352c9a"
|
||||
checksum = "1f0ffb1dd8e00a708a0e2c32d5efec5812953819888591fff9ff68236b8a5096"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
@@ -2481,9 +2481,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "virtio-queue"
|
||||
version = "0.11.0"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3f69a13d6610db9312acbb438b0390362af905d37634a2106be70c0f734986d"
|
||||
checksum = "07d8406e7250c934462de585d8f2d2781c31819bca1fbb7c5e964ca6bbaabfe8"
|
||||
dependencies = [
|
||||
"log",
|
||||
"virtio-bindings",
|
||||
|
||||
@@ -21,7 +21,7 @@ uuid = { version = "1.3.4", features = ["v4"] }
|
||||
versionize = "0.2.0"
|
||||
versionize_derive = "0.1.6"
|
||||
virtio-bindings = { version = "0.2.0", features = ["virtio-v5_0_0"] }
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vm-memory = { version = "0.14.0", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
|
||||
vm-virtio = { path = "../vm-virtio" }
|
||||
vmm-sys-util = "0.12.1"
|
||||
|
||||
@@ -58,16 +58,14 @@ use versionize_derive::Versionize;
|
||||
use virtio_bindings::virtio_blk::*;
|
||||
use virtio_queue::DescriptorChain;
|
||||
use vm_memory::{
|
||||
bitmap::AtomicBitmap, bitmap::Bitmap, ByteValued, Bytes, GuestAddress, GuestMemory,
|
||||
GuestMemoryError, GuestMemoryLoadGuard,
|
||||
bitmap::Bitmap, ByteValued, Bytes, GuestAddress, GuestMemory, GuestMemoryError,
|
||||
GuestMemoryLoadGuard,
|
||||
};
|
||||
use vm_virtio::{AccessPlatform, Translatable};
|
||||
use vmm_sys_util::aio;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
use vmm_sys_util::{ioctl_io_nr, ioctl_ioc_nr};
|
||||
|
||||
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
|
||||
|
||||
const SECTOR_SHIFT: u8 = 9;
|
||||
pub const SECTOR_SIZE: u64 = 0x01 << SECTOR_SHIFT;
|
||||
|
||||
@@ -197,8 +195,8 @@ pub enum RequestType {
|
||||
Unsupported(u32),
|
||||
}
|
||||
|
||||
pub fn request_type(
|
||||
mem: &GuestMemoryMmap,
|
||||
pub fn request_type<B: Bitmap + 'static>(
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
desc_addr: GuestAddress,
|
||||
) -> result::Result<RequestType, Error> {
|
||||
let type_ = mem.read_obj(desc_addr).map_err(Error::GuestMemory)?;
|
||||
@@ -211,7 +209,10 @@ pub fn request_type(
|
||||
}
|
||||
}
|
||||
|
||||
fn sector(mem: &GuestMemoryMmap, desc_addr: GuestAddress) -> result::Result<u64, Error> {
|
||||
fn sector<B: Bitmap + 'static>(
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
desc_addr: GuestAddress,
|
||||
) -> result::Result<u64, Error> {
|
||||
const SECTOR_OFFSET: usize = 8;
|
||||
let addr = match mem.checked_offset(desc_addr, SECTOR_OFFSET) {
|
||||
Some(v) => v,
|
||||
@@ -241,8 +242,8 @@ pub struct Request {
|
||||
}
|
||||
|
||||
impl Request {
|
||||
pub fn parse(
|
||||
desc_chain: &mut DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap>>,
|
||||
pub fn parse<B: Bitmap + 'static>(
|
||||
desc_chain: &mut DescriptorChain<GuestMemoryLoadGuard<vm_memory::GuestMemoryMmap<B>>>,
|
||||
access_platform: Option<&Arc<dyn AccessPlatform>>,
|
||||
) -> result::Result<Request, Error> {
|
||||
let hdr_desc = desc_chain
|
||||
@@ -333,11 +334,11 @@ impl Request {
|
||||
Ok(req)
|
||||
}
|
||||
|
||||
pub fn execute<T: Seek + Read + Write>(
|
||||
pub fn execute<T: Seek + Read + Write, B: Bitmap + 'static>(
|
||||
&self,
|
||||
disk: &mut T,
|
||||
disk_nsectors: u64,
|
||||
mem: &GuestMemoryMmap,
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
serial: &[u8],
|
||||
) -> result::Result<u32, ExecuteError> {
|
||||
disk.seek(SeekFrom::Start(self.sector << SECTOR_SHIFT))
|
||||
@@ -390,9 +391,9 @@ impl Request {
|
||||
Ok(len)
|
||||
}
|
||||
|
||||
pub fn execute_async(
|
||||
pub fn execute_async<B: Bitmap + 'static>(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
disk_nsectors: u64,
|
||||
disk_image: &mut dyn AsyncIo,
|
||||
serial: &[u8],
|
||||
|
||||
@@ -23,7 +23,7 @@ net_util = { path = "../net_util" }
|
||||
once_cell = "1.19.0"
|
||||
seccompiler = "0.4.0"
|
||||
virtio-devices = { path = "../virtio-devices" }
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vmm = { path = "../vmm" }
|
||||
vmm-sys-util = "0.12.1"
|
||||
vm-memory = "0.14.0"
|
||||
|
||||
@@ -16,7 +16,7 @@ thiserror = "1.0.52"
|
||||
versionize = "0.2.0"
|
||||
versionize_derive = "0.1.6"
|
||||
virtio-bindings = "0.2.0"
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vm-memory = { version = "0.14.0", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
|
||||
vm-virtio = { path = "../vm-virtio" }
|
||||
vmm-sys-util = "0.12.1"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
|
||||
|
||||
use super::{register_listener, unregister_listener, vnet_hdr_len, Tap};
|
||||
use crate::GuestMemoryMmap;
|
||||
use rate_limiter::{RateLimiter, TokenType};
|
||||
use std::io;
|
||||
use std::num::Wrapping;
|
||||
@@ -12,6 +11,7 @@ use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
use virtio_queue::{Queue, QueueOwnedT, QueueT};
|
||||
use vm_memory::bitmap::Bitmap;
|
||||
use vm_memory::{Bytes, GuestMemory};
|
||||
use vm_virtio::{AccessPlatform, Translatable};
|
||||
|
||||
@@ -35,9 +35,9 @@ impl TxVirtio {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_desc_chain(
|
||||
pub fn process_desc_chain<B: Bitmap + 'static>(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
tap: &Tap,
|
||||
queue: &mut Queue,
|
||||
rate_limiter: &mut Option<RateLimiter>,
|
||||
@@ -161,9 +161,9 @@ impl RxVirtio {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_desc_chain(
|
||||
pub fn process_desc_chain<B: Bitmap + 'static>(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
tap: &Tap,
|
||||
queue: &mut Queue,
|
||||
rate_limiter: &mut Option<RateLimiter>,
|
||||
@@ -350,9 +350,9 @@ pub struct NetQueuePair {
|
||||
}
|
||||
|
||||
impl NetQueuePair {
|
||||
pub fn process_tx(
|
||||
pub fn process_tx<B: Bitmap + 'static>(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
queue: &mut Queue,
|
||||
) -> Result<bool, NetQueuePairError> {
|
||||
let tx_tap_retry = self.tx.process_desc_chain(
|
||||
@@ -400,9 +400,9 @@ impl NetQueuePair {
|
||||
.map_err(NetQueuePairError::QueueNeedsNotification)
|
||||
}
|
||||
|
||||
pub fn process_rx(
|
||||
pub fn process_rx<B: Bitmap + 'static>(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
mem: &vm_memory::GuestMemoryMmap<B>,
|
||||
queue: &mut Queue,
|
||||
) -> Result<bool, NetQueuePairError> {
|
||||
self.rx_desc_avail = !self.rx.process_desc_chain(
|
||||
|
||||
@@ -13,9 +13,9 @@ epoll = "4.3.3"
|
||||
libc = "0.2.147"
|
||||
log = "0.4.20"
|
||||
option_parser = { path = "../option_parser" }
|
||||
vhost = { version = "0.10.0", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.13.1"
|
||||
vhost = { version = "0.11.0", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.15.0"
|
||||
virtio-bindings = "0.2.0"
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vm-memory = "0.14.0"
|
||||
vmm-sys-util = "0.12.1"
|
||||
|
||||
@@ -33,16 +33,18 @@ use std::vec::Vec;
|
||||
use std::{convert, error, fmt, io};
|
||||
use vhost::vhost_user::message::*;
|
||||
use vhost::vhost_user::Listener;
|
||||
use vhost_user_backend::{VhostUserBackendMut, VhostUserDaemon, VringRwLock, VringState, VringT};
|
||||
use vhost_user_backend::{
|
||||
bitmap::BitmapMmapRegion, VhostUserBackendMut, VhostUserDaemon, VringRwLock, VringState, VringT,
|
||||
};
|
||||
use virtio_bindings::virtio_blk::*;
|
||||
use virtio_bindings::virtio_config::VIRTIO_F_VERSION_1;
|
||||
use virtio_bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
||||
use virtio_queue::QueueT;
|
||||
use vm_memory::GuestAddressSpace;
|
||||
use vm_memory::{bitmap::AtomicBitmap, ByteValued, Bytes, GuestMemoryAtomic};
|
||||
use vm_memory::{ByteValued, Bytes, GuestMemoryAtomic};
|
||||
use vmm_sys_util::{epoll::EventSet, eventfd::EventFd};
|
||||
|
||||
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
|
||||
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<BitmapMmapRegion>;
|
||||
|
||||
const SECTOR_SHIFT: u8 = 9;
|
||||
const SECTOR_SIZE: u64 = 0x01 << SECTOR_SHIFT;
|
||||
@@ -301,7 +303,7 @@ impl VhostUserBlkBackend {
|
||||
}
|
||||
|
||||
impl VhostUserBackendMut for VhostUserBlkBackend {
|
||||
type Bitmap = AtomicBitmap;
|
||||
type Bitmap = BitmapMmapRegion;
|
||||
type Vring = VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>;
|
||||
|
||||
fn num_queues(&self) -> usize {
|
||||
|
||||
@@ -13,8 +13,8 @@ libc = "0.2.147"
|
||||
log = "0.4.20"
|
||||
net_util = { path = "../net_util" }
|
||||
option_parser = { path = "../option_parser" }
|
||||
vhost = { version = "0.10.0", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.13.1"
|
||||
vhost = { version = "0.11.0", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.15.0"
|
||||
virtio-bindings = "0.2.0"
|
||||
vm-memory = "0.14.0"
|
||||
vmm-sys-util = "0.12.1"
|
||||
|
||||
@@ -23,14 +23,15 @@ use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::vec::Vec;
|
||||
use vhost::vhost_user::message::*;
|
||||
use vhost::vhost_user::Listener;
|
||||
use vhost_user_backend::bitmap::BitmapMmapRegion;
|
||||
use vhost_user_backend::{VhostUserBackendMut, VhostUserDaemon, VringRwLock, VringT};
|
||||
use virtio_bindings::virtio_config::{VIRTIO_F_NOTIFY_ON_EMPTY, VIRTIO_F_VERSION_1};
|
||||
use virtio_bindings::virtio_net::*;
|
||||
use vm_memory::GuestAddressSpace;
|
||||
use vm_memory::{bitmap::AtomicBitmap, GuestMemoryAtomic};
|
||||
use vm_memory::GuestMemoryAtomic;
|
||||
use vmm_sys_util::{epoll::EventSet, eventfd::EventFd};
|
||||
|
||||
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
|
||||
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<BitmapMmapRegion>;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
type VhostUserBackendResult<T> = std::result::Result<T, std::io::Error>;
|
||||
@@ -159,7 +160,7 @@ impl VhostUserNetBackend {
|
||||
}
|
||||
|
||||
impl VhostUserBackendMut for VhostUserNetBackend {
|
||||
type Bitmap = AtomicBitmap;
|
||||
type Bitmap = BitmapMmapRegion;
|
||||
type Vring = VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>;
|
||||
|
||||
fn num_queues(&self) -> usize {
|
||||
|
||||
@@ -27,9 +27,9 @@ serial_buffer = { path = "../serial_buffer" }
|
||||
thiserror = "1.0.52"
|
||||
versionize = "0.2.0"
|
||||
versionize_derive = "0.1.6"
|
||||
vhost = { version = "0.10.0", features = ["vhost-user-frontend", "vhost-user-backend", "vhost-kern", "vhost-vdpa"] }
|
||||
vhost = { version = "0.11.0", features = ["vhost-user-frontend", "vhost-user-backend", "vhost-kern", "vhost-vdpa"] }
|
||||
virtio-bindings = { version = "0.2.0", features = ["virtio-v5_0_0"] }
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vm-allocator = { path = "../vm-allocator" }
|
||||
vm-device = { path = "../vm-device" }
|
||||
vm-memory = { version = "0.14.0", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
|
||||
|
||||
@@ -9,5 +9,5 @@ default = []
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.20"
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vm-memory = { version = "0.14.0", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
|
||||
|
||||
@@ -60,7 +60,7 @@ versionize_derive = "0.1.6"
|
||||
vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false }
|
||||
vfio_user = { git = "https://github.com/rust-vmm/vfio-user", branch = "main" }
|
||||
virtio-devices = { path = "../virtio-devices" }
|
||||
virtio-queue = "0.11.0"
|
||||
virtio-queue = "0.12.0"
|
||||
vm-allocator = { path = "../vm-allocator" }
|
||||
vm-device = { path = "../vm-device" }
|
||||
vm-memory = { version = "0.14.0", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
|
||||
|
||||
Reference in New Issue
Block a user