Statistics
| Branch: | Revision:

root / hw / virtio-balloon.h @ 6d0ee850

History | View | Annotate | Download (1.5 kB)

1 bd322087 aliguori
/*
2 bd322087 aliguori
 * Virtio Support
3 bd322087 aliguori
 *
4 bd322087 aliguori
 * Copyright IBM, Corp. 2007-2008
5 bd322087 aliguori
 *
6 bd322087 aliguori
 * Authors:
7 bd322087 aliguori
 *  Anthony Liguori   <aliguori@us.ibm.com>
8 bd322087 aliguori
 *  Rusty Russell     <rusty@rustcorp.com.au>
9 bd322087 aliguori
 *
10 bd322087 aliguori
 * This work is licensed under the terms of the GNU GPL, version 2.  See
11 bd322087 aliguori
 * the COPYING file in the top-level directory.
12 bd322087 aliguori
 *
13 bd322087 aliguori
 */
14 bd322087 aliguori
15 bd322087 aliguori
#ifndef _QEMU_VIRTIO_BALLOON_H
16 bd322087 aliguori
#define _QEMU_VIRTIO_BALLOON_H
17 bd322087 aliguori
18 bd322087 aliguori
#include "virtio.h"
19 bd322087 aliguori
#include "pci.h"
20 bd322087 aliguori
21 bd322087 aliguori
/* from Linux's linux/virtio_balloon.h */
22 bd322087 aliguori
23 bd322087 aliguori
/* The ID for virtio_balloon */
24 bd322087 aliguori
#define VIRTIO_ID_BALLOON 5
25 bd322087 aliguori
26 bd322087 aliguori
/* The feature bitmap for virtio balloon */
27 bd322087 aliguori
#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
28 625a5bef Adam Litke
#define VIRTIO_BALLOON_F_STATS_VQ 1       /* Memory stats virtqueue */
29 bd322087 aliguori
30 bd322087 aliguori
/* Size of a PFN in the balloon interface. */
31 bd322087 aliguori
#define VIRTIO_BALLOON_PFN_SHIFT 12
32 bd322087 aliguori
33 bd322087 aliguori
struct virtio_balloon_config
34 bd322087 aliguori
{
35 bd322087 aliguori
    /* Number of pages host wants Guest to give up. */
36 bd322087 aliguori
    uint32_t num_pages;
37 bd322087 aliguori
    /* Number of pages we've actually got in balloon. */
38 bd322087 aliguori
    uint32_t actual;
39 bd322087 aliguori
};
40 bd322087 aliguori
41 625a5bef Adam Litke
/* Memory Statistics */
42 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_SWAP_IN  0   /* Amount of memory swapped in */
43 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_SWAP_OUT 1   /* Amount of memory swapped out */
44 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_MAJFLT   2   /* Number of major faults */
45 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_MINFLT   3   /* Number of minor faults */
46 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_MEMFREE  4   /* Total amount of free memory */
47 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
48 625a5bef Adam Litke
#define VIRTIO_BALLOON_S_NR       6
49 625a5bef Adam Litke
50 625a5bef Adam Litke
typedef struct VirtIOBalloonStat {
51 625a5bef Adam Litke
    uint16_t tag;
52 625a5bef Adam Litke
    uint64_t val;
53 625a5bef Adam Litke
} __attribute__((packed)) VirtIOBalloonStat;
54 625a5bef Adam Litke
55 bd322087 aliguori
#endif