@@ -524,6 +524,55 @@ pub mod vsock {
524
524
impl crate :: FeatureBits for F { }
525
525
}
526
526
527
+ pub mod balloon {
528
+ use crate :: le128;
529
+
530
+ feature_bits ! {
531
+ /// Traditional Memory Balloon Device Feature Bits
532
+ #[ doc( alias = "VIRTIO_BALLOON_F" ) ]
533
+ pub struct F : le128 {
534
+ /// Host has to be told before pages from the balloon are used.
535
+ #[ doc( alias = "VIRTIO_BALLOON_F_MUST_TELL_HOST" ) ]
536
+ const MUST_TELL_HOST = 1 << 0 ;
537
+
538
+ /// A virtqueue for reporting guest memory statistics is present.
539
+ #[ doc( alias = "VIRTIO_BALLOON_F_STATS_VQ" ) ]
540
+ const STATS_VQ = 1 << 1 ;
541
+
542
+ /// Deflate balloon on guest out of memory condition.
543
+ ///
544
+ /// <div class="warning">
545
+ ///
546
+ /// The specification is a bit confusing on this feature, see [oasis-tcs/virtio-spec#228](https://github.com/oasis-tcs/virtio-spec/issues/228).
547
+ ///
548
+ /// </div>
549
+ #[ doc( alias = "VIRTIO_BALLOON_F_DEFLATE_ON_OOM" ) ]
550
+ const DEFLATE_ON_OOM = 1 << 2 ;
551
+
552
+ /// The device has support for free page hinting.
553
+ /// A virtqueue for providing hints as to what memory is currently free is present.
554
+ /// Configuration field [`free_page_hint_cmd_id`](`crate::balloon::ConfigVolatileFieldAccess::free_page_hint_cmd_id`) is valid.
555
+ #[ doc( alias = "VIRTIO_BALLOON_F_FREE_PAGE_HINT" ) ]
556
+ const FREE_PAGE_HINT = 1 << 3 ;
557
+
558
+ /// A hint to the device, that the driver will immediately write
559
+ /// [`poison_val`] to pages after deflating them.
560
+ /// Configuration field [`poison_val`] is valid.
561
+ ///
562
+ /// [`poison_val`]: crate::balloon::ConfigVolatileFieldAccess::poison_val
563
+ #[ doc( alias = "VIRTIO_BALLOON_F_PAGE_POISON" ) ]
564
+ const PAGE_POISON = 1 << 4 ;
565
+
566
+ /// The device has support for free page reporting.
567
+ /// A virtqueue for reporting free guest memory is present.
568
+ #[ doc( alias = "VIRTIO_BALLOON_F_PAGE_REPORTING" ) ]
569
+ const PAGE_REPORTING = 1 << 5 ;
570
+ }
571
+ }
572
+
573
+ impl crate :: FeatureBits for F { }
574
+ }
575
+
527
576
#[ cfg( test) ]
528
577
mod tests {
529
578
use super :: * ;
0 commit comments