1228301Sgrehan/*- 2227652Sgrehan * This header is BSD licensed so anyone can use the definitions to implement 3227652Sgrehan * compatible drivers/servers. 4227652Sgrehan * 5228301Sgrehan * Redistribution and use in source and binary forms, with or without 6228301Sgrehan * modification, are permitted provided that the following conditions 7228301Sgrehan * are met: 8228301Sgrehan * 1. Redistributions of source code must retain the above copyright 9228301Sgrehan * notice, this list of conditions and the following disclaimer. 10228301Sgrehan * 2. Redistributions in binary form must reproduce the above copyright 11228301Sgrehan * notice, this list of conditions and the following disclaimer in the 12228301Sgrehan * documentation and/or other materials provided with the distribution. 13228301Sgrehan * 3. Neither the name of IBM nor the names of its contributors 14228301Sgrehan * may be used to endorse or promote products derived from this software 15228301Sgrehan * without specific prior written permission. 16228301Sgrehan * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17228301Sgrehan * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18228301Sgrehan * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19228301Sgrehan * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE 20228301Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21228301Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22228301Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23228301Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24228301Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25228301Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26228301Sgrehan * SUCH DAMAGE. 27228301Sgrehan * 28227652Sgrehan * $FreeBSD: releng/10.2/sys/dev/virtio/balloon/virtio_balloon.h 238072 2012-07-03 15:15:41Z obrien $ 29227652Sgrehan */ 30227652Sgrehan 31227652Sgrehan#ifndef _VIRTIO_BALLOON_H 32227652Sgrehan#define _VIRTIO_BALLOON_H 33227652Sgrehan 34227652Sgrehan/* Feature bits. */ 35227652Sgrehan#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0x1 /* Tell before reclaiming pages */ 36227652Sgrehan#define VIRTIO_BALLOON_F_STATS_VQ 0x2 /* Memory stats virtqueue */ 37227652Sgrehan 38227652Sgrehan/* Size of a PFN in the balloon interface. */ 39227652Sgrehan#define VIRTIO_BALLOON_PFN_SHIFT 12 40227652Sgrehan 41227652Sgrehanstruct virtio_balloon_config { 42227652Sgrehan /* Number of pages host wants Guest to give up. */ 43227652Sgrehan uint32_t num_pages; 44227652Sgrehan 45227652Sgrehan /* Number of pages we've actually got in balloon. */ 46227652Sgrehan uint32_t actual; 47227652Sgrehan}; 48227652Sgrehan 49227652Sgrehan#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ 50227652Sgrehan#define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */ 51227652Sgrehan#define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */ 52227652Sgrehan#define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ 53227652Sgrehan#define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ 54227652Sgrehan#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ 55227652Sgrehan#define VIRTIO_BALLOON_S_NR 6 56227652Sgrehan 57227652Sgrehanstruct virtio_balloon_stat { 58227652Sgrehan uint16_t tag; 59227652Sgrehan uint64_t val; 60227652Sgrehan} __packed; 61227652Sgrehan 62227652Sgrehan#endif /* _VIRTIO_BALLOON_H */ 63