@@ -524,6 +524,51 @@ pub mod vsock {
524524 impl crate :: FeatureBits for F { }
525525}
526526
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 of the balloon is always? permitted on guest out of memory condition.
543+ ///
544+ /// TODO: Spec is a bit confusing on this feature, see <https://github.com/oasis-tcs/virtio-spec/issues/228>
545+ #[ doc( alias = "VIRTIO_BALLOON_F_DEFLATE_ON_OOM" ) ]
546+ const DEFLATE_ON_OOM = 1 << 2 ;
547+
548+ /// The device has support for free page hinting.
549+ /// A virtqueue for providing hints as to what memory is currently free is present.
550+ /// Configuration field [`free_page_hint_cmd_id`](`crate::balloon::ConfigVolatileFieldAccess::free_page_hint_cmd_id`) is valid.
551+ #[ doc( alias = "VIRTIO_BALLOON_F_FREE_PAGE_HINT" ) ]
552+ const FREE_PAGE_HINT = 1 << 3 ;
553+
554+ /// A hint to the device, that the driver will immediately write
555+ /// [`poison_val`] to pages after deflating them.
556+ /// Configuration field [`poison_val`] is valid.
557+ ///
558+ /// [`poison_val`]: crate::balloon::ConfigVolatileFieldAccess::poison_val
559+ #[ doc( alias = "VIRTIO_BALLOON_F_PAGE_POISON" ) ]
560+ const PAGE_POISON = 1 << 4 ;
561+
562+ /// The device has support for free page reporting.
563+ /// A virtqueue for reporting free guest memory is present.
564+ #[ doc( alias = "VIRTIO_BALLOON_F_PAGE_REPORTING" ) ]
565+ const PAGE_REPORTING = 1 << 5 ;
566+ }
567+ }
568+
569+ impl crate :: FeatureBits for F { }
570+ }
571+
527572#[ cfg( test) ]
528573mod tests {
529574 use super :: * ;
0 commit comments