aboutsummaryrefslogtreecommitdiff
path: root/hw/s390x
diff options
context:
space:
mode:
authorAnthony Liguori <anthony@codemonkey.ws>2013-09-03 12:30:51 -0500
committerAnthony Liguori <anthony@codemonkey.ws>2013-09-03 12:30:51 -0500
commit5cff81f098a57762ab937bfbedb298e658af2c7f (patch)
tree5b4af366b2fd084e72c601744bb6ba56bcee3413 /hw/s390x
parent545825d4cda03ea292b7788b3401b99860efe8bc (diff)
parent520902a656f21bdd4f212bfa55bc35c3e567affc (diff)
Merge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging
QOM device refactorings * Fix QOM and ISA documentation errors * Extend object_initialize() et al. to check the instance size # gpg: Signature made Fri 30 Aug 2013 02:19:48 PM CDT using RSA key ID 3E7E013F # gpg: Can't check signature: public key not found # By Andreas Färber (14) and others # Via Andreas Färber * afaerber/tags/qom-devices-for-anthony: isa: Fix documentation of isa_register_portio_list() qom: Assert instance size in object_initialize_with_type() qom: Pass available size to object_initialize() qdev: Pass size to qbus_create_inplace() virtio-mmio: Pass size to virtio_mmio_bus_new() virtio-ccw: Pass size to virtio_ccw_bus_new() s390-virtio-bus: Pass size to virtio_s390_bus_new() virtio-pci: Pass size to virtio_pci_bus_new() usb: Pass size to usb_bus_new() scsi: Pass size to scsi_bus_new() pci: Pass size to pci_bus_new_inplace() ide: Pass size to ide_bus_new() ipack: Pass size to ipack_bus_new_inplace() intel-hda: Pass size to hda_codec_bus_init() qom: Fix object_initialize_with_type() argument name in documentation virtio: Remove unnecessary OBJECT() casts object: Fix typo in qom/object.h
Diffstat (limited to 'hw/s390x')
-rw-r--r--hw/s390x/event-facility.c4
-rw-r--r--hw/s390x/s390-virtio-bus.c24
-rw-r--r--hw/s390x/virtio-ccw.c26
3 files changed, 29 insertions, 25 deletions
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index 0faade0766..a3aceef8f5 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -324,8 +324,8 @@ static int init_event_facility(S390SCLPDevice *sdev)
sdev->event_pending = event_pending;
/* Spawn a new sclp-events facility */
- qbus_create_inplace(&event_facility->sbus.qbus,
- TYPE_SCLP_EVENTS_BUS, (DeviceState *)sdev, NULL);
+ qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus),
+ TYPE_SCLP_EVENTS_BUS, DEVICE(sdev), NULL);
event_facility->sbus.qbus.allow_hotplug = 0;
event_facility->qdev = (DeviceState *) sdev;
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index f0aa9414f2..6a831114da 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -47,7 +47,8 @@
#define VIRTIO_EXT_CODE 0x2603
-static void virtio_s390_bus_new(VirtioBusState *bus, VirtIOS390Device *dev);
+static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
+ VirtIOS390Device *dev);
static const TypeInfo s390_virtio_bus_info = {
.name = TYPE_S390_VIRTIO_BUS,
@@ -170,7 +171,7 @@ static int s390_virtio_net_init(VirtIOS390Device *s390_dev)
static void s390_virtio_net_instance_init(Object *obj)
{
VirtIONetS390 *dev = VIRTIO_NET_S390(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_NET);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_NET);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -189,7 +190,7 @@ static int s390_virtio_blk_init(VirtIOS390Device *s390_dev)
static void s390_virtio_blk_instance_init(Object *obj)
{
VirtIOBlkS390 *dev = VIRTIO_BLK_S390(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_BLK);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BLK);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -230,7 +231,7 @@ static int s390_virtio_serial_init(VirtIOS390Device *s390_dev)
static void s390_virtio_serial_instance_init(Object *obj)
{
VirtIOSerialS390 *dev = VIRTIO_SERIAL_S390(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_SERIAL);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SERIAL);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -262,7 +263,7 @@ static int s390_virtio_scsi_init(VirtIOS390Device *s390_dev)
static void s390_virtio_scsi_instance_init(Object *obj)
{
VirtIOSCSIS390 *dev = VIRTIO_SCSI_S390(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_SCSI);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SCSI);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -283,7 +284,7 @@ static int s390_vhost_scsi_init(VirtIOS390Device *s390_dev)
static void s390_vhost_scsi_instance_init(Object *obj)
{
VHostSCSIS390 *dev = VHOST_SCSI_S390(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VHOST_SCSI);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VHOST_SCSI);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
#endif
@@ -309,7 +310,7 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev)
static void s390_virtio_rng_instance_init(Object *obj)
{
VirtIORNGS390 *dev = VIRTIO_RNG_S390(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_RNG);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_RNG);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
object_property_add_link(obj, "rng", TYPE_RNG_BACKEND,
(Object **)&dev->vdev.conf.rng, NULL);
@@ -585,7 +586,7 @@ static int s390_virtio_busdev_init(DeviceState *dev)
VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
VirtIOS390DeviceClass *_info = VIRTIO_S390_DEVICE_GET_CLASS(dev);
- virtio_s390_bus_new(&_dev->bus, _dev);
+ virtio_s390_bus_new(&_dev->bus, sizeof(_dev->bus), _dev);
return _info->init(_dev);
}
@@ -691,14 +692,15 @@ static const TypeInfo s390_virtio_bridge_info = {
/* virtio-s390-bus */
-static void virtio_s390_bus_new(VirtioBusState *bus, VirtIOS390Device *dev)
+static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
+ VirtIOS390Device *dev)
{
DeviceState *qdev = DEVICE(dev);
BusState *qbus;
char virtio_bus_name[] = "virtio-bus";
- qbus_create_inplace((BusState *)bus, TYPE_VIRTIO_S390_BUS, qdev,
- virtio_bus_name);
+ qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_S390_BUS,
+ qdev, virtio_bus_name);
qbus = BUS(bus);
qbus->allow_hotplug = 1;
}
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 8835bd4339..cd67db5e5b 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -27,7 +27,8 @@
#include "virtio-ccw.h"
#include "trace.h"
-static void virtio_ccw_bus_new(VirtioBusState *bus, VirtioCcwDevice *dev);
+static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
+ VirtioCcwDevice *dev);
static int virtual_css_bus_reset(BusState *qbus)
{
@@ -659,7 +660,7 @@ static int virtio_ccw_net_init(VirtioCcwDevice *ccw_dev)
static void virtio_ccw_net_instance_init(Object *obj)
{
VirtIONetCcw *dev = VIRTIO_NET_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_NET);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_NET);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -679,7 +680,7 @@ static int virtio_ccw_blk_init(VirtioCcwDevice *ccw_dev)
static void virtio_ccw_blk_instance_init(Object *obj)
{
VirtIOBlkCcw *dev = VIRTIO_BLK_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_BLK);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BLK);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -712,7 +713,7 @@ static int virtio_ccw_serial_init(VirtioCcwDevice *ccw_dev)
static void virtio_ccw_serial_instance_init(Object *obj)
{
VirtioSerialCcw *dev = VIRTIO_SERIAL_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_SERIAL);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SERIAL);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -758,7 +759,7 @@ static void balloon_ccw_stats_set_poll_interval(Object *obj, struct Visitor *v,
static void virtio_ccw_balloon_instance_init(Object *obj)
{
VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_BALLOON);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BALLOON);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
object_property_add(obj, "guest-stats", "guest statistics",
@@ -798,7 +799,7 @@ static int virtio_ccw_scsi_init(VirtioCcwDevice *ccw_dev)
static void virtio_ccw_scsi_instance_init(Object *obj)
{
VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_SCSI);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SCSI);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
@@ -819,7 +820,7 @@ static int vhost_ccw_scsi_init(VirtioCcwDevice *ccw_dev)
static void vhost_ccw_scsi_instance_init(Object *obj)
{
VHostSCSICcw *dev = VHOST_SCSI_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VHOST_SCSI);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VHOST_SCSI);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
}
#endif
@@ -1170,7 +1171,7 @@ static const TypeInfo vhost_ccw_scsi = {
static void virtio_ccw_rng_instance_init(Object *obj)
{
VirtIORNGCcw *dev = VIRTIO_RNG_CCW(obj);
- object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_RNG);
+ object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_RNG);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
object_property_add_link(obj, "rng", TYPE_RNG_BACKEND,
(Object **)&dev->vdev.conf.rng, NULL);
@@ -1209,7 +1210,7 @@ static int virtio_ccw_busdev_init(DeviceState *dev)
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
- virtio_ccw_bus_new(&_dev->bus, _dev);
+ virtio_ccw_bus_new(&_dev->bus, sizeof(_dev->bus), _dev);
return _info->init(_dev);
}
@@ -1289,14 +1290,15 @@ static const TypeInfo virtual_css_bridge_info = {
/* virtio-ccw-bus */
-static void virtio_ccw_bus_new(VirtioBusState *bus, VirtioCcwDevice *dev)
+static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
+ VirtioCcwDevice *dev)
{
DeviceState *qdev = DEVICE(dev);
BusState *qbus;
char virtio_bus_name[] = "virtio-bus";
- qbus_create_inplace((BusState *)bus, TYPE_VIRTIO_CCW_BUS, qdev,
- virtio_bus_name);
+ qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_CCW_BUS,
+ qdev, virtio_bus_name);
qbus = BUS(bus);
qbus->allow_hotplug = 1;
}