summary refs log tree commit diff
path: root/devices/src/virtio/mod.rs
diff options
context:
space:
mode:
authorChuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>2019-12-03 09:34:39 +0800
committerCommit Bot <commit-bot@chromium.org>2020-01-03 11:12:01 +0000
commit572ca0cca2b53157ce857676b1f054464d4522bd (patch)
treea62c3822353642d8246d3215d99c6de69eff6a64 /devices/src/virtio/mod.rs
parent3dc90d0124ca4d797ff9119daf16016b225c1d96 (diff)
downloadcrosvm-572ca0cca2b53157ce857676b1f054464d4522bd.tar
crosvm-572ca0cca2b53157ce857676b1f054464d4522bd.tar.gz
crosvm-572ca0cca2b53157ce857676b1f054464d4522bd.tar.bz2
crosvm-572ca0cca2b53157ce857676b1f054464d4522bd.tar.lz
crosvm-572ca0cca2b53157ce857676b1f054464d4522bd.tar.xz
crosvm-572ca0cca2b53157ce857676b1f054464d4522bd.tar.zst
crosvm-572ca0cca2b53157ce857676b1f054464d4522bd.zip
virtio: call virtio device reset method for reset
It refers to the implementation of the Cloud-hypervisor
commit:
- vm-virtio: Reset underlying device on driver request

If the driver triggers a reset by writing zero into the status register
then reset the underlying device if supported. A device reset also
requires resetting various aspects of the queue.

The reset method of a virtio device might return false if it is failed
to reset the device or it is not implemented. In this case, we don't
reset the queues. Otherwise the queues will also be reset together with
a successful device reset.

BUG=chromium:1030609
TEST=cargo test -p devices

Change-Id: Iad2be38149e423a79d8366dc72e570a1d6eb297c
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1971096
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'devices/src/virtio/mod.rs')
-rw-r--r--devices/src/virtio/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/devices/src/virtio/mod.rs b/devices/src/virtio/mod.rs
index c0b84fe..a1701f5 100644
--- a/devices/src/virtio/mod.rs
+++ b/devices/src/virtio/mod.rs
@@ -49,6 +49,7 @@ pub use self::wl::*;
 use std::cmp;
 use std::convert::TryFrom;
 
+const DEVICE_RESET: u32 = 0x0;
 const DEVICE_ACKNOWLEDGE: u32 = 0x01;
 const DEVICE_DRIVER: u32 = 0x02;
 const DEVICE_DRIVER_OK: u32 = 0x04;