1 /* 2 * Virtio Support 3 * 4 * Copyright IBM, Corp. 2007-2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * Rusty Russell <rusty@rustcorp.com.au> 9 * 10 * This work is licensed under the terms of the GNU GPL, version 2. See 11 * the COPYING file in the top-level directory. 12 * 13 */ 14 15 #ifndef QEMU_VIRTIO_BALLOON_H 16 #define QEMU_VIRTIO_BALLOON_H 17 18 #include "standard-headers/linux/virtio_balloon.h" 19 #include "hw/virtio/virtio.h" 20 21 #define TYPE_VIRTIO_BALLOON "virtio-balloon-device" 22 #define VIRTIO_BALLOON(obj) \ 23 OBJECT_CHECK(VirtIOBalloon, (obj), TYPE_VIRTIO_BALLOON) 24 25 typedef struct virtio_balloon_stat VirtIOBalloonStat; 26 27 typedef struct virtio_balloon_stat_modern { 28 uint16_t tag; 29 uint8_t reserved[6]; 30 uint64_t val; 31 } VirtIOBalloonStatModern; 32 33 typedef struct PartiallyBalloonedPage PartiallyBalloonedPage; 34 35 typedef struct VirtIOBalloon { 36 VirtIODevice parent_obj; 37 VirtQueue *ivq, *dvq, *svq; 38 uint32_t num_pages; 39 uint32_t actual; 40 uint64_t stats[VIRTIO_BALLOON_S_NR]; 41 VirtQueueElement *stats_vq_elem; 42 size_t stats_vq_offset; 43 QEMUTimer *stats_timer; 44 int64_t stats_last_update; 45 int64_t stats_poll_interval; 46 uint32_t host_features; 47 PartiallyBalloonedPage *pbp; 48 } VirtIOBalloon; 49 50 #endif 51