1 /* 2 * This header is BSD licensed so anyone can use the definitions to implement 3 * compatible drivers/servers. 4 * 5 * $FreeBSD$ 6 */ 7 8 #ifndef _VIRTIO_BALLOON_H 9 #define _VIRTIO_BALLOON_H 10 11 #include <sys/types.h> 12 13 /* Feature bits. */ 14 #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0x1 /* Tell before reclaiming pages */ 15 #define VIRTIO_BALLOON_F_STATS_VQ 0x2 /* Memory stats virtqueue */ 16 17 /* Size of a PFN in the balloon interface. */ 18 #define VIRTIO_BALLOON_PFN_SHIFT 12 19 20 struct virtio_balloon_config { 21 /* Number of pages host wants Guest to give up. */ 22 uint32_t num_pages; 23 24 /* Number of pages we've actually got in balloon. */ 25 uint32_t actual; 26 }; 27 28 #define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ 29 #define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */ 30 #define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */ 31 #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ 32 #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ 33 #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ 34 #define VIRTIO_BALLOON_S_NR 6 35 36 struct virtio_balloon_stat { 37 uint16_t tag; 38 uint64_t val; 39 } __packed; 40 41 #endif /* _VIRTIO_BALLOON_H */ 42