aboutsummaryrefslogtreecommitdiff
path: root/hw/s390-virtio-bus.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-01-02 08:01:36 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2013-01-02 08:01:36 -0600
commit079944e695589364d19de31f27761c6bdea1c207 (patch)
tree072caf3ebee747b1ff92ad8e0086ff4edbd7220e /hw/s390-virtio-bus.c
parenta97ff30e934c4d673122cf709e8e87f0effbe2f7 (diff)
parent89d62be9f4fb538db7f919a2be7df2544ffc02c5 (diff)
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pci,virtio This optimizes MSIX handling in virtio-pci. Also included is pci express capability bugfix. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> * mst/tags/for_anthony: virtio-pci: don't poll masked vectors msix: expose access to masked/pending state msi: add API to get notified about pending bit poll pcie: Fix bug in pcie_ext_cap_set_next virtio: make bindings typesafe
Diffstat (limited to 'hw/s390-virtio-bus.c')
-rw-r--r--hw/s390-virtio-bus.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index b78d6264fe..7e991755b4 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -138,7 +138,7 @@ static int s390_virtio_device_init(VirtIOS390Device *dev, VirtIODevice *vdev)
bus->dev_offs += dev_len;
- virtio_bind_device(vdev, &virtio_s390_bindings, dev);
+ virtio_bind_device(vdev, &virtio_s390_bindings, DEVICE(dev));
dev->host_features = vdev->get_features(vdev, dev->host_features);
s390_virtio_device_sync(dev);
s390_virtio_reset_idx(dev);
@@ -364,18 +364,32 @@ VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus, ram_addr_t mem)
return NULL;
}
-static void virtio_s390_notify(void *opaque, uint16_t vector)
+/* DeviceState to VirtIOS390Device. Note: used on datapath,
+ * be careful and test performance if you change this.
+ */
+static inline VirtIOS390Device *to_virtio_s390_device_fast(DeviceState *d)
+{
+ return container_of(d, VirtIOS390Device, qdev);
+}
+
+/* DeviceState to VirtIOS390Device. TODO: use QOM. */
+static inline VirtIOS390Device *to_virtio_s390_device(DeviceState *d)
+{
+ return container_of(d, VirtIOS390Device, qdev);
+}
+
+static void virtio_s390_notify(DeviceState *d, uint16_t vector)
{
- VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
+ VirtIOS390Device *dev = to_virtio_s390_device_fast(d);
uint64_t token = s390_virtio_device_vq_token(dev, vector);
S390CPU *cpu = s390_cpu_addr2state(0);
s390_virtio_irq(cpu, 0, token);
}
-static unsigned virtio_s390_get_features(void *opaque)
+static unsigned virtio_s390_get_features(DeviceState *d)
{
- VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
+ VirtIOS390Device *dev = to_virtio_s390_device(d);
return dev->host_features;
}