diff options
author | Stephen Barber <smbarber@chromium.org> | 2017-06-15 23:23:19 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-07-07 13:15:46 -0700 |
commit | 6a4ca7556aeb0bac836347460b397dec10ee534c (patch) | |
tree | 7623193601e21f8199d402d1d3b86e7db0bf873a /src/hw/virtio/mmio.rs | |
parent | a2b0fc1b8ef315ffe2d7f12cb987d0370d00f10c (diff) | |
download | crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.gz crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.bz2 crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.lz crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.xz crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.zst crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.zip |
crosvm: add device type for VirtioDevice
A VirtioDevice should expose its type so that the guest can probe it correctly. BUG=none TEST=boot with block device Change-Id: I6a8cae3afbdc5ae9f6af23eea928c83e67719c12 Reviewed-on: https://chromium-review.googlesource.com/538104 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
Diffstat (limited to 'src/hw/virtio/mmio.rs')
-rw-r--r-- | src/hw/virtio/mmio.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/hw/virtio/mmio.rs b/src/hw/virtio/mmio.rs index 176adb0..24f2d4d 100644 --- a/src/hw/virtio/mmio.rs +++ b/src/hw/virtio/mmio.rs @@ -24,6 +24,9 @@ const MMIO_VERSION: u32 = 2; /// Optionally, a virtio device can implement device reset in which it returns said resources and /// resets its internal. pub trait VirtioDevice: Send { + /// The virtio device type. + fn device_type(&self) -> u32; + /// The maximum size of each queue that this device supports. fn queue_max_sizes(&self) -> &[u16]; @@ -170,7 +173,7 @@ impl BusDevice for MmioDevice { let v = match offset { 0x0 => MMIO_MAGIC_VALUE, 0x004 => MMIO_VERSION, - 0x008 => TYPE_BLOCK, + 0x008 => self.device.device_type(), 0x00c => VENDOR_ID, // vendor id 0x010 => { self.device.features(self.features_select) | |