From 8a4a13d48d8495c3291d033e9ff05d0c9fd0b2ee Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 30 Aug 2018 16:29:00 -0700 Subject: virtio-gpu: fix reporting of VIRTIO_F_VERSION_1 The virtio 1.0 feature flag is defined as a shift count, not a mask. While we're at it, change the virtio gpu features() function to the avail_features style used in other devices for consistency. BUG=None TEST=None Change-Id: I704d9676cfe5f13d9a2f83eb9160937e94070d1e Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/1198224 Reviewed-by: Zach Reizner --- devices/src/virtio/gpu/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'devices/src') diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs index c4f2272..65c01c5 100644 --- a/devices/src/virtio/gpu/mod.rs +++ b/devices/src/virtio/gpu/mod.rs @@ -635,9 +635,10 @@ impl VirtioDevice for Gpu { } fn features(&self, page: u32) -> u32 { + let avail_features: u64 = 1 << VIRTIO_GPU_F_VIRGL | 1 << VIRTIO_F_VERSION_1; match page { - 0 => (1 << VIRTIO_GPU_F_VIRGL), - 1 => VIRTIO_F_VERSION_1, + 0 => avail_features as u32, + 1 => (avail_features >> 32) as u32, _ => 0, } } -- cgit 1.4.1