summary refs log tree commit diff
path: root/devices/src/lib.rs
diff options
context:
space:
mode:
authorXiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>2019-04-23 17:14:43 +0800
committerCommit Bot <commit-bot@chromium.org>2019-09-18 17:23:59 +0000
commit9628f61e7125bb6ee2ae921756af185d83a9c2aa (patch)
treeb1c859fe8c635dd75ca78ed883da5c9dc9d6a79a /devices/src/lib.rs
parent36cc5092fc6237ddbd1e63b8d2bc7c1460ea3041 (diff)
downloadcrosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.tar
crosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.tar.gz
crosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.tar.bz2
crosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.tar.lz
crosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.tar.xz
crosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.tar.zst
crosvm-9628f61e7125bb6ee2ae921756af185d83a9c2aa.zip
vfio: Implement PciDevice Trait for vfio device
According to kernel Documents/vfio.txt and
Documents/vfio-mediated-device.txt,user pass host assigned
device or mdev to crosvm through --vfio parameter, vfio module
open this device and get this device's information.

Implement PciDevice trait on this device, then vfio_pci
module could trap guest pci cfg r/w and mmio r/w,
and transfer this operation into kernel vfio.

Currently the relationship of vfio container:group:device are
1:1:1, in the future it could extend to 1:m:n.

BUG=chromium:992270
TEST=none

Change-Id: I8006ef65022d56197eaeb464811a59db2ce54b9a
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1580458
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'devices/src/lib.rs')
-rw-r--r--devices/src/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/devices/src/lib.rs b/devices/src/lib.rs
index bc9c8c1..512d08b 100644
--- a/devices/src/lib.rs
+++ b/devices/src/lib.rs
@@ -19,6 +19,7 @@ mod serial;
 pub mod split_irqchip_common;
 pub mod usb;
 mod utils;
+pub mod vfio;
 pub mod virtio;
 
 pub use self::bus::Error as BusError;
@@ -28,6 +29,7 @@ pub use self::i8042::I8042Device;
 pub use self::ioapic::Ioapic;
 pub use self::pci::{
     Ac97Dev, PciConfigIo, PciConfigMmio, PciDevice, PciDeviceError, PciInterruptPin, PciRoot,
+    VfioPciDevice,
 };
 pub use self::pic::Pic;
 pub use self::pit::{Pit, PitError};
@@ -40,4 +42,5 @@ pub use self::serial::{
 };
 pub use self::usb::host_backend::host_backend_device_provider::HostBackendDeviceProvider;
 pub use self::usb::xhci::xhci_controller::XhciController;
+pub use self::vfio::VfioDevice;
 pub use self::virtio::VirtioPciDevice;