mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
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:
committed by
Andreas Färber
parent
f976b09ea2
commit
efec3dd631
+1
-1
@@ -544,7 +544,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
|
||||
k->revision = 0x03;
|
||||
k->class_id = PCI_CLASS_BRIDGE_OTHER;
|
||||
dc->desc = "PM";
|
||||
dc->no_user = 1;
|
||||
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||
dc->vmsd = &vmstate_acpi;
|
||||
dc->props = piix4_pm_properties;
|
||||
}
|
||||
|
||||
+1
-1
@@ -938,7 +938,7 @@ static void typhoon_pcihost_class_init(ObjectClass *klass, void *data)
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
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 = {
|
||||
|
||||
@@ -390,7 +390,7 @@ static void vpb_sic_class_init(ObjectClass *klass, void *data)
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data)
|
||||
|
||||
dc->realize = pcspk_realizefn;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -632,7 +632,7 @@ static void pl041_device_class_init(ObjectClass *klass, void *data)
|
||||
|
||||
k->init = pl041_init;
|
||||
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->vmsd = &vmstate_pl041;
|
||||
dc->props = pl041_device_properties;
|
||||
|
||||
+1
-1
@@ -2234,7 +2234,7 @@ static void isabus_fdc_class_init(ObjectClass *klass, void *data)
|
||||
|
||||
dc->realize = isabus_fdc_realize;
|
||||
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->vmsd = &vmstate_isa_fdc;
|
||||
dc->props = isa_fdc_properties;
|
||||
|
||||
+1
-1
@@ -496,7 +496,7 @@ static void pl110_class_init(ObjectClass *klass, void *data)
|
||||
|
||||
k->init = pl110_initfn;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -381,7 +381,7 @@ static void pl080_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
dc->no_user = 1;
|
||||
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||
dc->vmsd = &vmstate_pl080;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data)
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_ICH9_6;
|
||||
k->revision = ICH9_A2_SMB_REVISION;
|
||||
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->desc = "ICH9 SMBUS Bridge";
|
||||
k->init = ich9_smbus_initfn;
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ static void kvmclock_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->realize = kvmclock_realize;
|
||||
dc->no_user = 1;
|
||||
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||
dc->vmsd = &kvmclock_vmsd;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -827,7 +827,7 @@ static void vapic_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
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->vmsd = &vmstate_vapic;
|
||||
dc->realize = vapic_realize;
|
||||
|
||||
+1
-1
@@ -547,7 +547,7 @@ static void port92_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
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->reset = port92_reset;
|
||||
dc->vmsd = &vmstate_port92_isa;
|
||||
|
||||
+3
-3
@@ -248,7 +248,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
|
||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||
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 = {
|
||||
@@ -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->class_id = PCI_CLASS_STORAGE_IDE;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
|
||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||
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 = {
|
||||
|
||||
+1
-1
@@ -225,7 +225,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
|
||||
k->revision = 0x06;
|
||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||
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 = {
|
||||
|
||||
+1
-1
@@ -522,7 +522,7 @@ static void i8042_class_initfn(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->realize = i8042_realizefn;
|
||||
dc->no_user = 1;
|
||||
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||
dc->vmsd = &vmstate_kbd_isa;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -282,7 +282,7 @@ static void vmmouse_class_initfn(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->realize = vmmouse_realizefn;
|
||||
dc->no_user = 1;
|
||||
dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
|
||||
dc->reset = vmmouse_reset;
|
||||
dc->vmsd = &vmstate_vmmouse;
|
||||
dc->props = vmmouse_properties;
|
||||
|
||||
@@ -386,7 +386,7 @@ static void apic_common_class_init(ObjectClass *klass, void *data)
|
||||
|
||||
dc->vmsd = &vmstate_apic_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;
|
||||
idc->init = apic_init_common;
|
||||
}
|
||||
|
||||
+1
-1
@@ -704,7 +704,7 @@ static void arm_gic_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_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;
|
||||
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->props = arm_gic_common_properties;
|
||||
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 = {
|
||||
|
||||
@@ -150,7 +150,7 @@ static void kvm_arm_gic_class_init(ObjectClass *klass, void *data)
|
||||
kgc->parent_reset = dc->reset;
|
||||
dc->realize = kvm_arm_gic_realize;
|
||||
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 = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user