diff options
author | Zach Reizner <zachr@google.com> | 2017-07-19 11:41:02 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-07-20 00:37:00 -0700 |
commit | 648a58d2486f462444a73b11cb5fc2b9a7148ab0 (patch) | |
tree | b6ba453c11f325152a1a47da9563ba6d087f049c /src/hw/virtio/queue.rs | |
parent | 5b5574471b2a13eea453ffb41bf8d92976ff0547 (diff) | |
download | crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.tar crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.tar.gz crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.tar.bz2 crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.tar.lz crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.tar.xz crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.tar.zst crosvm-648a58d2486f462444a73b11cb5fc2b9a7148ab0.zip |
crosvm: mmio register and queue check fixes
According to the Virtio specification, all MMIO register access must be 32-bit wide and aligned. However, this restriction is not true in general for the config space. This change relaxes the restriction for accesses to config space. This change also checks that each queue is valid before activating a device. TEST=crosvm run BUG=None Change-Id: I10228d99992576837ff505aad56fefbc4d8eff78 Reviewed-on: https://chromium-review.googlesource.com/578314 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'src/hw/virtio/queue.rs')
-rw-r--r-- | src/hw/virtio/queue.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/hw/virtio/queue.rs b/src/hw/virtio/queue.rs index b993715..1cdb9c0 100644 --- a/src/hw/virtio/queue.rs +++ b/src/hw/virtio/queue.rs @@ -3,7 +3,6 @@ // found in the LICENSE file. use std::cmp::min; -use std::result; use sys_util::{GuestAddress, GuestMemory}; @@ -203,7 +202,7 @@ impl Queue { min(self.size, self.max_size) } - fn is_valid(&self, mem: &GuestMemory) -> bool { + pub fn is_valid(&self, mem: &GuestMemory) -> bool { let queue_size = self.actual_size() as usize; let desc_table = self.desc_table; let desc_table_size = 16 * queue_size; |