vm-virtio: Add virtio-pmem implementation

This commit introduces the implementation of the virtio-pmem device
based on the pending proposal of the virtio specification here:
https://lists.oasis-open.org/archives/virtio-dev/201903/msg00083.html

It is also based on the kernel patches coming along with the virtio
proposal: https://lkml.org/lkml/2019/6/12/624

And it is based off of the current crosvm implementation found in
devices/src/virtio/pmem.rs relying on commit
bb340d9a94d48514cbe310d05e1ce539aae31264

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-06-18 14:40:57 -07:00
committed by Rob Bradford
parent c0336e83ea
commit 8862d61042
2 changed files with 428 additions and 0 deletions
+4
View File
@@ -23,6 +23,7 @@ mod block;
mod device;
pub mod fs;
pub mod net;
mod pmem;
mod queue;
mod rng;
@@ -32,6 +33,7 @@ pub use self::block::*;
pub use self::device::*;
pub use self::fs::*;
pub use self::net::*;
pub use self::pmem::*;
pub use self::queue::*;
pub use self::rng::*;
@@ -60,6 +62,7 @@ enum VirtioDeviceType {
TYPE_INPUT = 18,
TYPE_VSOCK = 19,
TYPE_FS = 26,
TYPE_PMEM = 27,
}
// In order to use the `{}` marker, the trait `fmt::Display` must be implemented
@@ -76,6 +79,7 @@ impl fmt::Display for VirtioDeviceType {
VirtioDeviceType::TYPE_9P => "9p",
VirtioDeviceType::TYPE_VSOCK => "vsock",
VirtioDeviceType::TYPE_FS => "fs",
VirtioDeviceType::TYPE_PMEM => "pmem",
_ => return Err(std::fmt::Error),
};
write!(f, "{}", output)