Patchwork [3/8] virtio: pass host features to driver init functions

login
register
mail settings
Submitter Jesse Larrew
Date Feb. 19, 2013, 11:04 p.m.
Message ID <1361315093-19383-4-git-send-email-jlarrew@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/221918/
State New
Headers show

Comments

Jesse Larrew - Feb. 19, 2013, 11:04 p.m.
Drivers affected:
 * virtio_balloon
 * virtio_serial_bus
 * virtio_scsi
 * virtio_blk
 * virtio_9p
 * virtio_rng

Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
 hw/s390x/s390-virtio-bus.c |  8 +++++---
 hw/s390x/virtio-ccw.c      | 11 +++++++----
 hw/virtio-balloon.c        |  2 +-
 hw/virtio-blk.c            |  3 ++-
 hw/virtio-pci.c            |  9 +++++----
 hw/virtio-scsi.c           |  3 ++-
 hw/virtio-serial-bus.c     |  3 ++-
 hw/virtio.h                | 11 +++++++----
 8 files changed, 31 insertions(+), 19 deletions(-)

Patch

diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index 089ed92..2abd598 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -166,7 +166,7 @@  static int s390_virtio_blk_init(VirtIOS390Device *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_blk_init((DeviceState *)dev, &dev->blk);
+    vdev = virtio_blk_init((DeviceState *)dev, &dev->blk, dev->host_features);
     if (!vdev) {
         return -1;
     }
@@ -182,7 +182,8 @@  static int s390_virtio_serial_init(VirtIOS390Device *dev)
 
     bus = DO_UPCAST(VirtIOS390Bus, bus, dev->qdev.parent_bus);
 
-    vdev = virtio_serial_init((DeviceState *)dev, &dev->serial);
+    vdev = virtio_serial_init((DeviceState *)dev, &dev->serial,
+                              dev->host_features);
     if (!vdev) {
         return -1;
     }
@@ -199,7 +200,8 @@  static int s390_virtio_scsi_init(VirtIOS390Device *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_scsi_init((DeviceState *)dev, &dev->scsi);
+    vdev = virtio_scsi_init((DeviceState *)dev, &dev->scsi,
+                             dev->host_features);
     if (!vdev) {
         return -1;
     }
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index d92e427..32edd2d 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -574,7 +574,8 @@  static int virtio_ccw_blk_init(VirtioCcwDevice *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_blk_init((DeviceState *)dev, &dev->blk);
+    vdev = virtio_blk_init((DeviceState *)dev, &dev->blk,
+                           dev->host_features[0]);
     if (!vdev) {
         return -1;
     }
@@ -593,7 +594,8 @@  static int virtio_ccw_serial_init(VirtioCcwDevice *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_serial_init((DeviceState *)dev, &dev->serial);
+    vdev = virtio_serial_init((DeviceState *)dev, &dev->serial,
+                              dev->host_features[0]);
     if (!vdev) {
         return -1;
     }
@@ -611,7 +613,7 @@  static int virtio_ccw_balloon_init(VirtioCcwDevice *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_balloon_init((DeviceState *)dev);
+    vdev = virtio_balloon_init((DeviceState *)dev, dev->host_features[0]);
     if (!vdev) {
         return -1;
     }
@@ -629,7 +631,8 @@  static int virtio_ccw_scsi_init(VirtioCcwDevice *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_scsi_init((DeviceState *)dev, &dev->scsi);
+    vdev = virtio_scsi_init((DeviceState *)dev, &dev->scsi,
+                            dev->host_features[0]);
     if (!vdev) {
         return -1;
     }
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index c0a7902..4574db6 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -349,7 +349,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, uint32_t host_features)
 {
     VirtIOBalloon *s;
     int ret;
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 34913ee..b3ab267 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -639,7 +639,8 @@  static const BlockDevOps virtio_block_ops = {
     .resize_cb = virtio_blk_resize,
 };
 
-VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk)
+VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk,
+                              uint32_t host_features)
 {
     VirtIOBlock *s;
     static int virtio_blk_id;
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index a869f53..07fbf98 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -933,7 +933,7 @@  static int virtio_blk_init_pci(PCIDevice *pci_dev)
         proxy->class_code != PCI_CLASS_STORAGE_OTHER)
         proxy->class_code = PCI_CLASS_STORAGE_SCSI;
 
-    vdev = virtio_blk_init(&pci_dev->qdev, &proxy->blk);
+    vdev = virtio_blk_init(&pci_dev->qdev, &proxy->blk, proxy->host_features);
     if (!vdev) {
         return -1;
     }
@@ -971,7 +971,8 @@  static int virtio_serial_init_pci(PCIDevice *pci_dev)
         proxy->class_code != PCI_CLASS_OTHERS)          /* qemu-kvm  */
         proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
 
-    vdev = virtio_serial_init(&pci_dev->qdev, &proxy->serial);
+    vdev = virtio_serial_init(&pci_dev->qdev, &proxy->serial,
+                              proxy->host_features);
     if (!vdev) {
         return -1;
     }
@@ -1027,7 +1028,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->host_features);
     if (!vdev) {
         return -1;
     }
@@ -1261,7 +1262,7 @@  static int virtio_scsi_init_pci(PCIDevice *pci_dev)
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
-    vdev = virtio_scsi_init(&pci_dev->qdev, &proxy->scsi);
+    vdev = virtio_scsi_init(&pci_dev->qdev, &proxy->scsi, proxy->host_features);
     if (!vdev) {
         return -EINVAL;
     }
diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index 0715865..d6db042 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -700,7 +700,8 @@  static struct SCSIBusInfo virtio_scsi_scsi_info = {
     .load_request = virtio_scsi_load_request,
 };
 
-VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf)
+VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf,
+                               uint32_t host_features)
 {
     VirtIOSCSI *s;
     static int virtio_scsi_id;
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index aa7d0d7..d6b588f 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -945,7 +945,8 @@  static int virtser_port_qdev_exit(DeviceState *qdev)
     return 0;
 }
 
-VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
+VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf,
+                                 uint32_t host_features)
 {
     VirtIOSerial *vser;
     VirtIODevice *vdev;
diff --git a/hw/virtio.h b/hw/virtio.h
index 7755fec..17ce9c8 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -252,16 +252,19 @@  void virtio_bind_device(VirtIODevice *vdev, const VirtIOBindings *binding,
 
 /* Base devices.  */
 typedef struct VirtIOBlkConf VirtIOBlkConf;
-VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk);
+VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk,
+                              uint32_t host_features);
 struct virtio_net_conf;
 VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
                               struct virtio_net_conf *net,
                               uint32_t host_features);
 typedef struct virtio_serial_conf virtio_serial_conf;
-VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial);
-VirtIODevice *virtio_balloon_init(DeviceState *dev);
+VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial,
+                                 uint32_t host_features);
+VirtIODevice *virtio_balloon_init(DeviceState *dev, uint32_t host_features);
 typedef struct VirtIOSCSIConf VirtIOSCSIConf;
-VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *conf);
+VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *conf,
+                               uint32_t host_features);
 typedef struct VirtIORNGConf VirtIORNGConf;
 VirtIODevice *virtio_rng_init(DeviceState *dev, VirtIORNGConf *conf);
 #ifdef CONFIG_LINUX