mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
devices: balloon: define features as shift counts
This matches the definitions from the virtio specification and makes balloon consistent with the other virtio devices in crosvm. BUG=None TEST=build_test.py Change-Id: I9dd6b6ec981944e28eaf6bc92332db5ec326433b Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1313011 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
This commit is contained in:
parent
994e418039
commit
60f55da937
1 changed files with 4 additions and 4 deletions
|
@ -37,8 +37,8 @@ const QUEUE_SIZES: &'static [u16] = &[QUEUE_SIZE, QUEUE_SIZE];
|
||||||
const VIRTIO_BALLOON_PFN_SHIFT: u32 = 12;
|
const VIRTIO_BALLOON_PFN_SHIFT: u32 = 12;
|
||||||
|
|
||||||
// The feature bitmap for virtio balloon
|
// The feature bitmap for virtio balloon
|
||||||
const VIRTIO_BALLOON_F_MUST_TELL_HOST: u32 = 0x01; // Tell before reclaiming pages
|
const VIRTIO_BALLOON_F_MUST_TELL_HOST: u32 = 0; // Tell before reclaiming pages
|
||||||
const VIRTIO_BALLOON_F_DEFLATE_ON_OOM: u32 = 0x04; // Deflate balloon on OOM
|
const VIRTIO_BALLOON_F_DEFLATE_ON_OOM: u32 = 2; // Deflate balloon on OOM
|
||||||
|
|
||||||
// BalloonConfig is modified by the worker and read from the device thread.
|
// BalloonConfig is modified by the worker and read from the device thread.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
@ -235,7 +235,7 @@ impl Balloon {
|
||||||
}),
|
}),
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
// TODO(dgreid) - Add stats queue feature.
|
// TODO(dgreid) - Add stats queue feature.
|
||||||
features: VIRTIO_BALLOON_F_MUST_TELL_HOST | VIRTIO_BALLOON_F_DEFLATE_ON_OOM,
|
features: 1 << VIRTIO_BALLOON_F_MUST_TELL_HOST | 1 << VIRTIO_BALLOON_F_DEFLATE_ON_OOM,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ impl VirtioDevice for Balloon {
|
||||||
|
|
||||||
fn features(&self, page: u32) -> u32 {
|
fn features(&self, page: u32) -> u32 {
|
||||||
match page {
|
match page {
|
||||||
0 => VIRTIO_BALLOON_F_MUST_TELL_HOST | VIRTIO_BALLOON_F_DEFLATE_ON_OOM,
|
0 => 1 << VIRTIO_BALLOON_F_MUST_TELL_HOST | 1 << VIRTIO_BALLOON_F_DEFLATE_ON_OOM,
|
||||||
_ => 0u32,
|
_ => 0u32,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue