qdev: Replace no_user by cannot_instantiate_with_device_add_yet
In an ideal world, machines can be built by wiring devices together
with configuration, not code. Unfortunately, that's not the world we
live in right now. We still have quite a few devices that need to be
wired up by code. If you try to device_add such a device, it'll fail
in sometimes mysterious ways. If you're lucky, you get an
unmysterious immediate crash.
To protect users from such badness, DeviceClass member no_user used to
make device models unavailable with -device / device_add, but that
regressed in commit 18b6dad
. The device model is still omitted from
help, but is available anyway.
Attempts to fix the regression have been rejected with the argument
that the purpose of no_user isn't clear, and it's prone to misuse.
This commit clarifies no_user's purpose. Anthony suggested to rename
it cannot_instantiate_with_device_add_yet_due_to_internal_bugs, which
I shorten somewhat to keep checkpatch happy. While there, make it
bool.
Every use of cannot_instantiate_with_device_add_yet gets a FIXME
comment asking for rationale. The next few commits will clean them
all up, either by providing a rationale, or by getting rid of the use.
With that done, the regression fix is hopefully acceptable.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
f976b09ea2
commit
efec3dd631
@ -544,7 +544,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
|
|||||||
k->revision = 0x03;
|
k->revision = 0x03;
|
||||||
k->class_id = PCI_CLASS_BRIDGE_OTHER;
|
k->class_id = PCI_CLASS_BRIDGE_OTHER;
|
||||||
dc->desc = "PM";
|
dc->desc = "PM";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_acpi;
|
dc->vmsd = &vmstate_acpi;
|
||||||
dc->props = piix4_pm_properties;
|
dc->props = piix4_pm_properties;
|
||||||
}
|
}
|
||||||
|
@ -938,7 +938,7 @@ static void typhoon_pcihost_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = typhoon_pcihost_init;
|
k->init = typhoon_pcihost_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo typhoon_pcihost_info = {
|
static const TypeInfo typhoon_pcihost_info = {
|
||||||
|
@ -390,7 +390,7 @@ static void vpb_sic_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = vpb_sic_init;
|
k->init = vpb_sic_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_vpb_sic;
|
dc->vmsd = &vmstate_vpb_sic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->realize = pcspk_realizefn;
|
dc->realize = pcspk_realizefn;
|
||||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->props = pcspk_properties;
|
dc->props = pcspk_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ static void pl041_device_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
k->init = pl041_init;
|
k->init = pl041_init;
|
||||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = pl041_device_reset;
|
dc->reset = pl041_device_reset;
|
||||||
dc->vmsd = &vmstate_pl041;
|
dc->vmsd = &vmstate_pl041;
|
||||||
dc->props = pl041_device_properties;
|
dc->props = pl041_device_properties;
|
||||||
|
@ -2234,7 +2234,7 @@ static void isabus_fdc_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->realize = isabus_fdc_realize;
|
dc->realize = isabus_fdc_realize;
|
||||||
dc->fw_name = "fdc";
|
dc->fw_name = "fdc";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = fdctrl_external_reset_isa;
|
dc->reset = fdctrl_external_reset_isa;
|
||||||
dc->vmsd = &vmstate_isa_fdc;
|
dc->vmsd = &vmstate_isa_fdc;
|
||||||
dc->props = isa_fdc_properties;
|
dc->props = isa_fdc_properties;
|
||||||
|
@ -496,7 +496,7 @@ static void pl110_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
k->init = pl110_initfn;
|
k->init = pl110_initfn;
|
||||||
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
|
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_pl110;
|
dc->vmsd = &vmstate_pl110;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ static void pl080_class_init(ObjectClass *oc, void *data)
|
|||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||||
|
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_pl080;
|
dc->vmsd = &vmstate_pl080;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data)
|
|||||||
k->device_id = PCI_DEVICE_ID_INTEL_ICH9_6;
|
k->device_id = PCI_DEVICE_ID_INTEL_ICH9_6;
|
||||||
k->revision = ICH9_A2_SMB_REVISION;
|
k->revision = ICH9_A2_SMB_REVISION;
|
||||||
k->class_id = PCI_CLASS_SERIAL_SMBUS;
|
k->class_id = PCI_CLASS_SERIAL_SMBUS;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_ich9_smbus;
|
dc->vmsd = &vmstate_ich9_smbus;
|
||||||
dc->desc = "ICH9 SMBUS Bridge";
|
dc->desc = "ICH9 SMBUS Bridge";
|
||||||
k->init = ich9_smbus_initfn;
|
k->init = ich9_smbus_initfn;
|
||||||
|
@ -114,7 +114,7 @@ static void kvmclock_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = kvmclock_realize;
|
dc->realize = kvmclock_realize;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &kvmclock_vmsd;
|
dc->vmsd = &kvmclock_vmsd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ static void vapic_class_init(ObjectClass *klass, void *data)
|
|||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = vapic_reset;
|
dc->reset = vapic_reset;
|
||||||
dc->vmsd = &vmstate_vapic;
|
dc->vmsd = &vmstate_vapic;
|
||||||
dc->realize = vapic_realize;
|
dc->realize = vapic_realize;
|
||||||
|
@ -547,7 +547,7 @@ static void port92_class_initfn(ObjectClass *klass, void *data)
|
|||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->realize = port92_realizefn;
|
dc->realize = port92_realizefn;
|
||||||
dc->reset = port92_reset;
|
dc->reset = port92_reset;
|
||||||
dc->vmsd = &vmstate_port92_isa;
|
dc->vmsd = &vmstate_port92_isa;
|
||||||
|
@ -248,7 +248,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
|
|||||||
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
|
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
|
||||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo piix3_ide_info = {
|
static const TypeInfo piix3_ide_info = {
|
||||||
@ -267,7 +267,7 @@ static void piix3_ide_xen_class_init(ObjectClass *klass, void *data)
|
|||||||
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
|
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
|
||||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->unplug = pci_piix3_xen_ide_unplug;
|
dc->unplug = pci_piix3_xen_ide_unplug;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
|
|||||||
k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
|
k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
|
||||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo piix4_ide_info = {
|
static const TypeInfo piix4_ide_info = {
|
||||||
|
@ -225,7 +225,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
|
|||||||
k->revision = 0x06;
|
k->revision = 0x06;
|
||||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo via_ide_info = {
|
static const TypeInfo via_ide_info = {
|
||||||
|
@ -522,7 +522,7 @@ static void i8042_class_initfn(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = i8042_realizefn;
|
dc->realize = i8042_realizefn;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_kbd_isa;
|
dc->vmsd = &vmstate_kbd_isa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ static void vmmouse_class_initfn(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = vmmouse_realizefn;
|
dc->realize = vmmouse_realizefn;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = vmmouse_reset;
|
dc->reset = vmmouse_reset;
|
||||||
dc->vmsd = &vmstate_vmmouse;
|
dc->vmsd = &vmstate_vmmouse;
|
||||||
dc->props = vmmouse_properties;
|
dc->props = vmmouse_properties;
|
||||||
|
@ -386,7 +386,7 @@ static void apic_common_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->vmsd = &vmstate_apic_common;
|
dc->vmsd = &vmstate_apic_common;
|
||||||
dc->reset = apic_reset_common;
|
dc->reset = apic_reset_common;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->props = apic_properties_common;
|
dc->props = apic_properties_common;
|
||||||
idc->init = apic_init_common;
|
idc->init = apic_init_common;
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ static void arm_gic_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
ARMGICClass *agc = ARM_GIC_CLASS(klass);
|
ARMGICClass *agc = ARM_GIC_CLASS(klass);
|
||||||
|
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
agc->parent_realize = dc->realize;
|
agc->parent_realize = dc->realize;
|
||||||
dc->realize = arm_gic_realize;
|
dc->realize = arm_gic_realize;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ static void arm_gic_common_class_init(ObjectClass *klass, void *data)
|
|||||||
dc->realize = arm_gic_common_realize;
|
dc->realize = arm_gic_common_realize;
|
||||||
dc->props = arm_gic_common_properties;
|
dc->props = arm_gic_common_properties;
|
||||||
dc->vmsd = &vmstate_gic;
|
dc->vmsd = &vmstate_gic;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo arm_gic_common_type = {
|
static const TypeInfo arm_gic_common_type = {
|
||||||
|
@ -150,7 +150,7 @@ static void kvm_arm_gic_class_init(ObjectClass *klass, void *data)
|
|||||||
kgc->parent_reset = dc->reset;
|
kgc->parent_reset = dc->reset;
|
||||||
dc->realize = kvm_arm_gic_realize;
|
dc->realize = kvm_arm_gic_realize;
|
||||||
dc->reset = kvm_arm_gic_reset;
|
dc->reset = kvm_arm_gic_reset;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo kvm_arm_gic_info = {
|
static const TypeInfo kvm_arm_gic_info = {
|
||||||
|
@ -135,7 +135,7 @@ static void pic_common_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->vmsd = &vmstate_pic_common;
|
dc->vmsd = &vmstate_pic_common;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->props = pic_properties_common;
|
dc->props = pic_properties_common;
|
||||||
dc->realize = pic_common_realize;
|
dc->realize = pic_common_realize;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ static void ioapic_common_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->realize = ioapic_common_realize;
|
dc->realize = ioapic_common_realize;
|
||||||
dc->vmsd = &vmstate_ioapic_common;
|
dc->vmsd = &vmstate_ioapic_common;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo ioapic_common_type = {
|
static const TypeInfo ioapic_common_type = {
|
||||||
|
@ -273,7 +273,7 @@ static void pl190_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = pl190_init;
|
k->init = pl190_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = pl190_reset;
|
dc->reset = pl190_reset;
|
||||||
dc->vmsd = &vmstate_pl190;
|
dc->vmsd = &vmstate_pl190;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ static void isabus_bridge_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->fw_name = "isa";
|
dc->fw_name = "isa";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo isabus_bridge_info = {
|
static const TypeInfo isabus_bridge_info = {
|
||||||
|
@ -644,7 +644,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
|
|||||||
dc->reset = ich9_lpc_reset;
|
dc->reset = ich9_lpc_reset;
|
||||||
k->init = ich9_lpc_initfn;
|
k->init = ich9_lpc_initfn;
|
||||||
dc->vmsd = &vmstate_ich9_lpc;
|
dc->vmsd = &vmstate_ich9_lpc;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
k->config_write = ich9_lpc_config_write;
|
k->config_write = ich9_lpc_config_write;
|
||||||
dc->desc = "ICH9 LPC bridge";
|
dc->desc = "ICH9 LPC bridge";
|
||||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||||
|
@ -113,7 +113,7 @@ static void piix4_class_init(ObjectClass *klass, void *data)
|
|||||||
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
|
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
|
||||||
k->class_id = PCI_CLASS_BRIDGE_ISA;
|
k->class_id = PCI_CLASS_BRIDGE_ISA;
|
||||||
dc->desc = "ISA bridge";
|
dc->desc = "ISA bridge";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_piix4;
|
dc->vmsd = &vmstate_piix4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ static void via_class_init(ObjectClass *klass, void *data)
|
|||||||
k->class_id = PCI_CLASS_BRIDGE_ISA;
|
k->class_id = PCI_CLASS_BRIDGE_ISA;
|
||||||
k->revision = 0x40;
|
k->revision = 0x40;
|
||||||
dc->desc = "ISA bridge";
|
dc->desc = "ISA bridge";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_via;
|
dc->vmsd = &vmstate_via;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ static void l2x0_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
k->init = l2x0_priv_init;
|
k->init = l2x0_priv_init;
|
||||||
dc->vmsd = &vmstate_l2x0;
|
dc->vmsd = &vmstate_l2x0;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->props = l2x0_properties;
|
dc->props = l2x0_properties;
|
||||||
dc->reset = l2x0_priv_reset;
|
dc->reset = l2x0_priv_reset;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ static void vmport_class_initfn(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = vmport_realizefn;
|
dc->realize = vmport_realizefn;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo vmport_info = {
|
static const TypeInfo vmport_info = {
|
||||||
|
@ -599,7 +599,7 @@ static void fw_cfg_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = fw_cfg_realize;
|
dc->realize = fw_cfg_realize;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = fw_cfg_reset;
|
dc->reset = fw_cfg_reset;
|
||||||
dc->vmsd = &vmstate_fw_cfg;
|
dc->vmsd = &vmstate_fw_cfg;
|
||||||
dc->props = fw_cfg_properties;
|
dc->props = fw_cfg_properties;
|
||||||
|
@ -806,7 +806,7 @@ static void bonito_class_init(ObjectClass *klass, void *data)
|
|||||||
k->revision = 0x01;
|
k->revision = 0x01;
|
||||||
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
||||||
dc->desc = "Host bridge";
|
dc->desc = "Host bridge";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_bonito;
|
dc->vmsd = &vmstate_bonito;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,7 +823,7 @@ static void bonito_pcihost_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = bonito_pcihost_initfn;
|
k->init = bonito_pcihost_initfn;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo bonito_pcihost_info = {
|
static const TypeInfo bonito_pcihost_info = {
|
||||||
|
@ -130,7 +130,7 @@ static void grackle_pci_class_init(ObjectClass *klass, void *data)
|
|||||||
k->device_id = PCI_DEVICE_ID_MOTOROLA_MPC106;
|
k->device_id = PCI_DEVICE_ID_MOTOROLA_MPC106;
|
||||||
k->revision = 0x00;
|
k->revision = 0x00;
|
||||||
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo grackle_pci_info = {
|
static const TypeInfo grackle_pci_info = {
|
||||||
@ -146,7 +146,7 @@ static void pci_grackle_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = pci_grackle_init_device;
|
k->init = pci_grackle_init_device;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo grackle_pci_host_info = {
|
static const TypeInfo grackle_pci_host_info = {
|
||||||
|
@ -635,7 +635,7 @@ static void piix3_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->desc = "ISA bridge";
|
dc->desc = "ISA bridge";
|
||||||
dc->vmsd = &vmstate_piix3;
|
dc->vmsd = &vmstate_piix3;
|
||||||
dc->no_user = 1,
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
k->no_hotplug = 1;
|
k->no_hotplug = 1;
|
||||||
k->init = piix3_initfn;
|
k->init = piix3_initfn;
|
||||||
k->config_write = piix3_write_config;
|
k->config_write = piix3_write_config;
|
||||||
@ -659,7 +659,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->desc = "ISA bridge";
|
dc->desc = "ISA bridge";
|
||||||
dc->vmsd = &vmstate_piix3;
|
dc->vmsd = &vmstate_piix3;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
k->no_hotplug = 1;
|
k->no_hotplug = 1;
|
||||||
k->init = piix3_initfn;
|
k->init = piix3_initfn;
|
||||||
k->config_write = piix3_write_config_xen;
|
k->config_write = piix3_write_config_xen;
|
||||||
@ -689,7 +689,7 @@ static void i440fx_class_init(ObjectClass *klass, void *data)
|
|||||||
k->revision = 0x02;
|
k->revision = 0x02;
|
||||||
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
||||||
dc->desc = "Host bridge";
|
dc->desc = "Host bridge";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_i440fx;
|
dc->vmsd = &vmstate_i440fx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +727,7 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
|
|||||||
hc->root_bus_path = i440fx_pcihost_root_bus_path;
|
hc->root_bus_path = i440fx_pcihost_root_bus_path;
|
||||||
dc->realize = i440fx_pcihost_realize;
|
dc->realize = i440fx_pcihost_realize;
|
||||||
dc->fw_name = "pci";
|
dc->fw_name = "pci";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->props = i440fx_props;
|
dc->props = i440fx_props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ static void raven_class_init(ObjectClass *klass, void *data)
|
|||||||
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
||||||
dc->desc = "PReP Host Bridge - Motorola Raven";
|
dc->desc = "PReP Host Bridge - Motorola Raven";
|
||||||
dc->vmsd = &vmstate_raven;
|
dc->vmsd = &vmstate_raven;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo raven_info = {
|
static const TypeInfo raven_info = {
|
||||||
@ -215,7 +215,7 @@ static void raven_pcihost_class_init(ObjectClass *klass, void *data)
|
|||||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||||
dc->realize = raven_pcihost_realizefn;
|
dc->realize = raven_pcihost_realizefn;
|
||||||
dc->fw_name = "pci";
|
dc->fw_name = "pci";
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo raven_pcihost_info = {
|
static const TypeInfo raven_pcihost_info = {
|
||||||
|
@ -532,7 +532,7 @@ static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = spapr_vio_bridge_init;
|
k->init = spapr_vio_bridge_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo spapr_vio_bridge_info = {
|
static const TypeInfo spapr_vio_bridge_info = {
|
||||||
|
@ -182,7 +182,7 @@ static void s390_ipl_class_init(ObjectClass *klass, void *data)
|
|||||||
k->init = s390_ipl_init;
|
k->init = s390_ipl_init;
|
||||||
dc->props = s390_ipl_properties;
|
dc->props = s390_ipl_properties;
|
||||||
dc->reset = s390_ipl_reset;
|
dc->reset = s390_ipl_reset;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo s390_ipl_info = {
|
static const TypeInfo s390_ipl_info = {
|
||||||
|
@ -680,7 +680,7 @@ static void s390_virtio_bridge_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = s390_virtio_bridge_init;
|
k->init = s390_virtio_bridge_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo s390_virtio_bridge_info = {
|
static const TypeInfo s390_virtio_bridge_info = {
|
||||||
|
@ -1287,7 +1287,7 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = virtual_css_bridge_init;
|
k->init = virtual_css_bridge_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtual_css_bridge_info = {
|
static const TypeInfo virtual_css_bridge_info = {
|
||||||
|
@ -506,7 +506,7 @@ static void pl181_class_init(ObjectClass *klass, void *data)
|
|||||||
sdc->init = pl181_init;
|
sdc->init = pl181_init;
|
||||||
k->vmsd = &vmstate_pl181;
|
k->vmsd = &vmstate_pl181;
|
||||||
k->reset = pl181_reset;
|
k->reset = pl181_reset;
|
||||||
k->no_user = 1;
|
k->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo pl181_info = {
|
static const TypeInfo pl181_info = {
|
||||||
|
@ -274,7 +274,7 @@ static void arm_mptimer_class_init(ObjectClass *klass, void *data)
|
|||||||
dc->realize = arm_mptimer_realize;
|
dc->realize = arm_mptimer_realize;
|
||||||
dc->vmsd = &vmstate_arm_mptimer;
|
dc->vmsd = &vmstate_arm_mptimer;
|
||||||
dc->reset = arm_mptimer_reset;
|
dc->reset = arm_mptimer_reset;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->props = arm_mptimer_properties;
|
dc->props = arm_mptimer_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,7 +765,7 @@ static void hpet_device_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = hpet_realize;
|
dc->realize = hpet_realize;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = hpet_reset;
|
dc->reset = hpet_reset;
|
||||||
dc->vmsd = &vmstate_hpet;
|
dc->vmsd = &vmstate_hpet;
|
||||||
dc->props = hpet_device_properties;
|
dc->props = hpet_device_properties;
|
||||||
|
@ -282,7 +282,7 @@ static void pit_common_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
dc->realize = pit_common_realize;
|
dc->realize = pit_common_realize;
|
||||||
dc->vmsd = &vmstate_pit_common;
|
dc->vmsd = &vmstate_pit_common;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo pit_common_type = {
|
static const TypeInfo pit_common_type = {
|
||||||
|
@ -750,7 +750,7 @@ static void m48t59_isa_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = m48t59_isa_realize;
|
dc->realize = m48t59_isa_realize;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->reset = m48t59_reset_isa;
|
dc->reset = m48t59_reset_isa;
|
||||||
dc->props = m48t59_isa_properties;
|
dc->props = m48t59_isa_properties;
|
||||||
}
|
}
|
||||||
|
@ -899,7 +899,7 @@ static void rtc_class_initfn(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = rtc_realizefn;
|
dc->realize = rtc_realizefn;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_rtc;
|
dc->vmsd = &vmstate_rtc;
|
||||||
dc->props = mc146818rtc_properties;
|
dc->props = mc146818rtc_properties;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ static void pl031_class_init(ObjectClass *klass, void *data)
|
|||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = pl031_init;
|
k->init = pl031_init;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
dc->vmsd = &vmstate_pl031;
|
dc->vmsd = &vmstate_pl031;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,18 @@ typedef struct DeviceClass {
|
|||||||
const char *fw_name;
|
const char *fw_name;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
Property *props;
|
Property *props;
|
||||||
int no_user;
|
|
||||||
|
/*
|
||||||
|
* Shall we hide this device model from -device / device_add?
|
||||||
|
* All devices should support instantiation with device_add, and
|
||||||
|
* this flag should not exist. But we're not there, yet. Some
|
||||||
|
* devices fail to instantiate with cryptic error messages.
|
||||||
|
* Others instantiate, but don't work. Exposing users to such
|
||||||
|
* behavior would be cruel; this flag serves to protect them. It
|
||||||
|
* should never be set without a comment explaining why it is set.
|
||||||
|
* TODO remove once we're there
|
||||||
|
*/
|
||||||
|
bool cannot_instantiate_with_device_add_yet;
|
||||||
|
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
void (*reset)(DeviceState *dev);
|
void (*reset)(DeviceState *dev);
|
||||||
|
@ -87,7 +87,7 @@ static void qdev_print_devinfo(DeviceClass *dc)
|
|||||||
if (dc->desc) {
|
if (dc->desc) {
|
||||||
error_printf(", desc \"%s\"", dc->desc);
|
error_printf(", desc \"%s\"", dc->desc);
|
||||||
}
|
}
|
||||||
if (dc->no_user) {
|
if (dc->cannot_instantiate_with_device_add_yet) {
|
||||||
error_printf(", no-user");
|
error_printf(", no-user");
|
||||||
}
|
}
|
||||||
error_printf("\n");
|
error_printf("\n");
|
||||||
@ -127,7 +127,8 @@ static void qdev_print_devinfos(bool show_no_user)
|
|||||||
if ((i < DEVICE_CATEGORY_MAX
|
if ((i < DEVICE_CATEGORY_MAX
|
||||||
? !test_bit(i, dc->categories)
|
? !test_bit(i, dc->categories)
|
||||||
: !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX))
|
: !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX))
|
||||||
|| (!show_no_user && dc->no_user)) {
|
|| (!show_no_user
|
||||||
|
&& dc->cannot_instantiate_with_device_add_yet)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!cat_printed) {
|
if (!cat_printed) {
|
||||||
|
@ -254,7 +254,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
|
|||||||
k->gdb_read_register = cpu_common_gdb_read_register;
|
k->gdb_read_register = cpu_common_gdb_read_register;
|
||||||
k->gdb_write_register = cpu_common_gdb_write_register;
|
k->gdb_write_register = cpu_common_gdb_write_register;
|
||||||
dc->realize = cpu_common_realizefn;
|
dc->realize = cpu_common_realizefn;
|
||||||
dc->no_user = 1;
|
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo cpu_type_info = {
|
static const TypeInfo cpu_type_info = {
|
||||||
|
Loading…
Reference in New Issue
Block a user