diff options
author | Daniel Verkamp <dverkamp@chromium.org> | 2018-10-24 13:07:02 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-26 20:31:22 -0800 |
commit | f4ee2ad205b5e014575252c9eccd0ae0bb306b8a (patch) | |
tree | 0838f5f3221b01e49a257f2dc9221b13ec84e068 /devices/src/virtio/block.rs | |
parent | 45cfe2164b3feed15ae5a58bcd91176fbb788e9d (diff) | |
download | crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.tar crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.tar.gz crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.tar.bz2 crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.tar.lz crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.tar.xz crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.tar.zst crosvm-f4ee2ad205b5e014575252c9eccd0ae0bb306b8a.zip |
devices: make all virtio devices report version 1
Our virtio devices are all "modern" (no legacy/transitional support). Add VIRTIO_F_VERSION_1 to the features() handler for all virtio devices that didn't already have it. This lets us remove the hack that forced VIRTIO_F_VERSION_1 on for all devices. BUG=None TEST=build_test; boot crosvm on kevin Change-Id: I008926a9075679aae46069aa37a14504f10e8584 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1313013 Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'devices/src/virtio/block.rs')
-rw-r--r-- | devices/src/virtio/block.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/devices/src/virtio/block.rs b/devices/src/virtio/block.rs index f2ddb2c..7d5fb02 100644 --- a/devices/src/virtio/block.rs +++ b/devices/src/virtio/block.rs @@ -22,7 +22,10 @@ use sys_util::{ use data_model::{DataInit, Le16, Le32, Le64}; -use super::{DescriptorChain, Queue, VirtioDevice, INTERRUPT_STATUS_USED_RING, TYPE_BLOCK}; +use super::{ + DescriptorChain, Queue, VirtioDevice, INTERRUPT_STATUS_USED_RING, TYPE_BLOCK, + VIRTIO_F_VERSION_1, +}; const QUEUE_SIZE: u16 = 256; const QUEUE_SIZES: &'static [u16] = &[QUEUE_SIZE]; @@ -655,6 +658,7 @@ impl<T: DiskFile> Block<T> { avail_features |= 1 << VIRTIO_BLK_F_DISCARD; avail_features |= 1 << VIRTIO_BLK_F_WRITE_ZEROES; } + avail_features |= 1 << VIRTIO_F_VERSION_1; Ok(Block { kill_evt: None, @@ -798,8 +802,8 @@ mod tests { let f = File::create(&path).unwrap(); let b = Block::new(f, false).unwrap(); // writable device should set VIRTIO_BLK_F_FLUSH + VIRTIO_BLK_F_DISCARD - // + VIRTIO_BLK_F_WRITE_ZEROES - assert_eq!(0x6200, b.features()); + // + VIRTIO_BLK_F_WRITE_ZEROES + VIRTIO_F_VERSION_1 + assert_eq!(0x100006200, b.features()); } // read-only block device @@ -807,7 +811,8 @@ mod tests { let f = File::create(&path).unwrap(); let b = Block::new(f, true).unwrap(); // read-only device should set VIRTIO_BLK_F_FLUSH and VIRTIO_BLK_F_RO - assert_eq!(0x220, b.features()); + // + VIRTIO_F_VERSION_1 + assert_eq!(0x100000220, b.features()); } } } |