Commit 88e65996 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging



QOM infrastructure fixes and device conversions

* GPIO conversion to QOM, continued
* Device property description support
* QTest cases for hotplug
* Hotplug handler conversion

# gpg: Signature made Wed 15 Oct 2014 04:05:17 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-devices-for-peter: (47 commits)
  qdev: Drop legacy_name from qdev properties
  qmp: Print descriptions of object properties
  qdev: Set the object property's description to the qdev property's.
  qom: Add description field in ObjectProperty struct
  qdev: Add description field in PropertyInfo struct
  qdev: device_del: Search for to be unplugged device in 'peripheral' container
  qdev: HotplugHandler: Add support for unplugging BUS-less devices
  qdev: Drop legacy hotplug fields/methods
  usb: Convert usb devices to hotplug handler API
  usb: Convert usb-ccid to hotplug handler API
  usb-storage: Drop not needed "allow_hotplug = 0"
  usb-bot: Drop not needed "allow_hotplug = 0"
  usb-bot: Mark device as non hotpluggable
  scsi: Cleanup not used anymore SCSIBusInfo{hotplug, hot_unplug} fields
  scsi: Convert virtio-scsi HBA to hotplug handler API
  scsi: Convert pvscsi HBA to hotplug handler API
  scsi: Set SCSI BUS itself as default HotplugHandler
  s390x: Convert virtio-ccw to hotplug handler API
  s390x: Convert s390-virtio to hotplug handler API
  s390x: Drop not used allow_hotplug in event-facility
  ...

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents b1d28ec6 18b91a3e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ static void piix4_device_plug_cb(HotplugHandler *hotplug_dev,
    }
}

static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev,
static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev,
                                           DeviceState *dev, Error **errp)
{
    PIIX4PMState *s = PIIX4_PM(hotplug_dev);
@@ -615,7 +615,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
    dc->cannot_instantiate_with_device_add_yet = true;
    dc->hotpluggable = false;
    hc->plug = piix4_device_plug_cb;
    hc->unplug = piix4_device_unplug_cb;
    hc->unplug_request = piix4_device_unplug_request_cb;
    adevc->ospm_status = piix4_ospm_status;
}

+15 −5
Original line number Diff line number Diff line
@@ -904,6 +904,12 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
    }

    port->elem.out_num = 0;
}

static void virtser_port_device_plug(HotplugHandler *hotplug_dev,
                                     DeviceState *dev, Error **errp)
{
    VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev);

    QTAILQ_INSERT_TAIL(&port->vser->ports, port, next);
    port->ivq = port->vser->ivqs[port->id];
@@ -912,7 +918,7 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
    add_port(port->vser, port->id);

    /* Send an update to the guest about this new port added */
    virtio_notify_config(vdev);
    virtio_notify_config(VIRTIO_DEVICE(hotplug_dev));
}

static void virtser_port_device_unrealize(DeviceState *dev, Error **errp)
@@ -935,7 +941,6 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
{
    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
    VirtIOSerial *vser = VIRTIO_SERIAL(dev);
    BusState *bus;
    uint32_t i, max_supported_ports;

    if (!vser->serial.max_virtserial_ports) {
@@ -957,8 +962,7 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
    /* Spawn a new virtio-serial bus on which the ports will ride as devices */
    qbus_create_inplace(&vser->bus, sizeof(vser->bus), TYPE_VIRTIO_SERIAL_BUS,
                        dev, vdev->bus_name);
    bus = BUS(&vser->bus);
    bus->allow_hotplug = 1;
    qbus_set_hotplug_handler(BUS(&vser->bus), DEVICE(vser), errp);
    vser->bus.vser = vser;
    QTAILQ_INIT(&vser->ports);

@@ -1021,7 +1025,6 @@ static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
    k->bus_type = TYPE_VIRTIO_SERIAL_BUS;
    k->realize = virtser_port_device_realize;
    k->unrealize = virtser_port_device_unrealize;
    k->unplug = qdev_simple_unplug_cb;
    k->props = virtser_props;
}

@@ -1064,6 +1067,7 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
{
    DeviceClass *dc = DEVICE_CLASS(klass);
    VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
    HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);

    QLIST_INIT(&vserdevices.devices);

@@ -1077,6 +1081,8 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
    vdc->reset = vser_reset;
    vdc->save = virtio_serial_save_device;
    vdc->load = virtio_serial_load_device;
    hc->plug = virtser_port_device_plug;
    hc->unplug = qdev_simple_device_unplug_cb;
}

static const TypeInfo virtio_device_info = {
@@ -1084,6 +1090,10 @@ static const TypeInfo virtio_device_info = {
    .parent = TYPE_VIRTIO_DEVICE,
    .instance_size = sizeof(VirtIOSerial),
    .class_init = virtio_serial_class_init,
    .interfaces = (InterfaceInfo[]) {
        { TYPE_HOTPLUG_HANDLER },
        { }
    }
};

static void virtio_serial_register_types(void)
+11 −0
Original line number Diff line number Diff line
@@ -23,6 +23,17 @@ void hotplug_handler_plug(HotplugHandler *plug_handler,
    }
}

void hotplug_handler_unplug_request(HotplugHandler *plug_handler,
                                    DeviceState *plugged_dev,
                                    Error **errp)
{
    HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);

    if (hdc->unplug_request) {
        hdc->unplug_request(plug_handler, plugged_dev, errp);
    }
}

void hotplug_handler_unplug(HotplugHandler *plug_handler,
                            DeviceState *plugged_dev,
                            Error **errp)
+4 −4
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static void set_drive(Object *obj, Visitor *v, void *opaque,

PropertyInfo qdev_prop_drive = {
    .name  = "str",
    .legacy_name  = "drive",
    .description = "ID of a drive to use as a backend",
    .get   = get_drive,
    .set   = set_drive,
    .release = release_drive,
@@ -169,7 +169,7 @@ static void set_chr(Object *obj, Visitor *v, void *opaque,

PropertyInfo qdev_prop_chr = {
    .name  = "str",
    .legacy_name  = "chr",
    .description = "ID of a chardev to use as a backend",
    .get   = get_chr,
    .set   = set_chr,
    .release = release_chr,
@@ -248,7 +248,7 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque,

PropertyInfo qdev_prop_netdev = {
    .name  = "str",
    .legacy_name  = "netdev",
    .description = "ID of a netdev to use as a backend",
    .get   = get_netdev,
    .set   = set_netdev,
};
@@ -328,7 +328,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,

PropertyInfo qdev_prop_vlan = {
    .name  = "int32",
    .legacy_name  = "vlan",
    .description = "Integer VLAN id to connect to",
    .print = print_vlan,
    .get   = get_vlan,
    .set   = set_vlan,
+8 −6
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,

PropertyInfo qdev_prop_bit = {
    .name  = "bool",
    .legacy_name  = "on/off",
    .description = "on/off",
    .get   = prop_get_bit,
    .set   = prop_set_bit,
};
@@ -455,7 +455,7 @@ inval:

PropertyInfo qdev_prop_macaddr = {
    .name  = "str",
    .legacy_name  = "macaddr",
    .description = "Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56",
    .get   = get_mac,
    .set   = set_mac,
};
@@ -477,7 +477,8 @@ QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));

PropertyInfo qdev_prop_bios_chs_trans = {
    .name = "BiosAtaTranslation",
    .legacy_name = "bios-chs-trans",
    .description = "Logical CHS translation algorithm, "
                   "auto/none/lba/large/rechs",
    .enum_table = BiosAtaTranslation_lookup,
    .get = get_enum,
    .set = set_enum,
@@ -551,7 +552,7 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,

PropertyInfo qdev_prop_pci_devfn = {
    .name  = "int32",
    .legacy_name  = "pci-devfn",
    .description = "Slot and optional function number, example: 06.0 or 06",
    .print = print_pci_devfn,
    .get   = get_int32,
    .set   = set_pci_devfn,
@@ -598,7 +599,7 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,

PropertyInfo qdev_prop_blocksize = {
    .name  = "uint16",
    .legacy_name  = "blocksize",
    .description = "A power of two between 512 and 32768",
    .get   = get_uint16,
    .set   = set_blocksize,
};
@@ -706,7 +707,8 @@ inval:

PropertyInfo qdev_prop_pci_host_devaddr = {
    .name = "str",
    .legacy_name = "pci-host-devaddr",
    .description = "Address (bus/device/function) of "
                   "the host device, example: 04:10.0",
    .get = get_pci_host_devaddr,
    .set = set_pci_host_devaddr,
};
Loading