summary refs log tree commit diff
path: root/devices/src/virtio/pmem.rs
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2019-11-01 10:01:23 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-18 07:43:03 +0000
commit24eeed2b6fb6306f404238d1343db4b55aa9beef (patch)
tree0a347754994d470b3df3e3811430b4da6758ea17 /devices/src/virtio/pmem.rs
parente7c46cad4150ecb18a0832a61042522974543938 (diff)
downloadcrosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.gz
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.bz2
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.lz
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.xz
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.zst
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.zip
devices: virtio: pass Interrupt to activate()
Factor out the common creation of struct Interrupt.

No functional change.

BUG=chromium:854765
TEST=./build_test

Change-Id: Idf8804771ba1af5181818f643e15e1b42918258a
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898268
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'devices/src/virtio/pmem.rs')
-rw-r--r--devices/src/virtio/pmem.rs17
1 files changed, 2 insertions, 15 deletions
diff --git a/devices/src/virtio/pmem.rs b/devices/src/virtio/pmem.rs
index 07ed137..931b037 100644
--- a/devices/src/virtio/pmem.rs
+++ b/devices/src/virtio/pmem.rs
@@ -6,18 +6,13 @@ use std::fmt::{self, Display};
 use std::fs::File;
 use std::io;
 use std::os::unix::io::{AsRawFd, RawFd};
-use std::sync::atomic::AtomicUsize;
-use std::sync::Arc;
 use std::thread;
-use sync::Mutex;
 
 use sys_util::Result as SysResult;
 use sys_util::{error, EventFd, GuestAddress, GuestMemory, PollContext, PollToken};
 
 use data_model::{DataInit, Le32, Le64};
 
-use crate::pci::MsixConfig;
-
 use super::{
     copy_config, DescriptorChain, DescriptorError, Interrupt, Queue, Reader, VirtioDevice, Writer,
     TYPE_PMEM, VIRTIO_F_VERSION_1,
@@ -268,10 +263,7 @@ impl VirtioDevice for Pmem {
     fn activate(
         &mut self,
         memory: GuestMemory,
-        interrupt_event: EventFd,
-        interrupt_resample_event: EventFd,
-        msix_config: Option<Arc<Mutex<MsixConfig>>>,
-        status: Arc<AtomicUsize>,
+        interrupt: Interrupt,
         mut queues: Vec<Queue>,
         mut queue_events: Vec<EventFd>,
     ) {
@@ -297,12 +289,7 @@ impl VirtioDevice for Pmem {
                 .name("virtio_pmem".to_string())
                 .spawn(move || {
                     let mut worker = Worker {
-                        interrupt: Interrupt::new(
-                            status,
-                            interrupt_event,
-                            interrupt_resample_event,
-                            msix_config,
-                        ),
+                        interrupt,
                         memory,
                         disk_image,
                         queue,