summary refs log tree commit diff
path: root/aarch64
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2018-10-03 13:22:59 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-04 00:37:22 -0700
commitc8986f14a8dd9f256d6faed55996d955b50ff923 (patch)
treece84d117a3d5e902a57a01ffb1ca553031d0c844 /aarch64
parentd635acbaf348c0863bc05b8f889b2fa5f8156aaa (diff)
downloadcrosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.tar
crosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.tar.gz
crosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.tar.bz2
crosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.tar.lz
crosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.tar.xz
crosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.tar.zst
crosvm-c8986f14a8dd9f256d6faed55996d955b50ff923.zip
Revert "linux: Convert all virtio devices to PCI"
This reverts commit d635acbaf348c0863bc05b8f889b2fa5f8156aaa.

This commit seems to be responsible for introducing hung tasks in tests,
so let's revert it for now to get the tests green and debug it offline.

BUG=chromium:891806
TEST=None

Change-Id: I83504058baeae00909d9fb4f4bb704a144a0dfaf
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1259408
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'aarch64')
-rw-r--r--aarch64/Cargo.toml1
-rw-r--r--aarch64/src/lib.rs23
2 files changed, 14 insertions, 10 deletions
diff --git a/aarch64/Cargo.toml b/aarch64/Cargo.toml
index 5845982..45201ae 100644
--- a/aarch64/Cargo.toml
+++ b/aarch64/Cargo.toml
@@ -7,7 +7,6 @@ authors = ["The Chromium OS Authors"]
 arch = { path = "../arch" }
 data_model = { path = "../data_model" }
 devices = { path = "../devices" }
-io_jail = { path = "../io_jail" }
 kernel_cmdline = { path = "../kernel_cmdline" }
 kvm_sys = { path = "../kvm_sys" }
 kvm = { path = "../kvm" }
diff --git a/aarch64/src/lib.rs b/aarch64/src/lib.rs
index cab05d5..8d71d44 100644
--- a/aarch64/src/lib.rs
+++ b/aarch64/src/lib.rs
@@ -6,7 +6,6 @@ extern crate arch;
 extern crate byteorder;
 extern crate data_model;
 extern crate devices;
-extern crate io_jail;
 extern crate kernel_cmdline;
 extern crate kvm;
 extern crate kvm_sys;
@@ -23,9 +22,8 @@ use std::sync::{Arc, Mutex};
 use std::os::unix::io::FromRawFd;
 use std::os::unix::net::UnixDatagram;
 
-use arch::{RunnableLinuxVm, VmComponents};
-use devices::{Bus, BusError, PciConfigMmio, PciDevice, PciInterruptPin};
-use io_jail::Minijail;
+use arch::{RunnableLinuxVm, VirtioDeviceStub, VmComponents};
+use devices::{Bus, BusError, PciConfigMmio, PciInterruptPin};
 use sys_util::{EventFd, GuestAddress, GuestMemory};
 use resources::{AddressRanges, SystemAllocator};
 
@@ -195,7 +193,7 @@ pub struct AArch64;
 impl arch::LinuxArch for AArch64 {
     fn build_vm<F>(mut components: VmComponents, virtio_devs: F) -> Result<RunnableLinuxVm>
         where
-            F: FnOnce(&GuestMemory, &EventFd) -> Result<Vec<(Box<PciDevice + 'static>, Minijail)>>
+            F: FnOnce(&GuestMemory, &EventFd) -> Result<Vec<VirtioDeviceStub>>
     {
         let mut resources = Self::get_resource_allocator(components.memory_mb,
                                                          components.wayland_dmabuf);
@@ -218,20 +216,27 @@ impl arch::LinuxArch for AArch64 {
 
         let mut mmio_bus = devices::Bus::new();
 
-        let exit_evt = EventFd::new().map_err(Error::CreateEventFd)?;
-
-        let pci_devices = virtio_devs(&mem, &exit_evt)?;
-        let (pci, pci_irqs) = arch::generate_pci_root(pci_devices,
+        let (pci, pci_irqs) = arch::generate_pci_root(components.pci_devices,
                                                       &mut mmio_bus,
                                                       &mut resources,
                                                       &mut vm)
             .map_err(Error::CreatePciRoot)?;
         let pci_bus = Arc::new(Mutex::new(PciConfigMmio::new(pci)));
 
+        let exit_evt = EventFd::new().map_err(Error::CreateEventFd)?;
         let (io_bus, stdio_serial) = Self::setup_io_bus()?;
 
+        // Create a list of mmio devices to be added.
+        let mmio_devs = virtio_devs(&mem, &exit_evt)?;
+
         Self::add_arch_devs(&mut vm, &mut mmio_bus)?;
 
+        for stub in mmio_devs {
+            arch::register_mmio(&mut mmio_bus, &mut vm, stub.dev, stub.jail,
+                                &mut resources, &mut cmdline)
+                .map_err(Error::RegisterVsock)?;
+        }
+
         mmio_bus.insert(pci_bus.clone(), AARCH64_PCI_CFG_BASE, AARCH64_PCI_CFG_SIZE, false)
             .map_err(Error::RegisterPci)?;