Patchwork [RFC,2/3] virtio-balloon: add virtio_balloon_conf skeleton

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 18, 2012, 8:16 p.m.
Message ID <1355861815-2607-3-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/207196/
State New
Headers show

Comments

Luiz Capitulino - Dec. 18, 2012, 8:16 p.m.
Next commit wants it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 hw/virtio-balloon.c | 2 +-
 hw/virtio-balloon.h | 4 ++++
 hw/virtio-pci.c     | 2 +-
 hw/virtio-pci.h     | 2 ++
 hw/virtio.h         | 3 ++-
 5 files changed, 10 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index 03248df..97d49b1 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -235,7 +235,7 @@  static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
     return 0;
 }
 
-VirtIODevice *virtio_balloon_init(DeviceState *dev)
+VirtIODevice *virtio_balloon_init(DeviceState *dev, virtio_balloon_conf *conf)
 {
     VirtIOBalloon *s;
     int ret;
diff --git a/hw/virtio-balloon.h b/hw/virtio-balloon.h
index 73300dd..9d631d5 100644
--- a/hw/virtio-balloon.h
+++ b/hw/virtio-balloon.h
@@ -38,6 +38,10 @@  struct virtio_balloon_config
     uint32_t actual;
 };
 
+typedef struct virtio_balloon_conf
+{
+} virtio_balloon_conf;
+
 /* Memory Statistics */
 #define VIRTIO_BALLOON_S_SWAP_IN  0   /* Amount of memory swapped in */
 #define VIRTIO_BALLOON_S_SWAP_OUT 1   /* Amount of memory swapped out */
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 7684ac9..026222b 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -835,7 +835,7 @@  static int virtio_balloon_init_pci(PCIDevice *pci_dev)
         proxy->class_code = PCI_CLASS_OTHERS;
     }
 
-    vdev = virtio_balloon_init(&pci_dev->qdev);
+    vdev = virtio_balloon_init(&pci_dev->qdev, &proxy->balloon);
     if (!vdev) {
         return -1;
     }
diff --git a/hw/virtio-pci.h b/hw/virtio-pci.h
index b58d9a2..3e4ca0d 100644
--- a/hw/virtio-pci.h
+++ b/hw/virtio-pci.h
@@ -20,6 +20,7 @@ 
 #include "virtio-rng.h"
 #include "virtio-serial.h"
 #include "virtio-scsi.h"
+#include "virtio-balloon.h"
 
 /* Performance improves when virtqueue kick processing is decoupled from the
  * vcpu thread using ioeventfd for some devices. */
@@ -46,6 +47,7 @@  typedef struct {
 #endif
     virtio_serial_conf serial;
     virtio_net_conf net;
+    virtio_balloon_conf balloon;
     VirtIOSCSIConf scsi;
     VirtIORNGConf rng;
     bool ioeventfd_disabled;
diff --git a/hw/virtio.h b/hw/virtio.h
index 7c17f7b..9a85a41 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -201,7 +201,8 @@  VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
                               struct virtio_net_conf *net);
 typedef struct virtio_serial_conf virtio_serial_conf;
 VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial);
-VirtIODevice *virtio_balloon_init(DeviceState *dev);
+typedef struct virtio_balloon_conf virtio_balloon_conf;
+VirtIODevice *virtio_balloon_init(DeviceState *dev, virtio_balloon_conf *conf);
 typedef struct VirtIOSCSIConf VirtIOSCSIConf;
 VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *conf);
 typedef struct VirtIORNGConf VirtIORNGConf;